public static async Task PushAsync(BaseViewModel viewModel)
        {
            var view = SimpleIoC.GetPage(viewModel.GetType());

            view.BindingContext = viewModel;
            await Navigation.PushAsync(view);
        }
        public static void SetRoot(object viewModel, bool wrapInNavigation = true)
        {
            var view = SimpleIoC.GetPage(viewModel.GetType());

            view.BindingContext          = viewModel;
            Application.Current.MainPage = wrapInNavigation ? new NavigationPage(view) : view;
        }
        public static async Task PushModalAsync(BaseViewModel viewModel, bool wrapInNavigation = true)
        {
            var view = SimpleIoC.GetPage(viewModel.GetType());

            view.BindingContext = viewModel;
            await Navigation.PushModalAsync(wrapInNavigation?new NavigationPage(view) : view);
        }
Example #4
0
        void SetContent()
        {
            var viewModel = (BindingContext as MainPageViewModel).CurrentPage;
            var page      = SimpleIoC.GetPage(viewModel);

            this.Detail = new NavigationPage(page);
        }
Example #5
0
 public App()
 {
     RegisterViewModels();
     BasicAuthApi.ShowAuthenticator = (IBasicAuthenicator obj) =>
     {
         Xamarin.Forms.Device.BeginInvokeOnMainThread(() => MainPage.Navigation.PushModalAsync(new NavigationPage(new LoginPage(obj))));
     };
     InitializeComponent();
     // The root page of your application
     MainPage = SimpleIoC.GetPage(new MainPageViewModel());
 }
Example #6
0
        public static async Task PushAsync(BaseViewModel viewModel)
        {
            var view = SimpleIoC.GetPage(viewModel.GetType());

            if (view == null)
            {
                throw new NotImplementedException($"There is no Page registered with {viewModel.GetType()}. Please register the page and view model with SimpleIoC");
            }
            view.BindingContext = viewModel;
            await Navigation.PushAsync(view);
        }
Example #7
0
 void RegisterViewModels()
 {
     SimpleIoC.RegisterPage <AppListViewModel, AppListPage>();
     SimpleIoC.RegisterPage <CreateAppViewModel, CreateAppPage>();
     SimpleIoC.RegisterPage <MainPageViewModel, MainPage>();
     SimpleIoC.RegisterPage <GettingStartedViewModel, GettingStartedPage>();
     SimpleIoC.RegisterPage <BuildViewModel, BuildPage>();
     SimpleIoC.RegisterPage <TestViewModel, TestPage>();
     SimpleIoC.RegisterPage <DistributeViewModel, DistributePage>();
     SimpleIoC.RegisterPage <CrashesViewModel, CrashesPage>();
     SimpleIoC.RegisterPage <AnalyticsViewModel, AnalyticsPage>();
     SimpleIoC.RegisterPage <BranchDetailsViewModel, BranchDetailsPage>();
     SimpleIoC.RegisterPage <RepoListViewModel, RepoListPage>();
     SimpleIoC.RegisterPage <BuildLogViewModel, BuildLogPage>();
 }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var viewModel = value as BaseViewModel;

            return(new NavigationPage(SimpleIoC.GetPage(viewModel)));
        }