Skip to content

Commit 23bcac1

Browse files
committed
* Simplified exporting
* Added code comments
1 parent 9dbc683 commit 23bcac1

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

MemPlus/Business/UTILS/Utils.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ internal static List<RamStick> GetRamSticks()
104104
/// Export all RamStick objects
105105
/// </summary>
106106
/// <param name="logController">The LogController object that can be used to add logs</param>
107+
/// <returns>True if the operation completed successfully, otherwise false</returns>
107108
internal static bool ExportRamSticks(LogController logController)
108109
{
109110
List<RamStick> ramSticks = GetRamSticks();
@@ -150,6 +151,7 @@ internal static bool ExportRamSticks(LogController logController)
150151
/// </summary>
151152
/// <param name="logType">The LogType that should be exported (can be null to export all logs)</param>
152153
/// <param name="logController">The LogController object that can be used to export logs</param>
154+
/// <returns>True if the operation complted successfully, otherwise false</returns>
153155
internal static bool ExportLogs(LogType? logType, LogController logController)
154156
{
155157
if (logType != null)
@@ -197,6 +199,7 @@ internal static bool ExportLogs(LogType? logType, LogController logController)
197199
/// Export all ProcessDetail objects
198200
/// </summary>
199201
/// <param name="logController">The LogController object that can be used to add logs</param>
202+
/// <returns>True if the operation completed successfully, otherwise false</returns>
200203
internal static async Task<bool> ExportProcessDetails(LogController logController)
201204
{
202205
SaveFileDialog sfd = new SaveFileDialog

MemPlus/Views/Windows/MainWindow.xaml.cs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ internal void LoadLanguage()
156156
case 1:
157157
langUri = new Uri("..\\Resources\\Languages\\nl.xaml", UriKind.Relative);
158158
break;
159+
case 2:
160+
langUri = new Uri("..\\Resources\\Languages\\yourlang.xaml", UriKind.Relative);
161+
break;
159162
}
160163
}
161164
catch (Exception ex)
@@ -648,10 +651,7 @@ private void AboutMenuItem_OnClick(object sender, RoutedEventArgs e)
648651
/// <param name="e">The RoutedEventArgs</param>
649652
private void RamExportMenuItem_OnClick(object sender, RoutedEventArgs e)
650653
{
651-
if (Utils.ExportLogs(LogType.Ram, _logController))
652-
{
653-
MessageBox.Show((string)Application.Current.FindResource("ExportedAllData"), "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
654-
}
654+
ExportLogs(LogType.Ram);
655655
}
656656

657657
/// <summary>
@@ -661,10 +661,7 @@ private void RamExportMenuItem_OnClick(object sender, RoutedEventArgs e)
661661
/// <param name="e">The RoutedEventArgs</param>
662662
private void ProcessExportMenuItem_OnClick(object sender, RoutedEventArgs e)
663663
{
664-
if (Utils.ExportLogs(LogType.Process, _logController))
665-
{
666-
MessageBox.Show((string)Application.Current.FindResource("ExportedAllData"), "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
667-
}
664+
ExportLogs(LogType.Process);
668665
}
669666

670667
/// <summary>
@@ -674,10 +671,7 @@ private void ProcessExportMenuItem_OnClick(object sender, RoutedEventArgs e)
674671
/// <param name="e">The RoutedEventArgs</param>
675672
private void ApplicationExportMenuItem_OnClick(object sender, RoutedEventArgs e)
676673
{
677-
if (Utils.ExportLogs(LogType.Application, _logController))
678-
{
679-
MessageBox.Show((string)Application.Current.FindResource("ExportedAllData"), "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
680-
}
674+
ExportLogs(LogType.Application);
681675
}
682676

683677
/// <summary>
@@ -687,7 +681,16 @@ private void ApplicationExportMenuItem_OnClick(object sender, RoutedEventArgs e)
687681
/// <param name="e">The RoutedEventArgs</param>
688682
private void ExportAllLogsMenuItem_OnClick(object sender, RoutedEventArgs e)
689683
{
690-
if (Utils.ExportLogs(null, _logController))
684+
ExportLogs(null);
685+
}
686+
687+
/// <summary>
688+
/// Export logs of a certain type
689+
/// </summary>
690+
/// <param name="logType">The type of log that needs to be exported</param>
691+
private void ExportLogs(LogType? logType)
692+
{
693+
if (Utils.ExportLogs(logType, _logController))
691694
{
692695
MessageBox.Show((string)Application.Current.FindResource("ExportedAllData"), "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
693696
}

0 commit comments

Comments
 (0)