Fixed form StartPositions

This commit is contained in:
pointfeev 2021-07-30 03:19:46 -05:00
parent 0a4cf5851f
commit 3189e7462a
8 changed files with 14 additions and 11 deletions

View file

@ -6,7 +6,7 @@
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>ini.ico</ApplicationIcon> <ApplicationIcon>ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract> <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>1.0.1</Version> <Version>1.0.2</Version>
<PackageIcon>ini.ico</PackageIcon> <PackageIcon>ini.ico</PackageIcon>
<PackageIconUrl /> <PackageIconUrl />
<Description>Automatically downloads and installs CreamAPI files for programs/games.</Description> <Description>Automatically downloads and installs CreamAPI files for programs/games.</Description>

View file

@ -131,7 +131,7 @@ namespace CreamInstaller
this.MaximizeBox = false; this.MaximizeBox = false;
this.MinimizeBox = false; this.MinimizeBox = false;
this.Name = "DialogForm"; this.Name = "DialogForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "DialogForm"; this.Text = "DialogForm";
this.TopMost = true; this.TopMost = true;
((System.ComponentModel.ISupportInitialize)(this.icon)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.icon)).EndInit();

View file

@ -6,8 +6,9 @@ namespace CreamInstaller
{ {
public partial class DialogForm : Form public partial class DialogForm : Form
{ {
public DialogForm() public DialogForm(IWin32Window owner)
{ {
Owner = owner as Form;
InitializeComponent(); InitializeComponent();
} }

View file

@ -126,7 +126,7 @@ namespace CreamInstaller
this.MinimumSize = new System.Drawing.Size(500, 300); this.MinimumSize = new System.Drawing.Size(500, 300);
this.Name = "InstallForm"; this.Name = "InstallForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "InstallForm"; this.Text = "InstallForm";
this.TopMost = true; this.TopMost = true;
this.Load += new System.EventHandler(this.OnLoad); this.Load += new System.EventHandler(this.OnLoad);

View file

@ -11,8 +11,9 @@ namespace CreamInstaller
{ {
public partial class InstallForm : Form public partial class InstallForm : Form
{ {
public InstallForm() public InstallForm(IWin32Window owner)
{ {
Owner = owner as Form;
InitializeComponent(); InitializeComponent();
Program.InstallForm = this; Program.InstallForm = this;
Text = Program.ApplicationName; Text = Program.ApplicationName;

View file

@ -32,7 +32,7 @@ namespace CreamInstaller
} }
Hide(); Hide();
new SelectForm().ShowDialog(); new SelectForm(this).ShowDialog();
Close(); Close();
} }
@ -86,7 +86,7 @@ namespace CreamInstaller
string FileName = Path.GetFileName(Program.CurrentProcessFilePath); string FileName = Path.GetFileName(Program.CurrentProcessFilePath);
if (FileName != "CreamInstaller.exe") if (FileName != "CreamInstaller.exe")
{ {
if (new DialogForm().Show(Program.ApplicationName, SystemIcons.Warning, if (new DialogForm(this).Show(Program.ApplicationName, SystemIcons.Warning,
"WARNING: CreamInstaller.exe was renamed!" + "WARNING: CreamInstaller.exe was renamed!" +
"\n\nThis will cause unwanted behavior when updating the program!", "\n\nThis will cause unwanted behavior when updating the program!",
"Ignore", "Abort") == DialogResult.Cancel) "Ignore", "Abort") == DialogResult.Cancel)
@ -104,7 +104,7 @@ namespace CreamInstaller
} }
catch (ApiException) catch (ApiException)
{ {
if (new DialogForm().Show(Program.ApplicationName, SystemIcons.Warning, if (new DialogForm(this).Show(Program.ApplicationName, SystemIcons.Warning,
$"ERROR: Failed logging into MEGA!" + $"ERROR: Failed logging into MEGA!" +
"\n\nMEGA is likely offline, please try again later. . .", "\n\nMEGA is likely offline, please try again later. . .",
"Retry", "Cancel") == DialogResult.OK) "Retry", "Cancel") == DialogResult.OK)

View file

@ -149,7 +149,7 @@ namespace CreamInstaller
this.MinimumSize = new System.Drawing.Size(500, 328); this.MinimumSize = new System.Drawing.Size(500, 328);
this.Name = "SelectForm"; this.Name = "SelectForm";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "SelectForm"; this.Text = "SelectForm";
this.TopMost = true; this.TopMost = true;
this.Load += new System.EventHandler(this.OnLoad); this.Load += new System.EventHandler(this.OnLoad);

View file

@ -13,8 +13,9 @@ namespace CreamInstaller
{ {
public partial class SelectForm : Form public partial class SelectForm : Form
{ {
public SelectForm() public SelectForm(IWin32Window owner)
{ {
Owner = owner as Form;
InitializeComponent(); InitializeComponent();
Program.SelectForm = this; Program.SelectForm = this;
Text = Program.ApplicationName; Text = Program.ApplicationName;
@ -222,7 +223,7 @@ namespace CreamInstaller
if (Program.ProgramSelections.Count > 0) if (Program.ProgramSelections.Count > 0)
{ {
Hide(); Hide();
new InstallForm().ShowDialog(); new InstallForm(this).ShowDialog();
Close(); Close();
} }
} }