private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (gotClients) { AASclient.Close(); ADSclient.Close(); APSclient.Close(); writeToLog(); } contWatcher = null; customWatcher = null; }
private void customRunButton_Click(object sender, EventArgs e) { bool valid = true; byte[] cPtArray = null; object[] values = new object[5]; progBar.Value = 0; progBar.Maximum = 2; customResultBox.ResetText(); string invalidMsg = "Please select a valid Label, Location, Parameter and CSV file"; string invalidCpt = "Invalid Input"; string cLabel = customTSlabelBox.Text; string cLoc = customTSlocBox.Text; string cParam = customTSparamBox.Text; bool newTS = createTScheckBox.Checked; int labLength = cLabel.Length; int locLength = cLoc.Length; int paramLength = cParam.Length; using (Stream inFile = openFileDialog1.OpenFile()) { if (inFile != null) { long allByte = inFile.Length; cPtArray = new Byte[allByte]; inFile.Read(cPtArray, 0, (int)allByte); } else valid = false; } System.Diagnostics.Trace.WriteLine(locLength); if ((cLabel.CompareTo(defLabel) == 0) || (cLoc.CompareTo(defLoc) == 0) || (cParam.CompareTo(defParam) == 0) || (labLength == 0) || (locLength == 0) || (paramLength == 0)) valid = false; if (valid) { customDelButton.Enabled = false; values[0] = cLabel; values[1] = cLoc; values[2] = cParam; values[3] = newTS; values[4] = cPtArray; customWatcher = new CustomAppendWatcher(this, values); customWatcher.svcHost = textBoxHost.Text; customWatcher.doAppend(); } else { MessageBox.Show(this, invalidMsg, invalidCpt); } }