public ToastMessage(String message, String title, int delay, ToastMessage.Position position) : this(message, title, delay, position, null) { }
/// <summary> /// Sets the position of the toast based on a predefined position. /// </summary> /// <param name="position">The position where the toast will show</param> private void setPosition(ToastMessage.Position position) { // Using WorkArea to take things as the TaskBar in mind double screenWidth = System.Windows.SystemParameters.WorkArea.Width; double screenHeight = System.Windows.SystemParameters.WorkArea.Height; switch (position) { case ToastMessage.Position.TOP_LEFT: this.Left = TOAST_MARGIN; this.Top = TOAST_MARGIN; break; case ToastMessage.Position.TOP_RIGHT: this.Left = screenWidth - Width - TOAST_MARGIN; this.Top = TOAST_MARGIN; break; case ToastMessage.Position.BOTTOM_LEFT: this.Left = TOAST_MARGIN; this.Top = screenHeight - Height - TOAST_MARGIN; break; case ToastMessage.Position.BOTTOM_RIGHT: this.Left = screenWidth - Width - TOAST_MARGIN; this.Top = screenHeight - Height - TOAST_MARGIN; break; } }