Close Browser

I have a browser that I am launching in Epicor. When the user closes I would like a Data View to refresh. Any ideas how to make this work. below is my code to launch the browser.

//Launch Epicor URL - Any Area
	private void LaunchURL(string url, string title = "", int padding = 65)
	Ice.Lib.Customization.CustomWebBrowserDialog uiWebBrowser = new Ice.Lib.Customization.CustomWebBrowserDialog();
	Ice.Lib.Framework.EpiBaseForm f = (Ice.Lib.Framework.EpiBaseForm)csm.PersonalizeCustomizeManager.TopControl.FindForm();
   uiWebBrowser.Width = f.Width - padding;
   uiWebBrowser.Height = f.Height - padding;
   uiWebBrowser.Text = title;
   uiWebBrowser.HomeURL = url;
   uiWebBrowser.StartPosition = FormStartPosition.CenterScreen; // If you don't center you can use .Top and .Left
   uiWebBrowser.OnRefresh(); // Loads URL
//	if (uiWebBrowser.Close)
//	{
//	RefreshAfterClose();
////Order - Refresh After Close
//private void RefreshAfterClose()
//MessageBox.Show("Window Closed");

Try using this event…

uiWebBrowser.FormClosed += uiWebBrowser_FormClosed;

Where do I add that and do I put it exactly like you have it typed?

This gives a high level overview about events and delegates. It’s not in the context of Epicor but all the same rules and info applies. I would review educational content like this to get a base understanding of the information you are being given here on the site. It will help greatly in the long run. The whole give a man a fish teach a man to fish thing and all lol.

1 Like

Here is what I got to work:

		DialogResult dr = new DialogResult();
		dr = uiWebBrowser.ShowDialog();
if (dr == DialogResult.OK || dr == DialogResult.Cancel)