/// <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;
     }
 }
        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);
        }
Example #3
0
        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();
        }