private void buttonScan_Click(object sender, System.EventArgs e) { if (openFileDialog1.ShowDialog(this) == DialogResult.OK) { string filename = openFileDialog1.FileName; textBoxReport.AppendText("Scanning file: " + filename); textBoxReport.AppendText("\r\n"); try { org.ebml.FileDataSource dataSource = new org.ebml.FileDataSource(filename); org.ebml.matroska.MatroskaFile mkFile = new org.ebml.matroska.MatroskaFile(dataSource); mkFile.setScanFirstCluster(false); mkFile.readFile(); string report = mkFile.getReport(); report = report.Replace("\n", "\r\n"); //report = report.Replace("\t", " "); textBoxReport.AppendText(report); } catch (Exception ex) { textBoxReport.AppendText("\r\n"); textBoxReport.AppendText(ex.ToString()); } } }
/// <summary> /// 记录 /// </summary> /// <param name="txtInfo"></param> /// <param name="info"></param> public static void showInfo(string info) { System.Windows.Forms.TextBox txtInfo = mainForm.textBox13; txtInfo.AppendText(info); txtInfo.AppendText(Environment.NewLine); txtInfo.ScrollToCaret(); }
private void UpdateTextBox(string message, bool newSection = false, bool error = false) { if (textBox == null) { return; } textBox.BeginInvoke((MethodInvoker) delegate { if (newSection) { textBox.AppendText("-------------------------------" + Environment.NewLine); } if (error) { textBox.AppendText("===== ВНИМАНИЕ! ОШИБКА! =====" + Environment.NewLine); } textBox.AppendText(DateTime.Now.ToString("HH:mm:ss") + ": " + message + Environment.NewLine); }); LoggingSystem.LogMessageToFile(message); }
void DisconnectClick(object sender, System.EventArgs e) { try { formstest.MainClass.Variables.one.ReaderClose(); MainTextBox.AppendText("Closing Reader One \n"); } catch { MessageBox.Show("Unable to Close Reader One"); } //if reader2 is connected... if (checkBox5.Checked == true) { try { formstest.MainClass.Variables.two.ReaderClose(); MainTextBox.AppendText("Closing Reader Two \n"); } catch { MessageBox.Show("Unable to Close Reader Two"); } } }
private void evaluate_click(object sender, System.EventArgs e) { try { Bindings bindings = new Bindings().bind("E", textBox1.Text + '.'); session.connect(); /* This will connect if neccessary. */ QueryAnswer answer = session.executeQuery("evaluate(E,R)", bindings); PBTerm result = answer.getValue("R"); if (result != null) { textBox2.AppendText(textBox1.Text + " = " + result + Environment.NewLine); textBox1.Clear(); } else { textBox2.AppendText("Error: " + answer.getError() + Environment.NewLine); } } catch (System.Exception ex) { textBox2.AppendText("Error when querying Prolog Server: " + ex.Message + Environment.NewLine); Console.Error.WriteLine(ex); Console.Error.Write(ex.StackTrace); Console.Error.Flush(); } }
public override void Write(string value) { if (_textBox.IsHandleCreated) { _textBox.BeginInvoke(new ThreadStart(() => _textBox.AppendText(value + " "))); } }
private void AppendLog(string pAppend) { txtLog.AppendText(pAppend); txtLog.AppendText("\r\n"); txtLog.SelectionStart = txtLog.Text.Length; txtLog.ScrollToCaret(); Application.DoEvents(); }
public static void FillMemo(TextBox lb, List<string> list) { lb.Clear(); foreach(var s in list) { if (lb.Text.Length > 0) lb.AppendText(Environment.NewLine); lb.AppendText(s); } }
private void txItems_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { BoxDeco deco = e.Data.GetData(typeof(BoxDeco)) as BoxDeco; if (deco != null) { txItems.AppendText("\r\n"); txItems.AppendText(deco.ID.ToString()); } }
private void btnTempTest_Click(object sender, System.EventArgs e) { //frmMain.msg.clear(); frmMain.labStatus.Text = ""; if (lstTemp.CheckedItems.Count < 1) { frmMain.labStatus.Text = "no template be selected in list."; return; } XmlDocument xmldoc2 = getXMLTemplate(); if (xmldoc2 == null) { frmMain.labStatus.Text = "XML file is not valid."; return; } XmlNodeList nodeList = xmldoc2.SelectNodes("config/template"); //create new IPara IPara ipara = frmMain.CreateIPara(); //set filed value ipara = frmMain.CreateSampleFiled(ipara); //テンプレートごとに出力処理 txtTempTest.Text = ""; for (int loopj = 0; loopj < nodeList.Count; loopj++) { ipara.TemplateNode = nodeList[loopj]; string stitle = ""; if (nodeList[loopj].Attributes["title"] != null) { stitle = nodeList[loopj].Attributes["title"].InnerText; if (nodeList[loopj].Attributes["language"] != null) { stitle = "[" + nodeList[loopj].Attributes["language"].InnerText + "] " + nodeList[loopj].Attributes["title"].InnerText; } } txtTempTest.AppendText("##################################################\r\n"); txtTempTest.AppendText("# " + stitle + "\r\n"); txtTempTest.AppendText("##################################################\r\n"); string sFileTxt = ClassExt.CreateClsFromTempString(ipara); if (sFileTxt != null) { txtTempTest.AppendText(sFileTxt); } else { txtTempTest.AppendText(" this file is Canceled by ipara\r\n"); } } frmMain.labStatus.Text = "only the selected template is created."; }
public override void Write(string value) { if (_textBox.IsHandleCreated) { _textBox.BeginInvoke(new ThreadStart(() => { _textBox.AppendText("[" + count.ToString() + "]" + value + " "); count++; })); } }
public void log(String szMessage) { if (szMessage == "") { txtLog.AppendText("\r\n"); } else { txtLog.AppendText(System.DateTime.Now + " - " + szMessage + "\r\n"); } txtLog.SelectionStart = txtLog.Text.Length; }
/// <summary> /// Add logging event to configured control /// </summary> /// <param name="loggingEvent">The event to log</param> private void UpdateControl(LoggingEvent loggingEvent) { // There may be performance issues if the buffer gets too long // So periodically clear the buffer if (_textBox.TextLength > _maxTextLength) { _textBox.Clear(); _textBox.AppendText(string.Format("(earlier messages cleared because log length exceeded maximum of {0})\n\n", _maxTextLength)); } _textBox.AppendText(RenderLoggingEvent(loggingEvent)); }
public void PrintMatrix(TextBox tb) { for (int i = 0; i < P; i++) { for (int j = 0; j < N; j++) { tb.AppendText(A[i,j] + " "); } tb.AppendText("\n"); } for (int i = 0; i < P; i++) { tb.AppendText(B[i] + "\n"); } }
private void btnConnect_Click(object sender, System.EventArgs e) { String result; string tempstr; this.Cursor = Cursors.WaitCursor; try { if (meReaderInterface == ComInterface.enumTCPIP) { mReader.InitOnNetwork(textBox1.Text, Convert.ToInt32(PortUD.Value)); } DisplayText("\r\nConnecting to the reader...\r\n"); label2.Text = "正在连接......"; this.Cursor = Cursors.WaitCursor; result = mReader.Connect(); if (!mReader.IsConnected) { textReaderTalk.AppendText("\r\nCan't connect\r\n"); } else { if (meReaderInterface == ComInterface.enumTCPIP) { DisplayText("\r\nLogging in...\r\n"); this.Cursor = Cursors.WaitCursor; if (!mReader.Login(this.UserName.Trim(), this.Password.Trim())) //returns result synchronously { DisplayText("\r\nLogin failed! Calling Disconnect()...\r\n"); mReader.Disconnect(); label2.Text = "连接失败!"; return; } DisplayText("\r\nLogged in - OK!\r\n"); tempstr = mReader.SendReceive("set function=programmer", false).Trim(); //设置Reader为编程状态 label2.Text = "登陆成功!编程状态"; } DisplayText(result); ManageGUI(true); textReaderTalk.Visible = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } this.Cursor = Cursors.Default; }
private void Output(string text) { if (this.txtOutput.InvokeRequired) { SetTextCallback stc = new SetTextCallback(Output); this.Invoke(stc, new object[] { text }); } else { txtOutput.AppendText(text); txtOutput.AppendText("\r\n"); } }
/// <summary> /// 显示信息 /// </summary> /// <param name="txtInfo"></param> /// <param name="Info"></param> public static void ShowInfo(System.Windows.Forms.TextBox txtInfo, string Info) { string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string info = string.Empty; info = time + " :" + Info; txtInfo.BeginInvoke((MethodInvoker) delegate() { txtInfo.AppendText(info); txtInfo.AppendText(Environment.NewLine); txtInfo.ScrollToCaret(); }); }
public void printOutResult(List<string> resultStrings, TextBox textbox) { textbox.Text = ""; if (resultStrings.Count() == 0) { textbox.AppendText("No Result"); return; } foreach (string resultString in resultStrings) { textbox.AppendText(resultString + Environment.NewLine); } }
private void button1_Click(object sender, System.EventArgs e) { Win32.HiPerfTimer timer = new Win32.HiPerfTimer(); textBox1.Clear(); // Initialisierung Matrizen und Vektoren for (int i = 0; i < n; i++) { m[i] = true; // anfangs alle Knoten als unerkundet markieren d[i] = -1; // Entfernung zum Startknoten ist unendlich -1 for (int j = 0; j < n; j++) { am[i, j] = -1; // keine Verbindung zwischen Knonten i und j wm[i, j] = -1; } } // Kanten eintragen (Beispieldaten) am[0, 1] = 14; am[0, 2] = 8; am[1, 3] = 3; am[1, 4] = 5; am[2, 1] = 5; am[2, 4] = 2; am[3, 4] = 1; // Entfernung zum Startknoten ist 0 d[s] = 0; textBox1.Text = "Dimension am [ " + am.GetLowerBound(0) + " : " + am.GetUpperBound(0) + " , " + am.GetLowerBound(1) + " : " + am.GetUpperBound(1) + " ]\r\n"; timer.Start(); dijkstra(); timer.Stop(); // Ausgabe der Ergebnisse textBox1.AppendText("\r\nEntfernungen:\r\n"); for (int i = d.GetLowerBound(0); i <= d.GetUpperBound(0); i++) { textBox1.AppendText(String.Format("d({0}) = {1}\r\n", i + 1, d[i])); } textBox1.AppendText("\r\nLösungsbaum:\r\n"); for (int i = wm.GetLowerBound(0); i <= wm.GetUpperBound(0); i++) { for (int j = wm.GetLowerBound(1); j <= wm.GetUpperBound(1); j++) { if (wm[i, j] >= 0) { textBox1.AppendText(String.Format("Kante von {0} nach {1} mit Länge = {2}\r\n", i + 1, j + 1, wm[i, j])); } } } textBox1.AppendText("Ende des Algorithmus\r\n"); textBox1.AppendText(String.Format("Rechenzeit {0:F8} [ms]\r\n", timer.Duration * 1000)); }
private void btnGK1Data_Click(object sender, System.EventArgs e) { EventLog evtLog = new EventLog("Application"); txtOutput.Clear(); foreach (EventLogEntry Entry in evtLog.Entries) { if (Entry.Source.CompareTo("PSLGatekeeper1") == 0) { txtOutput.AppendText(Entry.Message.Replace("\n", "\r\n") + "\r\n" + "----------------------------------\r\n"); } } }
public bool WyswietlParametryUrzadzenia(int index, System.Windows.Forms.TextBox txtbox) { txtbox.Clear(); if (this[index] is PC) { txtbox.AppendText("Marka: " + (this[index] as PC).marka.ToString() + Environment.NewLine); txtbox.AppendText("System operacyjny: " + (this[index] as PC).system.ToString() + Environment.NewLine); txtbox.AppendText("Wartość: " + (this[index] as PC).cena_urzadzenia.ToString() + " zł" + Environment.NewLine); txtbox.AppendText("Pobór mocy: " + (this[index] as PC).moc.ToString() + " W" + Environment.NewLine); txtbox.AppendText("Waga: " + (this[index] as PC).ciezar.ToString() + " kg" + Environment.NewLine); txtbox.AppendText("Taktowanie Procesora: " + (this[index] as PC).czestotliwosc.ToString() + " GHz" + Environment.NewLine); } if (this[index] is Laptop) { txtbox.AppendText("Przekątna Ekranu: " + (this[index] as Laptop).przekatna_ekranu.ToString() + " cala" + Environment.NewLine); } if (this[index] is Smarfon) { txtbox.AppendText("Rozdzielczość aparatu: " + (this[index] as Smarfon).rozdzielczosc_aparatu.ToString() + " Mpx" + Environment.NewLine); } return(true); }
//*************************** //BEGIN CONNECT BUTTON METHOD //*************************** private void ConnectButton_Click(object sender, System.EventArgs e) { try { //******************************************************* //Define list to hold the tables of database being used //******************************************************* ArrayList TableList = new ArrayList(); //********************************************************** //Create connection string from values entered in text boxes //********************************************************** string CONN_STRING = "Server=" + ServerNameBox.Text + ";" + "Database=" + DatabaseBox.Text + ";" + "User ID=" + UserNameBox.Text + ";" + "Password="******";"; //********************************************************** //Create DataBaseReader object using above connection string //********************************************************** DataBaseReader dbreader = new DataBaseReader(CONN_STRING); //***************************** //Send messages to message box //***************************** OutputBox.AppendText("Connected to SERVER:" + ServerNameBox.Text + "\r\n"); OutputBox.AppendText("Using DATABASE:" + DatabaseBox.Text + "\r\n"); //******************************************************************************** //Reinitialize table combo box, read tables from database and assign to local list //******************************************************************************** TableBox.Items.Clear(); dbreader.GetTableList(); TableList = dbreader.GetTableListArray(); //*********************************** //Populate combobox with new tables //*********************************** for (int z = 0; z < TableList.Count; z++) { TableBox.Items.Add(TableList[z]); } //*************************************************************************************** //Close DataBaseReader object, disable connection controls, give focus to table combobox //*************************************************************************************** dbreader.CloseDBConnection(); ConnectionGroup.Enabled = false; TableGroup.Enabled = true; TableBox.Focus(); } catch (System.Exception caught) { MessageBox.Show(caught.Message); } }
/// <summary> /// Этот метод производит обработку данных ПС киберплат. На вход подается массив ссылок на киберплат Links. /// Остальные три параметра - граф. эл-ты соответсвующего типа. /// </summary> /// <param name="Links">Массив ссылок на киберплат</param> /// <param name="dataBox">Поле, в которое выводится лог.</param> /// <param name="progress">Прогресбар 1</param> /// <param name="progress2">Прогресбар 2</param> /// <returns>Возвращает сумму за текущий час в строковом формате с запятой.</returns> public static string cyberplatProcessing(string[] Links, TextBox dataBox, ProgressBar progress, ProgressBar progress2)//обработка киберплата { double summa = 0; string tmpTime = ""; string s1 = ""; string s2 = ""; string s3 = ""; string s4 = ""; for (int i = 0; i < 20; i++) { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); NumberStyles styles; styles = NumberStyles.AllowParentheses | NumberStyles.AllowTrailingSign | NumberStyles.Float | NumberStyles.AllowThousands; tmpTime = cybertime; if (tmpTime != "") { s3 = tmpTime.Remove(3, 2); } s1 = Downloader.Download(Links[i]); s2 = s1.Substring(s1.IndexOf("Всего") + 228, 100); //поиск слова "Всего" в документе и сдвиг на 228 символов от него(несколько строк вниз) и выемка 50 символов Regex regex = new Regex("([0-9]+.+[0-9])"); //регулярка для поиска числа в строке Match match = regex.Match(s2); if (match.Value != "") { summa = summa + Double.Parse(match.Value, styles); dataBox.AppendText(regions[i] + "\n"); dataBox.AppendText(match.Value + "\n");// вывод в textBox2 dataBox.AppendText((s1.Substring(s1.IndexOf("Данные отчета актуальны"), 49)).Replace("<b> ", " ") + "\n"); dataBox.AppendText("\n"); cybertime = ((s1.Substring(s1.IndexOf("Данные отчета актуальны")+44, 5))); if (cybertime != "") { s4 = cybertime.Remove(3, 2); } if (i >0 & s3 != s4) { progress.Value = 0; progress2.Value = 0; return cyberplatProcessing(Links, dataBox, progress, progress2); } } else { summa = summa + 0; dataBox.AppendText(regions[i] + "\n"); dataBox.AppendText("0.00" + "\n"); dataBox.AppendText("Отчёт ещё не сформирован" + "\n"); dataBox.AppendText("\n"); } progress.PerformStep(); progress2.PerformStep(); } dataBox.AppendText("Данные сняты"); string result = (summa.ToString()).Replace(".", ",");//замена точки на запятую(для удобства) return result; }
private void OnDataReceived(object sender, EventArgs e) { Device d = (Device)sender; TextBox lm_value = new TextBox(); lm_value.Text = "datarecieved"; Device.DataEventArgs de = (Device.DataEventArgs)e; NeuroSky.ThinkGear.DataRow[] tempDataRowArray = de.DataRowArray; TGParser tgParser = new TGParser(); tgParser.Read(de.DataRowArray); //bool hasBlink = false; //int blinkeye = 0; /* Loops through the newly parsed data of the connected headset*/ // The comments below indicate and can be used to print out the different data outputs. // for (int i = 0; i < tgParser.ParsedData.Length; i++) // { // if (radio_att.Checked == true & tgParser.ParsedData[i].ContainsKey("Attention") // ) // { // // updateAttentionMode(tgParser, i); // // } // else if (radio_me.Checked == true & tgParser.ParsedData[i].ContainsKey("Meditation") // ) // { // updateMediationMode(tgParser, i); // } // // } for (int i = 0; i < tgParser.ParsedData.Length; i++) { if (tgParser.ParsedData[i].ContainsKey("Attention")) { lm_value.AppendText("Att Value:" + tgParser.ParsedData[i]["Attention"]); Equals("Att Value:" + tgParser.ParsedData[i]["Attention"]); } if (tgParser.ParsedData[i].ContainsKey("Meditation")) { lm_value.AppendText("Med Value:" + tgParser.ParsedData[i]["Meditation"]); Equals("Med Value:" + tgParser.ParsedData[i]["Meditation"]); } } }
void DoStep(string objectName) { txtOutput.AppendText(new String('=', 70) + Environment.NewLine + objectName + ":" + Environment.NewLine); if (_generating) { progressBar1.Value++; } else { progressBar1.Value = progressBar1.Minimum; } _generating = true; btnGenerate.Enabled = true; }
public bool Ping() { if (!SendCmd("P")) { return(false); } if (!WaitAnswer()) { return(false); } // Check what received IConsole.AppendText(RXString); IConsole.AppendText(Environment.NewLine); return(RXString.StartsWith("HackerTool")); }
private void mFormula3_ValueChanged(Object Sender, System.EventArgs e) { string v = Evaluator.ConvertToString(mFormula3.value); lblResults3.Text = v; LogBox3.AppendText(System.DateTime.Now.ToLongTimeString() + ": " + v + "\r\n"); }
public void OnDataReceived(IAsyncResult asyn) { try { CSocketPacket theSockId = (CSocketPacket)asyn.AsyncState; //end receive... int iRx = 0; iRx = theSockId.thisSocket.EndReceive(asyn); char[] chars = new char[iRx + 1]; System.Text.Decoder d = System.Text.Encoding.UTF8.GetDecoder(); int charLen = d.GetChars(theSockId.dataBuffer, 0, iRx, chars, 0); System.String szData = new System.String(chars); //txtDataRx.Text = txtDataRx.Text + szData; txtDataRx.AppendText(szData); broadcastData(szData); WaitForData(theSockId.thisSocket); } catch (ObjectDisposedException) { System.Diagnostics.Debugger.Log(0, "1", "\nOnDataReceived: Socket has been closed\n"); } catch (SocketException se) { MessageBox.Show(se.Message); } }
private void WriteLine(string text) { logTextBox.Focus(); logTextBox.AppendText(text + Environment.NewLine); logTextBox.ScrollToCaret(); System.Windows.Forms.Application.DoEvents(); }
//part3 поиск по маске рлецб p2[3] + p2[2] + * + p2[7] + p2[1] public string part3(string str3,string strch,TextBox txtbox) { //должна вернуть слово(список слов) System.IO.StringReader file = new System.IO.StringReader(Properties.Resources.Dictionary); string line=""; string tmp3=""; string res = str3+"("; int ctr = 0; string toTxt3 = strch + " - "; while ((line = file.ReadLine()) != null) { tmp3 = line.Trim(); if(tmp3.Length == 5) { if (tmp3[0] == str3[3] && tmp3[1] == str3[2] && tmp3[3] == str3[7] && tmp3[4] == str3[1]) { res = res + tmp3 + ", "; toTxt3 = toTxt3 + part4(tmp3);//+ ctr++; } } } if (toTxt3 != strch + " - ") { txtbox.AppendText(toTxt3 + "\r\n"); } if (ctr == 0) { res = ""; } else { res = res.Substring(0, res.Length - 2) + "),"; } return res; }
private void button1_Click(object sender, System.EventArgs e) { if (textBox1.Text != "") { DateTime dt = DateTime.Now; // This cycle is used only when you want to run numerous name pipes requests // and measure the performance. In the general case it is not needed. for (int i = 0; i < 1; i++) { IInterProcessConnection clientConnection = null; try { clientConnection = new ClientPipeConnection("MyPipe", "."); clientConnection.Connect(); clientConnection.Write(textBox1.Text); Activity.AppendText(clientConnection.Read() + Environment.NewLine); clientConnection.Close(); } catch (Exception ex) { clientConnection.Dispose(); throw (ex); } } this.duration.Text = DateTime.Now.Subtract(dt).Milliseconds.ToString(); } }
public static async void ProcessMonitoring(TextBox usageTextBox, TextBox listTextBox) { int changed = ProcessCounter; string[] data; while (true) { await Task.Delay(1000); CurrentNumberProcesses(); usageTextBox.Invoke(new Action(() => { usageTextBox.Text = ProcessCounter + ""; })); if (changed != ProcessCounter) { changed = ProcessCounter; listTextBox.Invoke(new Action(() => { data = ReadProcesses(); foreach (string pData in data) { if (listTextBox.Text.Length < 0) listTextBox.Text = pData; else listTextBox.AppendText($"\r\n{pData}"); } })); } } }
public static void StartAnomalyDetection(TextBox warningTextBox) { if (DoneSettingNormalUsage) { if (CPUMonitor.CPUCounter > NormalCPU) { if (warningTextBox.Text.Length == 0) { warningTextBox.Invoke(new Action(() => { warningTextBox.Text = "CPU Usage: " + CPUMonitor.CPUCounter.ToString("F2") + "%"; CPUMonitor.CPUWarnings = warningTextBox.Text; })); } else { warningTextBox.Invoke(new Action(() => { warningTextBox.AppendText("\r\nCPU Usage: " + CPUMonitor.CPUCounter.ToString("F2") + "%"); CPUMonitor.CPUWarnings = warningTextBox.Text; })); } } } }
public void avTransportSniffHandlerSink(UPnPServiceWatcher sender, byte[] raw, int offset, int length) { lock (avTransportTextBox) { avTransportTextBox.AppendText(utf8encoder.GetString(raw, offset, length)); } }
public void connectionManagerSniffHandlerSink(UPnPServiceWatcher sender, byte[] raw, int offset, int length) { lock (connectionManagerTextBox) { connectionManagerTextBox.AppendText(utf8encoder.GetString(raw, offset, length)); } }
public void renderingSniffHandlerSink(UPnPServiceWatcher sender, byte[] raw, int offset, int length) { lock (rendererControlTextBox) { rendererControlTextBox.AppendText(utf8encoder.GetString(raw, offset, length)); } }
public void PrintRadacini(TextBox tb) { tb.Clear(); for (int i = 0; i < radacini.Count; i++) { tb.AppendText(radacini[i] + "\n"); } }
protected override void WndProc(ref Message msg) { base.WndProc(ref msg); if (msg.Msg == GConst.WMG_MACRO_TRACE) { _textBox.AppendText(_lineToAdd); } }
private void AddLineInternal(string line) { if (_textBox.TextLength != 0) { line = "\r\n" + line; } _textBox.AppendText(line); }
static public void ScriptChecks(ref TextBox textbox, ref ToolStripProgressBar ProgressBar) { string[] src = FileSystemUtil.GetAllFileNames((string)Settings.Global.Properties["POLPath"], "*.src"); string[] ecl = FileSystemUtil.GetAllFileNames((string)Settings.Global.Properties["POLPath"], "*.ecl"); string[] asp = FileSystemUtil.GetAllFileNames((string)Settings.Global.Properties["POLPath"], "*.asp"); ScriptCount.Add("ECL", ecl.Length); ScriptCount.Add("SRC", src.Length); ScriptCount.Add("ASP", asp.Length); if (ecl.Length < src.Length) textbox.AppendText("* Warning: Not all scripts are compiled." + Environment.NewLine); else if (ecl.Length > src.Length) textbox.AppendText("* Warning: There are more ecl files than src files." + Environment.NewLine); else textbox.AppendText("* Pass: All scripts are compiled." + Environment.NewLine); textbox.AppendText("Found " + src.Length.ToString() + " .src files and " + ecl.Length.ToString() + " .ecl files." + Environment.NewLine); ProgressBar.PerformStep(); }
public static void add_text(TextBox tb, object s) { if (tb.InvokeRequired) tb.Invoke(new Action<TextBox, object>(add_text), new object[] { tb, s }); else { tb.AppendText(s.ToString()); tb.ScrollToCaret(); } }
private void AppendText(TextBox txtBox, String txt) { if (this.InvokeRequired) { this.Invoke(new DelegateAppendText(AppendText), new object[] { txtBox, txt }); } else { txtBox.AppendText(txt); } }
public void ConnectToHopper(TextBox log = null) { // setup timer System.Windows.Forms.Timer reconnectionTimer = new System.Windows.Forms.Timer(); reconnectionTimer.Tick += new EventHandler(reconnectionTimer_Tick); reconnectionTimer.Interval = 1000; // ms int attempts = 10; // Setup connection info Hopper.CommandStructure.ComPort = Global.ComPort; Hopper.CommandStructure.SSPAddress = Global.Validator2SSPAddress; Hopper.CommandStructure.BaudRate = 9600; Hopper.CommandStructure.Timeout = 1000; Hopper.CommandStructure.RetryLevel = 3; // Run for number of attempts specified for (int i = 0; i < attempts; i++) { if (log != null) log.AppendText("Trying connection to SMART Hopper\r\n"); // turn encryption off for first stage Hopper.CommandStructure.EncryptionStatus = false; // if the key negotiation is successful then set the rest up if (Hopper.OpenPort() && Hopper.NegotiateKeys(log)) { Hopper.CommandStructure.EncryptionStatus = true; // now encrypting // find the max protocol version this validator supports byte maxPVersion = FindMaxHopperProtocolVersion(); if (maxPVersion >= 6) Hopper.SetProtocolVersion(maxPVersion, log); else { MessageBox.Show("This program does not support slaves under protocol 6!", "ERROR"); return; } // get info from the validator and store useful vars Hopper.SetupRequest(log); // inhibits, this sets which channels can receive notes Hopper.SetInhibits(log); // set running to true so the hopper begins getting polled hopperRunning = true; return; } // reset timer reconnectionTimer.Enabled = true; while (reconnectionTimer.Enabled) { if (CHelpers.Shutdown) return; Application.DoEvents(); } } }
public void AppendText(TextBox ctl, string txt) { if (this.InvokeRequired) { this.Invoke(new DelegateShowText(AppendText), new object[] { ctl, txt }); } else { ctl.AppendText(txt); } }
private void SetTextBoxValue(string value, TextBox ctr) { Action<string> setValueAction = text => ctr.AppendText(value);//Action<T>本身就是delegate类型,省掉了delegate的定义 if (ctr.InvokeRequired) { ctr.Invoke(setValueAction, value); } else { setValueAction(value); } }
public static void AppendToTextBox(string text, TextBox txtBox) { if (txtBox.InvokeRequired) { txtBox.BeginInvoke( new MethodInvoker(delegate() { AppendToTextBox(text, txtBox); }) ); } else { txtBox.AppendText(text); } }
/************* * AUX METHODS* **************/ private void DisplayRegion(char[,] map, TextBox display) { display.ResetText(); for (int r = 0; r <= 14; r++) { for (int c = 0; c <= 14; c++) { if (map[r, c] == '#') area++; display.Text += map[r, c].ToString(); } display.AppendText("\n"); } }
static public void RealmChecks(ref TextBox textbox, ref ToolStripProgressBar ProgressBar) { if (!Directory.Exists((string)Settings.Global.Properties["POLPath"] + @"\realm")) textbox.AppendText("* Fail: Realms have not been generated." + Environment.NewLine); else { string[] tmp = FileSystemUtil.GetAllFileNames((string)Settings.Global.Properties["POLPath"] + @"\realm", "*.*"); if (tmp.Length > 1) textbox.AppendText("* Pass: Realm folder detected." + Environment.NewLine); else textbox.AppendText("* Fail: Realm folder is empty." + Environment.NewLine); } ProgressBar.PerformStep(); foreach (string s in PL_UOConvert.GetConfigFileNames()) { if (File.Exists((string)Settings.Global.Properties["POLPath"] + @"\" + s)) textbox.AppendText("* Pass: Found config file '" + s + "'." + Environment.NewLine); else textbox.AppendText("* Fail: Config file '" + s + "' not found." + Environment.NewLine); ProgressBar.PerformStep(); } }
private void appendTxtLog(TextBox tb, string txt, TabPage tp = null) { if (tb.InvokeRequired) { this.Invoke(new appendTxtLogCallback(appendTxtLog), new object[] { tb, txt, tp }); } else { tb.AppendText(txt); if (tp != null && tp != tabs.SelectedTab && !tp.Text.EndsWith("*")) { tp.Text += "*"; } } }
public void appendLine(string text,TextBox textBox) { BeginInvoke((Action)(() => { if (textBox.Text.Length > 32000) { //新しいファイルに保存 textBox.Text = ""; } textBox.AppendText(DateTime.Now.ToLongTimeString() + " " + text + Environment.NewLine); textBox.SelectionStart = textBox.Text.Length; textBox.ScrollToCaret(); })); }
public int WriteMessage(string a_message, bool a_request) { tbCurrentWindow = a_request?txtRequest:txtResponse; if (txtRequest.InvokeRequired) { m_txtMessage = a_message; return -1; // the calling thread will try to invoke the delegate } try { tbCurrentWindow.AppendText("\r\n" + a_message); } finally { } return 0; }
/// <summary> /// Appends text to a textbox in a multi-threaded environment. This method does not append a linefeed at the end of the text. /// </summary> /// <param name="tb">The NAME of the textbox to be written to.</param> /// <param name="text">The TEXT to be appeneded to the textbox (without linefeed).</param> public static void appendText(TextBox tb, String text) { // Stop if TextBox reference is null if (tb == null) return; // Stop if the text reference is null if (text == null) return; if (tb.InvokeRequired) { AppendTextCallback a = new AppendTextCallback(appendText); tb.Invoke(a, new object[] { tb, text }); } else { tb.AppendText(text); } }
public static void StartAnomalyDetection(TextBox warningTextBox) { if (DoneSettingNormalUsage) { if(true) { if(warningTextBox.Text.Length == 0) { warningTextBox.Invoke(new Action(() => { warningTextBox.Text = $"Warning! RAM Usage: {RAMMonitor.RAMCounter} MB"; })); } else { warningTextBox.Invoke(new Action(() => { warningTextBox.AppendText($"\r\nWarning! RAM Usage: {RAMMonitor.RAMCounter} MB"); })); } } } }
public void ThrowWarning(TextBox warningTextBox, string postfix) { if (NormalUsage > CurrentUsage) { if (warningTextBox.Text.Length == 0) { warningTextBox.Invoke(new Action(() => { warningTextBox.Text = "Usage: " + tools.DoFormat(CurrentUsage) + postfix; WarningUsage = warningTextBox.Text; })); } else { warningTextBox.Invoke(new Action(() => { warningTextBox.AppendText("\r\nUsage: " + tools.DoFormat(CurrentUsage) + postfix); WarningUsage = warningTextBox.Text; })); } } }
private static void DisplayPlayerInfo(Player player, TextBox bankroll, TextBox bet, TextBox playerInfo, TextBox highest, TextBox lowest) { bankroll.Text = player.Money.ToString(); bet.Text = player.Bet.ToString(); playerInfo.AppendText(string.Format("{0} - ", _handCount)); foreach (var card in player.Cards) { playerInfo.AppendText(string.Format("{0} ", card)); } playerInfo.AppendText(string.Format("\r\nHigh Total = {0} - Low Total = {1} - Total = {2}\r\n", player.HighTotal, player.LowTotal, player.Total)); playerInfo.AppendText(string.Format(" Bet = {0}", player.LastBet)); playerInfo.AppendText(string.Format(" Money = {0}\r\n", player.Money)); playerInfo.AppendText("-----------------------\r\n"); if (string.IsNullOrEmpty(highest.Text)) { highest.Text = player.Money.ToString(); } else { if (player.Money > int.Parse(highest.Text)) { highest.Text = player.Money.ToString(); } } if (string.IsNullOrEmpty(lowest.Text)) { lowest.Text = player.Money.ToString(); } else { if (player.Money < int.Parse(lowest.Text)) { lowest.Text = player.Money.ToString(); } } }
private void Log(TextBox t, string message, MessageType messageType = MessageType.INFORMATION) { t.AppendText($"{DateTime.Now.ToString("G")}: { (messageType == MessageType.ERROR ? "ERROR " : string.Empty) }{message}{Environment.NewLine}"); }
private static void _WriteLog(TextBox tb, string msg) { if (tb.InvokeRequired) { WriteLogCallback writeLog = new WriteLogCallback(_WriteLog); tb.Invoke(writeLog, tb, msg); } else { if (msg == null) return; if (tb.Lines.Length > 1000) { tb.SuspendLayout(); string[] sLines = new string[900]; Array.Copy(tb.Lines, tb.Lines.Length - 900, sLines, 0, 900); tb.Lines = sLines; tb.ResumeLayout(); } tb.AppendText(msg); } }
public FwHelpAbout() { // // Required for Windows Form Designer support // InitializeComponent(); AccessibleName = GetType().Name; // Cache the format strings. The control labels will be overwritten when the // dialog is shown. m_sAvailableMemoryFmt = edtAvailableMemory.Text; m_sTitleFmt = Text; m_sAvailableDiskSpaceFmt = edtAvailableDiskSpace.Text; if (MiscUtils.IsUnix) { // Link to System Monitor // Hide memory and disk usage fields and show a link to // Gnome System Monitor in their place. lblAvailableMemory.Visible = false; edtAvailableMemory.Visible = false; lblAvailableDiskSpace.Visible = false; edtAvailableDiskSpace.Visible = false; m_systemMonitorLink = new LinkLabel { Text = FwCoreDlgs.kstidMemoryDiskUsageInformation, Visible = true, Name = "systemMonitorLink", TabStop = true, Top = lblAvailableMemory.Top, Left = lblAvailableMemory.Left, Width = edtAvailableMemory.Right - lblAvailableMemory.Left, }; m_systemMonitorLink.LinkClicked += HandleSystemMonitorLinkClicked; Controls.Add(m_systemMonitorLink); // Package information int oldHeight = this.Height; this.Height += 200; var packageVersionLabel = new Label { Text = "Package versions:", Top = oldHeight - 20, Width = this.Width - 10 }; var versionInformation = new TextBox { Height = 200 - 30, Top = oldHeight, Multiline = true, ReadOnly = true, Width = this.Width - 10, ScrollBars = ScrollBars.Vertical }; this.Controls.Add(packageVersionLabel); this.Controls.Add(versionInformation); foreach(var info in LinuxPackageUtils.FindInstalledPackages("fieldworks*")) { versionInformation.AppendText(String.Format("{0} {1} {2}", info.Key, info.Value, Environment.NewLine)); } } }
public void Dump(TextBox txtMessage) { txtMessage.AppendText("DUMP<MyClassA>: \r\n"); txtMessage.AppendText(" guid : " + _guid.ToString().ToUpper() + "\r\n"); txtMessage.AppendText(" a = " + a.ToString() + "\r\n"); txtMessage.AppendText(" d = " + d.ToString() + "\r\n"); txtMessage.AppendText(" m = " + m.ToString() + "\r\n"); txtMessage.AppendText(" s = " + s.ToString() + "\r\n"); }
private static void LogTo(TextBox textBox, string message) { textBox.AppendText(message + "\r\n"); }