private void UpdateInfoBox() { InfoBox.Clear(); InfoBox.AppendText(" A: 0x" + Program.Emulator.Processor.A.ToString("X2") + " "); InfoBox.AppendText(" F: 0x" + Program.Emulator.Processor.F.ToString("X2") + " (" + Program.Emulator.Processor.ZeroFlag.ToString() + Program.Emulator.Processor.SubtractFlag.ToString() + Program.Emulator.Processor.HalfCarryFlag.ToString() + Program.Emulator.Processor.CarryFlag.ToString() + ")" + "\n"); InfoBox.AppendText(" B: 0x" + Program.Emulator.Processor.B.ToString("X2") + " "); InfoBox.AppendText(" C: 0x" + Program.Emulator.Processor.C.ToString("X2") + "\n"); InfoBox.AppendText(" D: 0x" + Program.Emulator.Processor.D.ToString("X2") + " "); InfoBox.AppendText(" E: 0x" + Program.Emulator.Processor.E.ToString("X2") + "\n"); InfoBox.AppendText(" H: 0x" + Program.Emulator.Processor.H.ToString("X2") + " "); InfoBox.AppendText(" L: 0x" + Program.Emulator.Processor.L.ToString("X2") + "\n"); InfoBox.AppendText("-----------------------------\n"); InfoBox.AppendText("PC: 0x" + Program.Emulator.Processor.PC.ToString("X4") + " "); InfoBox.AppendText("SP: 0x" + Program.Emulator.Processor.SP.ToString("X4") + "\n"); InfoBox.AppendText("OP: " + Program.Emulator.CurrentOPcode.ToString("X2") + " " + Program.Emulator.Disassembler.DisassembleMemoryAddress( ref Program.Emulator.Memory, Program.Emulator.Processor.PC) + "\n"); InfoBox.AppendText("-----------------------------\n"); InfoBox.AppendText("IE: " + ByteToBits(Program.Emulator.Memory.Data[0xFFFF]) + " "); InfoBox.AppendText("IF: " + ByteToBits(Program.Emulator.Memory.Data[0xFF0F]) + "\n"); InfoBox.AppendText("IME: " + Program.Emulator.Processor.IME + "\n"); }
private void Send_Click(object sender, EventArgs e) { if (backgroundWorker1.IsBusy != true) { _instructions.Clear(); backgroundWorker1.RunWorkerAsync(COMBox.SelectedItem.ToString()); } else { InfoBox.AppendText("Worker is busy...\r\n"); } Instruction newInstruction = new Instruction(true, MessageBox.Text); // you need to make sure only // one thread can access the list // at a time lock (_lock) { _instructions.Enqueue(newInstruction); } Thread.Sleep(200); // notify the waiting thread _signal.Set(); }
public void OnDataReveiced(object sender, SerialDataReceivedEventArgs e) { using (ArduinoPort) { Thread.Sleep(1); SerialPort sp = (SerialPort)sender; returnMessage += (string)sp.ReadExisting(); if (DebugBox.InvokeRequired) { DebugBox.Invoke(new Action(() => { DebugBox.AppendText("Message received."); DebugBox.AppendText(Environment.NewLine); })); } if (InfoBox.InvokeRequired) { InfoBox.Invoke(new Action(() => { InfoBox.AppendText(returnMessage); InfoBox.AppendText(Environment.NewLine); })); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { VersionTextLabel.Content = "v" + Ver.VER + " " + Ver.DATE; InfoBox.Text = "HomePage: https://zyzsdy.com/biliroku\n\n更新说明:\n" + Ver.DESC + "\n\n"; InfoBox.AppendText("注意:\n本程序不是bilibili官方出品。\n请在不违反bilibili用户协议的前提下使用。\n请遵守直播礼仪,未经up主同意请勿上传直播录像。\n\nBiliRoku可能会收集一些您的设备信息用于改进程序,其中不包含您的任何隐私信息。"); InfoBox_Toxiad.Text = $"该版本为Toxiad夹带私货版(\n版本号{Ver.Toxiad_VER}\n{Ver.Toxiad_DESC}"; }
// This reads the text file line by line public void lineReader(string address) { int counter = 0; string line; // Read the file and display it line by line. StreamReader file = new StreamReader(address); while ((line = file.ReadLine()) != null) { try { if (line.Length > 0) { if (line[0] != ';') { InfoBox.AppendText(counter + " " + line); InfoBox.AppendText(Environment.NewLine); counter++; } } } catch (Exception ex) { DebugBox.Text = ex.ToString(); } } file.Close(); }
// Sets the default port public void SetComPort() { try { DebugBox.AppendText(COMBox.SelectedItem.ToString()); DebugBox.AppendText(Environment.NewLine); ArduinoPort = new SerialPort(COMBox.SelectedItem.ToString(), 9600, Parity.None, 8, StopBits.One); ArduinoPort.Handshake = Handshake.None; ArduinoPort.RtsEnable = true; message = "IDENTIFY"; try { ArduinoPort.Open(); Thread.Sleep(200); } catch (UnauthorizedAccessException ex) { DebugBox.AppendText("Unauthorized Access Exception! Cannot open port " + COMBox.SelectedValue.ToString()); DebugBox.AppendText(Environment.NewLine); DebugBox.AppendText(ex.ToString()); } catch (Exception ex) { DebugBox.AppendText("Unknown error: "); DebugBox.AppendText(Environment.NewLine); DebugBox.AppendText(ex.ToString()); } Sender(ArduinoPort); returnMessage += ArduinoPort.ReadLine(); if (returnMessage.Contains("CONNECTED")) { InfoBox.AppendText(returnMessage); returnMessage = ""; try { using (ArduinoPort) { ArduinoPort.DataReceived += new SerialDataReceivedEventHandler(OnDataReveiced); DebugBox.AppendText("Created serial event handler"); DebugBox.AppendText(Environment.NewLine); } } catch (Exception ex) { DebugBox.AppendText("Could not create serial event handler"); DebugBox.AppendText(Environment.NewLine); DebugBox.AppendText(ex.ToString()); DebugBox.AppendText(Environment.NewLine); } } } catch (Exception ex) { DebugBox.Text += "\nError: " + ex.ToString(); } }
public void WriteLine(string line) { string text = $"{line}\n"; InfoBox.AppendText(text); Debug.WriteLine(text); InfoBox.ScrollToEnd(); }
public ExtendedErrorView(string message, string info, string title) { InitializeComponent(); ErrorMessage.Content = message; InfoBox.AppendText(info); this.Title = title + $"({Util.GetGitHash()})"; System.Media.SystemSounds.Exclamation.Play(); }
public ExtendedErrorView(string message, string info, string title, WindowStartupLocation startupLocation) { this.WindowStartupLocation = startupLocation; InitializeComponent(); ErrorMessage.Content = message; InfoBox.AppendText(info); this.Title = title; System.Media.SystemSounds.Exclamation.Play(); }
// Reads the buffer if the event doesn't fire private void Read_Click(object sender, EventArgs e) { // Got error here. "Port is closed!" // ArduinoPort.Open(); // This means the port closed before the arduino could respond! returnMessage += (string)ArduinoPort.ReadExisting(); DebugBox.AppendText("Message received."); DebugBox.AppendText(Environment.NewLine); InfoBox.AppendText(returnMessage); InfoBox.AppendText(Environment.NewLine); // lineReader(message); }
public void AppendText(string text) { if (this.InfoBox.InvokeRequired) { AppendTextCallback d = new AppendTextCallback(AppendText); this.Invoke(d, new object[] { text }); } else { if (string.IsNullOrEmpty(text)) { return; } InfoBox.AppendText(text); } }
private void UpdateInfo_Click(object sender, RoutedEventArgs e) { try { int tempSelectedObject = SelectedObject; for (int currentOrder = 0; currentOrder < _orders.Count; currentOrder++) { if (tempSelectedObject == _orders[currentOrder].NumOrder) { tempSelectedObject = currentOrder; break; } } InfoBox.Document.Blocks.Clear(); Order ord = _orders[tempSelectedObject]; InfoBox.AppendText("Номер заказа: " + ord.NumOrder + '\n' + "Тип оплаты: " + ord.PaymentType + '\n' + "Дата заказа: " + ord.Date.ToString("dd:MM:yyyy") + "\n \n"); List <Cars> cr = ord.returnCars; List <Trucks> tr = ord.returnTrucks; InfoBox.AppendText("Автомобили: \n"); if (cr.Count != 0) { for (int index = 0; index < cr.Count; index++) { InfoBox.AppendText("Марка: " + cr[index].Brand + '\n' + "Год выпуска: " + cr[index].Year + '\n' + "Цвет: " + cr[index].Color + '\n' + "Мощность: " + cr[index].Power + "\n \n"); } } if (tr.Count != 0) { for (int index = 0; index < tr.Count; index++) { InfoBox.AppendText("Марка: " + tr[index].Brand + '\n' + "Год выпуска: " + tr[index].Year + '\n' + "Грузоподъемность: " + tr[index].LoadCapacity + "\n \n"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void CtrlFInfoShow() { InfoBox.Text = ""; int Count_Temp = IndexInfoList.Count; if (Count_Temp == 0) { InfoBox.AppendText("没有检索到地图块!"); this.Text = ""; return; } InfoBox.AppendText("一共有" + Count_Temp + "个检索地图块!"); InfoBox.AppendText(System.Environment.NewLine); for (int i = 0; i <= Count_Temp - 1; ++i) { int x = IndexInfoList[i] % (MapPanelEditor.RowNum) + 1; int y = IndexInfoList[i] / (MapPanelEditor.LineNum) + 1; int count = i + 1; InfoBox.AppendText("检索地图块" + count + "的坐标为(" + x + "," + y + ")"); InfoBox.AppendText(System.Environment.NewLine); } this.Text = ""; }
private void Append(string line) { InfoBox.AppendText(line + "\n"); }
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { InfoBox.AppendText("Background worker successfully shut down.\r\n"); }
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { InfoBox.AppendText("Return message: " + e.ProgressPercentage.ToString()); }
public void AppendLogln(string level, string logText) { Dispatcher.Invoke(() => { InfoBox.AppendText("[" + level + " " + DateTime.Now.ToString("HH:mm:ss") + "] " + logText + "\n"); }); }
/// <summary> /// Event Handler For btn_"Получить название Родительского продукта" /// </summary> /// <param name="sender">btn5</param> /// <param name="e"></param> private void On_ParentIDReceiving(object sender, RoutedEventArgs e) { bool error = false; try { int count = ValidationImplementing(); if (count > 0) { throw new ArgumentException("Заполните отмеченное поле ввода."); } } catch (ArgumentException ex) { InfoBox.Clear(); InfoBox.Text = ex.Message; error = true; } if (!error) { string Number = number.Text; Guid ProductID = VirtuDB.ProductIDGetter(Number); List <ObjectTreeItem> parentList = new List <ObjectTreeItem>(); parentList = VirtuDB.ParentProductIDGetter(ProductID); if (ProductID != null) { productID.Clear(); productID.Text = ProductID.ToString(); } else { InfoBox.Clear(); InfoBox.Text = "Неудалось извлечь значение ID продукта."; } if (parentList == null) { InfoBox.Clear(); InfoBox.Text = "Операция завершилась неудачей"; } else { int count = parentList.Count <ObjectTreeItem>(); switch (count) { case 0: parentProductName.Clear(); parentProductName.Text = "Операция завершилась неудачей"; break; case 1: parentProductName.Clear(); parentProductName.Text = "Родительский продукт: " + parentList[0].Name; break; default: parentProductName.Clear(); parentProductName.Text = "Родительский продукт: " + parentList[1].Name; break; } InfoBox.Clear(); InfoBox.AppendText("Иерархия продукта:\r\n"); foreach (ObjectTreeItem item in parentList) { InfoBox.AppendText(item.DisplayName + "\r\n"); } } } }
private void infoBoxUpdater(string myString) { InfoBox.AppendText(myString); }