mirror of
https://github.com/abdelkader/vCardEditor
synced 2025-12-12 08:27:19 +07:00
the application check if un update is available.
This commit is contained in:
@@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
|
||||
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
|
||||
// en utilisant '*', comme indiqué ci-dessous :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.5.3")]
|
||||
[assembly: AssemblyVersion("0.5.4")]
|
||||
|
||||
64
vCardEditor/View/AboutDialog.Designer.cs
generated
64
vCardEditor/View/AboutDialog.Designer.cs
generated
@@ -36,36 +36,42 @@
|
||||
this.labelCompanyName = new System.Windows.Forms.Label();
|
||||
this.textBoxDescription = new System.Windows.Forms.TextBox();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.updateButton = new System.Windows.Forms.Button();
|
||||
this.tableLayoutPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel
|
||||
//
|
||||
this.tableLayoutPanel.ColumnCount = 2;
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 27.81775F));
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 72.18225F));
|
||||
this.tableLayoutPanel.ColumnCount = 3;
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 32.31441F));
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67.68559F));
|
||||
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 119F));
|
||||
this.tableLayoutPanel.Controls.Add(this.logoPictureBox, 0, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelProductName, 1, 0);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelVersion, 1, 1);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCopyright, 1, 2);
|
||||
this.tableLayoutPanel.Controls.Add(this.labelCompanyName, 1, 3);
|
||||
this.tableLayoutPanel.Controls.Add(this.textBoxDescription, 1, 4);
|
||||
this.tableLayoutPanel.Controls.Add(this.okButton, 1, 5);
|
||||
this.tableLayoutPanel.Controls.Add(this.okButton, 2, 5);
|
||||
this.tableLayoutPanel.Controls.Add(this.updateButton, 1, 5);
|
||||
this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel.Location = new System.Drawing.Point(12, 11);
|
||||
this.tableLayoutPanel.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tableLayoutPanel.Name = "tableLayoutPanel";
|
||||
this.tableLayoutPanel.RowCount = 6;
|
||||
this.tableLayoutPanel.RowCount = 7;
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 47.93651F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 12.69841F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 8F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel.Size = new System.Drawing.Size(556, 326);
|
||||
this.tableLayoutPanel.TabIndex = 0;
|
||||
//
|
||||
@@ -76,69 +82,74 @@
|
||||
this.logoPictureBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.logoPictureBox.Name = "logoPictureBox";
|
||||
this.tableLayoutPanel.SetRowSpan(this.logoPictureBox, 6);
|
||||
this.logoPictureBox.Size = new System.Drawing.Size(145, 121);
|
||||
this.logoPictureBox.Size = new System.Drawing.Size(133, 121);
|
||||
this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.logoPictureBox.TabIndex = 12;
|
||||
this.logoPictureBox.TabStop = false;
|
||||
//
|
||||
// labelProductName
|
||||
//
|
||||
this.tableLayoutPanel.SetColumnSpan(this.labelProductName, 2);
|
||||
this.labelProductName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelProductName.Location = new System.Drawing.Point(162, 0);
|
||||
this.labelProductName.Location = new System.Drawing.Point(149, 0);
|
||||
this.labelProductName.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0);
|
||||
this.labelProductName.MaximumSize = new System.Drawing.Size(0, 21);
|
||||
this.labelProductName.Name = "labelProductName";
|
||||
this.labelProductName.Size = new System.Drawing.Size(390, 21);
|
||||
this.labelProductName.Size = new System.Drawing.Size(403, 21);
|
||||
this.labelProductName.TabIndex = 19;
|
||||
this.labelProductName.Text = "Nom du produit";
|
||||
this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelVersion
|
||||
//
|
||||
this.tableLayoutPanel.SetColumnSpan(this.labelVersion, 2);
|
||||
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelVersion.Location = new System.Drawing.Point(162, 32);
|
||||
this.labelVersion.Location = new System.Drawing.Point(149, 31);
|
||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0);
|
||||
this.labelVersion.MaximumSize = new System.Drawing.Size(0, 21);
|
||||
this.labelVersion.Name = "labelVersion";
|
||||
this.labelVersion.Size = new System.Drawing.Size(390, 21);
|
||||
this.labelVersion.Size = new System.Drawing.Size(403, 21);
|
||||
this.labelVersion.TabIndex = 0;
|
||||
this.labelVersion.Text = "Version";
|
||||
this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelCopyright
|
||||
//
|
||||
this.tableLayoutPanel.SetColumnSpan(this.labelCopyright, 2);
|
||||
this.labelCopyright.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCopyright.Location = new System.Drawing.Point(162, 64);
|
||||
this.labelCopyright.Location = new System.Drawing.Point(149, 62);
|
||||
this.labelCopyright.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0);
|
||||
this.labelCopyright.MaximumSize = new System.Drawing.Size(0, 21);
|
||||
this.labelCopyright.Name = "labelCopyright";
|
||||
this.labelCopyright.Size = new System.Drawing.Size(390, 21);
|
||||
this.labelCopyright.Size = new System.Drawing.Size(403, 21);
|
||||
this.labelCopyright.TabIndex = 21;
|
||||
this.labelCopyright.Text = "Copyright";
|
||||
this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// labelCompanyName
|
||||
//
|
||||
this.tableLayoutPanel.SetColumnSpan(this.labelCompanyName, 2);
|
||||
this.labelCompanyName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.labelCompanyName.Location = new System.Drawing.Point(162, 96);
|
||||
this.labelCompanyName.Location = new System.Drawing.Point(149, 93);
|
||||
this.labelCompanyName.Margin = new System.Windows.Forms.Padding(8, 0, 4, 0);
|
||||
this.labelCompanyName.MaximumSize = new System.Drawing.Size(0, 21);
|
||||
this.labelCompanyName.Name = "labelCompanyName";
|
||||
this.labelCompanyName.Size = new System.Drawing.Size(390, 21);
|
||||
this.labelCompanyName.Size = new System.Drawing.Size(403, 21);
|
||||
this.labelCompanyName.TabIndex = 22;
|
||||
this.labelCompanyName.Text = "Nom de la société";
|
||||
this.labelCompanyName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// textBoxDescription
|
||||
//
|
||||
this.tableLayoutPanel.SetColumnSpan(this.textBoxDescription, 2);
|
||||
this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.textBoxDescription.Location = new System.Drawing.Point(162, 132);
|
||||
this.textBoxDescription.Location = new System.Drawing.Point(149, 128);
|
||||
this.textBoxDescription.Margin = new System.Windows.Forms.Padding(8, 4, 4, 4);
|
||||
this.textBoxDescription.Multiline = true;
|
||||
this.textBoxDescription.Name = "textBoxDescription";
|
||||
this.textBoxDescription.ReadOnly = true;
|
||||
this.textBoxDescription.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBoxDescription.Size = new System.Drawing.Size(390, 155);
|
||||
this.textBoxDescription.Size = new System.Drawing.Size(403, 143);
|
||||
this.textBoxDescription.TabIndex = 23;
|
||||
this.textBoxDescription.TabStop = false;
|
||||
this.textBoxDescription.Text = "Description";
|
||||
@@ -147,13 +158,23 @@
|
||||
//
|
||||
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.okButton.Location = new System.Drawing.Point(452, 295);
|
||||
this.okButton.Location = new System.Drawing.Point(442, 282);
|
||||
this.okButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(100, 27);
|
||||
this.okButton.Size = new System.Drawing.Size(110, 29);
|
||||
this.okButton.TabIndex = 24;
|
||||
this.okButton.Text = "&OK";
|
||||
//
|
||||
// updateButton
|
||||
//
|
||||
this.updateButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.updateButton.Location = new System.Drawing.Point(312, 283);
|
||||
this.updateButton.Name = "updateButton";
|
||||
this.updateButton.Size = new System.Drawing.Size(121, 29);
|
||||
this.updateButton.TabIndex = 25;
|
||||
this.updateButton.Text = "Check update...";
|
||||
this.updateButton.Click += new System.EventHandler(this.updateButton_Click);
|
||||
//
|
||||
// AboutDialog
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
@@ -188,5 +209,6 @@
|
||||
private System.Windows.Forms.Label labelCompanyName;
|
||||
private System.Windows.Forms.TextBox textBoxDescription;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button updateButton;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace vCardEditor.View
|
||||
@@ -100,5 +102,34 @@ namespace vCardEditor.View
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private async void updateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string url = "https://raw.githubusercontent.com/abdelkader/vCardEditor/master/vCardEditor/Releases.txt";
|
||||
using (var client = new System.Net.WebClient())
|
||||
{
|
||||
string result = await client.DownloadStringTaskAsync(url);
|
||||
if (result.Length > 0)
|
||||
{
|
||||
using (var reader = new StringReader(result))
|
||||
{
|
||||
string firstline = reader.ReadLine();
|
||||
var split1 = firstline.Split('.');
|
||||
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
|
||||
var split2 = version.Split('.');
|
||||
|
||||
if ((int.Parse(split1[1]) > int.Parse(split2[1]))
|
||||
||
|
||||
(int.Parse(split1[2]) > int.Parse(split2[2])))
|
||||
MessageBox.Show(String.Format("New version {0} found!", result));
|
||||
else
|
||||
MessageBox.Show("You have the latest version!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user