Beispiel #1
0
        /// <summary>
        /// 退出应用程序
        /// </summary>
        public void Exit()
        {
            this.Invoke((EventHandler) delegate
            {
                this.WindowState        = FormWindowState.Minimized;
                this.ShowInTaskbar      = false;
                this.notifyIcon.Visible = false;
                if (null != secondScreenShowWindow)
                {
                    secondScreenShowWindow.Hide();
                }

                #region  除历史文件
                try
                {
                    new Thread(ClearFilesResources).Start();
                }
                catch { }
                #endregion

                if (!PublicUtil.Config.安装时间)
                {
                    if (File.Exists(PublicUtil.Config.载的更新程序完整路径))
                    {
                        System.Diagnostics.Process myProcess = System.Diagnostics.Process.Start(PublicUtil.Config.载的更新程序完整路径);
                    }
                }

                #region 浏览器关闭处理
                try
                {
                    myBrowser.getWebBrowser().CloseDevTools();
                    myBrowser.getWebBrowser().GetBrowser().CloseBrowser(true);
                }
                catch { }

                try
                {
                    if (myBrowser.getWebBrowser() != null)
                    {
                        //Cef.ClearSchemeHandlerFactories();
                        myBrowser.getWebBrowser().Dispose();
                        Cef.Shutdown();
                    }
                }
                catch { }
                #endregion


                Process.GetCurrentProcess().Kill();
            });
        }
Beispiel #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            this.panel = new Panel();
            this.Controls.Add(panel);

            var path = Application.StartupPath + @"\html\test.html";

            path = path.Replace("#", "%23");

            myBrowser = new MyChromiumBrowserExtend(this);
            myBrowser.secodeScreenShowWindow = secondScreenShowWindow;


            string baseUrl = "http://119.23.15.8:8080/tty";

            try
            {
                baseUrl = ConfigurationManager.AppSettings["BaseUrl"];
            }
            catch (Exception)
            {
                baseUrl = "http://119.23.15.8:8080/tty";
            }
            myBrowser.Navigate(baseUrl);
            this.panel.Controls.Add(myBrowser.getWebBrowser());
            this.panel.Dock = DockStyle.Fill;

            //清理内存
            new Thread(TimerCleanLocalMemory).Start();
        }