Пример #1
0
        /// <summary>
        /// Handles the incoming xml message
        /// </summary>
        public void HandleXml(Object sender, XmlReceivedEventArgs e)
        {
            if (PluginBase.MainForm.MenuStrip.InvokeRequired)
            {
                PluginBase.MainForm.MenuStrip.BeginInvoke((MethodInvoker) delegate
                {
                    try
                    {
                        XmlDocument message = e.XmlDocument;
                        XmlNode mainNode    = message.FirstChild;
                        for (Int32 i = 0; i < mainNode.ChildNodes.Count; i++)
                        {
                            XmlNode cmdNode = mainNode.ChildNodes[i];
                            if (XmlHelper.HasAttribute(cmdNode, "cmd"))
                            {
                                String cmd = XmlHelper.GetAttribute(cmdNode, "cmd");
                                switch (cmd)
                                {
                                case "call":
                                    this.HandleCallMsg(cmdNode, e.Socket);
                                    break;

                                case "trace":
                                    this.HandleTraceMsg(cmdNode, e.Socket);
                                    break;

                                case "notify":
                                    this.HandleNotifyMsg(cmdNode, e.Socket);
                                    break;

                                case "return":
                                    this.HandleReturnMsg(cmdNode, e.Socket);
                                    break;

                                default:
                                    ErrorManager.ShowError(INVALID_MSG);
                                    break;
                                }
                            }
                            else
                            {
                                ErrorManager.ShowError(INVALID_MSG);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                    }
                });
            }
        }
Пример #2
0
        /**
         * Handles the incoming xml message
         */
        public void HandleXml(object sender, XmlReceivedEventArgs e)
        {
            try
            {
                XmlDocument message  = e.XmlDocument;
                XmlNode     mainNode = message.FirstChild;
                for (int i = 0; i < mainNode.ChildNodes.Count; i++)
                {
                    XmlNode cmdNode = mainNode.ChildNodes[i];
                    if (XmlUtils.HasAttribute(cmdNode, "cmd"))
                    {
                        string cmd = XmlUtils.GetAttribute(cmdNode, "cmd");
                        switch (cmd)
                        {
                        case "trace":
                            this.HandleTraceMsg(cmdNode, e.Socket);
                            break;

                        case "notify":
                            this.HandleNotifyMsg(cmdNode, e.Socket);
                            break;

                        case "getsetting":
                            this.HandleGetSettingsMsg(cmdNode, e.Socket);
                            break;

                        case "return":
                            this.HandleReturnMsg(cmdNode, e.Socket);
                            break;

                        default:
                            ErrorHandler.ShowError("Received xml message was invalid.", null);
                            break;
                        }
                    }
                    else
                    {
                        ErrorHandler.ShowError("Received xml message was invalid.", null);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.ShowError("Error while handling the xml data.", ex);
            }
        }
Пример #3
0
 /// <summary>
 /// Handles the incoming xml message
 /// </summary>
 public void HandleXml(Object sender, XmlReceivedEventArgs e)
 {
     if (PluginBase.MainForm.MenuStrip.InvokeRequired) PluginBase.MainForm.MenuStrip.BeginInvoke((MethodInvoker)delegate
         {
             try
             {
                 XmlDocument message = e.XmlDocument;
                 XmlNode mainNode = message.FirstChild;
                 for (Int32 i = 0; i < mainNode.ChildNodes.Count; i++)
                 {
                     XmlNode cmdNode = mainNode.ChildNodes[i];
                     if (XmlHelper.HasAttribute(cmdNode, "cmd"))
                     {
                         String cmd = XmlHelper.GetAttribute(cmdNode, "cmd");
                         switch (cmd)
                         {
                             case "call":
                                 this.HandleCallMsg(cmdNode, e.Socket);
                                 break;
                             case "trace":
                                 this.HandleTraceMsg(cmdNode, e.Socket);
                                 break;
                             case "notify":
                                 this.HandleNotifyMsg(cmdNode, e.Socket);
                                 break;
                             case "return":
                                 this.HandleReturnMsg(cmdNode, e.Socket);
                                 break;
                             default:
                                 ErrorManager.ShowError(INVALID_MSG);
                                 break;
                         }
                     }
                     else ErrorManager.ShowError(INVALID_MSG);
                 }
             }
             catch (Exception ex)
             {
                 ErrorManager.ShowError(ex);
             }
         });
 }
Пример #4
0
		/**
		* Handles the incoming xml message
		*/
		public void HandleXml(object sender, XmlReceivedEventArgs e)
		{
			try 
			{
				XmlDocument message = e.XmlDocument;
				XmlNode mainNode = message.FirstChild;
				for (int i = 0; i<mainNode.ChildNodes.Count; i++)
				{
					XmlNode cmdNode = mainNode.ChildNodes[i];
					if(XmlUtils.HasAttribute(cmdNode, "cmd"))
					{
						string cmd = XmlUtils.GetAttribute(cmdNode, "cmd");
						switch(cmd)
						{
							case "trace":
								this.HandleTraceMsg(cmdNode, e.Socket);
								break;
							case "notify":
								this.HandleNotifyMsg(cmdNode, e.Socket);
								break;
							case "getsetting":
								this.HandleGetSettingsMsg(cmdNode, e.Socket);
								break;
							case "return":
								this.HandleReturnMsg(cmdNode, e.Socket);
								break;
							default:
								ErrorHandler.ShowError("Received xml message was invalid.", null);
								break;
						}
					} 
					else 
					{
						ErrorHandler.ShowError("Received xml message was invalid.", null);
					}
				}
			}
			catch (Exception ex)
			{
				ErrorHandler.ShowError("Error while handling the xml data.", ex);
			}
		}