Exemplo n.º 1
0
        public RootViewModel(IMvxLogProvider logProvider, IMvxNavigationService navigationService, IMvxViewModelLoader mvxViewModelLoader) : base(logProvider, navigationService)
        {
            _mvxViewModelLoader = mvxViewModelLoader;
            _log = logProvider.GetLogFor <RootViewModel>();
            try
            {
                IMvxMessenger messenger = Mvx.IoCProvider.Resolve <IMvxMessenger>();
                string?       str       = messenger.ToString();
                _log.InfoFormat("Creating the Root View Model via the MVX IOC provider {messenger}", messenger);
            }
            catch (Exception e)
            {
                _log.ErrorException("could not resolve the Messenger", e);
            }

            //ShowChildCommand = new MvxAsyncCommand(async () =>
            //{
            //    var result = await NavigationService.Navigate<ChildViewModel, SampleModel, SampleModel>(new SampleModel
            //    {
            //        Message = "Hey",
            //        Value = 1.23m
            //    });
            //    var testIfReturn = result;
            //});

            //ShowModalCommand = new MvxAsyncCommand(Navigate);

            //ShowModalNavCommand =
            //    new MvxAsyncCommand(async () => await NavigationService.Navigate<ModalNavViewModel>());

            //ShowTabsCommand = new MvxAsyncCommand(async () => await NavigationService.Navigate<TabsRootViewModel>());

            //ShowPagesCommand = new MvxAsyncCommand(async () => await NavigationService.Navigate<PagesRootViewModel>());

            //ShowSplitCommand = new MvxAsyncCommand(async () => await NavigationService.Navigate<SplitRootViewModel>());

            //ShowNativeCommand = new MvxAsyncCommand(async () => await NavigationService.Navigate<NativeViewModel>());

            //ShowOverrideAttributeCommand = new MvxAsyncCommand(async () =>
            //    await NavigationService.Navigate<OverrideAttributeViewModel>());

            //ShowSheetCommand = new MvxAsyncCommand(async () => await NavigationService.Navigate<SheetViewModel>());

            ShowWindowCommand = new MvxAsyncCommand(async() => await NavigationService.Navigate <WindowViewModel>());

            //ShowMixedNavigationCommand =
            //    new MvxAsyncCommand(async () => await NavigationService.Navigate<MixedNavFirstViewModel>());

            //ShowDictionaryBindingCommand = new MvxAsyncCommand(async () =>
            //    await NavigationService.Navigate<DictionaryBindingViewModel>());

            //ShowCollectionViewCommand =
            //    new MvxAsyncCommand(async () => await NavigationService.Navigate<CollectionViewModel>());

            //ShowSharedElementsCommand = new MvxAsyncCommand(async () =>
            //    await NavigationService.Navigate<SharedElementRootChildViewModel>());

            //ShowCustomBindingCommand =
            //    new MvxAsyncCommand(async () => await NavigationService.Navigate<CustomBindingViewModel>());

            //ShowFluentBindingCommand =
            //    new MvxAsyncCommand(async () => await NavigationService.Navigate<FluentBindingViewModel>());

            //RegisterAndResolveWithReflectionCommand = new MvxAsyncCommand(RegisterAndResolveWithReflection);
            //RegisterAndResolveWithNoReflectionCommand = new MvxAsyncCommand(RegisterAndResolveWithNoReflection);

            _counter = 3;

            TriggerVisibilityCommand           =
                new MvxCommand(() => IsVisible = !IsVisible);

            //FragmentCloseCommand = new MvxAsyncCommand(() => NavigationService.Navigate<FragmentCloseViewModel>());

            //ShowLocationCommand = new MvxAsyncCommand(() => NavigationService.Navigate<LocationViewModel>());
        }