InfoForm.cs 1.4 KB

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