Exemple #1
0
        public void StartDevice(List<DeviceBase> devs)
        {
            try
            {
                if (!genConfiged)
                {
                    MessageBox.Show("配置文件尚未生成,请先生成配置文件!");
                    return;
                }

                MessageSend cmd = new MessageSend();
                cmd.Command = "WSStartDevice";
                cmd.LabIP = Util.SingletonGeneric<Data.UserData>.GetInstance.LabIP;
                cmd.UserID = Util.SingletonGeneric<Data.UserData>.GetInstance.UserName;

                string strcmd = cmd.MsgSendToXMLStr();
                string strdata;
                if (devs.Count == Util.SingletonGeneric<SystemData>.GetInstance.DeviceList.Count)
                    strdata = configMgr.GenStartAllDeviceCmd();
                else
                    strdata = configMgr.GenStartDeviceCmd(devs);

                PLabWebServiceSoapClient start = new PLabWebServiceSoapClient();
                start.Endpoint.Address = new EndpointAddress(Util.Function.GetWebServiceAddress());
                start.ExecuteCommandCompleted += new
                    EventHandler<ExecuteCommandCompletedEventArgs>(start_ExecuteCommandCompleted);
                start.ExecuteCommandAsync(strcmd, strdata);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.InnerException.ToString());
            }
        }
Exemple #2
0
        public void GenerateConfigFile()
        {
            try
            {
                if (Util.SingletonGeneric<Data.SystemData>.GetInstance.DeviceList.Count == 0)
                {
                    MessageBox.Show("拓扑中尚无设备,请创建!");
                    return;
                }
                MessageSend cmd = new MessageSend();
                cmd.Command = "WSGenerateConfigFile";
                cmd.LabIP = Util.SingletonGeneric<Data.UserData>.GetInstance.LabIP;
                cmd.UserID = Util.SingletonGeneric<Data.UserData>.GetInstance.UserName;

                string strcmd = cmd.MsgSendToXMLStr();
                string strdata = configMgr.GenConfigFile();

                PLabWebServiceSoapClient client = new PLabWebServiceSoapClient();
                client.Endpoint.Address = new EndpointAddress(Util.Function.GetWebServiceAddress());
                client.ExecuteCommandCompleted += new
                    EventHandler<ExecuteCommandCompletedEventArgs>(client_ExecuteCommandCompleted);
                client.ExecuteCommandAsync(strcmd, strdata);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #3
0
        /// <summary>
        /// 查找服务器上的标准拓扑
        /// </summary>
        public void GetServerTopo()
        {
            try
            {
                MessageSend cmd = new MessageSend();
                cmd.Command = "WSGetServerTopo";

                PLabWebServiceSoapClient getServer = new PLabWebServiceSoapClient();
                getServer.Endpoint.Address = new EndpointAddress(Util.Function.GetWebServiceAddress());
                /*getServer.Endpoint.Address = new EndpointAddress("http://localhost:1549/IP%20Lab.Web/" + ConfigurationManager.AppSettings["WebService"]);*/
                getServer.ExecuteCommandCompleted +=
                    new EventHandler<ExecuteCommandCompletedEventArgs>(getServer_ExecuteCommandCompleted);
                getServer.ExecuteCommandAsync(cmd.MsgSendToXMLStr(), "");
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.InnerException.Message);
            }
        }
Exemple #4
0
        void topoWindow_Closed(object sender, EventArgs e)
        {
            if ((bool)topoWindow.DialogResult)
            {
                try
                {
                    MessageSend cmd = new MessageSend();
                    cmd.Command = "WSGetServerTopoData";

                    PLabWebServiceSoapClient getServer = new PLabWebServiceSoapClient();
                    getServer.Endpoint.Address = new EndpointAddress(Util.Function.GetWebServiceAddress());
                    /*getServer.Endpoint.Address = new EndpointAddress("http://localhost:1549/IP%20Lab.Web/" + ConfigurationManager.AppSettings["WebService"]);*/
                    getServer.ExecuteCommandCompleted += new EventHandler<ExecuteCommandCompletedEventArgs>(getServer_ExecuteCommandCompleted);
                    getServer.ExecuteCommandAsync(cmd.MsgSendToXMLStr(), topoWindow.tbSelectTopo.Text);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(ex.InnerException.Message);
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// 获取可使用的服务器
        /// </summary>
        private void GetUsableServers()
        {
            try
            {
                MessageSend cmd = new MessageSend();
                cmd.Command = "WSGetUsableServer";

                PLabWebServiceSoapClient getServer = new PLabWebServiceSoapClient();
                getServer.Endpoint.Address = new EndpointAddress(Util.Function.GetWebServiceAddress());
                getServer.ExecuteCommandCompleted +=
                    new EventHandler<ExecuteCommandCompletedEventArgs>(getServer_ExecuteCommandCompleted);
                getServer.ExecuteCommandAsync(cmd.MsgSendToXMLStr(), "");
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.InnerException.Message);
            }
        }