示例#1
0
        void client_GetNodesCompleted(object sender, GetNodesCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                ComboBoxNode.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 Nodes", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error
                    },
                                            ButtonType.OkOnly);
                }

                sm.ShowPopup();
            }
            if (ComboBoxNode.Items.Count > 0)
            {
                ComboBoxNode.SelectedIndex = 0;
            }
        }
        private void GetNodeByIdAsyncCompleted(object sender, GetNodesCompletedEventArgs e)
        {
            List<INodeProxy> nodes = new List<INodeProxy>();
            
            foreach (SoapNode soapNode in e.Result.Values)
            {
                NodeProxy node = new NodeProxy(soapNode);

                nodes.Add(node);
                _cachedNodes.Add(node.Id, node);
            }

            ReturnedNodesEventArgs eventArgs = new ReturnedNodesEventArgs(null, nodes.ToArray());

            if (GetNodeByIdCompleted != null)
            {
                GetNodeByIdCompleted.Invoke(this, eventArgs);
            }
        }
示例#3
0
        private void GetNodeByIdAsyncCompleted(object sender, GetNodesCompletedEventArgs e)
        {
            List <INodeProxy> nodes = new List <INodeProxy>();

            foreach (SoapNode soapNode in e.Result.Values)
            {
                NodeProxy node = new NodeProxy(soapNode);

                nodes.Add(node);
                _cachedNodes.Add(node.Id, node);
            }

            ReturnedNodesEventArgs eventArgs = new ReturnedNodesEventArgs(null, nodes.ToArray());

            if (GetNodeByIdCompleted != null)
            {
                GetNodeByIdCompleted.Invoke(this, eventArgs);
            }
        }
        void client_GetNodesCompleted(object sender, GetNodesCompletedEventArgs e)
        {
            if (e.Error == null)
                ComboBoxNode.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 Nodes", SystemMessage = e.Error.Message, UserMessageType = MessageType.Error },
                        ButtonType.OkOnly);

                sm.ShowPopup();
            }
            if (ComboBoxNode.Items.Count > 0)
                ComboBoxNode.SelectedIndex = 0;
        }