|
| 1 | +using System; |
| 2 | +using System.Diagnostics; |
| 3 | +using System.Windows; |
| 4 | +using MemPlus.Classes.GUI; |
| 5 | +using MemPlus.Classes.LOG; |
| 6 | + |
| 7 | +namespace MemPlus.Windows |
| 8 | +{ |
| 9 | + /// <inheritdoc cref="Syncfusion.Windows.Shared.ChromelessWindow" /> |
| 10 | + /// <summary> |
| 11 | + /// Interaction logic for AboutWindow.xaml |
| 12 | + /// </summary> |
| 13 | + public partial class AboutWindow |
| 14 | + { |
| 15 | + private readonly LogController _logController; |
| 16 | + |
| 17 | + /// <inheritdoc /> |
| 18 | + /// <summary> |
| 19 | + /// Initialize a new AboutWindow |
| 20 | + /// </summary> |
| 21 | + public AboutWindow(LogController logController) |
| 22 | + { |
| 23 | + _logController = logController; |
| 24 | + _logController.AddLog(new ApplicationLog("Initializing AboutWindow")); |
| 25 | + |
| 26 | + InitializeComponent(); |
| 27 | + ChangeVisualStyle(); |
| 28 | + |
| 29 | + _logController.AddLog(new ApplicationLog("Done initializing AboutWindow")); |
| 30 | + } |
| 31 | + |
| 32 | + /// <summary> |
| 33 | + /// Change the visual style of the controls, depending on the settings. |
| 34 | + /// </summary> |
| 35 | + private void ChangeVisualStyle() |
| 36 | + { |
| 37 | + _logController.AddLog(new ApplicationLog("Changing AboutWindow theme style")); |
| 38 | + |
| 39 | + StyleManager.ChangeStyle(this); |
| 40 | + |
| 41 | + _logController.AddLog(new ApplicationLog("Done changing AboutWindow theme style")); |
| 42 | + } |
| 43 | + |
| 44 | + /// <summary> |
| 45 | + /// Close the current window |
| 46 | + /// </summary> |
| 47 | + /// <param name="sender">The object that has initialized the method</param> |
| 48 | + /// <param name="e">The routed event arguments</param> |
| 49 | + private void BtnClose_OnClick(object sender, RoutedEventArgs e) |
| 50 | + { |
| 51 | + _logController.AddLog(new ApplicationLog("Closing AboutWindow")); |
| 52 | + Close(); |
| 53 | + } |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// Open the file containing the license for MemPlus |
| 57 | + /// </summary> |
| 58 | + /// <param name="sender">The object that has initialized the method</param> |
| 59 | + /// <param name="e">The routed event arguments</param> |
| 60 | + private void BtnLicense_OnClick(object sender, RoutedEventArgs e) |
| 61 | + { |
| 62 | + try |
| 63 | + { |
| 64 | + _logController.AddLog(new ApplicationLog("Opening MemPlus license file")); |
| 65 | + Process.Start(AppDomain.CurrentDomain.BaseDirectory + "\\gpl.pdf"); |
| 66 | + } |
| 67 | + catch (Exception ex) |
| 68 | + { |
| 69 | + _logController.AddLog(new ApplicationLog(ex.Message)); |
| 70 | + MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error); |
| 71 | + } |
| 72 | + } |
| 73 | + |
| 74 | + /// <summary> |
| 75 | + /// Open the CodeDead website |
| 76 | + /// </summary> |
| 77 | + /// <param name="sender">The object that has initialized the method</param> |
| 78 | + /// <param name="e">The routed event arguments</param> |
| 79 | + private void BtnCodeDead_OnClick(object sender, RoutedEventArgs e) |
| 80 | + { |
| 81 | + try |
| 82 | + { |
| 83 | + _logController.AddLog(new ApplicationLog("Opening CodeDead website")); |
| 84 | + Process.Start("https://codedead.com/"); |
| 85 | + } |
| 86 | + catch (Exception ex) |
| 87 | + { |
| 88 | + _logController.AddLog(new ApplicationLog(ex.Message)); |
| 89 | + MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error); |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | +} |
0 commit comments