private void OpenLog() { if (SelectedLog.BegId != null) { MaintenanceBegPage begPage = new MaintenanceBegPage(); MaintenanceBegVM context = new MaintenanceBegVM((int)SelectedLog.BegId); begPage.BindingContext = context; Application.Current.MainPage.Navigation.PushAsync(begPage); } else if (SelectedLog.LagerId != null) { MaintenanceLagerPage lagerPage = new MaintenanceLagerPage(); MaintenanceLagerVM context = new MaintenanceLagerVM((int)SelectedLog.LagerId); lagerPage.BindingContext = context; Application.Current.MainPage.Navigation.PushAsync(lagerPage); } else { MaintenanceStandardPage standPage = new MaintenanceStandardPage(); MaintenanceStandardVM context = new MaintenanceStandardVM(SelectedLog); standPage.BindingContext = context; Application.Current.MainPage.Navigation.PushAsync(standPage); } }
public void Collection_SelectedMaintenance() { if (SelectedMaintenance.MaintenanceFormId != 0) { switch (SelectedMaintenance.MaintenanceFormId) { case 1: MaintenanceStandardVM contextStandard = new MaintenanceStandardVM(SelectedMaintenance.Id, Convert.ToInt32(Application.Current.Properties["EmpId"]), SelectedOffice.Id); MaintenanceStandardPage pageStandard = new MaintenanceStandardPage(); pageStandard.BindingContext = contextStandard; pageStandard.Disappearing += Page_Refresh; Application.Current.MainPage.Navigation.PushAsync(pageStandard); break; case 2: MaintenanceBegVM contextBeg = new MaintenanceBegVM(SelectedMaintenance.Id, Convert.ToInt32(Application.Current.Properties["EmpId"]), SelectedOffice.Id); MaintenanceBegPage pageBeg = new MaintenanceBegPage(); pageBeg.BindingContext = contextBeg; pageBeg.Disappearing += Page_Refresh; Application.Current.MainPage.Navigation.PushAsync(pageBeg); break; case 3: MaintenanceLagerVM contextLager = new MaintenanceLagerVM(SelectedMaintenance.Id, Convert.ToInt32(Application.Current.Properties["EmpId"]), SelectedOffice.Id); MaintenanceLagerPage pageLager = new MaintenanceLagerPage(); pageLager.BindingContext = contextLager; pageLager.Disappearing += Page_Refresh; Application.Current.MainPage.Navigation.PushAsync(pageLager); break; default: Application.Current.MainPage.DisplayAlert("FEL", "Object not found!", "STÄNG"); break; } } }