Пример #1
0
        public Form1()
        {
            InitializeComponent();
            res = new ResourceManager("iConnectMoniter.Resource", this.GetType().Assembly);
            XmlDocument doc = new XmlDocument();
            doc.Load("Config.xml");
            XmlNodeList nodes = doc.GetElementsByTagName("Server");
            serverid = Convert.ToUInt16(nodes[0].Attributes.GetNamedItem("id").InnerText);

            cc = (ClientMoniter)Communicator.CreateClient(APPID.iMoniter);
            cc.updateClientEvent += new Client.updateClientDelegate(cc_updateClientEvent);
            cc.ExceptionEvent += new Client.ExceptionDelegate(cc_ExceptionEvent);
            //cc.ReceivedEvent += new Client.ReceiveDelegate(cc_ReceivedEvent);
        }
        public static Client CreateClient(APPID App, string ConfigPath)
        {
            if (!Clients.ContainsKey(App))
            {
                lock (SynObject)
                {
                    if (!Clients.ContainsKey(App))
                    {
                        foreach (var v in Apps)
                        {
                            if (v.id == App)
                            {
                                switch (v.type)
                                {
                                case APPTYPE.App2Res:
                                    Client c1 = new ClientApp(v, ConfigPath);
                                    Clients.Add(App, c1);
                                    break;

                                case APPTYPE.App2App:
                                    Client c2 = new ClientP2P(v, ConfigPath);
                                    Clients.Add(App, c2);
                                    break;

                                case APPTYPE.Res2App:
                                    Client c3 = new ClientRes(v, ConfigPath);
                                    Clients.Add(App, c3);
                                    break;

                                case APPTYPE.Authorization:
                                    Client c4 = new ClientAuthor(v, ConfigPath);
                                    Clients.Add(App, c4);
                                    break;

                                case APPTYPE.Moniter:
                                    Client c5 = new ClientMoniter(v, ConfigPath);
                                    Clients.Add(App, c5);
                                    break;

                                default:
                                    break;
                                }
                                break;
                            }
                        }
                    }
                }
            }
            return(Clients[App]);
        }
Пример #3
0
 public static Client CreateClient(APPID App, string ConfigPath)
 {
     if (!Clients.ContainsKey(App))
     {
         lock (SynObject)
         {
             if (!Clients.ContainsKey(App))
             {
                 foreach (var v in Apps)
                 {
                     if (v.id == App)
                     {
                         switch (v.type)
                         {
                             case APPTYPE.App2Res:
                                 Client c1 = new ClientApp(v, ConfigPath);
                                 Clients.Add(App, c1);
                                 break;
                             case APPTYPE.App2App:
                                 Client c2 = new ClientP2P(v, ConfigPath);
                                 Clients.Add(App, c2);
                                 break;
                             case APPTYPE.Res2App:
                                 Client c3 = new ClientRes(v, ConfigPath);
                                 Clients.Add(App, c3);
                                 break;
                             case APPTYPE.Authorization:
                                 Client c4 = new ClientAuthor(v, ConfigPath);
                                 Clients.Add(App, c4);
                                 break;
                             case APPTYPE.Moniter:
                                 Client c5 = new ClientMoniter(v, ConfigPath);
                                 Clients.Add(App, c5);
                                 break;
                             default:
                                 break;
                         }
                         break;
                     }
                 }
             }
         }
     }
     return Clients[App];
 }