Msgbox про перезапуск для обновления.
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
1.0.50
|
||||
1.0.51
|
||||
|
||||
@@ -26,6 +26,6 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.50")]
|
||||
[assembly: AssemblyFileVersion("1.0.50")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.50")]
|
||||
[assembly: AssemblyVersion("1.0.51")]
|
||||
[assembly: AssemblyFileVersion("1.0.51")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.51")]
|
||||
|
||||
@@ -222,6 +222,14 @@ namespace JiraTimeBot.UI
|
||||
{
|
||||
//если обновились - отключаем до рестарта
|
||||
tmrUpdate.Enabled = false;
|
||||
var result = MessageBox.Show($"Приложение обновлено до новой версии. Перезапустить сейчас?",
|
||||
"Обновление",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Warning);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
updater.SelfRestart();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -5,5 +5,6 @@ namespace JiraTimeBot.Update
|
||||
internal interface IUpdater
|
||||
{
|
||||
bool UpdateToNewVersion(bool firstTime);
|
||||
void SelfRestart();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
@@ -124,6 +125,18 @@ namespace JiraTimeBot.Update
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public void SelfRestart()
|
||||
{
|
||||
var name = Application.ExecutablePath;
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo {
|
||||
Arguments = "/C choice /C Y /N /D Y /T 1 & \"" + name + "\"",
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
CreateNoWindow = true,
|
||||
FileName = "cmd.exe"
|
||||
};
|
||||
Process.Start(startInfo);
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
|
||||
private bool DownloadFile(string url, string to)
|
||||
|
||||
Reference in New Issue
Block a user