Example #1
0
 public MovieDetail(string id)
 {
     InitializeComponent();
     this.apiService = new NetWorkService();
     LoadDetails(id);
     ReturnData();
 }
Example #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            if (serverNetwork == null)
            {
                try
                {
                    serverNetwork = new NetWorkService(this);

                    serverNetwork.Listen("0.0.0.0", Int32.Parse(textBox2.Text), 100);

                    string myIp = GetMyIP(Dns.GetHostName());

                    DrawTex(string.Format("서버가 생성되었습니다. port: {0} Name: {1}",
                                          Int32.Parse(textBox2.Text), myIp));
                }
                catch (FormatException)
                {
                    MessageBox.Show("문자열 패턴에 맞지 않습니다.");
                }
                catch (OverflowException)
                {
                    MessageBox.Show("입력 값을 벗어났습니다.");
                }
                catch (Exception)
                {
                    Application.Exit();
                }
                textBox2.Text = "";
            }
        }
Example #3
0
 public Form1()
 {
     InitializeComponent();
     netWorkService = new NetWorkService();
     apiService     = new ApiService();
     dialogService  = new DialogService();
     dataService    = new DataService();
     LoadRates();
 }
Example #4
0
        public Home()
        {
            InitializeComponent();

            networkService = new NetWorkService();
            apiService     = new ApiService();
            dialogService  = new DialogService();
            Location       = new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent;
            dataService    = new DataService();
            LoadCountries();
        }
Example #5
0
 private void ProConn()
 {
     if (NetWorkService.ProConnLoop)
     {
         NetWorkService.ProConnLoop = false;
     }
     else
     {
         NetWorkService.ProConnLoop = true;
         NetWorkService.StartConnectCheck();
     }
 }
Example #6
0
 private void NetFlow()
 {
     if (NetWorkService.NetFlowLoop)
     {
         NetWorkService.NetFlowLoop = false;
     }
     else
     {
         NetWorkService.NetFlowLoop = true;
         NetWorkService.StartNetFlow();
     }
 }
Example #7
0
        public MainPage()
        {
            InitializeComponent();

            if (Application.Current.Properties.ContainsKey("appName"))
            {
                var nameApp = Application.Current.Properties["appName"];
                //lblWelcome.Text = nameApp.ToString();
            }
            this.apiService = new NetWorkService();
            ReturnData();
            BindingContext = ListMovies;
        }
Example #8
0
 private void CpuLoad()
 {
     R.Log.v("CpuLoad 1");
     if (NetWorkService.CpuLoadLoop)
     {
         R.Log.v("CpuLoad 2");
         NetWorkService.CpuLoadLoop = false;
     }
     else
     {
         R.Log.v("CpuLoad 3");
         NetWorkService.CpuLoadLoop = true;
         NetWorkService.StartCpuLoad();
     }
 }
        public void TestMethod2()
        {
            NetWorkService netWorkService = new NetWorkService();

            MessageEntity messageEntity = new MessageEntity();

            messageEntity.message = "这是我的消息";
            messageEntity.level   = "消息的优先级";
            messageEntity.type    = "消息的类型";

            string json = JsonConvert.SerializeObject(messageEntity);

            var str = netWorkService.PostData("http://localhost:22889/PostEntity", json);

            Debug.WriteLine(str);
        }
        public void TestMethod1()
        {
            NetWorkService netWorkService = new NetWorkService();

            Dictionary <string, string> dic = new Dictionary <string, string>();

            //dic.Add("message", "34343");
            //dic.Add("type", "6767");
            //dic.Add("level", "你78好");

            string err;

            var str = netWorkService.Post("http://localhost:22889/PostMessage?message=你好&type=可以&level=还行", dic, false, out err);


            Debug.WriteLine(str);
        }
Example #11
0
        public void TestMethod1()
        {
            NetWorkService service = new NetWorkService();

            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("jgdm", "729818173");

            string err;

            string url = "http://192.168.5.15:8080/register/countNum.do";

            var result = service.Post(url, dic, out err);

            Debug.WriteLine(result.ToString());


            string str = string.Empty;
        }
Example #12
0
        public void TestMethodPost()
        {
            NetWorkService httpPostHelper = new NetWorkService();

            Dictionary <string, string> keyValuePairs = new Dictionary <string, string>();

            keyValuePairs.Add("key", "chzhjkkj123456./");
            keyValuePairs.Add("sn", "Z55693");
            keyValuePairs.Add("startTime", "2019-04-01");
            keyValuePairs.Add("endTime", "2019-04-11");

            string err;

            string url = "http://121.40.75.174:7777/DaPaRe/FindPastRecordsData";

            var result = httpPostHelper.Post(url, keyValuePairs, out err);


            Debug.WriteLine(result);


            string ss = result;
        }
Example #13
0
        private void NetReportForm_Load(object sender, EventArgs e)
        {
            #region 启动功能
            this.ShowInTaskbar = false;
            this.Hide();
            IP = GetIP();
            Task.Factory.StartNew(() =>
            {
                try
                {
                    while (!this.IsDisposed)
                    {
                        GetNetProcess();
                        CalcBagFlow();
                        this.Invoke(new Action(() =>
                        {
                            status.Text = string.Format("信息:IP:{0},上传流量:{1},下载流量:{2}",
                                                        IP, ByteConvertTool.Fmt(NetWorkService.NowSent), ByteConvertTool.Fmt(NetWorkService.NowReceived));
                            status.Text += string.Format("\n单位时间:{0}分钟,上传流量:{1},下载流量:{2}",
                                                         NetWorkService.ThresholdTime, ByteConvertTool.Fmt(NetWorkService.UnitSent), ByteConvertTool.Fmt(NetWorkService.UnitReceived));
                            status.Text += string.Format("\n当前时间:{0},下次刷新时间:{1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), NetWorkService.CalcTime.ToString("yyyy-MM-dd HH:mm:ss"));

                            if ((NetWorkService.UnitSent + NetWorkService.UnitReceived) < NetWorkService.FlowThreshold || DateTime.Now > MaxTime)
                            {
                                NetWorkService.WriteRecord(BeginTime, DateTime.Now, netProcesses, IP);
                                this.Dispose();
                            }
                        }));
                        Thread.Sleep(1000);
                    }
                }
                catch { }
            });
            CaptureInit();
            Task.Factory.StartNew(() => { try { _rs.Capture(); } catch { } });
            #endregion
        }