private void InitAppParameters() { log.Info("Init app parameters"); Utils.CreateConfigFilePath(); if (Utils.GetAnonymousLogoutAndAnonymousJoinConf()) { // clear the flag Utils.SetAnonymousLogoutAndAnonymousJoinConf(false); } CefSharpUtil.ClearCefSharpCacheAndLog(); CefSharpUtil.InitCefSharpSetting(); Application.Current.MainWindow = new MainWindow(); InitEVSdk(); View.VideoPeopleWindow.Instance = new View.VideoPeopleWindow(); // set the window size to a small value to initialize the window in a smooth showing View.VideoPeopleWindow.Instance.Width = 10; View.VideoPeopleWindow.Instance.Height = 10; View.VideoPeopleWindow.Instance.Init(); View.VideoPeopleWindow.Instance.Show(); View.VideoPeopleWindow.Instance.Visibility = Visibility.Collapsed; View.VideoPeopleWindow.Instance.ResumeNormalSetting(); #if AUTOTEST log.Info("Start automation server."); www.WwwServer.StartServer(); #endif }
private void Application_Startup(object sender, StartupEventArgs e) { var resolverArgs = CefSharpUtil.AddAssemblyResolverForCefSharp(); var cefSettings = WPF.EntClient.BuildDefaultCefSettings(); cefSettings.IgnoreCertificateErrors = true; WPF.EntClient.Initialize(cefSettings, resolverArgs); }
/// <summary> /// Cleans up resources required for using <see cref="BaseDesktopClient{C}"/> in an application. /// This method must be called once when <see cref="BaseDesktopClient{C}"/> is no more used by the application. /// </summary> public static void Shutdown() { if (cefSharpInitialized) { CefSharpUtil.ShutdownCefSharp(); cefSharpInitialized = false; } }
static void Main() { var resolverArgs = CefSharpUtil.AddAssemblyResolverForCefSharp(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var appContext = new WinFormsSampleApplicationContext(resolverArgs); Application.Run(appContext); }
protected override void OnClosed(EventArgs e) { log.Info("OnClosed"); CallController.Instance.CallStatusChanged -= OnCallStatusChanged; if (CallController.Instance.CurrentCallStatus != CallStatus.Idle && CallController.Instance.CurrentCallStatus != CallStatus.Ended) { CallController.Instance.TerminateCall(); } base.OnClosed(e); Thread.Sleep(500);//should give this time to terminate call log.Info("Release resource"); EVSdkManager.Instance.Release(); CefSharpUtil.ShutdownCefSharp(); View.LayoutBackgroundWindow.Instance.Dispose(); TerminateProcess(Process.GetCurrentProcess().Handle, 1); }
void ShowUnhandledException(DispatcherUnhandledExceptionEventArgs e) { string procName = Process.GetCurrentProcess().ProcessName; using (PerformanceCounter pc = new PerformanceCounter("Process", "Private Bytes", procName)) { log.InfoFormat("Current memory used: {0}", pc.NextValue()); } log.Error("App ShowUnhandledException: " + e.Exception); e.Handled = true; string errorMessage = string.Format("An application error occurred.\n\nError: {0}", e.Exception.Message + (e.Exception.InnerException != null ? "\n" + e.Exception.InnerException.Message : null)); try { MessageBoxTip tip; MainWindow mainWindow = Current.MainWindow as MainWindow; if (null == mainWindow) { tip = new MessageBoxTip(null); } else { tip = new MessageBoxTip(mainWindow.GetCurrentMainDisplayWindow()); } tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), errorMessage, LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); } catch (Exception ex) { log.Error("Failed to ShowUnhandledException, detail: " + ex); } CefSharpUtil.ShutdownCefSharp(); View.LayoutBackgroundWindow.Instance.Dispose(); Application.Current.Shutdown(); }
/// <summary> /// <para>Executes initialization necessary for using <see cref="BaseDesktopClient{C}"/> in an application. /// This method (any overload of this method) must be called once during application lifecycle, /// before using <see cref="EntClient"/> for the first time.</para> /// <para><see cref="EntClient"/> uses <see cref="https://github.com/cefsharp/CefSharp"/> for displaying /// an embedded browser window for operations that require displaying server-side user interface, /// especially a sign-on window. <see cref="EntClient"/> supports using <c>AnyCPU</c> as target architecture, /// and with <c>CefSharp</c> this means that loading unmanaged CefSharp resources is required. This /// method assumes that the required CefSharp dependencies can be found under <c>x84</c> or <c>x64</c> /// subdirectories.</para> /// </summary> /// <param name="cefSettings">CefSharp initialization parameters. In many cases it is sufficient to /// pass an empty instance of a derived class suitable for the use case. Must not be <c>null</c>.</param> /// <param name="resolverArgs">Arguments for customizing how CefSharp / cef resources are searched, /// or <c>null</c> for default behavior.</param> public static void Initialize(CefSettingsBase cefSettings, CefSharpResolverArgs resolverArgs = null) { CefSharpUtil.InitializeCefSharp(cefSettings, resolverArgs); cefSharpInitialized = true; }