v3.5.2.0
- Forms now use automatic sizing - Fixed version info being duplicated after update cancellation
This commit is contained in:
parent
851e4ccaf5
commit
ca72e9adf5
7 changed files with 55 additions and 45 deletions
|
@ -14,6 +14,7 @@ internal class CustomForm : Form
|
|||
Owner = (owner as Form) ?? ActiveForm;
|
||||
KeyPreview = true;
|
||||
KeyPress += OnKeyPress;
|
||||
ResizeRedraw = true;
|
||||
}
|
||||
|
||||
protected override CreateParams CreateParams // Double buffering for all controls
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<UseWindowsForms>True</UseWindowsForms>
|
||||
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<Version>3.5.1.0</Version>
|
||||
<Version>3.5.2.0</Version>
|
||||
<PackageIcon>Resources\ini.ico</PackageIcon>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
|
||||
|
|
5
CreamInstaller/Forms/InstallForm.Designer.cs
generated
5
CreamInstaller/Forms/InstallForm.Designer.cs
generated
|
@ -128,6 +128,8 @@ namespace CreamInstaller
|
|||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.ClientSize = new System.Drawing.Size(784, 561);
|
||||
this.Controls.Add(this.reselectButton);
|
||||
this.Controls.Add(this.logTextBox);
|
||||
|
@ -137,11 +139,10 @@ namespace CreamInstaller
|
|||
this.Controls.Add(this.userProgressBar);
|
||||
this.Controls.Add(this.userInfoLabel);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(600, 400);
|
||||
this.Name = "InstallForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "InstallForm";
|
||||
this.Load += new System.EventHandler(this.OnLoad);
|
||||
|
|
45
CreamInstaller/Forms/MainForm.Designer.cs
generated
45
CreamInstaller/Forms/MainForm.Designer.cs
generated
|
@ -21,21 +21,21 @@ namespace CreamInstaller
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.progressLabel = new System.Windows.Forms.Label();
|
||||
this.updateButton = new System.Windows.Forms.Button();
|
||||
this.ignoreButton = new System.Windows.Forms.Button();
|
||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.progressBar = new System.Windows.Forms.ProgressBar();
|
||||
this.changelogTreeView = new CustomTreeView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
// progressLabel
|
||||
//
|
||||
this.label1.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.label1.Location = new System.Drawing.Point(12, 16);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(218, 15);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Checking for updates . . .";
|
||||
this.progressLabel.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.progressLabel.Location = new System.Drawing.Point(12, 16);
|
||||
this.progressLabel.Name = "progressLabel";
|
||||
this.progressLabel.Size = new System.Drawing.Size(218, 15);
|
||||
this.progressLabel.TabIndex = 0;
|
||||
this.progressLabel.Text = "Checking for updates . . .";
|
||||
//
|
||||
// updateButton
|
||||
//
|
||||
|
@ -62,38 +62,41 @@ namespace CreamInstaller
|
|||
this.ignoreButton.UseVisualStyleBackColor = true;
|
||||
this.ignoreButton.Click += new System.EventHandler(this.OnIgnore);
|
||||
//
|
||||
// progressBar1
|
||||
// progressBar
|
||||
//
|
||||
this.progressBar1.Location = new System.Drawing.Point(12, 41);
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Size = new System.Drawing.Size(380, 23);
|
||||
this.progressBar1.TabIndex = 4;
|
||||
this.progressBar1.Visible = false;
|
||||
this.progressBar.Location = new System.Drawing.Point(12, 41);
|
||||
this.progressBar.Name = "progressBar";
|
||||
this.progressBar.Size = new System.Drawing.Size(380, 23);
|
||||
this.progressBar.TabIndex = 4;
|
||||
this.progressBar.Visible = false;
|
||||
//
|
||||
// changelogTreeView
|
||||
//
|
||||
this.changelogTreeView.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawAll;
|
||||
this.changelogTreeView.Location = new System.Drawing.Point(12, 70);
|
||||
this.changelogTreeView.Margin = new System.Windows.Forms.Padding(0, 0, 0, 12);
|
||||
this.changelogTreeView.Name = "changelogTreeView";
|
||||
this.changelogTreeView.Size = new System.Drawing.Size(380, 179);
|
||||
this.changelogTreeView.Sorted = true;
|
||||
this.changelogTreeView.TabIndex = 5;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.ClientSize = new System.Drawing.Size(404, 261);
|
||||
this.Controls.Add(this.changelogTreeView);
|
||||
this.Controls.Add(this.progressBar1);
|
||||
this.Controls.Add(this.progressBar);
|
||||
this.Controls.Add(this.ignoreButton);
|
||||
this.Controls.Add(this.updateButton);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.progressLabel);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(420, 300);
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "MainForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "MainForm";
|
||||
this.Load += new System.EventHandler(this.OnLoad);
|
||||
|
@ -103,10 +106,10 @@ namespace CreamInstaller
|
|||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Label progressLabel;
|
||||
private Button updateButton;
|
||||
private Button ignoreButton;
|
||||
private ProgressBar progressBar1;
|
||||
private ProgressBar progressBar;
|
||||
private CustomTreeView changelogTreeView;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,15 +49,14 @@ internal partial class MainForm : CustomForm
|
|||
|
||||
private async void OnLoad()
|
||||
{
|
||||
Size = new(420, 85);
|
||||
progressBar1.Visible = false;
|
||||
progressBar.Visible = false;
|
||||
ignoreButton.Visible = true;
|
||||
updateButton.Text = "Update";
|
||||
updateButton.Click -= OnUpdateCancel;
|
||||
label1.Text = "Checking for updates . . .";
|
||||
progressLabel.Text = "Checking for updates . . .";
|
||||
changelogTreeView.Visible = false;
|
||||
changelogTreeView.Location = new(12, 41);
|
||||
changelogTreeView.Size = new(380, 208);
|
||||
changelogTreeView.Location = new(progressLabel.Location.X, progressLabel.Location.Y + progressLabel.Size.Height + 13);
|
||||
Refresh();
|
||||
|
||||
GithubPackageResolver resolver = new("pointfeev", "CreamInstaller", "CreamInstaller.zip");
|
||||
ZipPackageExtractor extractor = new();
|
||||
|
@ -87,8 +86,7 @@ internal partial class MainForm : CustomForm
|
|||
}
|
||||
else
|
||||
{
|
||||
Size = new(420, 300);
|
||||
label1.Text = $"An update is available: v{latestVersion}";
|
||||
progressLabel.Text = $"An update is available: v{latestVersion}";
|
||||
ignoreButton.Enabled = true;
|
||||
updateButton.Enabled = true;
|
||||
updateButton.Click += new(OnUpdate);
|
||||
|
@ -96,8 +94,10 @@ internal partial class MainForm : CustomForm
|
|||
Version currentVersion = new(Application.ProductVersion);
|
||||
foreach (Version version in versions.Where(v => v > currentVersion && !changelogTreeView.Nodes.ContainsKey(v.ToString())))
|
||||
{
|
||||
TreeNode root = new($"v{version}");
|
||||
root.Name = root.Text;
|
||||
TreeNode root = new($"v{version}")
|
||||
{
|
||||
Name = version.ToString()
|
||||
};
|
||||
changelogTreeView.Nodes.Add(root);
|
||||
if (changelogTreeView.Nodes.Count > 0) changelogTreeView.Nodes[0].EnsureVisible();
|
||||
_ = Task.Run(async () =>
|
||||
|
@ -155,22 +155,22 @@ internal partial class MainForm : CustomForm
|
|||
|
||||
private async void OnUpdate(object sender, EventArgs e)
|
||||
{
|
||||
progressBar1.Visible = true;
|
||||
progressBar.Visible = true;
|
||||
ignoreButton.Visible = false;
|
||||
updateButton.Text = "Cancel";
|
||||
updateButton.Click -= OnUpdate;
|
||||
updateButton.Click += new(OnUpdateCancel);
|
||||
changelogTreeView.Location = new(12, 70);
|
||||
changelogTreeView.Size = new(380, 179);
|
||||
changelogTreeView.Location = new(progressBar.Location.X, progressBar.Location.Y + progressBar.Size.Height + 6);
|
||||
Refresh();
|
||||
|
||||
Progress<double> progress = new();
|
||||
progress.ProgressChanged += new(delegate (object sender, double _progress)
|
||||
{
|
||||
label1.Text = $"Updating . . . {(int)_progress}%";
|
||||
progressBar1.Value = (int)_progress;
|
||||
progressLabel.Text = $"Updating . . . {(int)_progress}%";
|
||||
progressBar.Value = (int)_progress;
|
||||
});
|
||||
|
||||
label1.Text = "Updating . . . ";
|
||||
progressLabel.Text = "Updating . . . ";
|
||||
cancellationTokenSource = new();
|
||||
try
|
||||
{
|
||||
|
@ -180,6 +180,8 @@ internal partial class MainForm : CustomForm
|
|||
}
|
||||
catch { }
|
||||
|
||||
await Task.Run(() => Thread.Sleep(3000));
|
||||
|
||||
if (updateManager is not null && updateManager.IsUpdatePrepared(latestVersion))
|
||||
{
|
||||
updateManager.LaunchUpdater(latestVersion);
|
||||
|
@ -191,15 +193,15 @@ internal partial class MainForm : CustomForm
|
|||
|
||||
private void OnUpdateCancel(object sender, EventArgs e)
|
||||
{
|
||||
cancellationTokenSource.Cancel();
|
||||
updateManager.Dispose();
|
||||
cancellationTokenSource?.Cancel();
|
||||
updateManager?.Dispose();
|
||||
updateManager = null;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && components is not null)
|
||||
components.Dispose();
|
||||
if (disposing)
|
||||
components?.Dispose();
|
||||
base.Dispose(disposing);
|
||||
cancellationTokenSource?.Dispose();
|
||||
updateManager?.Dispose();
|
||||
|
|
|
@ -163,6 +163,8 @@ namespace CreamInstaller
|
|||
this.AcceptButton = this.acceptButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.ClientSize = new System.Drawing.Size(433, 279);
|
||||
this.Controls.Add(this.saveButton);
|
||||
this.Controls.Add(this.loadButton);
|
||||
|
|
5
CreamInstaller/Forms/SelectForm.Designer.cs
generated
5
CreamInstaller/Forms/SelectForm.Designer.cs
generated
|
@ -270,6 +270,8 @@ namespace CreamInstaller
|
|||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.ClientSize = new System.Drawing.Size(584, 361);
|
||||
this.Controls.Add(this.progressLabelDLCs);
|
||||
this.Controls.Add(this.progressLabelGames);
|
||||
|
@ -282,11 +284,10 @@ namespace CreamInstaller
|
|||
this.Controls.Add(this.installButton);
|
||||
this.Controls.Add(this.progressLabel);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(600, 400);
|
||||
this.Name = "SelectForm";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "SelectForm";
|
||||
this.Load += new System.EventHandler(this.OnLoad);
|
||||
|
|
Loading…
Reference in a new issue