annotate Chronosv2/source/SingleInstance.cs @ 21:dfc81f8bb838

working version for sttocks except ui within metrowpf
author adminsh@apollo
date Tue, 20 Mar 2012 15:07:31 +0000
parents 741981715d94
children
rev   line source
14
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
1 using System;
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
2 using System.Collections.Generic;
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
3 using System.Diagnostics.CodeAnalysis;
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
4 using System.Runtime.Remoting;
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
5 using System.Runtime.Remoting.Channels;
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
6 using System.Runtime.Remoting.Channels.Ipc;
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
7 using System.Runtime.Serialization.Formatters;
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
8 using System.Threading;
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
9 using System.Windows;
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
10
741981715d94 Initial review and translations
stevenh7776 stevenhollidge@hotmail.com
parents: 10
diff changeset
11 namespace Chronos
10
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
12 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
13 public static class SingleInstance
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
14 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
15 #region · Consts ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
16
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
17 private const string RemoteServiceName = "SingleInstanceApplicationService";
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
18
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
19 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
20
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
21 #region · Inner Types ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
22
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
23 private class IpcRemoteService : MarshalByRefObject
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
24 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
25 #region · Methods ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
26
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
27 /// <summary>Activate the first instance of the application.</summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
28 /// <param name="args">Command line arguemnts to proxy.</param>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
29 public void InvokeFirstInstance(IList<string> args)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
30 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
31 if (Application.Current != null && !Application.Current.Dispatcher.HasShutdownStarted)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
32 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
33 Application.Current.Dispatcher.BeginInvoke((Action<object>)((arg) => SingleInstance.ActivateFirstInstance((IList<string>)arg)), args);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
34 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
35 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
36
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
37 /// <summary>Overrides the default lease lifetime of 5 minutes so that it never expires.</summary>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
38 public override object InitializeLifetimeService()
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
39 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
40 return null;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
41 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
42
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
43 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
44 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
45
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
46 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
47
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
48 #region · Events ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
49
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
50 public static event EventHandler<SingleInstanceEventArgs> SingleInstanceActivated;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
51
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
52 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
53
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
54 #region · Fields ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
55
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
56 private static Mutex SingleInstanceMutex;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
57 private static IpcServerChannel Channel;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
58
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
59 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
60
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
61 #region · Methods ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
62
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
63 [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
64 public static void SafeDispose<T>(ref T disposable) where T : IDisposable
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
65 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
66 // Dispose can safely be called on an object multiple times.
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
67 IDisposable t = disposable;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
68 disposable = default(T);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
69
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
70 if (null != t)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
71 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
72 t.Dispose();
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
73 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
74 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
75
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
76 public static bool InitializeAsFirstInstance(string applicationName)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
77 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
78 IList<string> commandLineArgs = Environment.GetCommandLineArgs() ?? new string[0];
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
79
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
80 // Build a repeatable machine unique name for the channel.
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
81 string appId = applicationName + Environment.UserName;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
82 string channelName = String.Format("{0}:SingleInstanceIPCChannel", appId);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
83
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
84 bool isFirstInstance;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
85
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
86 SingleInstanceMutex = new Mutex(true, appId, out isFirstInstance);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
87
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
88 if (isFirstInstance)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
89 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
90 CreateRemoteService(channelName);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
91 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
92 else
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
93 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
94 SignalFirstInstance(channelName, commandLineArgs);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
95 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
96
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
97 return isFirstInstance;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
98 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
99
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
100 public static void Cleanup()
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
101 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
102 SafeDispose(ref SingleInstanceMutex);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
103
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
104 if (Channel != null)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
105 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
106 ChannelServices.UnregisterChannel(Channel);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
107 Channel = null;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
108 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
109 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
110
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
111 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
112
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
113 #region · Private Methods ·
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
114
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
115 private static void CreateRemoteService(string channelName)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
116 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
117 Channel = new IpcServerChannel(
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
118 new Dictionary<string, string>
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
119 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
120 { "name", channelName },
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
121 { "portName", channelName },
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
122 { "exclusiveAddressUse", "false" },
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
123 },
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
124 new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full });
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
125
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
126 ChannelServices.RegisterChannel(Channel, true);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
127 RemotingServices.Marshal(new IpcRemoteService(), RemoteServiceName);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
128 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
129
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
130 private static void SignalFirstInstance(string channelName, IList<string> args)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
131 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
132 var secondInstanceChannel = new IpcClientChannel();
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
133 ChannelServices.RegisterChannel(secondInstanceChannel, true);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
134
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
135 string remotingServiceUrl = String.Format("ipc://{0}/{1}", channelName, RemoteServiceName);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
136
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
137 // Obtain a reference to the remoting service exposed by the first instance of the application
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
138 var firstInstanceRemoteServiceReference = (IpcRemoteService)RemotingServices.Connect(typeof(IpcRemoteService), remotingServiceUrl);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
139
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
140 // Pass along the current arguments to the first instance if it's up and accepting requests.
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
141 if (firstInstanceRemoteServiceReference != null)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
142 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
143 firstInstanceRemoteServiceReference.InvokeFirstInstance(args);
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
144 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
145 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
146
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
147 private static void ActivateFirstInstance(IList<string> args)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
148 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
149 if (Application.Current != null && !Application.Current.Dispatcher.HasShutdownStarted)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
150 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
151 var handler = SingleInstanceActivated;
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
152
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
153 if (handler != null)
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
154 {
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
155 handler(Application.Current, new SingleInstanceEventArgs { Args = args });
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
156 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
157 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
158 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
159
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
160 #endregion
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
161 }
443821e55f06 Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff changeset
162 }