• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMvxViewModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMvxViewModel的典型用法代码示例。如果您正苦于以下问题:C# IMvxViewModel类的具体用法?C# IMvxViewModel怎么用?C# IMvxViewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMvxViewModel类属于命名空间,在下文中一共展示了IMvxViewModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Close

        public override void Close(IMvxViewModel toClose)
        {
            var topViewController = _masterNavigationController.TopViewController;

            if (topViewController == null)
            {
                MvxTrace.Trace(MvxTraceLevel.Warning, "Don't know how to close this viewmodel - no topmost");
                return;
            }

            var topView = topViewController as IMvxTouchView;
            if (topView == null)
            {
                MvxTrace.Trace(MvxTraceLevel.Warning,
                               "Don't know how to close this viewmodel - topmost is not a touchview");
                return;
            }

            var viewModel = topView.ReflectionGetViewModel();
            if (viewModel != toClose)
            {
                MvxTrace.Trace(MvxTraceLevel.Warning,
                               "Don't know how to close this viewmodel - topmost view does not present this viewmodel");
                return;
            }

            _masterNavigationController.PopViewControllerAnimated(true);
        }
开发者ID:JoanMiro,项目名称:MvxMod,代码行数:28,代码来源:MvxTouchViewPresenter.cs


示例2: TryLoad

        public bool TryLoad(Type viewModelType, IDictionary<string, string> parameters, out IMvxViewModel model)
        {
            model = null;
            var constructor = viewModelType
#if NETFX_CORE
                .GetTypeInfo().DeclaredConstructors
#else
                .GetConstructors()
#endif
                .FirstOrDefault(c => c.GetParameters().All(p=> p.ParameterType == typeof(string)));

            if (constructor == null)
                return false;

            var invokeWith = new List<object>();
            foreach (var parameter in constructor.GetParameters())
            {
                string parameterValue = null;
                if (parameters == null ||
                    !parameters.TryGetValue(parameter.Name, out parameterValue))
                {
                    MvxTrace.Trace("Missing parameter in call to {0} - missing parameter {1} - asssuming null", viewModelType,
                                   parameter.Name);
                }
                invokeWith.Add(parameterValue);
            }

            model = Activator.CreateInstance(viewModelType, invokeWith.ToArray()) as IMvxViewModel;
            return (model != null);
        }
开发者ID:284247028,项目名称:MvvmCross,代码行数:30,代码来源:MvxDefaultViewModelLocator.cs


示例3: Close

        public virtual void Close(IMvxViewModel toClose)
        {
            var topViewController = this.MasterNavigationController.TopViewController;

            if (topViewController == null)
            {
                MvxTrace.Warning("Don't know how to close this viewmodel - no topmost");
                return;
            }

            var topView = topViewController as IMvxIosView;
            if (topView == null)
            {
                MvxTrace.Warning(
                               "Don't know how to close this viewmodel - topmost is not a touchview");
                return;
            }

            var viewModel = topView.ReflectionGetViewModel();
            if (viewModel != toClose)
            {
                MvxTrace.Warning(
                               "Don't know how to close this viewmodel - topmost view does not present this viewmodel");
                return;
            }

            this.MasterNavigationController.PopViewController(true);
        }
开发者ID:MvvmCross,项目名称:MvvmCross,代码行数:28,代码来源:MvxIosViewPresenter.cs


示例4: Close

        public override void Close(IMvxViewModel toClose)
        {
            if (_currentModalViewController != null)
            {
                IMvxTouchView mvxTouchView = _currentModalViewController as IMvxTouchView;
                if (mvxTouchView == null)
                    MvxTrace.Error("Unable to close view - modal is showing but not an IMvxTouchView");
                else if (mvxTouchView.ReflectionGetViewModel() != toClose)
                {
                    MvxTrace.Error("Unable to close view - modal is showing but is not the requested viewmodel");
                }
                else
                {
                    // ISSUE: reference to a compiler-generated method
                    _currentModalViewController.DismissViewController(true, () => { });
                    _currentModalViewController = null;
                }

                return;
            }

            // We will look across all active navigation stacks to see if we can
            // pop our MvxView associated with this MvxViewModel (saves explicitly having to specify)
            bool modelClosed = CloseTopView(toClose, CentrePanelUiNavigationController());
            if (!modelClosed) modelClosed = CloseTopView(toClose, LeftPanelUiNavigationController());
            if (!modelClosed) modelClosed = CloseTopView(toClose, RightPanelUiNavigationController());

            if (!modelClosed)
            {
                MvxTrace.Warning("Don't know how to close this viewmodel - none of topmost views represent this viewmodel");
            }
        }
开发者ID:wickedw,项目名称:JASidePanelsMvx,代码行数:32,代码来源:JaSidePanelsMvxPresenter.cs


