internal static void Initialize() { try { lock (_Lock) { if (!_Initialized) { //init the file logger CallStackLogger.Instance.Initialize(); //start the wcf server if needed if (SettingsManager.Instance.Settings.AllowDistantControl) { _Host = new WcfHostService(); _Host.StartService(); _Initialized = true; } //allow capture from the first run if (SettingsManager.Instance.Settings.CaptureOnStart) { _CaptureAllowed = true; } } } } catch (Exception err) { RuntimeLogger.Instance.Log(LogType.Error, "ReflectionStudio.Spy.Performance.StartEvent {0}", err.Message); _Initialized = false; } }
private void btnStartService_Click(object sender, EventArgs e) { (sender as Button).Enabled = !MainThreadContext.Main.StartService(); timerJobUpdate.Enabled = btnStopService.Enabled = true; //啟動 WCF 服務 WcfHostService.StartWcfHost(); }
protected override void OnStart(string[] args) { MainThreadContext.Main = new MainThread(); MainThreadContext.Main.StartService(); //啟動 WCF 服務 WcfHostService.StartWcfHost(); }
private void btnStopService_Click(object sender, EventArgs e) { MainThreadContext.Main.StopService(); //停止 WCF 服務 WcfHostService.StopWcfHost(); btnStartService.Enabled = true; timerJobUpdate.Enabled = (sender as Button).Enabled = false; }
protected override void OnStop() { MainThreadContext.Main.StopService(); //停止 WCF 服務 WcfHostService.StopWcfHost(); }