From: George Pantazis Date: Wed, 25 Apr 2012 12:56:23 +0000 (+0300) Subject: Restart manager support for the main application. X-Git-Url: https://code.grnet.gr/git/pithos-ms-client/commitdiff_plain/100379b312f029fbd86c5a3920e573b74b3fc7e6 Restart manager support for the main application. Signed-off-by: George Pantazis --- diff --git a/trunk/Pithos.Client.WPF/App.xaml.cs b/trunk/Pithos.Client.WPF/App.xaml.cs index 6768577..800813f 100644 --- a/trunk/Pithos.Client.WPF/App.xaml.cs +++ b/trunk/Pithos.Client.WPF/App.xaml.cs @@ -55,6 +55,7 @@ using Pithos.Client.WPF.Properties; using log4net.Appender; using log4net.Core; using log4net.Repository.Hierarchy; +using System.Runtime.InteropServices; namespace Pithos.Client.WPF @@ -66,7 +67,10 @@ namespace Pithos.Client.WPF { private static readonly log4net.ILog Log = log4net.LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType ); - + ///DLL Import to add restart manager support + [DllImport("kernel32.dll", CharSet = CharSet.Auto)] + static extern uint RegisterApplicationRestart(string pwzCommandLine, RestartFlags dwFlags); + public App() { @@ -74,6 +78,9 @@ namespace Pithos.Client.WPF InitializeLogging(); + ///Register Application in the Restartmanager service + RegisterApplicationRestart("Upgrade", RestartFlags.NONE); + DispatcherUnhandledException += OnDispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; @@ -292,3 +299,15 @@ namespace Pithos.Client.WPF } } + + enum RestartFlags + { + NONE = 0, + RESTART_CYCLICAL = 1, + RESTART_NOTIFY_SOLUTION = 2, + RESTART_NOTIFY_FAULT = 4, + RESTART_NO_CRASH = 8, + RESTART_NO_HANG = 16, + RESTART_NO_PATCH = 32, + RESTART_NO_REBOOT = 64 + } \ No newline at end of file diff --git a/trunk/Pithos.Client.WPF/AppBootstrapper.cs b/trunk/Pithos.Client.WPF/AppBootstrapper.cs index 8f1eaf1..da0f2b8 100644 --- a/trunk/Pithos.Client.WPF/AppBootstrapper.cs +++ b/trunk/Pithos.Client.WPF/AppBootstrapper.cs @@ -65,13 +65,13 @@ namespace Pithos.Client.WPF public class AppBootstrapper : Bootstrapper { + CompositionContainer container; public AppBootstrapper() { LogManager.GetLog = type => new log4netLogger(type); UpgradeSettings(); - } private void UpgradeSettings() @@ -136,4 +136,4 @@ namespace Pithos.Client.WPF container.SatisfyImportsOnce(instance); } } -} +} \ No newline at end of file diff --git a/trunk/Pithos.Client.WPF/Wpf32Window.cs b/trunk/Pithos.Client.WPF/Wpf32Window.cs index f18ba39..da8ea6b 100644 --- a/trunk/Pithos.Client.WPF/Wpf32Window.cs +++ b/trunk/Pithos.Client.WPF/Wpf32Window.cs @@ -47,7 +47,6 @@ using System.Windows; using System.Windows.Interop; using IWin32Window = System.Windows.Forms.IWin32Window; - namespace Pithos.Client.WPF { public class Wpf32Window : IWin32Window diff --git a/trunk/Pithos.ShellExtensions/PithosHost.cs b/trunk/Pithos.ShellExtensions/PithosHost.cs index 1fe1bf3..89013b9 100644 --- a/trunk/Pithos.ShellExtensions/PithosHost.cs +++ b/trunk/Pithos.ShellExtensions/PithosHost.cs @@ -41,6 +41,7 @@ #endregion using System.ServiceModel; using Pithos.ShellExtensions.PithosService; +using System.Runtime.InteropServices; namespace Pithos.ShellExtensions { @@ -49,6 +50,7 @@ namespace Pithos.ShellExtensions /// public static class PithosHost { + /// /// Provides a client for retrieving file status from the Pithos App /// @@ -89,3 +91,15 @@ namespace Pithos.ShellExtensions } } + +enum RestartFlags +{ + NONE = 0, + RESTART_CYCLICAL = 1, + RESTART_NOTIFY_SOLUTION = 2, + RESTART_NOTIFY_FAULT = 4, + RESTART_NO_CRASH = 8, + RESTART_NO_HANG = 16, + RESTART_NO_PATCH = 32, + RESTART_NO_REBOOT = 64 +} \ No newline at end of file