Пример #1
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            AirCatApi airCatApi = new AirCatApi();

            airCatApi.AirWebApiIP    = AirWebApiIP;
            airCatApi.AirWebApiPort  = AirWebApiPort;
            airCatApi.ServicePort    = LocalManagerPort;
            airCatApi.AirWebApiToken = ShareToken;


            Type type = airCatApi.GetType();

            MethodInfo[] methods = type.GetMethods();

            List <String> CommandList = new List <string>();

            foreach (MethodInfo method in methods)
            {
                if (method.IsStatic == false)
                {
                    continue;
                }
                if (method.ReturnParameter.ParameterType.Name != "String")
                {
                    continue;
                }
                CommandList.Add(method.Name);
            }
            CommandList.Sort();
            this.CobmoxCommands.ItemsSource = CommandList;


            airCatApi.OnDebug += AirCatApi_OnDebug;
            airCatApi.ServiceStart();

            ServerIP.Text         = AirWebApiIP;
            ServerPort.Text       = AirWebApiPort.ToString();
            ManagerIP.Text        = "127.0.0.1";
            ManagerPort.Text      = LocalManagerPort.ToString();
            Token.Text            = ShareToken;
            TestRobotWxid.Text    = DefaultRobotWxid;
            TestRoomWxid.Text     = DefaultRoomWxid;
            TestContractWxid.Text = DefaultContractWxid;


            new Thread(() =>
            {
                this.Dispatcher.Invoke(new Action(() =>
                {
                    CobmoxCommands.SelectedIndex = CobmoxCommands.Items.IndexOf("GetRobotList");
                }));
            }).Start();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //启动本地Web服务器
            AirCatApi airCatApi = new AirCatApi();

            airCatApi.OnDebug += AirCatApi_OnDebug;
            airCatApi.ServiceStart();


            DemoGetServerStatus();
            Thread.Sleep(2000);

            DemoSendContractText();
            Thread.Sleep(2000);

            DemoSendRoomText();
            Thread.Sleep(2000);

            Console.ReadLine();
        }