Это мой App.xaml:
Код: Выделить всё
MainPage = new Sidebar()
{
FlowDirection = FlowDirection.LeftToRight
};
Код: Выделить всё
public partial class Sidebar : FlyoutPage
{
public Sidebar()
{
InitializeComponent();
Detail = new NavigationPage(new MainPage());
}
private async void GoToApplicationSettingsPage(object sender, TappedEventArgs e)
{
await Detail.Navigation.PushAsync(new ApplicationSetting());
IsPresented = false;
}
private async void GoToHxSettingsPage(object sender, TappedEventArgs e)
{
await Detail.Navigation.PushAsync(new MedicalHistorySettings(), true);
IsPresented = false;
}
private async void GoToVisitsSettingsPage(object sender, TappedEventArgs e)
{
await Detail.Navigation.PushAsync(new VisitsSettings(), true);
IsPresented = false;
}
private async void GoToOperationsSettingsPage(object sender, TappedEventArgs e)
{
await Detail.Navigation.PushAsync(new OperationsSettings(), true);
IsPresented = false;
}
private async void GoToVisitsSerachPage(object sender, TappedEventArgs e)
{
await Detail.Navigation.PushAsync(new VisitsSearch(), true);
IsPresented = false;
}
private async void GoToOperationsSearchPage(object sender, TappedEventArgs e)
{
await Detail.Navigation.PushAsync(new OperationsSearch(), true);
IsPresented = false;
}
}
[img]https:/ /i.sstatic.net/51ILCqWH.gif[/img]
Как видно, приложение аварийно завершает работу, когда этот код выполняется 3 раза:
Код: Выделить всё
await Detail.Navigation.PushAsync(new ApplicationSetting(), true);
Код: Выделить всё
await Detail.Navigation.PopAsync();
await Detail.Navigation.PushAsync(new ApplicationSetting());
An в Microsoft.iOS.dll произошло необработанное исключение типа «System.InvalidCastException»: «Указанное приведение недопустимо».
в UIKit.UIApplication.xamarin_UIApplicationMain(Int32) argc, IntPtr argv, IntPtr имя_основного класса, IntPtr имя_класса_делегата, IntPtr* gchandle)
at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr имя_основногокласса, IntPtr имя_класса делегата)
at UIKit.UIApplication.Main (Нить[] args, Введите PrincipalClass, Введите DelegateClass)
в EClinicMaui.Program.Main(String[] args) в /Users/sysprobs/Desktop/E-Clinic/EClinicMaui/Platforms/iOS/Program.cs:line 14
Я загружаю проект на github, чтобы каждый мог его протестировать.
Я используя код Visual Studio в MAC OS.
Подробнее здесь: https://stackoverflow.com/questions/793 ... eral-times