コード例 #1
0
        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()
                };
            }
        }
コード例 #2
0
 public void Refresh()
 {
     locator.Close();
     geometry?.Persist(this);
     safeAppHostChildHandle = new ChildProcessFactory()
                              .Create("AppHostCefSharp.WebBrowser.dll");
     locator = new BrowserServiceLocator(url, appDataPath);
     Content = safeAppHostChildHandle.CreateElement(locator);
 }