Exemplo n.º 1
0
        public static async Task PushAsync(BaseViewModel viewModel)
        {
            var view = SimpleIoC.GetPage(viewModel.GetType());

            view.BindingContext = viewModel;
            await Navigation.PushAsync(view);
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        void SetContent()
        {
            var viewModel = (BindingContext as MainPageViewModel).CurrentPage;
            var page      = SimpleIoC.GetPage(viewModel);

            this.Detail = new NavigationPage(page);
        }
Exemplo n.º 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());
 }
Exemplo n.º 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);
        }
Exemplo n.º 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)));
        }