Skip to content

Commit b94afb8

Browse files
committed
Updated to v1.0.1.0
- Fixed problems with window display when DPI scaling is enabled;
1 parent faa3352 commit b94afb8

16 files changed

+234
-139
lines changed

SavePandaWLE/Helpers/AppInfo.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Diagnostics;
1+
// v2024-08-06 23:50:49
2+
3+
using System.Diagnostics;
24
using System.Reflection;
35

46
namespace SavePandaWLE.Helpers;
Lines changed: 84 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,95 @@
1-
using SavePandaWolongEditionCore.Helpers;
1+
// v2024-08-06 23:50:49
22

3-
namespace SavePandaWLE.Helpers
4-
{
5-
public class SimpleMediatorWinForms : ISimpleMediator
6-
{
7-
/// <summary>
8-
/// Default constructor.
9-
/// </summary>
10-
public SimpleMediatorWinForms() { }
3+
using SavePandaWolongEditionCore.Helpers;
4+
using static SavePandaWolongEditionCore.Helpers.ISimpleMediator;
115

12-
/// <summary>
13-
/// Translates <see cref="ISimpleMediator.QuestionOptions"/> to <see cref="MessageBoxButtons"/>
14-
/// </summary>
15-
/// <param name="questionOptions"></param>
16-
/// <returns></returns>
17-
private static MessageBoxButtons GetDialogOpt(ISimpleMediator.QuestionOptions questionOptions)
18-
{
19-
return questionOptions switch
20-
{
21-
ISimpleMediator.QuestionOptions.OkCancel => MessageBoxButtons.OKCancel,
22-
ISimpleMediator.QuestionOptions.AbortRetryIgnore => MessageBoxButtons.AbortRetryIgnore,
23-
ISimpleMediator.QuestionOptions.YesNoCancel => MessageBoxButtons.YesNoCancel,
24-
ISimpleMediator.QuestionOptions.YesNo => MessageBoxButtons.YesNo,
25-
ISimpleMediator.QuestionOptions.RetryCancel => MessageBoxButtons.RetryCancel,
26-
ISimpleMediator.QuestionOptions.CancelTryContinue => MessageBoxButtons.CancelTryContinue,
27-
_ => MessageBoxButtons.OKCancel
28-
};
29-
}
6+
namespace SavePandaWLE.Helpers;
307

31-
/// <summary>
32-
/// Translates <see cref="ISimpleMediator.DialogType"/> to <see cref="MessageBoxIcon"/>
33-
/// </summary>
34-
/// <param name="dialogType"></param>
35-
/// <returns></returns>
36-
private static MessageBoxIcon GetDialogType(ISimpleMediator.DialogType dialogType)
8+
public class SimpleMediatorWinForms : ISimpleMediator
9+
{
10+
/// <summary>
11+
/// Default constructor.
12+
/// </summary>
13+
public SimpleMediatorWinForms() { }
14+
15+
/// <summary>
16+
/// Translates <see cref="ISimpleMediator.QuestionOptions"/> to <see cref="MessageBoxButtons"/>
17+
/// </summary>
18+
/// <param name="questionOptions"></param>
19+
/// <returns></returns>
20+
private static MessageBoxButtons GetDialogOpt(QuestionOptions questionOptions)
21+
{
22+
return questionOptions switch
3723
{
38-
return dialogType switch
39-
{
40-
ISimpleMediator.DialogType.None => MessageBoxIcon.None,
41-
ISimpleMediator.DialogType.Question => MessageBoxIcon.Question,
42-
ISimpleMediator.DialogType.Exclamation => MessageBoxIcon.Exclamation,
43-
ISimpleMediator.DialogType.Error => MessageBoxIcon.Error,
44-
ISimpleMediator.DialogType.Warning => MessageBoxIcon.Warning,
45-
ISimpleMediator.DialogType.Information => MessageBoxIcon.Information,
46-
_ => MessageBoxIcon.None
47-
};
48-
}
24+
QuestionOptions.OkCancel => MessageBoxButtons.OKCancel,
25+
QuestionOptions.AbortRetryIgnore => MessageBoxButtons.AbortRetryIgnore,
26+
QuestionOptions.YesNoCancel => MessageBoxButtons.YesNoCancel,
27+
QuestionOptions.YesNo => MessageBoxButtons.YesNo,
28+
QuestionOptions.RetryCancel => MessageBoxButtons.RetryCancel,
29+
QuestionOptions.CancelTryContinue => MessageBoxButtons.CancelTryContinue,
30+
_ => MessageBoxButtons.OKCancel
31+
};
32+
}
4933

50-
/// <summary>
51-
/// Ask the user a simple question and get an answer.
52-
/// </summary>
53-
/// <param name="question"></param>
54-
/// <param name="caption"></param>
55-
/// <param name="questionOptions"></param>
56-
/// <param name="dialogType"></param>
57-
/// <returns></returns>
58-
public ISimpleMediator.DialogAnswer Ask(string question, string caption, ISimpleMediator.QuestionOptions questionOptions, ISimpleMediator.DialogType dialogType)
34+
/// <summary>
35+
/// Translates <see cref="ISimpleMediator.DialogType"/> to <see cref="MessageBoxIcon"/>
36+
/// </summary>
37+
/// <param name="dialogType"></param>
38+
/// <returns></returns>
39+
private static MessageBoxIcon GetDialogType(DialogType dialogType)
40+
{
41+
return dialogType switch
5942
{
60-
var dlgOpt = GetDialogOpt(questionOptions);
61-
var dlgType = GetDialogType(dialogType);
43+
DialogType.None => MessageBoxIcon.None,
44+
DialogType.Question => MessageBoxIcon.Question,
45+
DialogType.Exclamation => MessageBoxIcon.Exclamation,
46+
DialogType.Error => MessageBoxIcon.Error,
47+
DialogType.Warning => MessageBoxIcon.Warning,
48+
DialogType.Information => MessageBoxIcon.Information,
49+
_ => MessageBoxIcon.None
50+
};
51+
}
6252

63-
var dialogResult = MessageBox.Show(question, caption, dlgOpt, dlgType);
53+
/// <summary>
54+
/// Ask the user a simple question and get an answer.
55+
/// </summary>
56+
/// <param name="question"></param>
57+
/// <param name="caption"></param>
58+
/// <param name="questionOptions"></param>
59+
/// <param name="dialogType"></param>
60+
/// <returns></returns>
61+
public DialogAnswer Ask(string question, string caption, QuestionOptions questionOptions, DialogType dialogType)
62+
{
63+
var dlgOpt = GetDialogOpt(questionOptions);
64+
var dlgType = GetDialogType(dialogType);
6465

65-
return dialogResult switch
66-
{
67-
DialogResult.None => ISimpleMediator.DialogAnswer.None,
68-
DialogResult.OK => ISimpleMediator.DialogAnswer.Ok,
69-
DialogResult.Cancel => ISimpleMediator.DialogAnswer.Cancel,
70-
DialogResult.Abort => ISimpleMediator.DialogAnswer.Abort,
71-
DialogResult.Retry => ISimpleMediator.DialogAnswer.Retry,
72-
DialogResult.Ignore => ISimpleMediator.DialogAnswer.Ignore,
73-
DialogResult.Yes => ISimpleMediator.DialogAnswer.Yes,
74-
DialogResult.No => ISimpleMediator.DialogAnswer.No,
75-
DialogResult.TryAgain => ISimpleMediator.DialogAnswer.TryAgain,
76-
DialogResult.Continue => ISimpleMediator.DialogAnswer.Continue,
77-
_ => ISimpleMediator.DialogAnswer.None
78-
};
79-
}
66+
var dialogResult = MessageBox.Show(question, caption, dlgOpt, dlgType);
8067

81-
/// <summary>
82-
/// Send a message to the user.
83-
/// </summary>
84-
/// <param name="info"></param>
85-
/// <param name="caption"></param>
86-
/// <param name="dialogType"></param>
87-
public void Inform(string info, string caption, ISimpleMediator.DialogType dialogType)
68+
return dialogResult switch
8869
{
89-
var dlgType = GetDialogType(dialogType);
90-
MessageBox.Show(info, caption, MessageBoxButtons.OK, dlgType);
91-
}
70+
DialogResult.None => DialogAnswer.None,
71+
DialogResult.OK => DialogAnswer.Ok,
72+
DialogResult.Cancel => DialogAnswer.Cancel,
73+
DialogResult.Abort => DialogAnswer.Abort,
74+
DialogResult.Retry => DialogAnswer.Retry,
75+
DialogResult.Ignore => DialogAnswer.Ignore,
76+
DialogResult.Yes => DialogAnswer.Yes,
77+
DialogResult.No => DialogAnswer.No,
78+
DialogResult.TryAgain => DialogAnswer.TryAgain,
79+
DialogResult.Continue => DialogAnswer.Continue,
80+
_ => DialogAnswer.None
81+
};
82+
}
83+
84+
/// <summary>
85+
/// Send a message to the user.
86+
/// </summary>
87+
/// <param name="info"></param>
88+
/// <param name="caption"></param>
89+
/// <param name="dialogType"></param>
90+
public void Inform(string info, string caption, DialogType dialogType)
91+
{
92+
var dlgType = GetDialogType(dialogType);
93+
MessageBox.Show(info, caption, MessageBoxButtons.OK, dlgType);
9294
}
93-
}
95+
}

