Пример #1
0
 private void ButtonEditClick(object sender, RoutedEventArgs e)
 {
     try
     {
         var keyValuePair   = (KeyValuePair <int, BIPLight>)DataGridSequences.SelectedItem;
         var bipLightWindow = new BipLightWindow(keyValuePair.Value, _bipLink.Description);
         bipLightWindow.ShowDialog();
         if (bipLightWindow.DialogResult.HasValue && bipLightWindow.DialogResult.Value)
         {
             //Clicked OK
             if (!bipLightWindow.IsDirty)
             {
                 //User made no changes
                 return;
             }
             _bipLink.BIPLights[keyValuePair.Key] = bipLightWindow.BIPLight;
             DataGridSequences.DataContext        = _bipLink.BIPLights;
             DataGridSequences.ItemsSource        = _bipLink.BIPLights;
             DataGridSequences.Items.Refresh();
             _isDirty = true;
         }
         SetFormState();
     }
     catch (Exception ex)
     {
         Common.ShowErrorMessageBox(1083, ex);
     }
 }
Пример #2
0
        private void ButtonAddClick(object sender, RoutedEventArgs e)
        {
            try
            {
                var bipLightWindow = new BipLightWindow();
                bipLightWindow.ShowDialog();
                if (bipLightWindow.DialogResult.HasValue && bipLightWindow.DialogResult.Value)
                {
                    _bipLink.BIPLights.Add(GetNewKeyValue(), bipLightWindow.BIPLight);

                    DataGridSequences.DataContext = _bipLink.BIPLights;
                    DataGridSequences.ItemsSource = _bipLink.BIPLights;
                    DataGridSequences.Items.Refresh();
                    _isDirty = true;
                }
                SetFormState();
            }
            catch (Exception ex)
            {
                Common.ShowErrorMessageBox(1065, ex);
            }
        }