コード例 #1
0
        public static async Task PushAsync(BaseViewModel viewModel)
        {
            var view = SimpleIoC.GetPage(viewModel.GetType());

            view.BindingContext = viewModel;
            await Navigation.PushAsync(view);
        }
コード例 #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;
        }
コード例 #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);
        }
コード例 #4
0
        void SetContent()
        {
            var viewModel = (BindingContext as MainPageViewModel).CurrentPage;
            var page      = SimpleIoC.GetPage(viewModel);

            this.Detail = new NavigationPage(page);
        }
コード例 #5
0
ファイル: App.xaml.cs プロジェクト: llenroc/MobileCenterApp
 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());
 }
コード例 #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);
        }
コード例 #7
0
ファイル: App.xaml.cs プロジェクト: llenroc/MobileCenterApp
 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)));
        }