private void ButtonRegister_Click(object sender, RoutedEventArgs e) { Window1 window1 = new Window1(); window1.ShowDialog(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { ResetAll(); status.Text = "Working..."; string inFileName = Path.Text; FileStream inFile = new FileStream(inFileName, FileMode.Open); try { int ss = (int)(inFile.Length / int.Parse(CountsThreads.Text)); data = new byte[inFile.Length]; inFile.Read(data, 0, data.Length); for (int i = 0; i < int.Parse(CountsThreads.Text); i++) { listBytes.Add(data.Skip(ss * i).Take(ss).ToArray()); } listBytes.Add(data.Skip(ss * int.Parse(CountsThreads.Text)).Take(data.Length - ss).ToArray()); Window1 window1 = new Window1(); window1.ShowDialog(); var stopwatch = new Stopwatch(); stopwatch.Start(); List <Task> listThread = new List <Task>(); for (int i = 0; i < listBytes.Count; i++) { listThread.Add(new Task(() => { CompressEvent(i); })); listThread[i].Start(); } Task.WaitAll(listThread.ToArray()); string pth = inFileName.Substring(0, inFileName.LastIndexOf('\\') + 1) + window1.Filename; using (FileStream fileStreamResult = new FileStream(pth, FileMode.Create)) { for (int i = 0; i < listBytes.Count; i++) { fileStreamResult.Write(listZipBytes[i], 0, listZipBytes[i].Length); } } //view stopwatch.Stop(); times.Text = stopwatch.ElapsedMilliseconds.ToString() + "ms"; status.Text = "Completed!!"; test.Text = "Infile Bytes count:" + inFile.Length.ToString(); test1.Text = "Thread1 : " + listBytes[0].Length.ToString(); if (listBytes.Count > 1) { test2.Text = "Thread2 : " + listBytes[1].Length.ToString(); } if (listBytes.Count > 2) { test3.Text = "Thread3 : " + listBytes[2].Length.ToString(); } if (listBytes.Count > 3) { test4.Text = "Thread4 : " + listBytes[3].Length.ToString(); } if (listBytes.Count > 4) { test5.Text = "Thread5 : " + listBytes[4].Length.ToString(); } inFile.Dispose(); listBytes.Clear(); listZipBytes.Clear(); data = null; } catch (Exception error) { status.Text = error.Message; } inFile.Dispose(); }
private void MenuItem_Click(object sender, RoutedEventArgs e) { Window1 window = new Window1(); window.ShowDialog(); }
private void Button_Click(object sender, RoutedEventArgs e) { Window1 NewWindow = new Window1(this); NewWindow.ShowDialog(); }