private string ExecuteCommand(string commandText) { // https://www.voip-info.org/asterisk-cli/#Generalcommands var command = new CommandAction(); var response = new CommandResponse(); command.Command = commandText; try { var result = string.Empty; TextBoxOutput.Text += "-----Executed '" + commandText + "' command -----" + Environment.NewLine; response = (CommandResponse)manager.SendAction(command); foreach (var line in response.Result) { result += line + Environment.NewLine; } TextBoxOutput.Text += result + Environment.NewLine; TextBoxOutput.SelectionStart = TextBoxOutput.TextLength; TextBoxOutput.ScrollToCaret(); return(result); } catch (Exception err) { Console.WriteLine("Command '" + commandText + "' failed: " + err + Environment.NewLine + Environment.NewLine); return("ERROR"); } }
public Action <SmsMessage> SmsSubscribe(TextBoxOutput output = null) { return((s) => { var r = s.Clone(); r.ReceivedTime = DateTime.Now; r.Status = SmsMessage.MsgStatus.Received; foreach (Contact contact in phone.UseComponent <Memory>().Get <Contact>()) { foreach (var item in contact.SmsReceiver) { if (item == r.Sender) { r.ReceivedFrom = contact.Name; break; } } } if (r.ReceivedFrom == null) { Contact contact = new Contact($"Unknown{unknown}", r.Sender, null); r.ReceivedFrom = contact.Name; phone.AddContact(contact); unknown++; } phone.UseComponent <Memory>().Add <SmsMessage>(r); output?.WriteLine(r.ToString()); }); }
public Action <PhoneCall> CallSubscribe(TextBoxOutput output = null) { return((s) => { var r = s.Clone(); r.StartTime = DateTime.Now; r.Direction = CallDirection.Incoming; foreach (Contact contact in phone.UseComponent <Memory>().Get <Contact>()) { foreach (var item in contact.CallReceiver) { if (item == r.Caller) { r.From = contact.Name; break; } } } if (r.From == null) { Contact contact = new Contact($"Unknown{unknown}", null, r.Caller); r.From = contact.Name; phone.AddContact(contact); unknown++; } SaveCallInMemory(r); output?.WriteLine(r.ToString()); }); }
public static IPlayback GetPlaybackType(HeadSetTypes headSetType) { IPlayback playback = null; IOutput output = new TextBoxOutput(); switch (headSetType) { case HeadSetTypes.iPhoneHeadset: playback = new iPhoneHeadset(output); break; case HeadSetTypes.SamsungHeadset: playback = new SamsungHeadset(output); break; case HeadSetTypes.UnofficialiPhoneHeadset: playback = new UnofficialiPhoneHeadset(output); break; case HeadSetTypes.PhoneSpeaker: playback = new PhoneSpeaker(output); break; default: throw new ArgumentException("Invalid playback type"); } return(playback); }
private void ExportVlmcsd() { var vlmcsdHeader = default(VlmcsdHeader); #if DEBUG Debug.Assert(CheckBoxIncludeApp.IsChecked != null, "CheckBoxIncludeApp.IsChecked != null"); Debug.Assert(CheckBoxIncludeKms.IsChecked != null, "CheckBoxIncludeKms.IsChecked != null"); Debug.Assert(CheckBoxIncludeSku.IsChecked != null, "CheckBoxIncludeSku.IsChecked != null"); Debug.Assert(CheckBoxNoDescription.IsChecked != null, "CheckBoxNoDescription.IsChecked != null"); Debug.Assert(CheckBoxIncludeBetaSku.IsChecked != null, "CheckBoxIncludeBetaSku.IsChecked != null"); #endif using (var stream = vlmcsdHeader.WriteData ( CheckBoxIncludeApp.IsChecked.Value, CheckBoxIncludeKms.IsChecked.Value, CheckBoxIncludeSku.IsChecked.Value, CheckBoxNoDescription.IsChecked.Value, CheckBoxIncludeBetaSku.IsChecked.Value)) { vlmcsdBytes = stream.ToArray(); } TextBoxOutput.Text = "uint8_t DefaultKmsData[] =\n{\n"; for (var i = 0; i < vlmcsdBytes.Length; i += 16) { var text = $"{tabs}"; for (var j = 0; j < 16; j++) { if (i + j < vlmcsdBytes.Length) { text += $"0x{vlmcsdBytes[i + j]:X2}, "; } else { text += " "; } } text += " // "; for (var j = 0; j < 16; j++) { if (i + j >= vlmcsdBytes.Length) { continue; } var character = vlmcsdBytes[i + j]; text += (character < 0x20 || (j == 15 && character == 0x5c)) || (character > 0x7e && character < 0xa1) ? '.' : (char)vlmcsdBytes[i + j]; } TextBoxOutput.AppendText(text); TextBoxOutput.AppendText(Environment.NewLine); } TextBoxOutput.AppendText("};"); }
internal void AppendLineToOutput(string text, Color color) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (TextBoxOutput.InvokeRequired) { SetTextCallback d = new SetTextCallback(AppendLineToOutput); this.Invoke(d, new object[] { text, color }); } else { TextBoxOutput.SelectionStart = TextBoxOutput.TextLength; TextBoxOutput.SelectionLength = 0; TextBoxOutput.SelectionColor = color; TextBoxOutput.AppendText("[" + System.DateTime.Now.ToString("dd/MM HH:mm:ss") + "] " + text + Environment.NewLine); TextBoxOutput.SelectionColor = TextBoxOutput.ForeColor; if (!this.ContainsFocus) { TextBoxOutput.ScrollToCaret(); } Console.Out.WriteLine("[" + System.DateTime.Now.ToString() + "] " + text); } }
/// <summary> /// Constructor. /// </summary> public MainForm() { InitializeComponent(); Log = new TextBoxOutput(_logBox); Readers = new BlockingCollection <ReaderInfo>(); Debtors = new BlockingCollection <DebtorInfo>(); ReadersByStatus = new DictionaryList <string, ReaderInfo>(); Connection = new IrbisConnection(); }
private void Output(string msg) { TextBoxOutput.Dispatcher.BeginInvoke(new Action(() => { TextBoxOutput.AppendText(msg); if (AutoScrollCheckBox.IsChecked.Value) { TextBoxOutput.ScrollToEnd(); } }), null); }
public void SendSms(string smsText, TextBoxOutput output = null, int simNum = 0, params string[] names) { Contact contact; foreach (var name in names) { if (this.TryGetContact(name, out contact)) { this.UseComponent <Communicator>().SendSms(contact, smsText, output, simNum); } } }
public SendSms() { InitializeComponent(); smsFormatting.DataSource = Enum.GetNames(typeof(TextBoxOutput.FormatingStyle)); smsPhone1 = new SmsPhone(FormFactor.Bar, "BP20200406"); smsPhone2 = new SmsPhone(FormFactor.Bar, "BP20200409"); output = new TextBoxOutput(this.receivedSms); subscribe = smsPhone2.UseComponent <Communicator>().SmsSubscribe(output); }
public SendManySms() { InitializeComponent(); smsPhone1 = new SmsPhone(FormFactor.Bar, "BP20200406"); smsPhone1.AddSimCard(new SimCard(), output); smsPhone2 = new SmsPhone(FormFactor.Bar, "BP20200409"); smsPhone2.AddSimCard(new SimCard(), output); smsPhone3 = new SmsPhone(FormFactor.Bar, "BP20200406"); smsPhone3.AddSimCard(new SimCard(), output); smsPhone4 = new SmsPhone(FormFactor.Bar, "BP20200409"); smsPhone4.AddSimCard(new SimCard(), output); output = new TextBoxOutput(this.receivedSms); var contact1 = smsPhone1.GetMyContact("Alex"); var contact2 = smsPhone2.GetMyContact("Vova"); var contact3 = smsPhone3.GetMyContact("Stas"); var contact4 = smsPhone4.GetMyContact("Oleg"); smsPhone1.AddContact(contact2, contact3, contact4); smsPhone2.AddContact(contact1); smsPhone3.AddContact(contact1); smsPhone4.AddContact(contact1); phones = new IPhone[] { smsPhone1, smsPhone2, smsPhone3, smsPhone4 }; smsFormatting.DataSource = Enum.GetNames(typeof(TextBoxOutput.FormatingStyle)); cmbWords.DataSource = new List <string>() { FILTER_ALL_VALUES }.Concat(words).ToArray(); cmbLogic.DataSource = Enum.GetNames(typeof(LogicOperand)); dtpFrom.CustomFormat = "dd/MM/yyyy hh:mm:ss"; dtpTo.CustomFormat = "dd/MM/yyyy hh:mm:ss"; resetFilters(); sendSms = delegate { int arrLength = words.Length - 1; smsPhone1.SendSms($"smsVSO|{words[random.Next(arrLength)]}|{smsCount++}", output, 0, "Vova", "Stas", "Oleg"); smsPhone2.SendSms($"smsVA|{words[random.Next(arrLength)]}|{smsCount++}", output, 0, "Alex"); smsPhone3.SendSms($"smsSA|{words[random.Next(arrLength)]}|{smsCount++}", output, 0, "Alex"); smsPhone4.SendSms($"smsOA|{words[random.Next(arrLength)]}|{smsCount++}", output, 0, "Alex"); cbxSubscribers.DataSource = getAllSenders(phones); }; powerbank = new PowerBank("PB20200430"); powerbank.PluginToUse = Plugins.Usb; }
public MainForm() { InitializeComponent(); Log = new TextBoxOutput(_logBox); //Kladovka = new Kladovka(Log); //IdleManager = new IrbisIdleManager //( // Kladovka.Connection, // 60 * 1000 //); //IdleManager.Idle += IdleManager_Idle; }
public void SendSms(Contact contact, string smsText, TextBoxOutput output, int simNum) { var msg = new SmsMessage() { SendTo = contact?.Name, Text = smsText, SentTime = DateTime.Now, Status = MsgStatus.Sent, Sender = phone?.ActiveSimCard.SmsReceiver }; phone.UseComponent <Memory>().Add <SmsMessage>(msg); contact.SmsReceiver[simNum](msg); output?.WriteLine(msg.ToString()); }
private void updateScreen() { TextBoxBouwjaar.Text = ""; TextBoxCO2.Text = ""; TextBoxNOx.Text = ""; TextBoxNummerplaat.Text = ""; TextBoxOutput.Text = ""; TextBoxPrijs.Text = ""; foreach (var wagen in Store.Lijst()) { TextBoxOutput.AppendText(wagen.ToString() + "\n"); } }
private void StartConversion() { var recentConversions = UserConfigHandler.GetRecentConversions(); lblError.Content = string.Empty; string docxPath = txtSelectWord2k7Doc.Text; string texPath = txtSelectLaTeXDoc.Text; var statusInfo = new TextBoxOutput(txtScreen, scrLog); try { statusInfo.WriteLine(string.Empty); StaticConfigHelper.DocxPath = docxPath; var docx2TexWorker = new Docx2TexWorker(); btnStartConversion.IsEnabled = false; statusInfo.WriteLine("Source: " + docxPath); statusInfo.WriteLine("Destination: " + texPath); statusInfo.WriteLine(string.Empty); if (docx2TexWorker.Process(docxPath, texPath, statusInfo)) { recentConversions.RemoveAll(rce => rce.From == docxPath && rce.To == texPath); recentConversions.Insert(0, new FromToElement { Order = 0, From = docxPath, To = texPath }); UserConfigHandler.UpdateRecentConversion(recentConversions); _contentClosable.BuildRecentConversionMenus(); } } catch (Exception ex) { lblError.Content = ex.Message.Replace(Environment.NewLine, string.Empty); statusInfo.Write(ex.ToString()); } finally { statusInfo.WriteLine(string.Empty); btnStartConversion.IsEnabled = true; } statusInfo.Flush(); }
public PhoneCall MakeCall(Contact contact, int duration, TextBoxOutput output, int simNum) { var call = new PhoneCall() { To = contact?.Name, StartTime = DateTime.Now, Direction = CallDirection.Outgoing, Duration = duration, Caller = phone?.ActiveSimCard.CallReceiver }; SaveCallInMemory(call); contact.CallReceiver[simNum](call); output?.WriteLine(call.ToString()); return(call); }
public MainForm() { _bindingList = new BindingList <StatusRecord>(); InitializeComponent(); _bindingSource.DataSource = _bindingList; Log = new TextBoxOutput(_logBox); Kladovka = new Kladovka(Log); IdleManager = new IrbisIdleManager ( Kladovka.Connection, 60 * 1000 ); IdleManager.Idle += IdleManager_Idle; }
/// <summary> /// Resets all of the file viewers /// </summary> private void ResetViewer() { TextBoxOutput.Visibility = Visibility.Hidden; ImageOutput.Visibility = Visibility.Hidden; RichTextOutput.Visibility = Visibility.Hidden; DataGridOutput.Visibility = Visibility.Hidden; DatViewerOutput.Visibility = Visibility.Hidden; TextBoxOutput.Clear(); ImageOutput.Source = null; RichTextOutput.Document.Blocks.Clear(); DataGridOutput.ItemsSource = null; TextBoxOffset.Text = String.Empty; TextBoxSize.Text = String.Empty; TextBoxNameHash.Text = String.Empty; TextBoxHash.Text = String.Empty; }
/// <summary> /// Adds the output. /// </summary> /// <param name="output">The output.</param> private void AddOutput(string output) { Debug.WriteLine($"{nameof(AddOutput)}: \"{output}\""); // Hybrid, when application is in console started if (Utility.GetIsConsolePresent()) { Console.WriteLine(output); return; } Utility.BeginInvoke(() => { TextBoxOutput.AppendText($"{output}\r\n"); TextBoxOutput.ScrollToEnd(); GroupBoxOutput.Header = $"Output (Processed files {_CurrentFileCount}/{_FileCount})"; }); }
private void CloseImage() { if (Generator != null) { Generator.Close(); Generator = null; } Points = null; if (PolyPointImage != null) { PolyPointImage.Close(); PolyPointImage = null; } TextBoxOutput.Clear(); PointOrigin = new Size(0, 0); PointOriginXTextBox.Text = "0"; PointOriginYTextBox.Text = "0"; GeneratorAccuracy = 1f; ConvertingImageBox.Invalidate(); }
private void LogMessage(string message) { // Init output log if (_logWriter == null) { _logWriter = new StreamWriter("robotlog.txt", false) { AutoFlush = true } } ; // Write to file _logWriter.WriteLine(message); // Write to GUI this.Dispatcher.InvokeAsync(() => { TextBoxOutput.AppendText(message + Environment.NewLine); TextBoxOutput.ScrollToEnd(); }); }
private void Initialize() { if (FloorCount == 0) { FloorCount = 4; } if (ElevatorCount == 0) { ElevatorCount = 3; } if (OutputBox == null) { OutputBox = this.textBox1; } if (Output == null) { Output = new TextBoxOutput(OutputBox); } CreateBuilding(); }
public SendManySms() { InitializeComponent(); smsPhone1 = new SmsPhone(FormFactor.Bar, "BP20200406"); smsPhone1.AddSimCard(new SimCard(), output); smsPhone2 = new SmsPhone(FormFactor.Bar, "BP20200409"); smsPhone2.AddSimCard(new SimCard(), output); smsPhone3 = new SmsPhone(FormFactor.Bar, "BP20200406"); smsPhone3.AddSimCard(new SimCard(), output); smsPhone4 = new SmsPhone(FormFactor.Bar, "BP20200409"); smsPhone4.AddSimCard(new SimCard(), output); output = new TextBoxOutput(this.receivedSms); var contact1 = smsPhone1.GetMyContact("Alex"); var contact2 = smsPhone2.GetMyContact("Vova"); var contact3 = smsPhone3.GetMyContact("Stas"); var contact4 = smsPhone4.GetMyContact("Oleg"); smsPhone1.AddContact(contact2, contact3, contact4); smsPhone2.AddContact(contact1); smsPhone3.AddContact(contact1); smsPhone4.AddContact(contact1); phones = new GeneralPhone[] { smsPhone1, smsPhone2, smsPhone3, smsPhone4 }; smsFormatting.DataSource = Enum.GetNames(typeof(TextBoxOutput.FormatingStyle)); cmbWords.DataSource = new List <string>() { FILTER_ALL_VALUES }.Concat(words).ToArray(); cmbLogic.DataSource = Enum.GetNames(typeof(LogicOperand)); dtpFrom.CustomFormat = "MM/dd/yyyy hh:mm:ss"; dtpTo.CustomFormat = "MM/dd/yyyy hh:mm:ss"; resetFilters(); }
public IPhone AddSimCard(SimCard simCard, TextBoxOutput output = null) { bool added = false; for (int i = 0; i < SimCards.Length; i++) { if (SimCards[i] == null) { SimCards[i] = simCard; added = true; break; } } if (!added) { throw new Exception("No free slot found for SimCard"); } simCard.CallReceiver = this.UseComponent <Communicator>().CallSubscribe(output); simCard.SmsReceiver = this.UseComponent <Communicator>().SmsSubscribe(output); return(this); }
public void MakeCall(int duration, string name, TextBoxOutput output = null, int simNum = 0) { Contact contact = this.UseComponent <Memory>().Get <Contact>().Where(x => x.Name == name).First(); this.UseComponent <Communicator>().MakeCall(contact, duration, output, simNum); }
private void ButtonClose_Click(object sender, EventArgs e) { this.Hide(); TextBoxOutput.Clear(); }
private void ShowTransliteration_Activated(object sender, EventArgs e) { TextBoxOutput.Focus(); }
private void RadioButtonEncrypt_CheckedChanged(object sender, EventArgs e) { TextBoxInput.Clear(); TextBoxOutput.Clear(); }
public SendSmsReceiveCalls() { InitializeComponent(); outputEvents = new TextBoxOutput(this.receivedEvents); phone1 = new SmsCallPhone(FormFactor.Bar, "BP20200406"); phone1.AddSimCard(new SimCard(), outputEvents); phone2 = new SmsCallPhone(FormFactor.Bar, "BP20200409"); phone2.AddSimCard(new SimCard(), outputEvents); phone3 = new SmsCallPhone(FormFactor.Bar, "BP20200406"); phone3.AddSimCard(new SimCard(), outputEvents); phone41 = new SmsCallPhone(FormFactor.Bar, "BP20200409"); phone41.AddSimCard(new SimCard(), outputEvents); phone42 = new SmsCallPhone(FormFactor.Bar, "BP20200507"); phone42.AddSimCard(new SimCard(), outputEvents); phone5 = new SmsCallPhone(FormFactor.Bar, "BP20200511"); phone5.AddSimCard(new SimCard(), outputEvents); phone5.AddSimCard(new SimCard(), outputEvents); var contact1 = phone1.GetMyContact("Alex"); var contact2 = phone2.GetMyContact("Vova"); var contact3 = phone3.GetMyContact("Stas"); var contact41 = phone41.GetMyContact("Oleg"); var contact42 = phone42.GetMyContact("Oleg"); var contact51 = phone5.GetMyContact("Roma"); var contact52 = phone5.GetMyContact("Roma", 1); phone1.AddContact(contact2, contact42, contact51, contact52); phone2.AddContact(contact1); phone3.AddContact(contact1); phone41.AddContact(contact1); phone42.AddContact(contact1); phone5.AddContact(contact1); phones = new IPhone[] { phone1, phone2, phone3, phone41, phone42, phone5 }; smsFormatting.DataSource = Enum.GetNames(typeof(TextBoxOutput.FormatingStyle)); cmbWords.DataSource = new List <string>() { FILTER_ALL_VALUES }.Concat(words).ToArray(); cmbLogic.DataSource = Enum.GetNames(typeof(LogicOperand)); dtpFrom.CustomFormat = "dd/MM/yyyy hh:mm:ss"; dtpTo.CustomFormat = "dd/MM/yyyy hh:mm:ss"; resetFilters(); sendSms = delegate { int arrLength = words.Length - 1; phone1.SendSms($"smsVSOR|{words[random.Next(arrLength)]}|{smsCount++}", outputEvents, 0, "Vova", "Oleg", "Roma"); phone2.SendSms($"smsVA|{words[random.Next(arrLength)]}|{smsCount++}", outputEvents, 0, "Alex"); phone3.SendSms($"smsSA|{words[random.Next(arrLength)]}|{smsCount++}", outputEvents, 0, "Alex"); phone41.SendSms($"smsOA|{words[random.Next(arrLength)]}|{smsCount++}", outputEvents, 0, "Alex"); phone42.SendSms($"smsOA|{words[random.Next(arrLength)]}|{smsCount++}", outputEvents, 0, "Alex"); phone5.SetActiveSimCard(0).SendSms($"smsR1A|{words[random.Next(arrLength)]}|{smsCount++}", outputEvents, 0, "Alex"); phone5.SetActiveSimCard(1).SendSms($"smsR2A|{words[random.Next(arrLength)]}|{smsCount++}", outputEvents, 0, "Alex"); cbxSubscribers.DataSource = getAllSenders(phones); }; var callers = new IPhone[] { phone2, phone41, phone42, phone5 }; var callTo = new string[] { "Vova", "Oleg", "Roma" }; receiveCalls = delegate { callers[random.Next(3)].SetActiveSimCard(0).MakeCall(random.Next(300, 3000), "Alex", outputEvents); phone1.MakeCall(random.Next(300, 3000), callTo[random.Next(2)], outputEvents); phone5.SetActiveSimCard(0).MakeCall(random.Next(300, 3000), "Alex", outputEvents); phone5.SetActiveSimCard(1).MakeCall(random.Next(300, 3000), "Alex", outputEvents); phone1.MakeCall(random.Next(300, 3000), "Oleg", outputEvents); phone1.MakeCall(random.Next(300, 3000), "Roma", outputEvents, 1); phone1.MakeCall(random.Next(300, 3000), "Roma", outputEvents); phone3.MakeCall(111, "Alex", outputEvents); phone3.MakeCall(222, "Alex", outputEvents); phone41.MakeCall(333, "Alex", outputEvents); phone41.MakeCall(444, "Alex", outputEvents); cbxSubscribers.DataSource = getAllCallers(phones); }; powerbank = new PowerBank("PB20200430"); powerbank.PluginToUse = Plugins.Usb; }
private void AddOutput(string text) { TextBoxOutput.AppendText(text + Environment.NewLine); }