diff --git a/Creator/Program.cs b/Creator/Program.cs index 060575d..90dbecb 100644 --- a/Creator/Program.cs +++ b/Creator/Program.cs @@ -149,7 +149,8 @@ namespace KattekerCreator var kattekerConfig = new KattekerConfig { Publish = _appArguments.PublishDir ?? _appArguments.OutputDir, - Changelog = Path.GetFileName(_appArguments.ChangeLog) + Changelog = Path.GetFileName(_appArguments.ChangeLog), + Channel = _appArguments.Channel }; kattekerConfig.WriteToFile(pathToFile); return pathToFile; diff --git a/Creator/Properties/AssemblyInfo.cs b/Creator/Properties/AssemblyInfo.cs index f8a3af7..f865701 100644 --- a/Creator/Properties/AssemblyInfo.cs +++ b/Creator/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.1.0")] +[assembly: AssemblyFileVersion("1.0.1.0")] diff --git a/Katteker.Gui/Katteker.UserInterface.csproj b/Katteker.Gui/Katteker.UserInterface.csproj index aa053a8..902273b 100644 --- a/Katteker.Gui/Katteker.UserInterface.csproj +++ b/Katteker.Gui/Katteker.UserInterface.csproj @@ -34,6 +34,9 @@ bin\Release\Katteker.UserInterface.xml + + ..\packages\Katteker.1.1.0\lib\net45\Katteker.dll + @@ -59,6 +62,7 @@ + @@ -70,12 +74,6 @@ UpdateWindow.cs - - - {a45e1c59-ba9e-452c-a5e2-50de49d53e92} - Katteker - - diff --git a/Katteker.Gui/Properties/AssemblyInfo.cs b/Katteker.Gui/Properties/AssemblyInfo.cs index 76d3cad..08053b7 100644 --- a/Katteker.Gui/Properties/AssemblyInfo.cs +++ b/Katteker.Gui/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("1.0.0")] +[assembly: AssemblyVersion("1.1.4")] +[assembly: AssemblyFileVersion("1.1.4")] diff --git a/Katteker.Gui/UpdateWindow.cs b/Katteker.Gui/UpdateWindow.cs index 6d7792d..86e12f2 100644 --- a/Katteker.Gui/UpdateWindow.cs +++ b/Katteker.Gui/UpdateWindow.cs @@ -90,30 +90,27 @@ namespace Katteker } changelogContent = changelogContent.ChangelogAsHtml(Path.GetExtension(Changelog)); - Invoke(new Action(() => changelogBrowser.DocumentText = changelogContent)); + InvokeOnGui(() => changelogBrowser.DocumentText = changelogContent); if (_entry == null) { - Invoke(new Action(() => { WriteTitle(Resources.No_update_available); })); + WriteTitle(Resources.No_update_available); } else { var latest = _entry.Version; - Invoke(new Action(() => - { - WriteTitle(Resources.You_can_update_to_Version + latest); - updBtn.Visible = true; - })); + WriteTitle(Resources.You_can_update_to_Version + latest); + InvokeOnGui(() => updBtn.Visible = true); } } private async void UpdBtn_Click(object sender, EventArgs e) { - Invoke(new Action(() => progressBar1.Visible = true)); + InvokeOnGui(() => progressBar1.Visible = true); try { - var progress = new Progress(x => Invoke(new Action(() => { progressBar1.Value = x; }))); + var progress = new Progress(x => InvokeOnGui(() => progressBar1.Value = x)); await _updateManager.UpdateAppAsync(progress).ConfigureAwait(false); WriteTitle(Resources.You_re_up_to_date); @@ -124,8 +121,12 @@ namespace Katteker MessageBoxIcon.Question); if (messResult == DialogResult.Yes) { - DialogResult = DialogResult.OK; - Close(); + InvokeOnGui(() => + { + DialogResult = DialogResult.OK; + Close(); + }); + return; } } catch (Exception ex) @@ -134,23 +135,34 @@ namespace Katteker Resources.Updater, MessageBoxButtons.OK, MessageBoxIcon.Error); WriteTitle(Resources.Updater); } - finally + + InvokeOnGui(() => { - Invoke(new Action(() => - { - progressBar1.Visible = false; - updBtn.Visible = false; - })); - } + progressBar1.Visible = false; + updBtn.Visible = false; + }); } private void WriteTitle(string text) { - Invoke(new Action(() => + InvokeOnGui(() => { Text = text; titlebar.Text = text; - })); + }); + } + + private void InvokeOnGui(Action action) + { + if (Disposing || IsDisposed) return; + if (InvokeRequired) + { + Invoke(action); + } + else + { + action(); + } } } } \ No newline at end of file diff --git a/Katteker.Gui/UserInterface.cs b/Katteker.Gui/UserInterface.cs index 3c41864..2581e88 100644 --- a/Katteker.Gui/UserInterface.cs +++ b/Katteker.Gui/UserInterface.cs @@ -1,5 +1,4 @@ -using System; -using System.Linq; +using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -13,7 +12,6 @@ namespace Katteker public static class UserInterface { private static UpdateManager _manager; - private static Action _restartApp; /// /// Checks for Updates. @@ -40,8 +38,7 @@ namespace Katteker } var releases = (await _manager.CheckForUpdateAsync().ConfigureAwait(false)).ToArray(); - _restartApp = () => _manager.RestartApp(); - if (releases.Any() || !isStartup) + if (releases.Length > 0 || !isStartup) { var thread = new Thread(ThreadProcess); thread.SetApartmentState(ApartmentState.STA); @@ -58,7 +55,7 @@ namespace Katteker var dialogResult = window.ShowDialog(); if (dialogResult == DialogResult.OK) { - _restartApp?.Invoke(); + _manager.RestartApp(); } } } diff --git a/Katteker.Gui/packages.config b/Katteker.Gui/packages.config new file mode 100644 index 0000000..82a1859 --- /dev/null +++ b/Katteker.Gui/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Katteker/KattekerConfig.cs b/Katteker/KattekerConfig.cs index 19f7147..013e826 100644 --- a/Katteker/KattekerConfig.cs +++ b/Katteker/KattekerConfig.cs @@ -7,7 +7,7 @@ namespace Katteker /// /// Configuration of a Katteker-Deployment /// - [Serializable] + [Serializable] public class KattekerConfig { /// @@ -20,6 +20,11 @@ namespace Katteker /// public string Changelog { get; set; } + /// + /// Channel of the application. (Alpha, Beta and so on...) + /// + public string Channel { get; set; } + /// /// Read file and deserialize content. /// diff --git a/Katteker/Properties/AssemblyInfo.cs b/Katteker/Properties/AssemblyInfo.cs index 6272e7e..18cb9ea 100644 --- a/Katteker/Properties/AssemblyInfo.cs +++ b/Katteker/Properties/AssemblyInfo.cs @@ -32,6 +32,6 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0")] -[assembly: AssemblyFileVersion("1.1.0")] +[assembly: AssemblyVersion("1.1.1")] +[assembly: AssemblyFileVersion("1.1.1")] [assembly: InternalsVisibleTo("Katteker.Test")] \ No newline at end of file diff --git a/Katteker/UpdateManager.cs b/Katteker/UpdateManager.cs index d0cf4a9..5da1fdd 100644 --- a/Katteker/UpdateManager.cs +++ b/Katteker/UpdateManager.cs @@ -55,7 +55,8 @@ namespace Katteker _config = ReadConfigFile(); urlOrPath = urlOrPath ?? _config.Publish; var appName = applicationName ?? Utility.GetApplicationName(); - var rootAppDirectory = Path.Combine(rootDirectory ?? Utility.GetLocalAppDataDirectory(), appName); + var channel = string.IsNullOrWhiteSpace(_config.Channel) ? string.Empty : $"_{_config.Channel}"; + var rootAppDirectory = Path.Combine(rootDirectory ?? Utility.GetLocalAppDataDirectory(), appName + channel); return new UpdateManager(urlOrPath, appName, rootAppDirectory); }