当前位置: 首页>>代码示例>>C#>>正文


C# IMvxMessenger.SubscribeOnMainThread方法代码示例

本文整理汇总了C#中IMvxMessenger.SubscribeOnMainThread方法的典型用法代码示例。如果您正苦于以下问题:C# IMvxMessenger.SubscribeOnMainThread方法的具体用法?C# IMvxMessenger.SubscribeOnMainThread怎么用?C# IMvxMessenger.SubscribeOnMainThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMvxMessenger的用法示例。


在下文中一共展示了IMvxMessenger.SubscribeOnMainThread方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HomeViewModel

 public HomeViewModel(IDescriptionService descriptionService, IMvxMessenger messenger)
 {
     _token = messenger.SubscribeOnMainThread<TickMessage>(OnTick);
     Descriptions = descriptionService.Descriptions
                                     .Select(x => new DescriptionViewModel(x))
                                     .ToList();
 }
开发者ID:Dexyon,项目名称:MvvmCross-Samples,代码行数:7,代码来源:HomeViewModel.cs

示例2: AddViewModel

 public AddViewModel(ICollectionService collectionService, ILocationService locationService, IMvxMessenger messenger)
 {
     _collectionService = collectionService;
     _locationService = locationService;
     _token = messenger.SubscribeOnMainThread<LocationMessage>(OnLocation);
     GetInitialLocation();
 }
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:7,代码来源:AddViewModel.cs

示例3: GenerateViewModel

 public GenerateViewModel(IMvxMessenger messenger, IDisplayDimensionsService displayDimensionsService,
                          IMandelbrotTaskGenerator mandelbrotTaskGenerator)
 {
     _displayDimensionsService = displayDimensionsService;
     _mandelbrotTaskGenerator = mandelbrotTaskGenerator;
     _mvxSubscriptionToken = messenger.SubscribeOnMainThread<TickMessage>(OnTick);
     _autoPlay = true;
 }
开发者ID:Dexyon,项目名称:MvvmCross-Samples,代码行数:8,代码来源:GenerateViewModel.cs

示例4: RootViewModel

		public RootViewModel(IAuthenticationService authService, IMvxMessenger messenger)
		{
			_authService = authService;

			_sessionChangedToken = messenger.SubscribeOnMainThread<SessionStateChangedMessage>((m) =>
				{
					reloadFavorites();
				});
			this.UserStoreViewModel = MvxToolbox.LoadViewModel<BaseUserStoreViewModel>();
		}
开发者ID:fadafido,项目名称:tojeero,代码行数:10,代码来源:RootViewModel.cs

示例5: AddViewModel

 public AddViewModel(
     ICollectionService collectionService, 
     ILocationService locationService, 
     IMvxMessenger messenger, 
     IMvxPictureChooserTask pictureChooserTask, IMvxFileStore fileStore)
 {
     _collectionService = collectionService;
     _locationService = locationService;
     _pictureChooserTask = pictureChooserTask;
     _fileStore = fileStore;
     _token = messenger.SubscribeOnMainThread<LocationMessage>(OnLocation);
     GetInitialLocation();
 }
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:13,代码来源:AddViewModel.cs

示例6: BaseUserStoreViewModel

		public BaseUserStoreViewModel(IAuthenticationService authService, IMvxMessenger messenger )
			:base(authService, messenger)
		{
			this.ShouldSubscribeToSessionChange = true;

			_storeChangeToken = messenger.SubscribeOnMainThread<StoreChangedMessage>((message) =>
				{
					//If the changed store is related to current user then refetch the user store to reflect the change
					if(message.Store != null && this.CurrentUser != null &&
						message.Store.OwnerID == this.CurrentUser.ID)
					{
						reloadUserStore();
					}
				});
			PropertyChanged += propertyChanged;
		}
开发者ID:fadafido,项目名称:tojeero,代码行数:16,代码来源:BaseUserStoreViewModel.cs

示例7: MainViewModel

        public MainViewModel()
        {
            _ds = BettrFitDataSource.Instance;
            _messenger = Mvx.Resolve<IMvxMessenger>();

            _mapNav = new Dictionary<string, Type>();
            _mapNav.Add(menuNutritionPlan, typeof(NutritionPlanOverviewViewModel));
            _mapNav.Add(menuNutritiondiary, typeof(NutritionPlanMainViewModel));
            _mapNav.Add(menuGoals, typeof(GoalOverviewViewModel));
            _mapNav.Add(menuNutrition, typeof(NutritionPlanMainViewModel));
            _mapNav.Add(menuWeight, typeof(DailyDataOverviewViewModel));

            _mapNav.Add("Login", typeof(LoginViewModel));
            _mapNav.Add("Login mit Facebook", typeof(FirstViewModel));
            _mapNav.Add(CultureHelper.GetLocalString("Register|Registrieren"), typeof(RegisterViewModel));

            NavCommands = new ObservableCollection<NavEntry>();

            NavCommand = new MvxCommand<string>(OnNavCommand);

            LogoffCommand = new MvxCommand(OnLogoffCommand);
            RefreshCommand = new MvxCommand(OnRefreshCommand);
            ShowInfoCommand = new MvxCommand(OnShowInfo);
            FeedbackCommand = new MvxCommand(OnFeedbackCommand);
            ShakeCommand = new MvxCommand(()=>_messenger.Publish(new ShakeEvent(this)));

            ShowAGBCommand = new MvxCommand(OnShowAGB);

            _logintoken = _messenger.Subscribe<LoggedInEvent>(a => LoginChanged(a.LoggedIn));
            _synctoken = _messenger.Subscribe<SyncEvent>(a => RaisePropertyChanged("Sync"));
            _nonetworktoken = _messenger.SubscribeOnMainThread<NetworkEvent>(m =>
            {
                IsNetworkAvailable = m.IsAvailable;
            });

            LoginChanged(_ds.IsLoggedIn());

            //var client = WebService.Instance.WS;

            RaisePropertyChanged("Sync");

            IsNotRefreshing = true;
        }
