/// <summary> /// 定义公有方法提供一个全局访问点,同时你也可以定义公有属性来提供全局访问点 /// </summary> /// <returns></returns> public static AnalyzeConfig GetInstance() { // 如果类的实例不存在则创建,否则直接返回 if (uniqueInstance == null) { uniqueInstance = new AnalyzeConfig(); } return(uniqueInstance); }
private void live() { string appParam = AnalyzeConfig.GetInstance().configRoot.test.rtsp_url + " " + AnalyzeConfig.GetInstance().configRoot.test.rtmp_url; try { if (_liveStatus == 0) { if (proc != null) { proc.Kill(); proc = null; } _liveStatus = 1; proc = Process.Start(appName, appParam); //监视进程退出 proc.EnableRaisingEvents = true; //指定退出事件方法 proc.Exited += new EventHandler(proc_Exited); setbtnLive_live(); } else { if (proc != null) { proc.Kill(); proc = null; } _liveStatus = 0; setbtnLive_live(); } } catch (ArgumentException ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }