Пример #1
0
        void client_GetOutputStreamDevicePhasorListCompleted(object sender, GetOutputStreamDevicePhasorListCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                ListBoxOutputStreamDevicePhasorList.ItemsSource = e.Result;
                if (ListBoxOutputStreamDevicePhasorList.Items.Count > 0 && m_selectFirst)
                {
                    ListBoxOutputStreamDevicePhasorList.SelectedIndex = 0;
                    m_selectFirst = false;
                }
            }
            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 Output Stream Device Phasor List", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error
                    },
                                            ButtonType.OkOnly);
                }

                sm.ShowPopup();
            }
        }
        void client_GetOutputStreamDevicePhasorListCompleted(object sender, GetOutputStreamDevicePhasorListCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                ListBoxOutputStreamDevicePhasorList.ItemsSource = e.Result;
                if (ListBoxOutputStreamDevicePhasorList.Items.Count > 0 && m_selectFirst)
                {
                    ListBoxOutputStreamDevicePhasorList.SelectedIndex = 0;
                    m_selectFirst = false;
                }
            }
            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 Output Stream Device Phasor List", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error },
                        ButtonType.OkOnly);

                sm.ShowPopup();
            }
        }