Navigation.PopAsync with a PushModalAsync? - xamarin.forms

i'm doing some support to an existing application. it's a really big application, and several pages are using a base controller, this controller works as the name says controller for all the events and stuff of the form.
the thing is that this application was done on xamarin 2.0 and never updated the version, now i've updated xamarin forms to the actual version 4.0 and some stuff works different. but the issue that bugs me more is Navigation.PopAsync.
In the 2.0 it closes all "windows" it doesn't matter if it's modal or a normal window.
but now with xamarin 4.0, the modal windows are not closed.
is there a way of knowing if the current window in Navigation is a modal or something like that?
Regards.

you could check whether it appears at the top of the Navigation.ModalStack like this:
private bool IsModal(Page page)
{
if (page == Navigation.ModalStack[Navigation.ModalStack.Count])
{
// is modal page
return true;
}
else
{
//not modal page
return false;
}
}

Related

Using WebBrowser in ASP.Net Web Application

I am trying to use a WebBrowser in a .cs class in a Web Application - NOT A WINDOWS FORM app using (VS 2019).
I know it's a Windows Form app control, but it seems like I should be able to use it in a Web App.
Using WebBrowser in Web App does not have the .Url property, so I just use the .Navigate directly - this is where the code breaks.
I have tried many suggestions on the Net, but nothing seems to work - it looks like most of the examples uses a Web Page - I want to use the WebBrowser directly in code (.cs class).
private static void LoginViaUserAgentFlow()
{
Thread thread = new Thread(delegate ()
{
StringBuilder sb = new StringBuilder(String.Format("{0}/services/oauth2/authorize",
RHOutlook.chosenInstance.sfdcURL));
sb.Append("?response_type=token");
sb.Append(String.Format("&client_id={0}", RHOutlook.chosenInstance.clientId));
sb.Append(String.Format("&redirect_uri={0}", System.Web.HttpUtility.UrlEncode(RHOutlook.chosenInstance.redirectUri)));
WebBrowser webBrowserSFDCLogin = new WebBrowser();
//Here I can't use the .Url becaue it is not available - so I just use
//Navigate to get to the site
webBrowserSFDCLogin.Url = new Uri(sb.ToString());
//This is were it breaks, comes back with error when I navigate to the site.
webBrowserSFDCLogin.Navigate(sb.ToString());
//This code is never reached - failed at above code.
if (webBrowserSFDCLogin.LocationURL != null && webBrowserSFDCLogin.LocationURL.StartsWith(RHOutlook.chosenInstance.redirectUri))
{
//webBrowserSFDCLogin.ScriptErrorsSuppressed = true;
webBrowserSFDCLogin.Stop();
}
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
}
I expect to be able to navigate to the external website. If I can navigate to the site if I copy the url directly in a browser (say Chrome).
I tried using ; this gives me the Url property, but still get the error.
You really should stick to suggestions and examples.
What you are trying to do is to use class that is designed for Windows Application inside a Web Application.
Those two frameworks are similar like Earth and Mars. I am afraid you are not going to be able to grow a tree on Mars.

JXBrowser control over dialog website not responding

Hey im having issues with a website in the jxbrowser. it seems like it is running into a timeout or whatever and then in the jxbrowser there is a dialog showing up "website not responding" and i can click on "reload" or "leave".
Can I in any way access this dialog and overwrite it? For instance everytime i would get this dont ask but go to the homepage instead?
I'm having trouble finding this if it is even possible.
I found a solution. JXBrowser has a RenderAdapter where a function exists onRenderUnresponsive wich can be overridden. Look at this: https://jxbrowser.support.teamdev.com/support/solutions/articles/9000091687-detecting-unresponsive-web-page
In my case I simply want to reload the website:
Browser browser = new Browser();
browser.addRenderListener(new RenderAdapter() {
#Override
public void onRenderUnresponsive(RenderEvent event) {
browser.reloadIgnoringCache(false);
}
});

Avoid back button using vaadin

I develop RIA application using Vaadin CDI addon.
About the app : it has two views(viewA and viewB) which maintained by Navigator.
User story is pretty simple:
User enters viewA
Perform some business stuff
Redirects to viewB
Using address bar to go some external website(ex. google.com)
Press back and it goes to he lastest page what he saw(viewB), instead of viewA
Any suggestions/tips-n-tricks how to avoid redirecting to viewB, but redirect to viewA?
Vaadin Forum quiet about this thing.
Thank you
I had same problem but resolved using following code:
getUI().getNavigator().addViewChangeListener(new ViewChangeListener() {
public boolean beforeViewChange(ViewChangeEvent event) {
return changeView;
}
#Override
public void afterViewChange(ViewChangeEvent event) {
// TODO Auto-generated method stub
}});
Set changeView = true only through proper navigation's (eg: On button clicks).
This how you can avoid navigation's using browser back button. In this case if user uses any of browser buttons the view does not changes and it remains on same page.
You could override View.enter(...) in your ViewB, and, according to your application state, update your view URI using Page.getCurrent().setUriFragment(recentUrl, false);

How to reload Page in blackberry cascades QML

in my blackberry cascades app I have created a page using qml that loads data from backend after making an API call and works fine. But after I move to next page and come back I need to reload the data. i.e perform the onCreationCompleted operation again. Also the Qt.pageDef shows undefined after I come back so I guess if I could reload the page, it would work fine. I'm new to blackberry cascades, can anyone tell me what should I do to reload this page again and re-initialise Qt.pageDef?
Page {
id: homePage
Container {
id:contactListView
//Some code to create listview
onCreationCompleted:
{
Qt.pageDef = contactListView;
fetchInfo();
}
fetchInfo()
{
//make api call and fill listview
}
}
}
Obviously, there are some part of code missing as you show us a Page but you seem to push a new page from a NavigationPane.
Add this to your NavigationPane :
onPopTransitionEnded: {
fetchInfo()
}

XAF: How to minimize ribbon from code in XAF Windows App

I want to minimize the ribbon when user click on particular navigation Item.
For example - when User clicks on Dashboard nav item, I want the ribbon minimized, and automatically "maximized" on others.
How can I do that ?
I've found that I can simple access the ribbon in the ViewController.
So like usual in XAF, override "OnActivated" and do the magic there
protected override void OnActivated()
{
if (Frame.Template != null)
{
((XtraFormTemplateBase)Frame.Template)).RibbonTransformer.Ribbon
.Minimized = View.Id == "TestView;
}
base.OnActivated();
}
I got a couple of errors while accessing Frame.Template being NULL when I'd hit a dashboardview, with many nested ListView in it. Make sure You don't forget to check it :)
They released a hotfix for this bug in Devexpress's version 22.1.4. Today I updated to 22.1.4 while getting this error when there was version 22.1.3 and the error was completely resolved.
NullReferenceException is thrown in the MinimizedRibbonPopupForm.GetSizeWithIndents method when the Classic panel style is used

Resources