private void Form1_Load(object sender, EventArgs e) { // PathConfig ptc = new PathConfig(); PathManager.Instance.RootPath = @"D:\ServerPathRoot" /*Path.GetDirectoryName(Application.ExecutablePath)*/; PathManager.Instance.PartProgramsPath = "PartPrograms"; PathManager.Instance.BladesPath = "blades"; PathManager.Instance.ReportsPath = "Results"; PathManager.Instance.TempPath = @"D:\ServerPathRoot"; //PathManager.Instance.Configration = ptc; PartConfigManager.Instance.InitPartConfigManager(/*@"D:\ServerPathRoot\parts.xml"*/); _bladeMeasureContext = new MeasureServiceContext(10, 10); _bladeMeasureContext.Initialize(); cmmCtrlHost = new ServiceHost(_bladeMeasureContext); cmmCtrlHost.Opened += Host_Opened; cmmCtrlHost.Open(TimeSpan.FromMinutes(0.5)); partServiceHost = new ServiceHost(typeof(PartConfigService)); partServiceHost.Open(TimeSpan.FromMinutes(0.5)); }
private void MainFrm_Load(object sender, EventArgs e) { AutoResetEvent arevt = new AutoResetEvent(false); errorInfo = "服务器启动成功"; Task.Run(() => { InitForm initForm = new InitForm(arevt); initForm.ShowDialog(); }); // 初始化工件配置管理器 PartConfigManager.Instance.InitPartConfigManager(/*_partFile*/); if (!_msc.Initialize()) { //初始化PCDMIS失败 errorInfo = "未能初始化PCDMIS"; LocalLogCollector.WriteMessage(errorInfo); } // 开启服务器 try { _ctrlHost.Open(TimeSpan.FromSeconds(_ServiceOpenTimeout)); _partServiceHost.Open(TimeSpan.FromSeconds(_ServiceOpenTimeout)); LocalLogCollector.WriteMessage(errorInfo); } catch (TimeoutException) { errorInfo = "服务器未正常启动"; //RefreshInfoView(errorInfo); LocalLogCollector.WriteMessage(errorInfo); } finally { arevt.Set(); } //logListView.Items.Add(errorInfo); //RefreshInfoView(errorInfo); }