private void _updateToastButton_OnClick(object sender, RoutedEventArgs e) { SmartClientTextToastData selectedSmartClientTextToastData = (SmartClientTextToastData)_toastListView.SelectedItem; //Open a new TextToastDetailsWindow window that allows the user to edit the toast data TextToastDetailsWindow textToastDetailsWindow = new TextToastDetailsWindow(selectedSmartClientTextToastData); textToastDetailsWindow.ShowDialog(); if (textToastDetailsWindow.SmartClientTextToastData != null) { //If toast data was updated then replace it in the active toasts collection and signal to the environment that the toast should be displayed int index = _activeToasts.IndexOf(selectedSmartClientTextToastData); if (index >= 0) { //replace item in _activeToasts _activeToasts.RemoveAt(index); _activeToasts.Insert(index, textToastDetailsWindow.SmartClientTextToastData); } else { //item does not exists in _activeToasts. Can happen if it expires while dialog is open. Add item again _activeToasts.Add(textToastDetailsWindow.SmartClientTextToastData); } EnvironmentManager.Instance.PostMessage(new Message(MessageId.SmartClient.ToastShowCommand, textToastDetailsWindow.SmartClientTextToastData)); } }
private void _addToastButton_OnClick(object sender, RoutedEventArgs e) { //Open a new TextToastDetailsWindow window that allows the user to create the toast data TextToastDetailsWindow textToastDetailsWindow = new TextToastDetailsWindow(Dismissed, Activated, Expired); textToastDetailsWindow.ShowDialog(); if (textToastDetailsWindow.SmartClientTextToastData != null) { //If toast data was created then add it to the active toasts collection and signal to the environment that the toast should be displayed _activeToasts.Add(textToastDetailsWindow.SmartClientTextToastData); EnvironmentManager.Instance.PostMessage(new Message(MessageId.SmartClient.ToastShowCommand, textToastDetailsWindow.SmartClientTextToastData)); } }