Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

How to solve: DisplayAlert not showing on detailpage (master-detail page)

$
0
0

Hi all

I have a very strange Problem and not able to solve it myself...
In my app, I have a master-detail-navigation. The user can select a guide from menu and then he can search for various search-options (including start-point for the search, what can be a city/zip-code or GPS-Data and radius).
If no data are found in the given radius, I want to ask the user, if he want to automatically double the radius and automatically search once more.
Therefore, I have added a DisplayAlert, that have to be displayed, if no data are found.
The problem is, that the DisplayAlert not is showed on the page, as soon as I have changed the detail-page over the master-page.
It seems, as that the DisplayAlert is called (“displayed”), but not showed on the active-page.
-> See also “Detail problem-description” at the end of this posting:
I have no Idea, how to solve this problem, maybe it’s a bug..?

I work with VS2013 - update 2 and the latest “stable” XF-Version (1.2.3.6257)

Many thanks for any feedback.

Code-snipped master-page:

string cTitel = "";
if (option.Titel == "FreizeitGuide")
{
  GV.iGuideWahl = 0; // Guide zentral setzen
  cTitel = "FreizeitGuide";
  cGuide = "EFZ";
  cURL = cURL + "/api/SQL/" + cIdentCode + cGuide + GV.cSQLServerZusatz; 
  GV.cAnzeigeModus = "Empfehlung";
  return new EmpfehlungenPage(cURL, cTitel) { Icon = "FreizeitGuide.png" };
}
if (option.Titel == "GourmetGuide")
{
cTitel = "GourmetGuide";
cGuide = "ERE";
GV.iGuideWahl = 1;
cURL = cURL + "/api/SQL/" + cIdentCode + cGuide + GV.cSQLServerZusatz; 
GV.cAnzeigeModus = "Empfehlung";
return new EmpfehlungenPage(cURL, cTitel);
}
if (option.Titel == "BeautyGuide")
{
GV.iGuideWahl = 2;
cTitel = "BeautyGuide";
cGuide = "EBT";
cURL = cURL + "/api/SQL/" + cIdentCode + cGuide + GV.cSQLServerZusatz;
GV.cAnzeigeModus = "Empfehlung";
return new EmpfehlungenPage(cURL, cTitel);
}

Note: for all three options, the same page is returned
On EmpfehlungenPage then the data are queried (cURL) and the result is showed in a ListView

Code snipped from EmpfehlungenPage

    async Task<List<GV.Empfehlung>> EmpfehlungenLaden(string cURL)
    {
    //…
    // various code
    //…
    <strong>// problem-code: </strong>
    lStatusAbfrage.Text = "Vor Display Alert"; // updates a label on EmpfehlungenPage -> for test
    var AntwortJa = await this.DisplayAlert("Es wurden keine Daten gefunden", cText, "Ja", "Nein");
    lStatusAbfrage.Text = "Nach Display Alert"; // updates a label on EmpfehlungenPage -> for test
    if (AntwortJa)
    {
      GV.cSuch_Url = GV.cSuch_Url.Replace(AktuellerUmkreis, NeuerUmkreis); 
      GV.SucheGuides.cUmkreis = iUmkreisNeu.ToString(); 
      GV.SucheGuides.iUmkreis = iUmkreisNeu;
      MessagingCenter.Send(new GV.UpdateStatusMessageData("Text aus Such-Maske", true), GV.UpdateStatusMessageData.MessageIDSuchenBeendet); // triggers a new query
      lStatusAbfrage.Text = "Nach Display Abfrage";
      return null;
    }
    else
    {
      lStatusAbfrage.Text = "Antwort Nein";// updates a label on EmpfehlungenPage -> for test
      return null;
    }

Detail problem-description:
If I load the app and select “FreizeitGuide” from menu, EmpfehlungenPage is loaded.
The DisplayAlert then is displayed, If I search and nothing is found (as it should be).
If I then select another Guide, search without result, the DiplayAlert is called, but not showed (seems to “hang” somewhere behind the page).
Strange Wyse, the label in the active page is updated (see comment // updates a label on EmpfehlungenPage -> for test).
If I disable the DisplayAlert and automatically do the search, it works.

My conclusion: The problem is related directly to DisplayAlert (as the label on the page is updated correct and the logic (requery the data) also works correct..


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>