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(); }