I am creating an an app in Xamarin.forms in which i want to change the page with some condition. If my sqlite table is filled then i wanted to move on second page or else i will move to first page when my app start on that time i have to check.
Step:-
1)when we click the app first it will check in sqlite database whether database is empty or not.
2)if database is empty the it will show first page then on click on button it store the value in database and move on to second page.
3)if database is not empty then it directly go to second page.
here is my sample code public static Connect Data { get; private set; } public static MasterDetailPage MasterDetailPage;
public App(string dbPath, ISQLitePlatform sqlitePlatform)
{
Data = new Connect(sqlitePlatform, dbPath);
List<Username> User = await App.Data.User();
if (User.Count() > 0)
{
MasterDetailPage = new Xamarin.Forms.MasterDetailPage
{
Master = new Menu(),
Detail = new NavigationPage(new second())
{
Tint = Color.FromHex("3F51B5")
}
};
MasterDetailPage.MasterBehavior = MasterBehavior.Popover;
MainPage = MasterDetailPage;
}
else
{
MainPage = new NavigationPage(new first())
{
Tint = Color.FromHex("3F51B5")
};
}
}
I Know my code is wrong please suggest me how to resolve these issue.
Aucun commentaire:
Enregistrer un commentaire