示例5: Close

 public sealed override void Close(IMvxViewModel viewModel)
 {
     if (_fragmentHostRegistrationSettings.IsTypeRegisteredAsFragment(viewModel.GetType()))
         CloseFragment(viewModel);
     else
         CloseActivity(viewModel);
 }
开发者ID:MvvmCross,项目名称:MvvmCross,代码行数:7,代码来源:MvxFragmentsPresenter.cs


示例6: Close

        public override void Close(IMvxViewModel toClose)
        {
            var root = _window.RootViewController;

            var view = Mvx.Resolve<IMvxTouchViewCreator>().CreateView(toClose) as BaseViewController;

            var masterView = MasterNavigationController.TopViewController as MasterPanelView;
            if (masterView != null && view != null)
            {
                switch (view.TypeOfView)
                {
                    case ViewType.MenuView:
                        base.Close(masterView.ViewModel);
                        break;
                    case ViewType.SubMenuView:
                        masterView.MasterContainer.HideMenu();
                        break;
                    case ViewType.DetailView:
                        base.Close(masterView.ViewModel);
                        break;
                    case ViewType.SingleView:
                        base.Close(toClose);
                        break;
                }
            }
            else
                base.Close(toClose);
        }
开发者ID:Brinium,项目名称:ThreeColumnContainer,代码行数:28,代码来源:IpadModalTouchViewPresenter.cs


示例7: CustomDialog

 public CustomDialog(Android.Content.Context context, int layout, IMvxViewModel viewModel)
     : this(context, Resource.Style.CustomDialog)
 {
     this.BindingContext = new MvxAndroidBindingContext(context, (context as IMvxLayoutInflaterHolder));
     ViewModel = viewModel;
     Init(layout);
 }
开发者ID:texas16,项目名称:Dialog,代码行数:7,代码来源:CustomDialog.cs


示例8: Close

        public override void Close(IMvxViewModel viewModel)
        {
            if (NavigationProvider == null)
                return;

            NavigationProvider.Pop();
        }
开发者ID:Milton761,项目名称:EduticNow,代码行数:7,代码来源:MvxPagePresenter.cs


示例9: Close

        public virtual void Close(IMvxViewModel toClose)
        {
            var topInterfaceController = this._interfaceControllers.Last();

            if (topInterfaceController == null)
            {
                MvxTrace.Warning("Don't know how to close this viewmodel - no topmost");
                return;
            }

            var topView = topInterfaceController as IMvxWatchOSView;
            if (topView == null)
            {
                MvxTrace.Warning(
                               "Don't know how to close this viewmodel - topmost is not a watchOSView");
                return;
            }

            var viewModel = topView.ReflectionGetViewModel();
            if (viewModel != toClose)
            {
                MvxTrace.Warning(
                               "Don't know how to close this viewmodel - topmost view does not present this viewmodel");
                return;
            }

            topInterfaceController.PopController();
        }
开发者ID:jonaswisplinghoff,项目名称:WearableSmarthomeRemote,代码行数:28,代码来源:MvxWatchOSViewPresenter.cs


示例10: Close

        public override void Close(IMvxViewModel toClose)
        {
            if (_currentModalViewController != null)
            {
                var touchView = _currentModalViewController as IMvxTouchView;
                if (touchView == null)
                {
                    MvxTrace.Error(
                                   "Unable to close view - modal is showing but not an IMvxTouchView");
                    return;
                }

                var viewModel = touchView.ReflectionGetViewModel();
                if (viewModel != toClose)
                {
                    MvxTrace.Error(
                                   "Unable to close view - modal is showing but is not the requested viewmodel");
                    return;
                }

                var nav = _currentModalViewController.ParentViewController as UINavigationController;
                if (nav != null)
                    nav.DismissViewController(true, () => { });
                else
                    _currentModalViewController.DismissViewController(true, () => { });
                _currentModalViewController = null;
                return;
            }

            base.Close(toClose);
        }
开发者ID:talisqualis,项目名称:MvvmCross-Build,代码行数:31,代码来源:MvxModalNavSupportTouchViewPresenter.cs


示例11: Close

        public override void Close(IMvxViewModel toClose)
        {
            if (_currentModalViewController != null)
            {
                var touchView = _currentModalViewController as IMvxTouchView;
                if (touchView == null)
                {
                    MvxTrace.Trace(MvxTraceLevel.Error, "Unable to close view - modal is showing but not an IMvxTouchView");
                    return;
                }

                var viewModel = touchView.ReflectionGetViewModel();
                if (viewModel != toClose)
                {
                    MvxTrace.Trace(MvxTraceLevel.Error, "Unable to close view - modal is showing but is not the requested viewmodel");
                    return;
                }

                _currentModalViewController.DismissModalViewControllerAnimated(true);
                _currentModalViewController = null;
                return;
            }

            base.Close(toClose);
        }
