public BrowserWindow(string url, IPersistGeometry geometry, string appDataPath)
        {
            InitializeComponent();

            this.url         = url;
            this.appDataPath = appDataPath;
            this.geometry    = geometry;

            try
            {
                geometry?.Restore(this);

                safeAppHostChildHandle = new ChildProcessFactory()
                                         .Create("AppHostCefSharp.WebBrowser.dll");

                locator = new BrowserServiceLocator(url, appDataPath);
                Content = safeAppHostChildHandle.CreateElement(locator);

                Closing += (sender, args) =>
                {
                    locator.Close();
                    geometry?.Persist(this);
                };
            }
            catch (Exception ex)
            {
                Content = new TextBlock {
                    Text = ex.ToString()
                };
            }
        }
 public void Refresh()
 {
     locator.Close();
     geometry?.Persist(this);
     safeAppHostChildHandle = new ChildProcessFactory()
                              .Create("AppHostCefSharp.WebBrowser.dll");
     locator = new BrowserServiceLocator(url, appDataPath);
     Content = safeAppHostChildHandle.CreateElement(locator);
 }
Beispiel #3
0
 /// <summary>
 /// Creates the main form
 /// </summary>
 public MainForm()
 {
     _handle = Program.CreateChildProcessHandle();
     InitializeComponent();
 }