static class Program { [STAThread] static void Main() { bool createdNew=false; Mutex mutex = new Mutex(true, @"GlobalAirVoice", out createdNew); try { if (createdNew) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); LoginForm loginForm = new LoginForm(); if (loginForm.ShowDialog() != DialogResult.OK) { return; } IMultimediaManager multimediaManager = MultimediaManagerFactory.GetSingleton(); multimediaManager.CameraDeviceIndex = 0; multimediaManager.MicrophoneDeviceIndex = 0; multimediaManager.AutoAdjustCameraEncodeQuality = false; multimediaManager.CameraEncodeQuality = 0; multimediaManager.ChannelMode = ChannelMode.P2PChannelFirst; multimediaManager.Initialize(loginForm.CurrentUserID, loginForm.CurrentPwd, ConfigurationManager.AppSettings["ServerIP"], int.Parse(ConfigurationManager.AppSettings["ServerPort"])); multimediaManager.AllowControlDesktop = false; multimediaManager.OutputDesktop = false; MainForm mainForm = new MainForm(); mainForm.Initialize(multimediaManager, loginForm.CurrentUserID); Application.Run(mainForm); } } catch (Exception ee) { MessageBox.Show(ee.Message + "," + ee.StackTrace); }finally { mutex.ReleaseMutex(); } } }