public void CloseClient() { if (transferClient == null) { return; } transferClient.Close(); transferClient = null; Connected = false; }
private void btnConnect_Click(object sender, EventArgs e) { if (transferClient == null) { transferClient = new TransferClient(); transferClient.Connect(txtCntHost.Text.Trim(), int.Parse(txtCntPort.Text.Trim()), connectCallback); Enabled = false; } else { transferClient.Close(); transferClient = null; } }
private void ExecuteConnect() { if (transferClient == null) { transferClient = new TransferClient(); transferClient.Connect(Host.Trim(), int.Parse(Port.Trim()), connectCallback); } else { transferClient.Close(); transferClient = null; } sendFileCommand.RaiseCanExecuteChanged(); }
private void btnConnect_Click(object sender, EventArgs e) { if (transferClient == null) { //Create our new transfer client. //And attempt to connect transferClient = new TransferClient(); transferClient.Connect(txtCntHost.Text.Trim(), int.Parse(txtCntPort.Text.Trim()), connectCallback); Enabled = false; } else { //This means we're trying to disconnect. transferClient.Close(); transferClient = null; } }
private void button1_Click(object sender, EventArgs e) { using (TransferClient transfer = new TransferClient("BasicHttpBinding_ITransfer")) { using (FileStream stream = File.OpenRead("Commanigy.Transmit.Client.pdb")) { schemas.commanigy.com.UploadMeta md = new schemas.commanigy.com.UploadMeta(); md.Code = Guid.NewGuid().ToString("N"); transfer.Upload(md, stream); stream.Close(); } transfer.Close(); } }
private void btnConnect_Click(object sender, EventArgs e) { if (transferClient == null) { //Create our new transfer client. //And attempt to connect transferClient = new TransferClient(); string serverIpv6Add = ConfigurationManager.AppSettings["IPV6Address"]; string serverPortStr = ConfigurationManager.AppSettings["Port"]; int serverPort = int.Parse(serverPortStr); //transferClient.Connect("2001:250:4800:ef:a4fe:bc62:9bc2:8f6b", 3003, connectCallback); transferClient.Connect(serverIpv6Add, serverPort, connectCallback); Enabled = false; } else { //This means we're trying to disconnect. transferClient.Close(); transferClient = null; } }
private void btnConnect_Click(object sender, EventArgs e) { if (transferClient == null) { try { //Create our new transfer client. //And attempt to connect transferClient = new TransferClient(); transferClient.Connect("2001:250:4800:fea:f9be:b1ab:4fd5:118e", 8000, connectCallback); Enabled = false; } catch (Exception e0) { MessageBox.Show("conn" + e0); } } else { //This means we're trying to disconnect. transferClient.Close(); transferClient = null; } }
/// <summary> /// Performs actual upload by streaming entire (zipped) file. /// </summary> /// <param name="token"></param> /// <param name="transferFileName"></param> /// <returns></returns> private string Upload(string token, string transferFileName) { using (TransferClient transfer = new TransferClient("BasicHttpBinding_ITransfer")) { using (FileStream stream = File.OpenRead(transferFileName)) { schemas.commanigy.com.UploadMeta meta = new schemas.commanigy.com.UploadMeta(); meta.Code = token; transfer.Upload(meta, stream); stream.Close(); } transfer.Close(); } return token; }
private string SharePackage(string token) { string[] fileTokens = files.ToArray(); for (int i = 0; i < fileTokens.Length; i++) { fileTokens[i] = Path.GetFileName(fileTokens[i]); } using (TransferClient transfer = new TransferClient("BasicHttpBinding_ITransfer")) { string result = transfer.SharePackage(options["SenderMail"], new string[0], token, fileTokens, options["Subject"], options["Body"]); transfer.Close(); return result; } }