private void DisplayCurrentRound(Round round) { SpinsTextblock.Text = round.Spin.ToString(); TextBox1.Text = round.WinningNumber.ToString(); GoalTextBlock.Text = Goal.ToString("0.00"); MoneyTextBlock.Text = round.Money.ToString("0.00"); BetUnitTextBlock.Text = round.BetUnit.ToString("0.00"); if (round.Spin >= SessionStart) { OutputRichTextBox.Document.Blocks.Clear(); OutputRichTextBox.Document.TextAlignment = TextAlignment.Center; if (round.ExpectedNumbers != null) { OutputRichTextBox.AppendText($"\nPlace {round.BetUnit} on the {round.ExpectedNumbers.Count} expected numbers: " + $"\n\n" + String.Join(", ", round.ExpectedNumbers)); } } else { OutputRichTextBox.Document.Blocks.Clear(); OutputRichTextBox.Document.TextAlignment = TextAlignment.Center; OutputRichTextBox.AppendText($"\nExpected numbers: \n\n ???"); } }
/// <summary> /// Кнопка "Парсинг текста правил" /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ParseRulesButton_Click(object sender, EventArgs e) { try { int gothash = RulesInputRichTextBox.Text.GetHashCode(); if (hash != gothash) { Debug.WriteLineIf(allRules == null, "allRules was null"); Debug.WriteLineIf(hash != RulesInputRichTextBox.Text.GetHashCode(), "hash was:" + hash + " got:" + gothash); hash = gothash; Debug.WriteLine("new hash:" + hash); allRules = transformationComponent.TransformToRules(RulesInputRichTextBox.Text, true); Debug.WriteLine("rules parsed succesful"); AutoCompleteStringCollection names = new AutoCompleteStringCollection(); names.AddRange(allRules.Languages.ToArray()); SourceLangTextBox.AutoCompleteCustomSource = names; SourceLangTextBox.AutoCompleteMode = AutoCompleteMode.Suggest; SourceLangTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource; TargetLangTextBox.AutoCompleteCustomSource = names; TargetLangTextBox.AutoCompleteMode = AutoCompleteMode.Suggest; TargetLangTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource; OutputRichTextBox.StartTimestamp(); OutputRichTextBox.AppendText(DateTime.Now.ToString() + ": Правила запарсены успешно\n", System.Drawing.Color.Black); OutputRichTextBox.EndTimestamp(); } else { Debug.WriteLine("rules where ready and same hash"); if (MessageBox.Show( "Похоже, входная строка не изменилась. Вы уверены, что хотите повторить парсинг?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) { Debug.WriteLine("got yes"); hash = RulesInputRichTextBox.Text.GetHashCode(); Debug.WriteLine("new hash:" + hash); allRules = transformationComponent.TransformToRules(RulesInputRichTextBox.Text, true); Debug.WriteLine("rules parsed succesful"); } else { Debug.WriteLine("got not yes"); } } } catch (Exception ex) { Debug.WriteLine(ex); OutputRichTextBox.AppendException(ex); } }
private void EncryptAppsInSelectedPath() { // find all appx files string directoryPath = UriTextBox.Text; var allDirectoryFilePaths = Directory.GetFiles(directoryPath, "*.appx", SearchOption.AllDirectories); // foreach (var filePath in allDirectoryFilePaths) { //foreach file generate a key for encryption var fileGuidString = Directory.GetParent(filePath).Name; var encryptionKey = FileEncryptor.GenerateEncryptionKey(fileGuidString.ToLower()); // encrypt and save file with generatedKey OutputRichTextBox.AppendText($"Start encrypting file {fileGuidString} ..."); FileEncryptor.EncryptFile(filePath, encryptionKey); OutputRichTextBox.AppendText($"file {fileGuidString} encrypted" + Environment.NewLine); } }
private void ResetUI() { List <TextBox> textBoxes = new List <TextBox> { TextBox1, TextBox2, TextBox3, TextBox4, TextBox5, TextBox6, TextBox7, TextBox8, TextBox9, TextBox10, TextBox11, TextBox12 }; foreach (var tb in textBoxes) { tb.Clear(); } SpinsTextblock.Text = "0"; GoalTextBlock.Text = Goal.ToString("0.00"); MoneyTextBlock.Text = StartingMoney.ToString("0.00"); BetUnitTextBlock.Text = StartingBetUnit.ToString("0.00"); OutputRichTextBox.Document.Blocks.Clear(); OutputRichTextBox.Document.TextAlignment = TextAlignment.Center; OutputRichTextBox.AppendText($"\nExpected numbers: \n\n ???"); }
private void AppendRichText(string message) { OutputRichTextBox.AppendText(String.Format("<{0:yyyy/MM/dd HH:mm:ss}>\n", DateTime.Now)); OutputRichTextBox.AppendText(message); OutputScrollViewer.ScrollToEnd(); }