Esempio n. 1
0
        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));
            }
        }
 public TextToastDetailsWindow(SmartClientTextToastData smartClientTextToastData) : this(smartClientTextToastData.Dismissed, smartClientTextToastData.Activated, smartClientTextToastData.Expired)
 {
     _idTextBlock.Text = smartClientTextToastData.Id.ToString();
     _durationComboBox.SelectedItem = ((List <DurationComboBoxItem>)_durationComboBox.ItemsSource).Single(x => x.Duration == smartClientTextToastData.Duration);
     _iconComboBox.SelectedItem     = ((List <IconComboBoxItem>)_iconComboBox.ItemsSource).Single(x => x.Icon == smartClientTextToastData.Icon);
     _primaryTextTextBox.Text       = smartClientTextToastData.PrimaryText;
     _secondaryTextTextBox.Text     = smartClientTextToastData.SecondaryText;
     _countTextTextBox.Text         = smartClientTextToastData.CountText;
 }
 private void OkButton_OnClick(object sender, RoutedEventArgs e)
 {
     SmartClientTextToastData = new SmartClientTextToastData(Guid.Parse(_idTextBlock.Text), ((DurationComboBoxItem)_durationComboBox.SelectedItem).Duration, _dismissed, _activated, _expired, ((IconComboBoxItem)_iconComboBox.SelectedItem).Icon, _primaryTextTextBox.Text, _secondaryTextTextBox.Text, _countTextTextBox.Text);
     Close();
 }