public static void Pop(Account account) { Toast slice = new Toast(account); slice.FormClosed += SliceClosed; _loaf.Enqueue(slice); PositionSlice(slice); slice.Show(); }
private static void PositionSlice(Toast slice) { Screen primary = Screen.PrimaryScreen; Rectangle workingArea = primary.WorkingArea; Point start = new Point(workingArea.Width - slice.Width, workingArea.Height - slice.Height); start.Y -= ((_loaf.Count - 1) * slice.Height); // all of the slices are a constant height if (_loaf.Count > 1) { start.Y -= 8; } slice.Location = start; }
private static void Slide(Toast slice) { int targetY = slice.Top + slice.Height; Timer timer = new Timer() { Interval = 10 }; timer.Tick += delegate(object sender, EventArgs args) { slice.Top = Math.Min(slice.Top + 10, targetY); if (slice.Top == targetY) { timer.Stop(); timer.Dispose(); } }; timer.Start(); }