private void button1_Click(object sender, EventArgs eventArgs) { textBoxError.Text = ""; ResultBox.Text = "Starting...\r\n"; if (comboBoxNumberOfExample.SelectedIndex == -1) { textBoxError.Text = "Method and example aren't defined"; ResultBox.Text += "Error: " + textBoxError.Text + "\r\n"; return; } try { Convert.ToDouble(textBoxA.Text); Convert.ToDouble(textBoxB.Text); Convert.ToDouble(textBoxE.Text); } catch (FormatException exc) { textBoxError.Text = "Error in a, b or E values"; ResultBox.Text += "Error: " + textBoxError.Text + "\r\n" + exc; return; } double a = Convert.ToDouble(textBoxA.Text); double b = Convert.ToDouble(textBoxB.Text); double e = Convert.ToDouble(textBoxE.Text); double result; switch (comboBoxNumberOfExample.SelectedIndex) { case 0: if (!checkErrorsInInterval(a, b, example24Function)) { return; } result = methodOfChords(a, b, e, example24Function, example24FunctionDerivative1, example24FunctionDerivative2); break; case 1: if (!checkErrorsInInterval(a, b, example16Function)) { return; } result = methodOfSimpleIterations(a, b, e, example16Function, example16FunctionDerivative1); break; case 2: if (!checkErrorsInInterval(a, b, example16Function)) { return; } result = methodOfNewtonMod(a, b, e, example16Function, example16FunctionDerivative1, example16FunctionDerivative2); break; default: throw new Exception("Incorrect method!"); } ResultBox.AppendText("Result: " + result.ToString()); MessageBox.Show("Success!\r\nResult: " + result.ToString()); return; }
private double[] methodLobachevskiy(double eps, double[] a) { double criterion; int numberOfIteration = 0; while (true) { ResultBox.AppendText(numberOfIteration + " iteration...\r\n"); double[] b = methodLobachevskiyIteration(a); displayArray(b, "Coefficients"); if (checkOverflow(b)) { double[] x = calculateRoots(a, numberOfIteration); displayArray(x, "Roots"); return(x); } numberOfIteration++; criterion = methodLobachevskiyCriterion(a, b); ResultBox.AppendText("Criterion: " + criterion + "; epsilon = " + eps + "\r\n"); if (criterion < eps) { double[] x = calculateRoots(b, numberOfIteration); displayArray(x, "Roots"); return(x); } a = b; } }
private double methodOfSimpleIterations(double a, double b, double e, function f, function fder1) { if (a > b) { double c = a; a = b; b = c; } double j1 = fder1(a); double j2 = fder1(b); double lambda = 2 / (j1 + j2); double q = (j2 - j1) / (j2 + j1); ResultBox.AppendText("alpha = " + j1 + "; gamma = " + j2 + "; lambda = " + lambda + "; q = " + q + "\r\n"); double xn1 = a, xn2; int n = 1; while (true) { xn2 = xn1 - lambda * f(xn1); ResultBox.AppendText(n.ToString() + " iteration. Root: " + xn2.ToString() + "\r\n"); if (Math.Abs(xn2 - xn1) <= ((1 - q) / q) * e) { return(xn2); } n++; if (n > 2000) { ResultBox.AppendText("The iteration number became more than 2000. Overflow!\r\nAborting...\r\n"); return(xn2); } xn1 = xn2; } }
private void ResultFormLoad(object sender, EventArgs e) { foreach (var guid in _missingGuids) { ResultBox.AppendText(guid + "," + Environment.NewLine); } }
private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e) { Dispatcher.BeginInvoke(new Action(delegate { ResultBox.AppendText(e.Data); ResultBox.AppendText(Environment.NewLine); ResultBox.ScrollToEnd(); })); }
private double[] calculateRoots(double[] b, int numberOfIteration) { double[] x = new double[b.Length - 1]; for (int i = 1; i < b.Length; i++) { x[i - 1] = Math.Pow(((b[b.Length - 1 - i]) / (b[b.Length - i])), 1 / (Math.Pow(2, numberOfIteration))); ResultBox.AppendText(i + ") root is " + x[i - 1].ToString() + "\r\n"); } return(x); }
private void B4_Click(object sender, EventArgs e) { if (OperationsIsClear()) { ResultBox.AppendText("4"); A = Convert.ToDouble(ResultBox.Text.Replace(".", ",")); } else { ResultBox.AppendText("4"); B = Convert.ToDouble(ResultBox.Text.Replace(".", ",")); } }
private void displayArray(double[] a, string arrayOf) { ResultBox.SelectionColor = Color.Blue; ResultBox.AppendText(arrayOf + " :\r\n"); ResultBox.SelectionColor = Color.Black; ResultBox.AppendText("[ "); for (int i = a.Length - 1; i >= 0; i--) { ResultBox.SelectionColor = Color.BlueViolet; ResultBox.AppendText(a[i].ToString()); ResultBox.SelectionColor = Color.Black; if (i != 0) { ResultBox.AppendText("; "); } } ResultBox.AppendText(" ]\r\n"); }
private void append(string str) { if (!isEntering) { isEntering = true; ResultBox.Text = ""; } if (str == "." && ResultBox.Text.Contains(".")) { return; } if (str == "0" && ResultBox.Text == "0") { return; } ResultBox.AppendText(str); }
private void ParseButton_Click(object sender, EventArgs e) { LoadXML(); if (!string.IsNullOrEmpty(filename_)) { //MessageBox.Show(filename_); List <String> filedata = new List <String>(File.ReadAllLines(filename_)); foreach (String dataLine in filedata) { string recordType_ = dataLine.Substring(6, 2); ParseData(dataLine, getNodeType(recordType_)); ResultBox.AppendText(Environment.NewLine); //MessageBox.Show(recordType_); } } else { MessageBox.Show("please select a file first"); } }
//Запятая private void BDot_Click(object sender, EventArgs e) { if (OperationsIsClear()) { if (Dot == false) { ResultBox.AppendText(","); Dot = true; } } else { if (Dot == true) { ResultBox.AppendText(","); Dot = false; } } }
public void ParseData(string DataString, XmlNode nodeType) { int cursor_ = 0; ResultBox.AppendText("-------[" + nodeType.Name.ToString() + "]-------" + Environment.NewLine); ResultBox.AppendText("--------------------------------------------------------------------" + Environment.NewLine); foreach (XmlNode xn in nodeType) { int length_ = Int32.Parse(xn.Attributes["length"].Value); int string_length = DataString.Length; if (cursor_ < string_length) { if (!string.IsNullOrEmpty(DataString.Substring(cursor_, length_))) { String _dataLine = xn.Name.ToString() + " = " + DataString.Substring(cursor_, length_); ResultBox.AppendText(_dataLine + Environment.NewLine + Environment.NewLine); //MessageBox.Show(_dataLine); } } cursor_ = cursor_ + length_; } ResultBox.AppendText(Environment.NewLine); }
private double getRadiusOverWesterfieldMethod(double [] a) { if (a[a.Length - 1] != 1) { a = shortArrayInNumber(a, 0, a[a.Length - 1]); } double max1 = 0, max2 = 0, current; for (int t = 1; t < a.Length; t++) { current = Math.Pow(Math.Abs(a[a.Length - 1 - t]), (1 / Convert.ToDouble(t))); ResultBox.AppendText("For t = " + t.ToString() + ", iteration = " + current.ToString() + "\r\n"); if (t == 1) { max1 = current; } else if (t == 2) { max2 = current; } else { if (current > max1) { max1 = current; } else { if (current > max2) { max2 = current; } } } } return(max1 + max2); }
private double methodOfChords(double a, double b, double e, function f, function fder1, function fder2) { if (f(a) * fder2(a) < 0) { double c = a; a = b; b = c; } int n = 1; double b1; while (true) { b1 = methodOfChordsIteration(a, b, f); ResultBox.AppendText("b" + n.ToString() + " = " + b1.ToString() + " (a = " + a.ToString() + ")\r\n"); ResultBox.AppendText("root: " + b1.ToString() + ", iteration №" + n.ToString() + "\r\n"); if (methodOfChordsCriterion(b, b1, e, f, fder1)) { return(b1); } b = b1; n++; } }
private double methodOfNewtonMod(double a, double b, double e, function f, function fder1, function fder2) { int n = 0; if (f(a) * fder2(a) < 0) { double c = a; a = b; b = c; } double a1, a0 = a; while (true) { a1 = methodOfNewtonModIteartion(a, a0, f, fder1); ResultBox.AppendText("a" + n.ToString() + " = " + a1.ToString() + " (b = " + b.ToString() + ")\r\n"); if (methodOfChordsCriterion(a, a1, e, f, fder1)) { return(a1); } a = a1; n++; } }
private void openToolStripMenuItem_Click_1(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog { InitialDirectory = @"C:\", Title = "Browse Text Files", CheckFileExists = true, CheckPathExists = true, DefaultExt = "txt", Filter = "txt files (*.txt)|*.txt", FilterIndex = 2, RestoreDirectory = true, ReadOnlyChecked = true, ShowReadOnly = true }; if (openFileDialog1.ShowDialog() == DialogResult.OK) { ResultBox.AppendText("It works!"); } }
// main function private void SearchButton_Click(object sender, EventArgs e) { // init variables int start, finish; String AccountInput = AccountBox.GetItemText(AccountBox.SelectedItem); String ExploreInput = ExploreBox.GetItemText(ExploreBox.SelectedItem); System.Text.RegularExpressions.Regex Input2 = new System.Text.RegularExpressions.Regex(@"[A-Z]"); // scuffed ordinal dictionary Dictionary <int, String> ordinal = new Dictionary <int, String>() { { 0, "th" }, { 1, "st" }, { 2, "nd" }, { 3, "rd" }, { 4, "th" }, { 5, "th" }, { 6, "th" }, { 7, "th" }, { 8, "th" }, { 9, "th" }, { 10, "th" }, { 11, "th" }, { 12, "th" }, { 13, "th" }, { 14, "th" }, { 15, "th" }, { 16, "th" }, { 17, "th" }, { 18, "th" }, { 19, "th" }, { 20, "th" }, { 21, "th" }, { 22, "th" }, { 23, "th" }, { 24, "th" } }; //Reset Graph Color foreach (String v in g.vertices) { graph.FindNode(v).Attr.FillColor = Microsoft.Msagl.Drawing.Color.White; } //case no account input if (!Input2.IsMatch(AccountInput)) { ResultBox.Text = "Invalid Input 2 . . ."; return; } ResultBox.Clear(); //case same input if (AccountInput == ExploreInput) { ResultBox.AppendText("Please input a different node . . .\n"); } //Explore Friend if ((BFSRadio.Checked || DFSRadio.Checked) && Input2.IsMatch(ExploreInput) && AccountInput != ExploreInput) { // get path from BFS or DFS Algo List <String> pathToExplore; if (BFSRadio.Checked) { pathToExplore = g.ExploreBFS(AccountInput, ExploreInput); } else { pathToExplore = g.ExploreDFS(AccountInput, ExploreInput); } //Bold first line, it's stupid i know start = ResultBox.Text.Length; ResultBox.AppendText("Explore Path From " + AccountInput + " To " + ExploreInput + (BFSRadio.Checked ? " (BFS) " : " (DFS) ") + "\n"); finish = ResultBox.Text.Length - start; ResultBox.Select(start, finish); ResultBox.SelectionFont = new Font(ResultBox.Font, FontStyle.Bold); //case not found if (pathToExplore[0] == "-1") { ResultBox.AppendText("Tidak ada jalur koneksi yang tersedia.\nAnda harus memulai koneksi baru itu sendiri.\n"); } //case found else { //print each node and color it foreach (String path in pathToExplore) { if (path == pathToExplore.Last()) { ResultBox.AppendText(path + "\n"); graph.FindNode(path).Attr.FillColor = Microsoft.Msagl.Drawing.Color.LightPink; } else { ResultBox.AppendText(path + " -> "); graph.FindNode(path).Attr.FillColor = Microsoft.Msagl.Drawing.Color.MistyRose; } } //print degree ResultBox.AppendText((pathToExplore.Count() - 2) + ordinal[pathToExplore.Count() - 2] + " Degree Connection\n"); } ResultBox.AppendText("\n"); } //Friend Recommendation List <List <String> > firstDegreeFriend = g.FriendRecBFS(AccountInput); //Bold first line, again, it's stupid start = ResultBox.Text.Length; ResultBox.AppendText("Friend Recommendation For " + AccountInput + " :\n"); finish = ResultBox.Text.Length - start; ResultBox.Select(start, finish); ResultBox.SelectionFont = new Font(ResultBox.Font, FontStyle.Bold); ResultBox.Select(ResultBox.Text.Length, 0); //Print foreach (List <String> list in firstDegreeFriend) { foreach (String v in list) { if (v == list.First()) { ResultBox.SelectionBullet = true; ResultBox.AppendText("Friend " + v + "\n"); ResultBox.SelectionBullet = false; ResultBox.AppendText((list.Count() - 1) + " Mutual Friend : "); } else { ResultBox.AppendText(v + " "); } } ResultBox.AppendText("\n"); } //Color First Node graph.FindNode(AccountInput).Attr.FillColor = Microsoft.Msagl.Drawing.Color.LightCyan; //Update Graph gViewer1.Graph = graph; }
private void button1_Click(object sender, EventArgs e) { textBoxError.Text = ""; ResultBox.Text = "Starting...\r\n"; try { Convert.ToDouble(tb7.Text); Convert.ToDouble(tb6.Text); Convert.ToDouble(tb5.Text); Convert.ToDouble(tb4.Text); Convert.ToDouble(tb3.Text); Convert.ToDouble(tb2.Text); Convert.ToDouble(tb1.Text); Convert.ToDouble(tb0.Text); Convert.ToDouble(textBoxE.Text); Convert.ToInt32(textBoxCancel.Text); } catch (FormatException exc) { textBoxError.Text = "The coefficient values error!"; ResultBox.Text += "Error: " + textBoxError.Text + "\r\n" + exc; return; } double [] a = new double[8]; int n = 5; a[7] = Convert.ToDouble(tb7.Text); a[6] = Convert.ToDouble(tb6.Text); a[5] = Convert.ToDouble(tb5.Text); a[4] = Convert.ToDouble(tb4.Text); a[3] = Convert.ToDouble(tb3.Text); a[2] = Convert.ToDouble(tb2.Text); a[1] = Convert.ToDouble(tb1.Text); a[0] = Convert.ToDouble(tb0.Text); for (int i = 7; i >= 0; i--) { if (a[i] != 0) { if (i == 0) { textBoxError.Text = "Incorrect equation!"; ResultBox.Text += "Error: " + textBoxError.Text + "\r\n"; return; } n = i; break; } } if (Convert.ToInt32(textBoxCancel.Text) < 0) { textBoxError.Text = "The cancel value error!"; ResultBox.Text += "Error: " + textBoxError.Text + "\r\n"; return; } if (Convert.ToDouble(textBoxE.Text) < 0) { textBoxError.Text = "The epsilon value error!"; ResultBox.Text += "Error: " + textBoxError.Text + "\r\n"; return; } double[] aNew = new double[n + 1]; for (int i = 0; i < (n + 1); i++) { aNew[i] = a[i]; } ResultBox.AppendText("Extent of equation is " + n.ToString() + "\r\n"); displayArray(aNew, "Coefficients"); int minCoefWhenWeNeedToShortCoefs = 30; aNew = shortArrayInNumber(aNew, minCoefWhenWeNeedToShortCoefs, getMinCoefAbs(a)); displayTitle("Finding roots with Lobachevskiy method"); double[] x = methodLobachevskiy(Convert.ToDouble(textBoxE.Text), aNew); displayTitle("Checking signs of roots"); int cancel = Convert.ToInt32(textBoxCancel.Text); ResultBox.AppendText("Cancel is " + cancel + "\r\n"); x = getSignedRoots(x, aNew, cancel); displayArray(x, "Proper roots (NaN appears when it's impossible to define sign)"); displayTitle("Simple method of finding boundaries"); double R = calculateBigRadius(aNew); double r = calculateSmallRadius(aNew); displayBoundaries(R, r); string boundariesResult1 = "Range of positive numbers: (" + r.ToString() + "; " + R.ToString() + ")\r\nRange of negative numbers: (-" + R.ToString() + "; -" + r.ToString() + ")\r\n"; ResultBox.AppendText(boundariesResult1); displayTitle("Westerfield method of finding boundaries"); R = getRadiusOverWesterfieldMethod(aNew); r = getRadiusOverWesterfieldMethod(inverseArray(aNew)); displayBoundaries(R, r); string boundariesResult2 = "Range of positive numbers: (0; " + R.ToString() + ")\r\nRange of negative numbers: (-" + r.ToString() + "; 0)\r\n"; ResultBox.AppendText(boundariesResult2); ResultBox.AppendText("Sending results..."); MessageBox.Show("Success!\r\nRoots: " + getPrintedArray(x) + "\r\nI method:\r\n" + boundariesResult1 + "II method:\r\n" + boundariesResult2); }
private void displayTitle(string title) { ResultBox.SelectionColor = Color.Magenta; ResultBox.AppendText(title + "\r\n"); ResultBox.SelectionColor = Color.Black; }
private void displayBoundaries(double R, double r) { ResultBox.AppendText("Upper boundary (R) = " + R + "\r\nLower boundary (r) = " + r + "\r\n"); }
private void TextWindow_OnLoaded(object sender, RoutedEventArgs e) { ResultBox.AppendText(TextContent); }
private void InstallLicenses_DoWork(object sender, DoWorkEventArgs e) { Dispatcher.BeginInvoke(new Action(delegate { Tab4Process.IsIndeterminate = true; TaskProgressBar.ProgressState = TaskbarItemProgressState.Indeterminate; })).Wait(); OTP.OfficeConfiguration office = new OTP.OfficeConfiguration(); Process p = new Process(); p.StartInfo.FileName = "cscript"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.CreateNoWindow = true; string[] ar = (string[])e.Argument; if (ar[0] == "2") { XElement loadxml = XElement.Load(office.InstallPath + "\\root\\Licenses16\\c2rpridslicensefiles_auto.xml"); IEnumerable <XElement> MatchElements = from el in loadxml.Elements("ProductReleaseId") select el; char[] separator = { ',' }; string[] Licenses = ar[1].Split(separator); foreach (string id in Licenses) { foreach (XElement ele in MatchElements) { if (ele.Attribute("id").Value == id) { foreach (XElement elements in ele.Elements()) { foreach (XElement element in elements.Element("Files").Elements()) { p.StartInfo.Arguments = "//Nologo \"" + office.InstallPath + "\\Office16\\ospp.vbs\" /inslic:\"" + office.InstallPath + "\\root\\Licenses16\\" + element.Attribute("name").Value + "\""; p.Start(); string sOutput = p.StandardOutput.ReadToEnd(); Dispatcher.BeginInvoke(new Action(delegate { ResultBox.AppendText(sOutput); ResultBox.ScrollToEnd(); })); } } } } } return; } string[] files = Directory.GetFiles(ar[1], "*.xrm-ms");//获取指定路径的证书文件 if (files.Length == 0) { e.Result = Find("ToastLicensesInstallError"); return; } if (ar[0] == "0")//是否指定 common 证书 { string[] commonfiles = Directory.GetFiles(ar[3], "*.xrm-ms"); foreach (string s in commonfiles) { FileInfo fi = new FileInfo(s); p.StartInfo.Arguments = "//Nologo \"" + office.InstallPath + "\\Office16\\ospp.vbs\" /inslic:\"" + ar[3] + "\\" + fi.Name + "\""; p.Start(); string sOutput = p.StandardOutput.ReadToEnd(); Dispatcher.BeginInvoke(new Action(delegate { ResultBox.AppendText(sOutput); ResultBox.ScrollToEnd(); })); } } foreach (string s in files)//安装指定路径的证书文件 { FileInfo fi = new FileInfo(s); p.StartInfo.Arguments = "//Nologo \"" + office.InstallPath + "\\Office16\\ospp.vbs\" /inslic:\"" + ar[1] + "\\" + fi.Name + "\""; p.Start(); string sOutput = p.StandardOutput.ReadToEnd(); Dispatcher.BeginInvoke(new Action(delegate { ResultBox.AppendText(sOutput); ResultBox.ScrollToEnd(); })); } if (ar[0] == "0")//安装 Key { if (ar[2] != string.Empty) { p.StartInfo.Arguments = "//Nologo \"" + office.InstallPath + "\\Office16\\ospp.vbs\" /inpkey:" + ar[2]; p.Start(); string Output = p.StandardOutput.ReadToEnd(); Dispatcher.BeginInvoke(new Action(delegate { ResultBox.AppendText(Output); ResultBox.AppendText(Environment.NewLine); ResultBox.ScrollToEnd(); })).Wait(); } } }
private void InstallLicenses_DoWork(object sender, DoWorkEventArgs e) { Process p = new Process(); p.StartInfo.FileName = "cscript"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.CreateNoWindow = true; string[] ar = (string[])e.Argument; if (ar[0] == "2") { XElement loadxml = XElement.Load(OfficeInstallPath + "\\root\\Licenses16\\c2rpridslicensefiles_auto.xml"); IEnumerable <XElement> MatchElements = from el in loadxml.Elements("ProductReleaseId") select el; char[] separator = { ',' }; string[] Licenses = ar[1].Split(separator); foreach (string id in Licenses) { foreach (XElement ele in MatchElements) { if (ele.Attribute("id").Value == id) { foreach (XElement elements in ele.Elements()) { foreach (XElement element in elements.Element("Files").Elements()) { if (File.Exists("files\\activate\\ospp_" + Find("Culture") + ".vbs")) { p.StartInfo.Arguments = "//Nologo files\\activate\\ospp_" + Find("Culture") + ".vbs /inslic:\"" + OfficeInstallPath + "\\root\\Licenses16\\" + element.Attribute("name").Value + "\""; } else { p.StartInfo.Arguments = "//Nologo files\\activate\\ospp.vbs /inslic:\"" + OfficeInstallPath + "\\root\\Licenses16\\" + element.Attribute("name").Value + "\""; } p.Start(); string sOutput = p.StandardOutput.ReadToEnd(); Dispatcher.BeginInvoke(new Action(delegate { ResultBox.AppendText(sOutput); ResultBox.ScrollToEnd(); })); } } } } } return; } else if (ar[0] == "0") { try //删除多余文件,避免出错 { DirectoryInfo di = new DirectoryInfo(a + "licenses\\"); di.Delete(true); } catch { } ZipFile.ExtractToDirectory("files\\activate\\licenses.data", a); } string[] files = Directory.GetFiles(ar[1], "*.xrm-ms");//获取指定路径的证书文件 if (files.Length == 0) { e.Result = Find("ToastLicensesInstallError"); return; } if (ar[0] == "0")//是否指定 common 证书 { string[] commonfiles = Directory.GetFiles(ar[3], "*.xrm-ms"); foreach (string s in commonfiles) { FileInfo fi = new FileInfo(s); if (File.Exists("files\\activate\\ospp_" + Find("Culture") + ".vbs")) { p.StartInfo.Arguments = "//Nologo files\\activate\\ospp_" + Find("Culture") + ".vbs /inslic:\"" + ar[3] + "\\" + fi.Name + "\""; } else { p.StartInfo.Arguments = "//Nologo files\\activate\\ospp.vbs /inslic:\"" + ar[3] + "\\" + fi.Name + "\""; } p.Start(); string sOutput = p.StandardOutput.ReadToEnd(); Dispatcher.BeginInvoke(new Action(delegate { ResultBox.AppendText(sOutput); ResultBox.ScrollToEnd(); })); } } foreach (string s in files)//安装指定路径的证书文件 { FileInfo fi = new FileInfo(s); if (File.Exists("files\\activate\\ospp_" + Find("Culture") + ".vbs")) { p.StartInfo.Arguments = "//Nologo files\\activate\\ospp_" + Find("Culture") + ".vbs /inslic:\"" + ar[1] + "\\" + fi.Name + "\""; } else { p.StartInfo.Arguments = "//Nologo files\\activate\\ospp.vbs /inslic:\"" + ar[1] + "\\" + fi.Name + "\""; } p.Start(); string sOutput = p.StandardOutput.ReadToEnd(); Dispatcher.BeginInvoke(new Action(delegate { ResultBox.AppendText(sOutput); ResultBox.ScrollToEnd(); })); } if (ar[0] == "0")//安装 Key { if (ar[2] != string.Empty) { if (File.Exists("files\\activate\\ospp_" + Find("Culture") + ".vbs")) { p.StartInfo.Arguments = "//Nologo files\\activate\\ospp_" + Find("Culture") + ".vbs /inpkey:" + ar[2]; } else { p.StartInfo.Arguments = "//Nologo files\\activate\\ospp.vbs /inpkey:" + ar[2]; } p.Start(); string Output = p.StandardOutput.ReadToEnd(); Dispatcher.BeginInvoke(new Action(delegate { ResultBox.AppendText(Output); ResultBox.AppendText(Environment.NewLine); ResultBox.ScrollToEnd(); })).Wait(); } } }