feature/auto-update #5
@@ -332,15 +332,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:Car Manager 3"
|
||||
"ProductCode" = "8:{79688954-DAEC-4255-BF3C-8FD89EEC28AA}"
|
||||
"PackageCode" = "8:{6ED782FF-C62F-45E9-B6A8-756604C01717}"
|
||||
"ProductCode" = "8:{8FDFF7ED-D464-4F87-BA8F-BDC1000520E4}"
|
||||
"PackageCode" = "8:{83DA7553-805F-4A70-921B-9A6FB0787780}"
|
||||
"UpgradeCode" = "8:{6FF57925-465E-4DB9-85DA-CE933191A3DD}"
|
||||
"AspNetVersion" = "8:2.0.50727.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:FALSE"
|
||||
"ProductVersion" = "8:1.3.0"
|
||||
"ProductVersion" = "8:1.4.0"
|
||||
"Manufacturer" = "8:Jaro Digital"
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.3.0</ApplicationVersion>
|
||||
<ApplicationVersion>1.4.0</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
@@ -25,7 +25,7 @@
|
||||
<ApplicationIcon>CarMgm_Icon.ico</ApplicationIcon>
|
||||
<AssemblyTitle>Car Manager 3</AssemblyTitle>
|
||||
<Product>Car Manager 3</Product>
|
||||
<Version>1.3.0</Version>
|
||||
<Version>1.4.0</Version>
|
||||
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
180
CarManagerV3/Forms/Components/AnimatedProgressBar.cs
Normal file
180
CarManagerV3/Forms/Components/AnimatedProgressBar.cs
Normal file
@@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CarManagerV3
|
||||
{
|
||||
public class AnimatedProgressBar : UserControl
|
||||
{
|
||||
private Timer animationTimer;
|
||||
private float animationPosition = 0f;
|
||||
private Color primaryColor = Color.FromArgb(0, 120, 215);
|
||||
private Color secondaryColor = Color.FromArgb(100, 180, 255);
|
||||
private Color backgroundColor = Color.FromArgb(240, 240, 240);
|
||||
|
||||
public AnimatedProgressBar()
|
||||
{
|
||||
this.SetStyle(
|
||||
ControlStyles.AllPaintingInWmPaint |
|
||||
ControlStyles.UserPaint |
|
||||
ControlStyles.OptimizedDoubleBuffer |
|
||||
ControlStyles.ResizeRedraw,
|
||||
true);
|
||||
|
||||
this.Height = 8;
|
||||
|
||||
// Initialize animation timer
|
||||
animationTimer = new Timer();
|
||||
animationTimer.Interval = 20; // 50 FPS
|
||||
animationTimer.Tick += AnimationTimer_Tick;
|
||||
animationTimer.Start();
|
||||
}
|
||||
|
||||
private void AnimationTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
animationPosition += 2f;
|
||||
if (animationPosition > this.Width + 100)
|
||||
{
|
||||
animationPosition = -100;
|
||||
}
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
|
||||
// Draw background with rounded corners
|
||||
using (GraphicsPath path = GetRoundedRect(ClientRectangle, 4))
|
||||
{
|
||||
using (SolidBrush bgBrush = new SolidBrush(backgroundColor))
|
||||
{
|
||||
g.FillPath(bgBrush, path);
|
||||
}
|
||||
}
|
||||
|
||||
// Create animated gradient bar
|
||||
float barWidth = 100f;
|
||||
RectangleF barRect = new RectangleF(animationPosition, 0, barWidth, this.Height);
|
||||
|
||||
if (barRect.Right > 0 && barRect.Left < this.Width)
|
||||
{
|
||||
using (GraphicsPath barPath = GetRoundedRect(barRect, 4))
|
||||
{
|
||||
// Create gradient brush
|
||||
using (LinearGradientBrush gradientBrush = new LinearGradientBrush(
|
||||
barRect,
|
||||
Color.Transparent,
|
||||
Color.Transparent,
|
||||
LinearGradientMode.Horizontal))
|
||||
{
|
||||
ColorBlend colorBlend = new ColorBlend();
|
||||
colorBlend.Colors = new Color[] {
|
||||
Color.FromArgb(0, primaryColor),
|
||||
primaryColor,
|
||||
secondaryColor,
|
||||
primaryColor,
|
||||
Color.FromArgb(0, primaryColor)
|
||||
};
|
||||
colorBlend.Positions = new float[] { 0f, 0.2f, 0.5f, 0.8f, 1f };
|
||||
gradientBrush.InterpolationColors = colorBlend;
|
||||
|
||||
// Clip to control bounds
|
||||
Region oldClip = g.Clip;
|
||||
using (GraphicsPath clipPath = GetRoundedRect(ClientRectangle, 4))
|
||||
{
|
||||
g.SetClip(clipPath);
|
||||
g.FillPath(gradientBrush, barPath);
|
||||
g.Clip = oldClip;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw subtle border
|
||||
using (GraphicsPath borderPath = GetRoundedRect(ClientRectangle, 4))
|
||||
{
|
||||
using (Pen borderPen = new Pen(Color.FromArgb(220, 220, 220), 1))
|
||||
{
|
||||
g.DrawPath(borderPen, borderPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private GraphicsPath GetRoundedRect(RectangleF rect, float radius)
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
float diameter = radius * 2;
|
||||
|
||||
path.AddArc(rect.X, rect.Y, diameter, diameter, 180, 90);
|
||||
path.AddArc(rect.Right - diameter, rect.Y, diameter, diameter, 270, 90);
|
||||
path.AddArc(rect.Right - diameter, rect.Bottom - diameter, diameter, diameter, 0, 90);
|
||||
path.AddArc(rect.X, rect.Bottom - diameter, diameter, diameter, 90, 90);
|
||||
path.CloseFigure();
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
public void StartAnimation()
|
||||
{
|
||||
animationTimer.Start();
|
||||
}
|
||||
|
||||
public void StopAnimation()
|
||||
{
|
||||
animationTimer.Stop();
|
||||
}
|
||||
|
||||
//protected override void Dispose(bool disposing)
|
||||
//{
|
||||
// if (disposing)
|
||||
// {
|
||||
// animationTimer?.Stop();
|
||||
// animationTimer?.Dispose();
|
||||
// }
|
||||
// base.Dispose(disposing);
|
||||
//}
|
||||
|
||||
// Properties for customization
|
||||
public Color PrimaryColor
|
||||
{
|
||||
get => primaryColor;
|
||||
set
|
||||
{
|
||||
primaryColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color SecondaryColor
|
||||
{
|
||||
get => secondaryColor;
|
||||
set
|
||||
{
|
||||
secondaryColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Color ProgressBackColor
|
||||
{
|
||||
get => backgroundColor;
|
||||
set
|
||||
{
|
||||
backgroundColor = value;
|
||||
this.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
CarManagerV3/Forms/Components/AnimatedProgressBar.resx
Normal file
120
CarManagerV3/Forms/Components/AnimatedProgressBar.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
47
CarManagerV3/Forms/MainForm.Designer.cs
generated
47
CarManagerV3/Forms/MainForm.Designer.cs
generated
@@ -49,11 +49,14 @@
|
||||
addCarToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
clearSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
openWelcomeScreenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
clearRecentFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
imageList1 = new System.Windows.Forms.ImageList(components);
|
||||
settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
checkForUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
gitRepositoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
tableLayoutPanel1.SuspendLayout();
|
||||
tlpControls.SuspendLayout();
|
||||
tlpSearch.SuspendLayout();
|
||||
@@ -171,7 +174,7 @@
|
||||
//
|
||||
menuStrip1.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||
menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, editToolStripMenuItem, toolsToolStripMenuItem });
|
||||
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, editToolStripMenuItem, toolsToolStripMenuItem, aboutToolStripMenuItem });
|
||||
menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
menuStrip1.Name = "menuStrip1";
|
||||
menuStrip1.Size = new System.Drawing.Size(902, 28);
|
||||
@@ -240,24 +243,31 @@
|
||||
// addCarToolStripMenuItem
|
||||
//
|
||||
addCarToolStripMenuItem.Name = "addCarToolStripMenuItem";
|
||||
addCarToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
addCarToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||
addCarToolStripMenuItem.Text = "Add Car";
|
||||
addCarToolStripMenuItem.Click += addCarToolStripMenuItem_Click;
|
||||
//
|
||||
// importToolStripMenuItem
|
||||
//
|
||||
importToolStripMenuItem.Name = "importToolStripMenuItem";
|
||||
importToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
importToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||
importToolStripMenuItem.Text = "Import";
|
||||
importToolStripMenuItem.Click += importToolStripMenuItem_Click;
|
||||
//
|
||||
// clearSearchToolStripMenuItem
|
||||
//
|
||||
clearSearchToolStripMenuItem.Name = "clearSearchToolStripMenuItem";
|
||||
clearSearchToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
clearSearchToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||
clearSearchToolStripMenuItem.Text = "Clear Search";
|
||||
clearSearchToolStripMenuItem.Click += clearSearchToolStripMenuItem_Click;
|
||||
//
|
||||
// settingsToolStripMenuItem
|
||||
//
|
||||
settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
|
||||
settingsToolStripMenuItem.Size = new System.Drawing.Size(174, 26);
|
||||
settingsToolStripMenuItem.Text = "Settings";
|
||||
settingsToolStripMenuItem.Click += settingsToolStripMenuItem_Click;
|
||||
//
|
||||
// toolsToolStripMenuItem
|
||||
//
|
||||
toolsToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
@@ -290,12 +300,26 @@
|
||||
imageList1.Images.SetKeyName(0, "Icon_Search.png");
|
||||
imageList1.Images.SetKeyName(1, "Icon_Add.png");
|
||||
//
|
||||
// settingsToolStripMenuItem
|
||||
// aboutToolStripMenuItem
|
||||
//
|
||||
settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
|
||||
settingsToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
settingsToolStripMenuItem.Text = "Settings";
|
||||
settingsToolStripMenuItem.Click += settingsToolStripMenuItem_Click;
|
||||
aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { checkForUpdatesToolStripMenuItem, gitRepositoryToolStripMenuItem });
|
||||
aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
|
||||
aboutToolStripMenuItem.Size = new System.Drawing.Size(64, 24);
|
||||
aboutToolStripMenuItem.Text = "About";
|
||||
//
|
||||
// checkForUpdatesToolStripMenuItem
|
||||
//
|
||||
checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem";
|
||||
checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
checkForUpdatesToolStripMenuItem.Text = "Check for Updates";
|
||||
checkForUpdatesToolStripMenuItem.Click += checkForUpdatesToolStripMenuItem_Click;
|
||||
//
|
||||
// gitRepositoryToolStripMenuItem
|
||||
//
|
||||
gitRepositoryToolStripMenuItem.Name = "gitRepositoryToolStripMenuItem";
|
||||
gitRepositoryToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
||||
gitRepositoryToolStripMenuItem.Text = "Git Repository";
|
||||
gitRepositoryToolStripMenuItem.Click += gitRepositoryToolStripMenuItem_Click;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
@@ -348,5 +372,8 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem clearRecentFilesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem checkForUpdatesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem gitRepositoryToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -61,12 +61,18 @@ namespace CarManagerV3
|
||||
}
|
||||
|
||||
refreshRecents();
|
||||
|
||||
try
|
||||
{
|
||||
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
|
||||
{
|
||||
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(), Updater.GetLatestVersion());
|
||||
updatePrompt.ShowDialog();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine("Error checking for updates: " + ex.Message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -558,5 +564,35 @@ namespace CarManagerV3
|
||||
settingsForm.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Updater.IsUpdateAvailable(Properties.Settings.Default.AllowPrerelease))
|
||||
{
|
||||
UpdatePromptForm updatePrompt = new UpdatePromptForm(Updater.GetCurrentVersion(), Updater.GetLatestVersion());
|
||||
updatePrompt.ShowDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show($"You are already using the latest version. ({Updater.GetCurrentVersion()})", "No Updates Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error checking for updates: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void gitRepositoryToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Open the Git repository in the user's default browser
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = "https://git.jaro.digital/frozd/carmanager-3",
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="btnNewCar.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
@@ -139,9 +142,6 @@
|
||||
VXs21p8MAVc2KdQAvwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>153, 17</value>
|
||||
</metadata>
|
||||
@@ -150,15 +150,15 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
|
||||
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
|
||||
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAYAQAAAJNU0Z0AUkBTAIBAQIB
|
||||
AAGIAQABiAEAARQBAAEUAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABUAMAARQDAAEBAQABIAYAARn/
|
||||
AAGYAQABmAEAARQBAAEUAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABUAMAARQDAAEBAQABIAYAARn/
|
||||
AP8AzAADCAEKAyMBMgMuAUYDFgEe/wAtAAMIAQoDIwEyAk8BTgGXAlYBVAGrAy4BRv8ALQADIwEyAk8B
|
||||
TgGXAf8BmQEzAf8DTgGWAyMBMiwAA10BzAT/9AADKAE8Ak8BTgGXAl8BWwHTA04BlgMjATIDCAEKLAAD
|
||||
XQHMBP/UAAMDAQQDDwETA0QBewJPAU4BlwNNAZIDQAFuAwYBBwMpAT0DTgGYAlsBWQHAAk8BTgGXAyMB
|
||||
MgMIAQowAANdAcwE/9AAAxMBGgMxAU0DRAF5AlwBWQHBAmEBXQHPAl0BWwHKAlcBVQG0Az8BbQNSAaMC
|
||||
WwFZAcADTgGYAygBPDgAA10BzAT/zAADAwEEAzEBTQJZAVcBvAJgAV0BzgNLAYwDQAFvA0ABbwNLAYwC
|
||||
YAFdAc4BggFxAVMB9AJTAVEBogMpAT08AANdAcwE/8wAAw8BEwNEAXkCYAFdAc4DBgEIBAIIAAQCAwYB
|
||||
YAFdAc4BfAFtAVMB9AJTAVEBogMpAT08AANdAcwE/8wAAw8BEwNEAXkCYAFdAc4DBgEIBAIIAAQCAwYB
|
||||
CAJgAV0BzgM+AWsDBAEFKAADXQHMLP+4AANEAXkDWgG/A0sBjAQCEAAEAgNLAYwCWgFYAbcDQQFxKAAD
|
||||
UgGjA10BzANdAcwDXQHMA10BzAOJAfUE/wNdAcwDXQHMA10BzANdAcwDXQHMuAACTwFOAZcCYAFdAc4D
|
||||
UgGjA10BzANdAcwDXQHMA10BzAOFAfUE/wNdAcwDXQHMA10BzANdAcwDXQHMuAACTwFOAZcCYAFdAc4D
|
||||
QAFvGAADQAFvAl8BXAHLA04BlDwAA10BzAT/zAACTwFOAZcCYAFdAc4DQAFvGAADQAFvAl4BWwHNA04B
|
||||
ljwAA10BzAT/zAADRAF6AlsBWQHAA0sBjAQCEAAEAgNLAYwCWgFYAb0CRAFDAXc8AANdAcwE/8wAAw4B
|
||||
EgNEAXgCYAFdAc4DBgEIBAIIAAQCAwYBCAJgAV0BzgJDAUIBdQMMAQ88AANdAcwE/8wAAwMBBAMxAU0C
|
||||
|
||||
1
CarManagerV3/Forms/UpdatePromptForm.Designer.cs
generated
1
CarManagerV3/Forms/UpdatePromptForm.Designer.cs
generated
@@ -151,6 +151,7 @@
|
||||
btnReadChangelog.TabIndex = 1;
|
||||
btnReadChangelog.Text = "Changelog";
|
||||
btnReadChangelog.UseVisualStyleBackColor = true;
|
||||
btnReadChangelog.Click += btnReadChangelog_Click;
|
||||
//
|
||||
// UpdatePromptForm
|
||||
//
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace CarManagerV3.Forms
|
||||
InitializeComponent();
|
||||
lblInstalledVersion.Text = lblInstalledVersion.Text.Replace("?.?.?", currentVersion);
|
||||
lblLatestVersion.Text = lblLatestVersion.Text.Replace("?.?.?", latestVersion);
|
||||
|
||||
}
|
||||
|
||||
private void btnDismissUpdate_Click(object sender, EventArgs e)
|
||||
@@ -25,9 +26,39 @@ namespace CarManagerV3.Forms
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private async void btnInstallUpdate_Click(object sender, EventArgs e)
|
||||
private void btnInstallUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
/*
|
||||
var msgbox = new PleaseWait();
|
||||
msgbox.Show();
|
||||
Application.DoEvents();
|
||||
StateManager.UpdateCar(car);
|
||||
Image fooimg = ImageManager.GetImage(car);
|
||||
msgbox.Close();
|
||||
this.Close();
|
||||
*/
|
||||
PleaseWait loadForm = new PleaseWait("Downloading the newest version...");
|
||||
try
|
||||
{
|
||||
this.Enabled = false;
|
||||
loadForm.Show();
|
||||
Application.DoEvents();
|
||||
//return;
|
||||
Updater.DownloadNewestInstaller();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("An error occurred while trying to download the update: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
this.Enabled = true;
|
||||
loadForm.Close();
|
||||
this.Close();
|
||||
|
||||
}
|
||||
|
||||
private void btnReadChangelog_Click(object sender, EventArgs e)
|
||||
{
|
||||
Updater.openReleasePage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
67
CarManagerV3/Forms/Util/PleaseWait.Designer.cs
generated
67
CarManagerV3/Forms/Util/PleaseWait.Designer.cs
generated
@@ -28,50 +28,69 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
lblContent = new System.Windows.Forms.Label();
|
||||
animatedProgressBar1 = new AnimatedProgressBar();
|
||||
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
flowLayoutPanel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
progressBar1.Location = new System.Drawing.Point(12, 78);
|
||||
progressBar1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
progressBar1.Name = "progressBar1";
|
||||
progressBar1.Size = new System.Drawing.Size(422, 29);
|
||||
progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
|
||||
progressBar1.TabIndex = 0;
|
||||
progressBar1.Click += progressBar1_Click;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
|
||||
label1.Location = new System.Drawing.Point(12, 16);
|
||||
label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
|
||||
label1.Location = new System.Drawing.Point(13, 10);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new System.Drawing.Size(121, 20);
|
||||
label1.Size = new System.Drawing.Size(140, 25);
|
||||
label1.TabIndex = 1;
|
||||
label1.Text = "Please wait...";
|
||||
label1.UseWaitCursor = true;
|
||||
//
|
||||
// lblContent
|
||||
//
|
||||
lblContent.AutoSize = true;
|
||||
lblContent.Location = new System.Drawing.Point(13, 41);
|
||||
lblContent.Location = new System.Drawing.Point(13, 40);
|
||||
lblContent.Margin = new System.Windows.Forms.Padding(3, 5, 3, 10);
|
||||
lblContent.Name = "lblContent";
|
||||
lblContent.Size = new System.Drawing.Size(144, 20);
|
||||
lblContent.TabIndex = 2;
|
||||
lblContent.Text = "Saving your changes";
|
||||
lblContent.UseWaitCursor = true;
|
||||
//
|
||||
// animatedProgressBar1
|
||||
//
|
||||
animatedProgressBar1.Location = new System.Drawing.Point(13, 73);
|
||||
animatedProgressBar1.Name = "animatedProgressBar1";
|
||||
animatedProgressBar1.PrimaryColor = System.Drawing.Color.FromArgb(0, 120, 215);
|
||||
animatedProgressBar1.ProgressBackColor = System.Drawing.Color.FromArgb(240, 240, 240);
|
||||
animatedProgressBar1.SecondaryColor = System.Drawing.Color.FromArgb(100, 180, 255);
|
||||
animatedProgressBar1.Size = new System.Drawing.Size(408, 22);
|
||||
animatedProgressBar1.TabIndex = 3;
|
||||
animatedProgressBar1.UseWaitCursor = true;
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
flowLayoutPanel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom;
|
||||
flowLayoutPanel1.Controls.Add(label1);
|
||||
flowLayoutPanel1.Controls.Add(lblContent);
|
||||
flowLayoutPanel1.Controls.Add(animatedProgressBar1);
|
||||
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
flowLayoutPanel1.Padding = new System.Windows.Forms.Padding(10);
|
||||
flowLayoutPanel1.Size = new System.Drawing.Size(437, 153);
|
||||
flowLayoutPanel1.TabIndex = 4;
|
||||
flowLayoutPanel1.UseWaitCursor = true;
|
||||
flowLayoutPanel1.WrapContents = false;
|
||||
//
|
||||
// PleaseWait
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
AutoSize = true;
|
||||
ClientSize = new System.Drawing.Size(446, 121);
|
||||
ClientSize = new System.Drawing.Size(437, 153);
|
||||
ControlBox = false;
|
||||
Controls.Add(lblContent);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(progressBar1);
|
||||
Controls.Add(flowLayoutPanel1);
|
||||
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
MaximizeBox = false;
|
||||
@@ -79,16 +98,20 @@
|
||||
Name = "PleaseWait";
|
||||
ShowIcon = false;
|
||||
ShowInTaskbar = false;
|
||||
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
Text = "Please Wait";
|
||||
TopMost = true;
|
||||
UseWaitCursor = true;
|
||||
flowLayoutPanel1.ResumeLayout(false);
|
||||
flowLayoutPanel1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ProgressBar progressBar1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label lblContent;
|
||||
private AnimatedProgressBar animatedProgressBar1;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,16 @@ namespace CarManagerV3
|
||||
public PleaseWait(string content = "Saving your changes...")
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer |
|
||||
ControlStyles.AllPaintingInWmPaint |
|
||||
ControlStyles.UserPaint, true);
|
||||
|
||||
// loading animation
|
||||
progressBar1.Style = ProgressBarStyle.Marquee;
|
||||
progressBar1.MarqueeAnimationSpeed = 30;
|
||||
animatedProgressBar1.StartAnimation();
|
||||
lblContent.Text = content;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void progressBar1_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace CarManagerV3.Manager
|
||||
private static DateTime lastChecked = DateTime.MinValue;
|
||||
private static readonly int CacheDurationMinutes = 60;
|
||||
private static bool cacheIncludesPrerelease = false;
|
||||
private static readonly string debugVersion = "1.2.0";
|
||||
private static readonly string debugVersion = null;//"1.2.0";
|
||||
|
||||
public static string GetCurrentVersion()
|
||||
{
|
||||
@@ -111,7 +111,7 @@ namespace CarManagerV3.Manager
|
||||
}
|
||||
|
||||
|
||||
public static async void DownloadNewestInstaller(bool includePreRelease = false)
|
||||
public static void DownloadNewestInstaller(bool includePreRelease = false)
|
||||
{
|
||||
string latestVersion = GetLatestVersion(includePreRelease);
|
||||
if (latestVersion == null)
|
||||
@@ -137,13 +137,11 @@ namespace CarManagerV3.Manager
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (downloadUrl != null)
|
||||
{
|
||||
PleaseWait loadForm = new PleaseWait("Downloading the newest version...");
|
||||
loadForm.Show();
|
||||
Application.DoEvents();
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
|
||||
// Download the installer to the users set Data dir, run it, and then exit the application.
|
||||
string tempFilePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), $"CarManagerInstaller_{latestVersion}.msi");
|
||||
using (var downloadClient = new System.Net.WebClient())
|
||||
@@ -157,7 +155,7 @@ namespace CarManagerV3.Manager
|
||||
UseShellExecute = true
|
||||
};
|
||||
System.Diagnostics.Process.Start(processStartInfo);
|
||||
});
|
||||
|
||||
|
||||
Application.Exit();
|
||||
}
|
||||
@@ -181,5 +179,19 @@ namespace CarManagerV3.Manager
|
||||
string latestVersion = GetLatestVersion(includePreRelease);
|
||||
return IsNewerVersion(latestVersion, currentVersion);
|
||||
}
|
||||
|
||||
public static void openReleasePage(string version = null)
|
||||
{
|
||||
if(version == null)
|
||||
{
|
||||
version = GetLatestVersion(true);
|
||||
}
|
||||
string releaseUrl = $"https://git.jaro.digital/{GitRepoOwner}/{GitRepoName}/releases/tag/{version}";
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = releaseUrl,
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user