Toasts – Diff between revs 8 and 9

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 8 Rev 9
Line 37... Line 37...
37 base.Show(); 37 base.Show();
38 } 38 }
Line 39... Line 39...
39   39  
Line 40... Line -...
40 #endregion -  
41   -  
42 #region Private Methods -  
43   -  
44 private static async Task<byte[]> LoadResource(string resource) -  
45 { -  
46 var assembly = Assembly.GetExecutingAssembly(); -  
47   -  
48 using (var manifestResourceStream = assembly.GetManifestResourceStream(resource)) -  
49 { -  
50 if (manifestResourceStream == null) -  
51 { -  
52 return null; -  
53 } -  
54   -  
55 var memoryStream = new MemoryStream(); -  
56   -  
57 await manifestResourceStream.CopyToAsync(memoryStream); -  
58   -  
59 memoryStream.Position = 0L; -  
60   -  
61 return memoryStream.ToArray(); -  
62 } -  
63 } -  
64   -  
65 #endregion 40 #endregion
Line 66... Line 41...
66   41  
67 #region Constructors, Destructors and Finalizers 42 #region Constructors, Destructors and Finalizers
68   43  
Line 123... Line 98...
123 500); 98 500);
Line 124... Line 99...
124   99  
125 Region = Region.FromHrgn(NativeMethods.CreateRoundRectRgn(0, 0, Width - 5, Height - 5, 20, 20)); 100 Region = Region.FromHrgn(NativeMethods.CreateRoundRectRgn(0, 0, Width - 5, Height - 5, 20, 20));
Line -... Line 101...
-   101 }
-   102  
-   103 public ToastForm(string title, string body, int duration, Image logo) : this()
-   104 {
-   105 lifeTimer.Interval = duration;
-   106 labelTitle.Text = title;
-   107 labelBody.Text = body;
-   108 imageBox.Image = logo;
-   109  
-   110 _animator = new FormAnimator(this, FormAnimator.AnimationMethod.Slide, FormAnimator.AnimationDirection.Up,
-   111 500);
-   112  
-   113 Region = Region.FromHrgn(NativeMethods.CreateRoundRectRgn(0, 0, Width - 5, Height - 5, 20, 20));
126 } 114 }
127   115  
128 /// <summary> 116 /// <summary>
129 /// Clean up any resources being used. 117 /// Clean up any resources being used.
130 /// </summary> 118 /// </summary>
Line 152... Line 140...
152   140  
Line 153... Line 141...
153 #endregion 141 #endregion
Line 154... Line 142...
154   142  
155 #region Event Handlers 143 #region Event Handlers
156   144  
157 private async void Notification_Load(object sender, EventArgs e) 145 private void Notification_Load(object sender, EventArgs e)
158 { 146 {
-   147 // Play the sound.
-   148 if (_sound == null)
159 // Play the sound. 149 {
-   150 using (var memoryStream = new MemoryStream())
-   151 {
-   152 Properties.Resources.normal.CopyTo(memoryStream);
-   153  
-   154 memoryStream.Position = 0L;
160 if (_sound == null) 155  
Line 161... Line 156...
161 { 156 _sound = memoryStream.ToArray();
162 _sound = await LoadResource($"Toasts.Sounds.default.wav"); 157 }
163 } 158 }