TrayNotificationBalloon CreateBalloon(string title, string message, TrayNotificationButtons tnb = TrayNotificationButtons.tnbNone, ICommand[] buttonCommands = null) { var balloon = new TrayNotificationBalloon(this); balloon.Setup(title, message, tnb, buttonCommands); return(balloon); }
public void Setup(string title, string message, TrayNotificationButtons tnb = TrayNotificationButtons.tnbNone, ICommand[] buttonCommands = null) { if (!ValidateCommands(tnb, buttonCommands)) throw new ArgumentException("Number of buttons selected does not match number of commands passed."); Title = title; Message = message; SetupSelectedButtons(tnb); _buttonCommands = buttonCommands; }
public void Setup(string title, string message, TrayNotificationButtons tnb = TrayNotificationButtons.tnbNone, ICommand[] buttonCommands = null) { if (!ValidateCommands(tnb, buttonCommands)) { throw new ArgumentException("Number of buttons selected does not match number of commands passed."); } Title = title; Message = message; SetupSelectedButtons(tnb); _buttonCommands = buttonCommands; }
public bool ValidateCommands(TrayNotificationButtons tnb, ICommand[] buttonCommands) { switch (tnb) { case (TrayNotificationButtons.tnbYesNo): if (buttonCommands.Length != 2) { return(false); } break; case (TrayNotificationButtons.tnbAcceptDeclineIgnore): if (buttonCommands.Length != 3) { return(false); } break; } return(true); }
public void SetupSelectedButtons(TrayNotificationButtons tnb) { switch (tnb) { case (TrayNotificationButtons.tnbNone): { Button_0.Visibility = Visibility.Collapsed; Button_1.Visibility = Visibility.Collapsed; Button_2.Visibility = Visibility.Collapsed; break; } case (TrayNotificationButtons.tnbYesNo): { Button_0.Content = "Yes"; Button_1.Content = "No"; Button_0.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); Button_1.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); SetMargin(Button_0, 48, 109); SetMargin(Button_1, 126, 109); Button_2.Visibility = Visibility.Collapsed; break; } case (TrayNotificationButtons.tnbAcceptDeclineIgnore): { Button_0.Content = "Accept"; Button_1.Content = "Decline"; Button_2.Content = "Ignore"; Button_0.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0)); Button_1.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0)); Button_2.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0)); SetMargin(Button_0, 8, 109); SetMargin(Button_1, 86, 109); SetMargin(Button_2, 164, 109); break; } } }
public bool ValidateCommands(TrayNotificationButtons tnb, ICommand[] buttonCommands) { switch (tnb) { case (TrayNotificationButtons.tnbYesNo): if (buttonCommands.Length != 2) return false; break; case (TrayNotificationButtons.tnbAcceptDeclineIgnore): if (buttonCommands.Length != 3) return false; break; } return true; }
TrayNotificationBalloon CreateBalloon(string title, string message, TrayNotificationButtons tnb = TrayNotificationButtons.tnbNone, ICommand[] buttonCommands = null) { var balloon = new TrayNotificationBalloon(this); balloon.Setup(title, message, tnb, buttonCommands); return balloon; }