Ejemplo n.º 1
0
        void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
#if SILVERLIGHT
            Storyboard sb = new Storyboard();
            sb            = Application.Current.Resources["ButtonPressAnimation"] as Storyboard;
            sb.Completed += new EventHandler(delegate(object obj, EventArgs es) { sb.Stop(); });
            Storyboard.SetTarget(sb, ButtonSaveTransform);
            sb.Begin();
#endif

            if (IsValid())
            {
                OutputStreamDeviceAnalog outputStreamDeviceAnalog = new OutputStreamDeviceAnalog();
                App app = (App)Application.Current;

                outputStreamDeviceAnalog.NodeID = app.NodeValue;
                outputStreamDeviceAnalog.OutputStreamDeviceID = m_sourceOutputStreamDeviceID;
                outputStreamDeviceAnalog.Type         = ((KeyValuePair <int, string>)ComboBoxType.SelectedItem).Key;
                outputStreamDeviceAnalog.Label        = TextBoxLabel.Text.CleanText();
                outputStreamDeviceAnalog.LoadOrder    = TextBoxLoadOrder.Text.ToInteger();
                outputStreamDeviceAnalog.ScalingValue = TextBoxScalingValue.Text.ToInteger();
                if (m_inEditMode == true && m_outputStreamDeviceAnalogID > 0)
                {
                    outputStreamDeviceAnalog.ID = m_outputStreamDeviceAnalogID;
                    SaveOutputStreamDeviceAnalog(outputStreamDeviceAnalog, false);
                }
                else
                {
                    SaveOutputStreamDeviceAnalog(outputStreamDeviceAnalog, true);
                }
            }
        }
Ejemplo n.º 2
0
        void SaveOutputStreamDeviceAnalog(OutputStreamDeviceAnalog outputStreamDeviceAnalog, bool isNew)
        {
            SystemMessages sm;

            try
            {
                string result = CommonFunctions.SaveOutputStreamDeviceAnalog(null, outputStreamDeviceAnalog, isNew);
                sm = new SystemMessages(new Message()
                {
                    UserMessage = result, SystemMessage = string.Empty, UserMessageType = MessageType.Success
                },
                                        ButtonType.OkOnly);
                GetOutputStreamDeviceAnalogList();
                //ClearForm();
                //make this newly added or updated item as default selected. So user can click initialize right away.
                ListBoxOutputStreamDeviceAnalogList.SelectedItem = ((List <OutputStreamDeviceAnalog>)ListBoxOutputStreamDeviceAnalogList.ItemsSource).Find(c => c.Label == outputStreamDeviceAnalog.Label);
            }
            catch (Exception ex)
            {
                CommonFunctions.LogException(null, "WPF.SaveOutputStreamDeviceAnalog", ex);
                sm = new SystemMessages(new Message()
                {
                    UserMessage = "Failed to Save Output Stream Device Analog Information", SystemMessage = ex.Message, UserMessageType = MessageType.Error
                },
                                        ButtonType.OkOnly);
            }
            sm.Owner = Window.GetWindow(this);
            sm.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            sm.ShowPopup();
        }
Ejemplo n.º 3
0
 void ListBoxOutputStreamDeviceAnalogList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (ListBoxOutputStreamDeviceAnalogList.SelectedIndex >= 0)
     {
         OutputStreamDeviceAnalog selectedOutputStreamDeviceAnalog = ListBoxOutputStreamDeviceAnalogList.SelectedItem as OutputStreamDeviceAnalog;
         GridOutputStreamDeviceAnalogDetail.DataContext = selectedOutputStreamDeviceAnalog;
         ComboBoxType.SelectedItem = new KeyValuePair <int, string>(selectedOutputStreamDeviceAnalog.Type, selectedOutputStreamDeviceAnalog.TypeName);
         m_inEditMode = true;
         m_outputStreamDeviceAnalogID = selectedOutputStreamDeviceAnalog.ID;
         ButtonSave.Tag = "Update";
     }
 }
Ejemplo n.º 4
0
 public string SaveOutputStreamDeviceAnalog(OutputStreamDeviceAnalog outputStreamDeviceAnalog, bool isNew)
 {
     try
     {
         return(CommonFunctions.SaveOutputStreamDeviceAnalog(null, outputStreamDeviceAnalog, isNew));
     }
     catch (Exception ex)
     {
         CommonFunctions.LogException(null, "Service.SaveOutputStreamDeviceAnalog", ex);
         CustomServiceFault fault = new CustomServiceFault()
         {
             UserMessage = "Failed to Save Output Stream Device Analog Information", SystemMessage = ex.Message
         };
         throw new FaultException <CustomServiceFault>(fault);
     }
 }
 void SaveOutputStreamDeviceAnalog(OutputStreamDeviceAnalog outputStreamDeviceAnalog, bool isNew)
 {
     m_client.SaveOutputStreamDeviceAnalogAsync(outputStreamDeviceAnalog, isNew);
 }
Ejemplo n.º 6
0
 void SaveOutputStreamDeviceAnalog(OutputStreamDeviceAnalog outputStreamDeviceAnalog, bool isNew)
 {
     m_client.SaveOutputStreamDeviceAnalogAsync(outputStreamDeviceAnalog, isNew);
 }