private void btnOpenFile_Click(object sender, RoutedEventArgs e) { string[] commandLineArgsTab = Environment.GetCommandLineArgs(); // index 0 - system information with process path .exe // index 1 - file name filled in project properties FileUploadClass fileUpload = new FileUploadClass(commandLineArgsTab[1]); try { listLabel1 = fileUpload.uploadData("1"); listLabel2 = fileUpload.uploadData("2"); } catch (Exception ex) { Console.WriteLine(ex.ToString()); Environment.Exit(0); } finally { textBox_Count.Text = String.Format("{0}", listLabel1.Count + listLabel2.Count); textBox_Label1_Count.Text = String.Format("{0}", listLabel1.Count); textBox_Label2_Count.Text = String.Format("{0}", listLabel2.Count); foreach (double element in listLabel1) { textBox_Label1.Text += element.ToString() + "\n"; } foreach (double element in listLabel2) { textBox_Label2.Text += element.ToString() + "\n"; } /* Niezaimplementowany backgroud worker * worker.DoWork += worker_DoWork; * worker.RunWorkerCompleted += worker_RunWorkerCompleted; * * worker.RunWorkerAsync(); */ // Odblokowanie przycisku uruchamiającego przeliczanie. button_loadData.IsEnabled = false; button_Count.IsEnabled = true; button_histogram_1.IsEnabled = true; button_histogram_2.IsEnabled = true; } }
private void button_load_iris_Click(object sender, RoutedEventArgs e) { string[] commandLineArgsTab = Environment.GetCommandLineArgs(); // index 0 - system information with process path .exe // index 2 - file name filled in project properties -irisy // Dla Irysów są 3 klasy i 4 cechy FileUploadClass fileUpload = new FileUploadClass(commandLineArgsTab[2]); try { seSepalLength = fileUpload.uploadIrisData("se", 0); // setosa sepal length seSepalWidth = fileUpload.uploadIrisData("se", 1); // setosa sepal width sePetalLendth = fileUpload.uploadIrisData("se", 2); // setosa petal length sePetalWidth = fileUpload.uploadIrisData("se", 3); // setosa petal width veSepalLength = fileUpload.uploadIrisData("ve", 0); // versicolor sepal length veSepalWidth = fileUpload.uploadIrisData("ve", 1); // versicolor sepal width vePetalLendth = fileUpload.uploadIrisData("ve", 2); // versicolor petal length vePetalWidth = fileUpload.uploadIrisData("ve", 3); // versicolor petal width viSepalLength = fileUpload.uploadIrisData("vi", 0); // virginica sepal length viSepalWidth = fileUpload.uploadIrisData("vi", 1); // virginica sepal width viPetalLendth = fileUpload.uploadIrisData("vi", 2); // virginica petal length viPetalWidth = fileUpload.uploadIrisData("vi", 3); // virginica petal width } catch (Exception ex) { Console.WriteLine(ex.ToString()); } finally { textBox_Count_Iris.Text = String.Format("{0}", seSepalLength.Count + seSepalWidth.Count + sePetalLendth.Count + sePetalWidth.Count + veSepalLength.Count + veSepalWidth.Count + vePetalLendth.Count + vePetalWidth.Count + viSepalLength.Count + viSepalWidth.Count + viPetalLendth.Count + viPetalWidth.Count); textBox_setosa_Count.Text = String.Format("{0}", seSepalLength.Count + seSepalWidth.Count + sePetalLendth.Count + sePetalWidth.Count); textBox_versicolor_Count.Text = String.Format("{0}", veSepalLength.Count + veSepalWidth.Count + vePetalLendth.Count + vePetalWidth.Count); textBox_virginica_Count.Text = String.Format("{0}", viSepalLength.Count + viSepalWidth.Count + viPetalLendth.Count + viPetalWidth.Count); #region Wypełnianie texBoxów /***** SETOSA ****/ seSepalLength.Sort(); foreach (double element in seSepalLength) { textBox_se_0.Text += element.ToString() + "\n"; } seSepalWidth.Sort(); foreach (double element in seSepalWidth) { textBox_se_1.Text += element.ToString() + "\n"; } sePetalLendth.Sort(); foreach (double element in sePetalLendth) { textBox_se_2.Text += element.ToString() + "\n"; } sePetalWidth.Sort(); foreach (double element in sePetalWidth) { textBox_se_3.Text += element.ToString() + "\n"; } /**** VERSICOLOR ****/ veSepalLength.Sort(); foreach (double element in veSepalLength) { textBox_ve_0.Text += element.ToString() + "\n"; } veSepalWidth.Sort(); foreach (double element in veSepalWidth) { textBox_ve_1.Text += element.ToString() + "\n"; } vePetalLendth.Sort(); foreach (double element in vePetalLendth) { textBox_ve_2.Text += element.ToString() + "\n"; } vePetalWidth.Sort(); foreach (double element in vePetalWidth) { textBox_ve_3.Text += element.ToString() + "\n"; } /**** VIRGINICA ****/ viSepalLength.Sort(); foreach (double element in viSepalLength) { textBox_vi_0.Text += element.ToString() + "\n"; } viSepalWidth.Sort(); foreach (double element in viSepalWidth) { textBox_vi_1.Text += element.ToString() + "\n"; } viPetalLendth.Sort(); foreach (double element in viPetalLendth) { textBox_vi_2.Text += element.ToString() + "\n"; } viPetalWidth.Sort(); foreach (double element in viPetalWidth) { textBox_vi_3.Text += element.ToString() + "\n"; } #endregion button_load_iris.IsEnabled = false; button_histogram_iris_0.IsEnabled = true; button_histogram_iris_1.IsEnabled = true; button_histogram_iris_2.IsEnabled = true; button_histogram_iris_3.IsEnabled = true; button_iris_Count.IsEnabled = true; } }