public bool DoClose(IWebBrowser chromiumWebBrowser, IBrowser browser) { Console.WriteLine(" Life Handler DoClose : " + browser.IsDisposed); if (!browser.IsDisposed) { browser.Dispose(); } return(false); }
private void ShowPopup(IBrowser popupBrowser, Rectangle rectangle) { BrowserView browserView = new BrowserView(); browserView.InitializeFrom(popupBrowser); // Set the same popup handler for the popup browser itself. popupBrowser.OpenPopupHandler = new OpenPopupHandler(browserView); Window window = new Window { Owner = Window.GetWindow(parent) }; if (!rectangle.IsEmpty) { window.Top = rectangle.Origin.Y; window.Left = rectangle.Origin.X; window.SizeToContent = SizeToContent.WidthAndHeight; browserView.Width = rectangle.Size.Width; browserView.Height = rectangle.Size.Height; } else { window.Width = 800; window.Height = 600; } window.Closed += (sender, args) => { window.Content = null; if (!popupBrowser.IsDisposed) { popupBrowser.Dispose(); } }; popupBrowser.TitleChanged += (sender, e) => { Dispatcher?.BeginInvoke((Action)(() => window.Title = e.Title)); }; popupBrowser.Disposed += delegate { Dispatcher?.Invoke(() => { window.Content = null; window.Hide(); window.Close(); }); }; window.Content = browserView; window.Show(); }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { _browser.Dispose(); } _presubmissionResults = null; _fullResults = null; _submission = null; _assignment = null; _repo = null; _validator = null; _allDevices = null; _browser = null; disposedValue = true; } }
private void Window_Closing(object sender, CancelEventArgs e) { browser.Dispose(); engine.Dispose(); }
private void MainWindow_OnClosed(object sender, EventArgs e) { browser?.Dispose(); engine?.Dispose(); }
private void ShowPopup(IBrowser popupBrowser, Rectangle rectangle) { BrowserView browserView = new BrowserView { Dock = DockStyle.Fill }; browserView.InitializeFrom(popupBrowser); // Set the same popup handler for the popup browser itself. popupBrowser.OpenPopupHandler = new OpenPopupHandler(browserView); Form form = new Form(); if (!rectangle.IsEmpty) { form.StartPosition = FormStartPosition.Manual; form.Location = new System.Drawing.Point(rectangle.Origin.X, rectangle.Origin.Y); form.ClientSize = new System.Drawing.Size((int)rectangle.Size.Width, (int)rectangle.Size.Height); browserView.Width = (int)rectangle.Size.Width; browserView.Height = (int)rectangle.Size.Height; } else { form.Width = 800; form.Height = 600; } form.Closed += delegate { form.Controls.Clear(); if (!popupBrowser.IsDisposed) { popupBrowser.Dispose(); } }; popupBrowser.TitleChanged += delegate(object sender, TitleChangedEventArgs e) { form.BeginInvoke((Action)(() => { form.Text = e.Title; })); }; popupBrowser.Disposed += delegate { Action formCloseAction = () => { form.Controls.Clear(); form.Hide(); form.Close(); form.Dispose(); }; form.BeginInvoke(formCloseAction); }; form.Controls.Add(browserView); form.Show(); }
public override void SampleCall(string[] args) { #region Parse Arguments ArgParser cmdLineParser = new ArgParser(); if (!cmdLineParser.Parse(args)) { // parse failed PrintUsage(INVALID_ARGUMENTS_ERROR); return; } #endregion #region Initialize properties from command line // Initialize the properties. ContextProperties contextProps = new ContextProperties(); SessionProperties sessionProps = SampleUtils.NewSessionPropertiesFromConfig(cmdLineParser.Config); #endregion // Define IContext and ISession. IContext context = null; ISession session = null; IBrowser browser = null; IQueue queue = null; try { InitContext(cmdLineParser.LogLevel); #region Initialize the context, connect the Session, and assert capabilities. Console.WriteLine("About to create the context ..."); context = ContextFactory.Instance.CreateContext(contextProps, null); Console.WriteLine("Context successfully created "); Console.WriteLine("About to create the session ..."); session = context.CreateSession(sessionProps, SampleUtils.HandleMessageEvent, SampleUtils.HandleSessionEvent); Console.WriteLine("Session successfully created."); Console.WriteLine("About to connect the session ..."); if (session.Connect() == ReturnCode.SOLCLIENT_OK) { Console.WriteLine("Session successfully connected"); Console.WriteLine(GetRouterInfo(session)); } // Does the appliance support these capabilities:PUB_GUARANTEED,ENDPOINT_MANAGEMENT,BROWSER? Console.Write(String.Format("Check for capability: {0} ... ", CapabilityType.PUB_GUARANTEED)); if (!session.IsCapable(CapabilityType.PUB_GUARANTEED)) { Console.WriteLine("Not Supported\n Exiting"); return; } else { Console.WriteLine("Supported"); } Console.Write(String.Format("Check for capability: {0} ... ", CapabilityType.ENDPOINT_MANAGEMENT)); if (!session.IsCapable(CapabilityType.ENDPOINT_MANAGEMENT)) { Console.WriteLine("Not Supported\n Exiting"); return; } else { Console.WriteLine("Supported"); } Console.Write(String.Format("Check for capability: {0} ... ", CapabilityType.BROWSER)); if (!session.IsCapable(CapabilityType.BROWSER)) { Console.WriteLine("Not Supported \n Exiting"); return; } else { Console.WriteLine("Supported"); } #endregion #region Provision a new queue endpoint EndpointProperties endpointProps = new EndpointProperties(); // Set permissions to allow all permissions to others. endpointProps.Permission = EndpointProperties.EndpointPermission.Delete; // Set access type to exclusive. endpointProps.AccessType = EndpointProperties.EndpointAccessType.Exclusive; // Set quota to 100 MB. endpointProps.Quota = 100; string queueName = "solclient_dotnet_sample_QueueProvisionAndBrowse_" + (new Random()).Next(1000); queue = ContextFactory.Instance.CreateQueue(queueName); Console.WriteLine(String.Format("About to provision queue '{0}' on the appliance", queueName)); try { session.Provision(queue /* endpoint */, endpointProps /*endpoint properties */, ProvisionFlag.WaitForConfirm /* block waiting for confirmation */, null /*no correlation key*/); Console.WriteLine("Endpoint queue successfully provisioned on the appliance"); } catch (Exception ex) { PrintException(ex); Console.WriteLine("Exiting"); return; } #endregion #region Publishing some messages to this newly provisioned queue IMessage msg = ContextFactory.Instance.CreateMessage(); msg.BinaryAttachment = Encoding.ASCII.GetBytes(SampleUtils.MSG_ATTACHMENTTEXT); msg.DeliveryMode = MessageDeliveryMode.Persistent; msg.Destination = queue; int howManyToPublish = 10; Console.WriteLine(String.Format("About to publish {0} messages", howManyToPublish)); for (int i = 0; i < howManyToPublish; i++) { if (session.Send(msg) == ReturnCode.SOLCLIENT_OK) { Console.Write("."); } Thread.Sleep(100); // wait for 0.5 seconds } Console.WriteLine("\nDone"); #endregion #region Create a Browser to the newly provisioned Queue, and selectively remove the spooled messages. BrowserProperties browserProps = new BrowserProperties(); browser = session.CreateBrowser(queue, browserProps); Console.WriteLine(string.Format("Browsing queue {0} ", queueName)); int count = 0, removedCount = 0; while ((msg = browser.GetNext()) != null) { Console.WriteLine(msg.Dump()); count++; if (count % 3 == 0) { // A message may be removed by calling IBrowser.remove(). // This deletes it from the appliance's message spool. Console.WriteLine("Removing spooled message ({0}).", count); browser.Remove(msg); removedCount++; } } Console.WriteLine(string.Format("Browsed {0} messages, removed {1} ", count, removedCount)); #endregion } catch (Exception ex) { PrintException(ex); Console.WriteLine("Exiting"); } finally { if (browser != null) { browser.Dispose(); } if (session != null) { session.Deprovision(queue, ProvisionFlag.WaitForConfirm, null); session.Dispose(); } if (context != null) { context.Dispose(); } // Must cleanup after. CleanupContext(); } }
private void Window_Closed(object sender, EventArgs e) { browser.Dispose(); engine.Dispose(); }
public void Dispose() { _browser.Dispose(); }
private void Form1_Closed(object sender, EventArgs e) { browser?.Dispose(); engine?.Dispose(); }
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { // Dispose browser and engine when close app window. browser.Dispose(); engine.Dispose(); }
public void Dispose() { wrappedBrowser.Dispose(); }
//private static VerifyCertificateResponse VerifyCert(VerifyCertificateParameters parameters) //{ // // Reject SSL certificate for all "google.com" hosts. // //if (parameters.HostName.Contains("google.com")) // //{ // // Console.WriteLine("Rejected certificate for " + parameters.HostName); // // return VerifyCertificateResponse.Invalid(); // //} // return VerifyCertificateResponse.Default(); //} //void handlePKI(IBrowser browser) //{ // browser.SelectCertificateHandler = // new Handler<SelectCertificateParameters, SelectCertificateResponse>(p => // { // // The dialog title. // string title = p.Title; // // The dialog message. // string message = p.Message; // // Available SSL certificates. // IEnumerable<Certificate> certificates = p.Certificates; // //... // // The last certificate in the list has been selected. // //X509Certificate2Collection selectedCertificateCollection = X509Certificate2UI.SelectFromCollection(certificates, title, message, X509SelectionFlag.SingleSelection); // return SelectCertificateResponse.Select(p.Certificates.Count() - 3); // }); //} private void browserContainer_FormClosing(object sender, FormClosingEventArgs e) { browser?.Dispose(); //engine?.Dispose(); }
public void Dispose() { browser?.Dispose(); }
private void Window_Closing(object sender, CancelEventArgs e) { // Dispose browser and engine when close app window. browser.Dispose(); engine.Dispose(); }
public void TearDown() { _server.Kill(); _browser.Dispose(); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { browser?.Dispose(); engine?.Dispose(); }
private void BrowserForm_FormClosed(object sender, FormClosedEventArgs e) { browser?.Dispose(); }