开发者ID:obiwan007,项目名称:bettrdiet,代码行数:43,代码来源:MainViewModel.cs

示例8: ScanAsMessageViewModel

        public ScanAsMessageViewModel(IMvxMessenger messenger, IWatcher watcher)
        {
            _watcher = watcher;

            _messageToken = messenger.SubscribeOnMainThread<MessageReceived>(MessageRecieved);
        }
开发者ID:rossdargan,项目名称:MvxPlugins,代码行数:6,代码来源:ScanAsMessageViewModel.cs

示例9: OnViewModelSet


//.........这里部分代码省略.........
                TouchModeAbove = TouchMode.Fullscreen,
                BehindOffset = 80,
                ShadowWidth = 20,
                ShadowDrawableRes = Resource.Drawable.SlidingMenuShadow,
                SecondaryShadowDrawableRes = Resource.Drawable.SlidingMenuShadowRight
            };

            slidingMenu.AttachToActivity (this, SlideStyle.Content);
            slidingMenu.SetMenu (Resource.Layout.Menu_Frame);
            //slidingMenu.ShadowDrawableRes = Resource.Drawable.SlidingMenuShadow;

            menuFragment = new MenuFragment ();
            menuFragment.ViewModel = ViewModel;

            SupportFragmentManager.BeginTransaction ()
                .Replace (Resource.Id.menu_frame, menuFragment).Commit ();

            slidingMenu.SetSecondaryMenu (Resource.Layout.UserList_Frame);
            //slidingMenu.SecondaryShadowDrawableRes = Resource.Drawable.SlidingMenuShadowRight;

            emptyFragment = new EmptyFragment ();
            emptyFragment.ViewModel = this.ViewModel;

            SupportFragmentManager.BeginTransaction ()
                .Replace (Resource.Id.content_frame, emptyFragment).Commit ();

            //TODO: Put some kind of default view in the chat fragment space

            homeViewModel.PropertyChanged += (sender, e) => {

                Console.WriteLine("PropertyChanged: "+  e.PropertyName);

                if (e.PropertyName == "CurrentRoom")
                {
                    if (homeViewModel.CurrentRoom == null)
                    {
                        if (emptyFragment == null)
                            emptyFragment = new EmptyFragment();

                        chatFragment = null;

                        SupportFragmentManager.BeginTransaction ()
                            .Replace (Resource.Id.content_frame, emptyFragment).Commit ();

                        LegacyBar.Title = "JabbR";

                        showActions = false;
                        ToggleActions();

                        userListFragment.ViewModel = null;

                        SupportFragmentManager.BeginTransaction ()
                            .Replace (Resource.Id.userlist_frame, userListFragment).Commit ();
                        return;
                    }

                    showActions = true;

                    if (chatFragment == null)
                    {
                        chatFragment = new ChatFragment();
                        chatFragment.ViewModel = homeViewModel.CurrentRoom;

                        SupportFragmentManager.BeginTransaction()
                            .Replace(Resource.Id.content_frame, chatFragment).Commit();
                    }
                    else
                    {
                        chatFragment.ViewModel = homeViewModel.CurrentRoom;
                    }

                    if (userListFragment == null)
                    {
                        userListFragment = new UserListFragment();
                        userListFragment.ViewModel = homeViewModel.CurrentRoom;

                        SupportFragmentManager.BeginTransaction ()
                            .Replace (Resource.Id.userlist_frame, userListFragment).Commit ();

                    }
                    else
                    {
                        userListFragment.ViewModel = homeViewModel.CurrentRoom;
                    }

                    ToggleActions();

                    slidingMenu.Toggle();

                    this.RunOnUiThread(() => LegacyBar.Title = homeViewModel.CurrentRoom.Room.Name);
                }
            };

            messenger = Mvx.Resolve<IMvxMessenger> ();
            _mvxMsgTokUserSelected = messenger.SubscribeOnMainThread<UserSelectedMessage> (msg => {
                chatFragment.AppendText("@" + msg.User.Name);

                slidingMenu.ShowContent(true);
            });
        }
开发者ID:Redth,项目名称:JabbRIsMobile,代码行数:101,代码来源:HomeView.cs


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