开发者ID:Gert-Cominotto,项目名称:MvvmCross,代码行数:25,代码来源:MvxModalSupportTouchViewPresenter.cs


示例12: CreateTabFor

    private UIViewController CreateTabFor(string title, string imageName, IMvxViewModel viewModel)
    {
        Mvx.Trace("CreateTabFor");
        var innerView = (UIViewController)this.CreateViewControllerFor(viewModel);

        PresentViewController(innerView, false, () => { });
        return innerView;
    }
开发者ID:JordanMarr,项目名称:mvx-unity-ngui,代码行数:8,代码来源:CompositeView.cs


示例13: Reload

        public virtual IMvxViewModel Reload(IMvxViewModel viewModel,
                                   IMvxBundle parameterValues,
                                   IMvxBundle savedState)
        {
            RunViewModelLifecycle(viewModel, parameterValues, savedState);

            return viewModel;
        }
开发者ID:talisqualis,项目名称:MvvmCross-Build,代码行数:8,代码来源:MvxDefaultViewModelLocator.cs


示例14: CreateViewFor

		// from Stuart Lodge N+1-25
		private UIViewController CreateViewFor(IMvxViewModel viewModel, bool navBarHidden)
		{
			var controller = new UINavigationController();
			var screen = this.CreateViewControllerFor(viewModel) as UIViewController;
			controller.PushViewController(screen, false);
			controller.NavigationBarHidden = navBarHidden;
			return controller;
		}
开发者ID:paddyfink,项目名称:MvvmCross.FlyOutMenu,代码行数:9,代码来源:RootView.cs


示例15: CreateTabFor

 private UIViewController CreateTabFor(string title, string imageName, IMvxViewModel viewModel)
 {
     var controller = new UINavigationController();
     var screen = this.CreateViewControllerFor(viewModel) as UIViewController;
     SetTitleAndTabBarItem(screen, title, imageName);
     controller.PushViewController(screen, false);
     return controller;
 }
开发者ID:j-hayes,项目名称:Flash-Card-App,代码行数:8,代码来源:HomePageView.cs


示例16: Close

 public override void Close(IMvxViewModel toClose)
 {
     if (ParentRootViewController.ViewControllers.Count() > 1)
         ParentRootViewController.PopViewController(true);
     else if (RootViewController.NavigationController.ViewControllers.Count() > 1)
         RootViewController.NavigationController.PopViewController(true);
     else
         base.Close(toClose);
 }
开发者ID:mvanbeusekom,项目名称:MvvmCross-iOSSupport,代码行数:9,代码来源:MvxSidebarPresenter.cs


示例17: RequestClose

 public bool RequestClose(IMvxViewModel toClose)
 {
     Action action = () =>
                         {
                             MvxTrace.TaggedTrace("MacNavigation", "Navigate back requested");
                             _presenter.Close(toClose);
                         };
     return RequestMainThreadAction(action);
 }
开发者ID:darkice-matt-crombie,项目名称:MvxSpinnerTest,代码行数:9,代码来源:MvxMacViewDispatcher.cs


示例18: Close

 public virtual void Close(IMvxViewModel toClose)
 {
     toClose.ActOnRegisteredViews(view =>
         {
             var activity = view as Activity;
             if (activity != null)
                 activity.Finish();
         });
 }
开发者ID:JoanMiro,项目名称:MvxMod,代码行数:9,代码来源:MvxAndroidViewPresenter.cs


示例19: AddNewTab

        private void AddNewTab(string title, IMvxViewModel viewModel)
        {
            var tabSpec = TabHost.NewTabSpec(title);

            tabSpec.SetIndicator(title);
            tabSpec.SetContent(this.CreateIntentFor(viewModel));

            this.TabHost.AddTab(tabSpec);
        }
开发者ID:EmiiFont,项目名称:MyShuttle_RC,代码行数:9,代码来源:MainView.cs


示例20: AddPreloadedViewModel

 public void AddPreloadedViewModel(string viewModelType, IMvxViewModel viewModel)
 {
     if (_preloadedViewModels.ContainsKey(viewModelType)) { // replace
         // TODO: destroy old instance??
         _preloadedViewModels[viewModelType] = viewModel;
     }
     else {
         _preloadedViewModels.Add(viewModelType, viewModel);
     }
 }
开发者ID:EugenMayer,项目名称:MvvmCrossConditions,代码行数:10,代码来源:PreloaderViewModelLoader.cs



注:本文中的IMvxViewModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMwsReader类代码示例发布时间:2022-05-24
下一篇:
C# IMvxMessenger类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap