public bool Open(string address) { if (PropertyService.Get <bool>("Unity.Base.Documentation.OpenInBrowser", true)) { // TODO: Change back to using DesktopService.ShowUrl(address) // PlatformService was replaced with DesktopService // Windows MonoDevelop is not updated with this change yet. System.Diagnostics.Process.Start(address); return(true); } else { if (MonoDevelop.Core.Gui.WebBrowserService.CanGetWebBrowser) { browser = WebBrowserService.GetWebBrowser(); browser.LoadUrl(address); return(true); } else { MessageService.ShowMessage(GettextCatalog.GetString("Missing Extension"), GettextCatalog.GetString("The Mono.WebBrowser Extension (part of Mono) is required for this functionality to work. We'll set your \"Open In Browser\" setting back to open with your default browser.")); PropertyService.Set("Unity.Base.Documentation.OpenInBrowser", true); return(false); } } }
// protected Gtk.Alignment frmBrowserAlign; #endregion /// <summary>Initializes a new instance of the AddWebReferenceDialog widget.</summary> public WebReferenceDialog(DotNetProject project) { Build(); this.basePath = Library.GetWebReferencePath(project); this.IsWebService = false; this.project = project; // Add the mozilla control to the frame if (WebBrowserService.CanGetWebBrowser) { browser = WebBrowserService.GetWebBrowser(); browserWidget = (Widget)browser; browser.LocationChanged += Browser_LocationChanged; browser.NetStart += Browser_StartLoading; browser.NetStop += Browser_StopLoading; frmBrowser.Add(browserWidget); browser.LoadUrl(this.homeUrl); browserWidget.Show(); } else { tlbNavigate.Visible = false; ScrolledWindow sw = new ScrolledWindow(); sw.ShadowType = ShadowType.In; docLabel = new Label(); docLabel.Xpad = 6; docLabel.Ypad = 6; docLabel.Xalign = 0; docLabel.Yalign = 0; sw.AddWithViewport(docLabel); sw.ShowAll(); frmBrowser.Add(sw); tbxReferenceURL.Text = homeUrl; UpdateLocation(); } frmBrowser.Show(); this.Child.ShowAll(); }
void ChangeState(DialogState newState) { bool hasConfig = comboModel.Active == 0; switch (newState) { case DialogState.Create: btnBack.Visible = false; btnConfig.Visible = true; btnConfig.Sensitive = isWebService && hasConfig; btnOK.Visible = true; btnOK.Sensitive = isWebService; tlbNavigate.Visible = WebBrowserService.CanGetWebBrowser; tbxReferenceName.Sensitive = isWebService; comboModel.Sensitive = !project.IsPortableLibrary; break; case DialogState.CreateConfig: btnBack.Visible = true; btnBack.Sensitive = true; btnConfig.Visible = false; btnOK.Visible = true; btnOK.Sensitive = true; tlbNavigate.Visible = false; tbxReferenceName.Sensitive = false; comboModel.Sensitive = false; break; case DialogState.Modify: btnBack.Visible = false; btnConfig.Visible = true; btnConfig.Sensitive = isWebService && hasConfig; btnOK.Visible = true; btnOK.Sensitive = isWebService; tlbNavigate.Visible = WebBrowserService.CanGetWebBrowser; tbxReferenceName.Sensitive = false; comboModel.Sensitive = false; break; case DialogState.ModifyConfig: btnBack.Visible = false; btnConfig.Visible = false; btnOK.Visible = true; btnOK.Sensitive = true; tlbNavigate.Visible = false; tbxReferenceName.Sensitive = false; comboModel.Sensitive = false; break; default: throw new InvalidOperationException(); } if (wcfConfig != null) { wcfConfig.Update(); } if (state == newState) { return; } if (state != DialogState.Uninitialized) { frmBrowser.Forall(frmBrowser.Remove); } browser = null; browserWidget = null; docLabel = null; wcfConfig = null; state = newState; ScrolledWindow sw; switch (state) { case DialogState.Create: case DialogState.Modify: if (WebBrowserService.CanGetWebBrowser) { browser = WebBrowserService.GetWebBrowser(); browserWidget = (Widget)browser; browser.LocationChanged += Browser_LocationChanged; browser.NetStart += Browser_StartLoading; browser.NetStop += Browser_StopLoading; frmBrowser.Add(browserWidget); browser.LoadUrl(tbxReferenceURL.Text); browserWidget.Show(); } else { docLabel = new Label(); docLabel.Xpad = 6; docLabel.Ypad = 6; docLabel.Xalign = 0; docLabel.Yalign = 0; sw = new ScrolledWindow(); sw.ShadowType = ShadowType.In; sw.AddWithViewport(docLabel); sw.ShowAll(); frmBrowser.Add(sw); UpdateLocation(); } break; case DialogState.ModifyConfig: case DialogState.CreateConfig: if (!hasConfig) { return; } sw = new ScrolledWindow(); sw.ShadowType = ShadowType.In; wcfConfig = new WCFConfigWidget(wcfOptions, wcfProject); sw.AddWithViewport(wcfConfig); sw.ShowAll(); frmBrowser.Add(sw); break; default: throw new InvalidOperationException(); } }