private void Run() { while(true) { Thread.Sleep(m_tsSleep); ManagerRemote managerRemote = new ManagerFactory().ManagerRemote; if(managerRemote == null || managerRemote.CanShutdown) { break; } } }
private bool Initialize( ManagerFactory factory ) { ManagerRemote mgr = null; try { mgr = factory.ManagerRemote; mgr.Register( this ); RegisterRemoteObject( mgr ); } catch { return false; } m_mgr = mgr; return true; }
//#endif public Manager( ManagerFactory factory ) { RegisterChannel(); Initialize( factory ); }
/// <include file='doc\ConnectionManager.uex' path='docs/doc[@for="Manager.Manager"]/*' /> public Manager() { ManagerFactory factory = null; // ENABLING THIS FOR RELEASE BUILDS FOR NOW SO THAT DEBUGGING WILL WORK FOR RELEASE BUILDS // THIS SHOULD BE REVISITED FOR FUTURE RELEAsES //#if DEBUG if (NoConnectionManagerHost) { factory = new ManagerFactory(); Initialize( factory ); return; } //#endif RegisterChannel(); // // Launch the ConnectionManagerHost if possible // bool fLaunch = true; factory = (ManagerFactory)Activator.GetObject( typeof(ManagerFactory), string.Format( "{0}://{1}/{2}", ChannelRegistrationHelper.c_ChannelName, ManagerFactory.Port, ManagerFactory.ServiceName ) ); for (int iRetries = 0; iRetries < 20; iRetries++) { if(Initialize( factory )) { break; } if(fLaunch) { string file = null; using(Win32.RegistryKey key = Win32.Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\.NETTinyFramework")) { file = (string)key.GetValue("ConnectionManager"); } System.Diagnostics.Process process = new Process(); process.StartInfo = new ProcessStartInfo(file); process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.Start(); fLaunch = false; } Thread.Sleep(100); } if(m_mgr == null) { throw new ApplicationException("Could not create ManagerRemote"); } }
//#endif public Manager(ManagerFactory factory) { RegisterChannel(); Initialize(factory); }