public static void Main() { ManageLiteAV.CrashDump dump = new ManageLiteAV.CrashDump(); dump.open(); SetProcessDPIAware(); // 默认关闭高DPI,避免SDK录制出错 Log.Open(); // 初始化SDK的 Local 配置信息 DataManager.GetInstance().InitConfig(); Process processes = Process.GetCurrentProcess(); Log.I(String.Format("Progress <{0}, {1}>", processes.ProcessName, processes.Id)); TRTCWPFDemo.App app = new TRTCWPFDemo.App(); app.InitializeComponent(); app.Run(); // 退出程序前写入最新的 Local 配置信息。 DataManager.GetInstance().Uninit(); DataManager.GetInstance().Dispose(); Log.Close(); dump.close(); }
public static void Main() { bool createNew; using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, ProductName, out createNew)) { if (/*true ||*/ createNew) { ManageLiteAV.CrashDump dump = new ManageLiteAV.CrashDump(); dump.open(); SetProcessDPIAware(); // 默认关闭高DPI,避免SDK录制出错 Log.Open(); // 初始化SDK的 Local 配置信息 DataManager.GetInstance().InitConfig(); Process processes = Process.GetCurrentProcess(); Log.I(String.Format("Progress <{0}, {1}>", processes.ProcessName, processes.Id)); CloudDesktop.App app = new CloudDesktop.App(); app.InitializeComponent(); app.Run(); // 退出程序前写入最新的 Local 配置信息。 DataManager.GetInstance().Uninit(); DataManager.GetInstance().Dispose(); Log.Close(); dump.close(); } else { IpcClientChannel channel = new IpcClientChannel(); if (channel != null) { try { ChannelServices.RegisterChannel(channel, false); WndHandle obj = (WndHandle)Activator.GetObject(typeof(WndHandle), "ipc://" + ProductName + "ServerChannel" + "/WindowsHandle"); if (obj != null) { IntPtr nWndHandle = obj.GetWndHandle(); ShowWindowAsync(nWndHandle, SW_SHOWNOMAL); //显示 SetForegroundWindow(nWndHandle); //当到最前端 } ChannelServices.UnregisterChannel(channel); } catch (Exception) { } } } } }
static void Main() { ManageLiteAV.CrashDump dump = new ManageLiteAV.CrashDump(); dump.open(); // 尝试创建一个命名事件 bool createNew; ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, "TRTCStartEvent", out createNew); // 如果该命名事件已经存在(存在有前一个运行实例),则发事件通知并退出 if (!createNew) { ProgramStarted.Set(); return; } SetProcessDPIAware(); // 默认关闭高DPI,避免SDK录制出错 Log.Open(); // 初始化SDK的 Local 配置信息 DataManager.GetInstance().InitConfig(); Process processes = Process.GetCurrentProcess(); Log.I(String.Format("Progress <{0}, {1}>", processes.ProcessName, processes.Id)); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new TRTCCSharpDemo.TRTCLoginForm()); // 退出程序前写入最新的 Local 配置信息。 DataManager.GetInstance().Uninit(); DataManager.GetInstance().Dispose(); Log.Close(); dump.close(); }