void MainWindow_Closing(object sender, CancelEventArgs e) { if (mService03Helper != null) { mService03Helper.Close(); mService03Helper = null; } if (mMediaClient != null) { mMediaClient.Stop(); mMediaClient = null; } }
private void downloadsftp() { string strAddress = "192.168.8.96"; //string strAddress = "192.168.6.75"; int port = 8081 - 3; if (mService03Helper != null) { mService03Helper.Close(); } mService03Helper = new Service03Helper(); mService03Helper.HostAddress = strAddress; mService03Helper.HostPort = port; RequestMessage request = new RequestMessage(); request.Command = (int)Service03Command.DownloadRecordFile; request.ListData.Add("192.168.8.149"); request.ListData.Add("3022"); request.ListData.Add("1020000000000000001|00000"); request.ListData.Add("asd.123"); request.ListData.Add("166"); request.ListData.Add("1505070200000000166"); request.ListData.Add(""); OperationReturn optReturn = mService03Helper.DoRequest(request); if (!optReturn.Result) { AppendMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } ReturnMessage ret = optReturn.Data as ReturnMessage; if (ret == null) { AppendMessage(string.Format("Fail.\tReturnMessage is null")); return; } AppendMessage(string.Format("End.\t{0}", @"http://192.168.8.100:8081/MediaData/" + ret.Data)); }
private void UploadFile() { try { string strAddress = "192.168.6.27"; //string strAddress = "192.168.5.31"; int port = 8081 - 3; if (mService03Helper != null) { mService03Helper.Close(); } mService03Helper = new Service03Helper(); mService03Helper.HostAddress = strAddress; mService03Helper.HostPort = port; RequestMessage request = new RequestMessage(); request.Command = (int)Service03Command.UploadFile; request.ListData.Add("123.txt"); request.ListData.Add("1"); request.ListData.Add("test.txt"); OperationReturn optReturn = mService03Helper.DoRequest(request); if (!optReturn.Result) { AppendMessage(string.Format("Fail.\t{0}\t{1}", optReturn.Code, optReturn.Message)); return; } ReturnMessage ret = optReturn.Data as ReturnMessage; if (ret == null) { AppendMessage(string.Format("Fail.\tReturnMessage is null")); return; } AppendMessage(string.Format("End.")); } catch (Exception ex) { AppendMessage(ex.Message); } }