InfoForm.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. namespace Optimizer {
  6. public sealed partial class InfoForm : Form {
  7. public InfoForm(string info) {
  8. InitializeComponent();
  9. CheckForIllegalCrossThreadCalls = false;
  10. OptionsHelper.ApplyTheme(this);
  11. txtInfo.Text = info;
  12. // translate UI elements
  13. if (OptionsHelper.CurrentOptions.LanguageCode != LanguageCode.EN) Translate();
  14. }
  15. private void Translate() {
  16. Dictionary<string, string> translationList = OptionsHelper.TranslationList.ToObject<Dictionary<string, string>>();
  17. Control element;
  18. foreach (var x in translationList) {
  19. if (x.Key == null || x.Key == string.Empty) continue;
  20. element = this.Controls.Find(x.Key, true).FirstOrDefault();
  21. if (element == null) continue;
  22. element.Text = x.Value;
  23. }
  24. }
  25. private void btnOK_Click(object sender, EventArgs e) {
  26. this.Close();
  27. }
  28. private void Info_Load(object sender, EventArgs e) {
  29. }
  30. private void copyIPB_Click(object sender, EventArgs e) {
  31. try {
  32. Clipboard.SetText(txtInfo.Text);
  33. }
  34. catch { }
  35. }
  36. }
  37. }