Restart manager support for the main application.
authorGeorge Pantazis <gpant@noc.grnet.gr>
Wed, 25 Apr 2012 12:56:23 +0000 (15:56 +0300)
committerGeorge Pantazis <gpant@noc.grnet.gr>
Wed, 25 Apr 2012 12:56:23 +0000 (15:56 +0300)
Signed-off-by: George Pantazis <gpant@noc.grnet.gr>

trunk/Pithos.Client.WPF/App.xaml.cs
trunk/Pithos.Client.WPF/AppBootstrapper.cs
trunk/Pithos.Client.WPF/Wpf32Window.cs
trunk/Pithos.ShellExtensions/PithosHost.cs

index 6768577..800813f 100644 (file)
@@ -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
index 8f1eaf1..da0f2b8 100644 (file)
@@ -65,13 +65,13 @@ namespace Pithos.Client.WPF
 
        public class AppBootstrapper : Bootstrapper<IShell>
        {
+
                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
index f18ba39..da8ea6b 100644 (file)
@@ -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
index 1fe1bf3..89013b9 100644 (file)
@@ -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
     /// </summary>
     public static class PithosHost
     {
+
        /// <summary>
        /// Provides a client for retrieving file status from the Pithos App
        /// </summary>
@@ -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