SavePandaWLE/Form1.Designer.cs renamed to SavePandaWLE/MainForm.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SavePandaWLE/Form1.cs renamed to SavePandaWLE/MainForm.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
namespace SavePandaWLE;
88

9-
public partial class Form1 : Form
9+
public partial class MainForm : Form
1010
{
1111
// Program Core
1212
private readonly Core _programCore;
1313

14-
public Form1()
14+
public MainForm()
1515
{
1616
var mediator = new SimpleMediatorWinForms();
1717
var pText = new Progress<string>(s => toolStripStatusLabel1.Text = s);
File renamed without changes.

SavePandaWLE/Program.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
using SavePandaWLE;
1+
namespace SavePandaWLE;
22

3-
namespace SavePandaWLE
3+
internal static class Program
44
{
5-
internal static class Program
5+
/// <summary>
6+
/// The main entry point for the application.
7+
/// </summary>
8+
[STAThread]
9+
internal static void Main()
610
{
7-
/// <summary>
8-
/// The main entry point for the application.
9-
/// </summary>
10-
[STAThread]
11-
static void Main()
12-
{
13-
// To customize application configuration such as set high DPI settings or default font,
14-
// see https://aka.ms/applicationconfiguration.
15-
ApplicationConfiguration.Initialize();
16-
Application.Run(new Form1());
17-
}
11+
// To customize application configuration such as set high DPI settings or default font,
12+
// see https://aka.ms/applicationconfiguration.
13+
ApplicationConfiguration.Initialize();
14+
Application.Run(new MainForm());
1815
}
1916
}

SavePandaWolongEditionCore/Helpers/Base64Deencryptor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Text;
1+
// v2024-07-13 21:16:48
2+
3+
using System.Text;
24

35
namespace SavePandaWolongEditionCore.Helpers;
46

SavePandaWolongEditionCore/Helpers/BinReader.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Text;
1+
// v2024-08-06 23:19:03
2+
3+
using System.Text;
24

35
namespace SavePandaWolongEditionCore.Helpers;
46

SavePandaWolongEditionCore/Helpers/BinWriter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Text;
1+
// v2024-08-06 23:19:03
2+
3+
using System.Text;
24

35
namespace SavePandaWolongEditionCore.Helpers;
46

SavePandaWolongEditionCore/Helpers/CustomBitConverter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Runtime.InteropServices;
1+
// v2024-08-03 21:16:48
2+
3+
using System.Runtime.InteropServices;
24
using System.Text;
35
using static System.Globalization.NumberStyles;
46

SavePandaWolongEditionCore/Helpers/ISimpleMediator.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace SavePandaWolongEditionCore.Helpers;
1+
// v2024-08-03 21:16:48
2+
3+
namespace SavePandaWolongEditionCore.Helpers;
24

35
public interface ISimpleMediator
46
{

0 commit comments

Comments
 (0)