Skip to content

Commit cd6c9ad

Browse files
committed
* Added AboutWindow
* Added more functions behind GUI components
1 parent d3ab718 commit cd6c9ad

File tree

5 files changed

+169
-2
lines changed

5 files changed

+169
-2
lines changed

MemPlus/MemPlus.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
<Generator>MSBuild:Compile</Generator>
6464
<SubType>Designer</SubType>
6565
</ApplicationDefinition>
66+
<Page Include="Windows\AboutWindow.xaml">
67+
<SubType>Designer</SubType>
68+
<Generator>MSBuild:Compile</Generator>
69+
</Page>
6670
<Page Include="Windows\LogWindow.xaml">
6771
<SubType>Designer</SubType>
6872
<Generator>MSBuild:Compile</Generator>
@@ -84,6 +88,9 @@
8488
<Compile Include="Classes\RAM\RamController.cs" />
8589
<Compile Include="Classes\RAM\RamOptimizer.cs" />
8690
<Compile Include="Classes\GUI\StyleManager.cs" />
91+
<Compile Include="Windows\AboutWindow.xaml.cs">
92+
<DependentUpon>AboutWindow.xaml</DependentUpon>
93+
</Compile>
8794
<Compile Include="Windows\LogWindow.xaml.cs">
8895
<DependentUpon>LogWindow.xaml</DependentUpon>
8996
</Compile>

MemPlus/Windows/AboutWindow.xaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<syncfusion:ChromelessWindow
2+
x:Class="MemPlus.Windows.AboutWindow"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
8+
mc:Ignorable="d"
9+
TitleTextAlignment="Center"
10+
WindowStartupLocation="CenterScreen"
11+
UseLayoutRounding="True"
12+
Title="MemPlus - About" Height="200" Width="350" Icon="/MemPlus;component/Resources/Images/ram.png">
13+
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
14+
<Grid.RowDefinitions>
15+
<RowDefinition></RowDefinition>
16+
<RowDefinition Height="Auto"></RowDefinition>
17+
</Grid.RowDefinitions>
18+
<Grid>
19+
<Grid.ColumnDefinitions>
20+
<ColumnDefinition Width="Auto"></ColumnDefinition>
21+
<ColumnDefinition Width="Auto"></ColumnDefinition>
22+
<ColumnDefinition Width="Auto"></ColumnDefinition>
23+
</Grid.ColumnDefinitions>
24+
<Image Width="64" Height="64" Source="/MemPlus;component/Resources/Images/ram.png"></Image>
25+
<Separator Margin="5" Grid.Column="1" Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
26+
<TextBlock Grid.Column="2">
27+
MemPlus was created by DeadLine.<LineBreak></LineBreak>
28+
<LineBreak></LineBreak>
29+
Images: small-n-flat by paomedia<LineBreak></LineBreak>
30+
Theme: Syncfusion<LineBreak></LineBreak>
31+
Version: 1.0.0.0<LineBreak></LineBreak>
32+
<LineBreak></LineBreak>
33+
Copyright © CodeDead 2018
34+
</TextBlock>
35+
</Grid>
36+
<Grid Grid.Row="1">
37+
<Grid.ColumnDefinitions>
38+
<ColumnDefinition></ColumnDefinition>
39+
<ColumnDefinition></ColumnDefinition>
40+
<ColumnDefinition></ColumnDefinition>
41+
</Grid.ColumnDefinitions>
42+
<Button Margin="5" x:Name="BtnClose" Content="Close" Click="BtnClose_OnClick"></Button>
43+
<Button Margin="5" Grid.Column="1" x:Name="BtnLicense" Content="License" Click="BtnLicense_OnClick"></Button>
44+
<Button Margin="5" Grid.Column="2" x:Name="BtnCodeDead" Content="CodeDead" Click="BtnCodeDead_OnClick"></Button>
45+
</Grid>
46+
</Grid>
47+
</syncfusion:ChromelessWindow>
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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+
}

MemPlus/Windows/MainWindow.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@
8787
</MenuItem.Icon>
8888
</MenuItem>
8989
<Separator />
90-
<MenuItem Header="Donate">
90+
<MenuItem Header="Donate" Click="DonateMenuItem_OnClick">
9191
<MenuItem.Icon>
9292
<Image Width="16" Height="16" Source="/Resources/Images/donate.png"/>
9393
</MenuItem.Icon>
9494
</MenuItem>
95-
<MenuItem Header="About">
95+
<MenuItem Header="About" Click="MenuItem_OnClick">
9696
<MenuItem.Icon>
9797
<Image Width="16" Height="16" Source="/Resources/Images/about.png"/>
9898
</MenuItem.Icon>

MemPlus/Windows/MainWindow.xaml.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ private void HomePageMenuItem_OnClick(object sender, RoutedEventArgs e)
120120
{
121121
try
122122
{
123+
_logController.AddLog(new ApplicationLog("Opening CodeDead website"));
123124
System.Diagnostics.Process.Start("https://codedead.com/");
124125
}
125126
catch (Exception ex)
@@ -128,5 +129,24 @@ private void HomePageMenuItem_OnClick(object sender, RoutedEventArgs e)
128129
MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error);
129130
}
130131
}
132+
133+
private void DonateMenuItem_OnClick(object sender, RoutedEventArgs e)
134+
{
135+
try
136+
{
137+
_logController.AddLog(new ApplicationLog("Opening donation website"));
138+
System.Diagnostics.Process.Start("https://codedead.com/?page_id=302");
139+
}
140+
catch (Exception ex)
141+
{
142+
_logController.AddLog(new ApplicationLog(ex.Message));
143+
MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error);
144+
}
145+
}
146+
147+
private void MenuItem_OnClick(object sender, RoutedEventArgs e)
148+
{
149+
new AboutWindow(_logController).ShowDialog();
150+
}
131151
}
132152
}

0 commit comments

Comments
 (0)