示例#1
0
 void client_GetPhasorsCompleted(object sender, GetPhasorsCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         ComboboxDestinationPhasor.ItemsSource = e.Result;
     }
     else
     {
         SystemMessages sm;
         if (e.Error is FaultException <CustomServiceFault> )
         {
             FaultException <CustomServiceFault> fault = e.Error as FaultException <CustomServiceFault>;
             sm = new SystemMessages(new Message()
             {
                 UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error
             },
                                     ButtonType.OkOnly);
         }
         else
         {
             sm = new SystemMessages(new Message()
             {
                 UserMessage = "Failed to Retrieve Phasors", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error
             },
                                     ButtonType.OkOnly);
         }
         sm.ShowPopup();
     }
     if (ComboboxDestinationPhasor.Items.Count > 0)
     {
         ComboboxDestinationPhasor.SelectedIndex = 0;
     }
 }
示例#2
0
        void client_GetPhasorsCompleted(object sender, GetPhasorsCompletedEventArgs e)
        {
            //ComboBoxPhasorSource.Items.Clear();
            if (e.Error == null)
            {
                ComboBoxPhasorSource.ItemsSource = e.Result;
                if (ComboBoxPhasorSource.Items.Count > 0)
                {
                    ComboBoxPhasorSource.SelectedIndex = 0;
                    if (ListBoxMeasurementList.SelectedIndex >= 0)
                    {
                        Measurement selectedMeasurement = ListBoxMeasurementList.SelectedItem as Measurement;
                        if (selectedMeasurement.PhasorSourceIndex.HasValue)
                        {
                            foreach (KeyValuePair <int, string> item in ComboBoxPhasorSource.Items)
                            {
                                if (item.Value == selectedMeasurement.PhasorLabel)
                                {
                                    ComboBoxPhasorSource.SelectedItem = item;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            ComboBoxPhasorSource.SelectedIndex = 0;
                        }
                    }
                }
            }
            else
            {
                SystemMessages sm;
                if (e.Error is FaultException <CustomServiceFault> )
                {
                    FaultException <CustomServiceFault> fault = e.Error as FaultException <CustomServiceFault>;
                    sm = new SystemMessages(new Message()
                    {
                        UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error
                    },
                                            ButtonType.OkOnly);
                }
                else
                {
                    sm = new SystemMessages(new Message()
                    {
                        UserMessage = "Failed to Retrieve Phasors", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error
                    },
                                            ButtonType.OkOnly);
                }

                sm.ShowPopup();
            }
        }
示例#3
0
 void client_GetPhasorsCompleted(object sender, GetPhasorsCompletedEventArgs e)
 {
     if (e.Error == null)
         ComboboxDestinationPhasor.ItemsSource = e.Result;
     else
     {
         SystemMessages sm;
         if (e.Error is FaultException<CustomServiceFault>)
         {
             FaultException<CustomServiceFault> fault = e.Error as FaultException<CustomServiceFault>;
             sm = new SystemMessages(new Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error },
                 ButtonType.OkOnly);
         }
         else
             sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Phasors", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error },
                 ButtonType.OkOnly);
         sm.ShowPopup();
     }
     if (ComboboxDestinationPhasor.Items.Count > 0)
         ComboboxDestinationPhasor.SelectedIndex = 0;
 }
示例#4
0
        void client_GetPhasorsCompleted(object sender, GetPhasorsCompletedEventArgs e)
        {
            //ComboBoxPhasorSource.Items.Clear();
            if (e.Error == null)
            {
                ComboBoxPhasorSource.ItemsSource = e.Result;
                if (ComboBoxPhasorSource.Items.Count > 0)
                {
                    ComboBoxPhasorSource.SelectedIndex = 0;
                    if (ListBoxMeasurementList.SelectedIndex >= 0)
                    {
                        Measurement selectedMeasurement = ListBoxMeasurementList.SelectedItem as Measurement;
                        if (selectedMeasurement.PhasorSourceIndex.HasValue)
                        {
                            foreach (KeyValuePair<int, string> item in ComboBoxPhasorSource.Items)
                            {
                                if (item.Value == selectedMeasurement.PhasorLabel)
                                {
                                    ComboBoxPhasorSource.SelectedItem = item;
                                    break;
                                }
                            }
                        }
                        else
                            ComboBoxPhasorSource.SelectedIndex = 0;
                    }
                }
            }
            else
            {
                SystemMessages sm;
                if (e.Error is FaultException<CustomServiceFault>)
                {
                    FaultException<CustomServiceFault> fault = e.Error as FaultException<CustomServiceFault>;
                    sm = new SystemMessages(new Message() { UserMessage = fault.Detail.UserMessage, SystemMessage = fault.Detail.SystemMessage, UserMessageType = MessageType.Error },
                        ButtonType.OkOnly);
                }
                else
                    sm = new SystemMessages(new Message() { UserMessage = "Failed to Retrieve Phasors", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error },
                        ButtonType.OkOnly);

                sm.ShowPopup();
            }
        }