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


C# IMvxMessenger.Subscribe方法代码示例

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


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

示例1: TestViewModel

        public TestViewModel(IMvxMessenger messenger)
        {
            _messenger = messenger;

            _receivedTokenDisposable = _messenger.Subscribe<TokenChangedMessage>(msg =>
            {
                if(msg == null) return;
                var token = msg.NewToken;
                if(token == null) return;

                Issuer = token.Issuer;
                Audience = token.Audience;
                IdentityProvider = token.IdentityProvider;
                ExpiresOn = token.ExpiresOn;
                RawToken = token.RawToken;
            });

            _loggedInTokenDisposable =
                _messenger.Subscribe<LoggedInMessage>(async msg =>
                    {
                        //Validate token here, i.e. call your Web Service
                        await Task.Delay(2000);
                        //Calling this immediately, can result in nothing happening
                        //MvxAndroidTask might still be "showing".
                        _messenger.Publish(new CloseSelfMessage(this) {Close = true});
                    });
        }
开发者ID:remcok,项目名称:Cheesebaron.MvxPlugins,代码行数:27,代码来源:TestViewModel.cs

示例2: LiveCardPresenter

 public LiveCardPresenter()
 {
     _messenger = Mvx.Resolve<IMvxMessenger>();
     _messenger.Subscribe<ServiceStartedMessage>(onServiceStart);
     _messenger.Subscribe<ServiceDestroyedMessage>(onServiceDestroyed);
     _messenger.Subscribe<GlassShowViewModelMessage>(onShowViewModel);
 }
开发者ID:42Spikes,项目名称:F2S,代码行数:7,代码来源:LiveCardPresenter.cs

示例3: EnterResultsViewModel

        public EnterResultsViewModel(ITeamsService service, IMvxMessenger messenger, IGAService gaService)
		{
			_teamsService = service;
            _messenger = messenger;
            _gaService = gaService;

			_teamsChangedToken = messenger.Subscribe<TeamsChangedMessage> (OnTeamsChanged);
			_resultsChangedToken = messenger.Subscribe<ResultsChangedMessage> (OnResultsChanged);

			DataLoader = new DataLoader ();
		}
开发者ID:fatelord,项目名称:chgk,代码行数:11,代码来源:EnterResultsViewModel.cs

示例4: LogIn

        public void LogIn(string url, Action<RequestSecurityTokenResponse> onLoggedIn, Action assumeCancelled, string identityProviderName = null)
        {
            var webAuthController = new AccessControlWebAuthController { RawUrl = url, IdentityProviderName = identityProviderName };

            _messageHub = Mvx.Resolve<IMvxMessenger>();
            _subscriptionToken = _messageHub.Subscribe<RequestTokenMessage>(message =>
            {
                webAuthController.OnCancel();

                if (message.TokenResponse != null)
                    onLoggedIn(message.TokenResponse);
                else
                    assumeCancelled();
            });

            var navControl = new UINavigationController(webAuthController)
            {
                Title = identityProviderName,
                NavigationBarHidden = false,
            };
            webAuthController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Done,
                (sender, args) =>
                {
                    webAuthController.OnCancel();
                    assumeCancelled();
                });

            var modalHost = Mvx.Resolve<IMvxTouchModalHost>();
            modalHost.PresentModalViewController(navControl, true);
        }
开发者ID:Everbridge,项目名称:sm-Cheesebaron.MvxPlugins,代码行数:30,代码来源:LoginIdentityProviderTask.cs

示例5: BettrFitDataSource

        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="nav"></param>
        /// <param name="events"></param>
        /// <param name="sync"></param>
        public BettrFitDataSource()
        {
            _sync = new SyncDataViewModel();
            Server = "https://www.bettrfit.com";
            UserData = new UserVM();
            UserGoals = new ObservableCollection<UserGoalVM>();
            Auth = new WebAccess.ServiceReference.AuthData();
            UserDaily = new ObservableCollection<UserDailyVM>();
            NutritionPlanFavorites = new ObservableCollection<NutritionPlanFavoriteVM>();
            NutritionPlanLeb = new ObservableCollection<LebensmittelVM>();
            SummaryConsumedDaytime = new WebAccess.ServiceReference.SummaryData();
            SummaryConsumedDay = new WebAccess.ServiceReference.SummaryData();

            _messenger = Mvx.Resolve<IMvxMessenger>();
            _mapper = new InitMapper();

            _messenger.Subscribe<NetworkEvent>(m => IsNetworkAvailable = m.IsAvailable);

            LoadAll();

            CheckLogin();
            //if (ret == 0)
            //{
            //    _EventAggregator = Container.Resolve<IEventAggregator>();
            //    _EventAggregator.GetEvent<LoggedInEvent>().Publish(true);
            //    _ds._loggedIn = true;
            //}
        }
开发者ID:obiwan007,项目名称:bettrdiet,代码行数:34,代码来源:BettrFitDataSource.cs

示例6: MainViewModel

 public MainViewModel(ISampleAppService sampleappservice, IMvxMessenger messenger)
 {
     _sampleAppService = sampleappservice;
     ReloadList();
     _messenger = messenger;
     _listChangedToken = _messenger.Subscribe<SampleAppChangedMessage>(OnListChanged);
 }
开发者ID:kohlerb,项目名称:SampleApp641,代码行数:7,代码来源:MainViewModel.cs

示例7: GoalEditViewModel

        public GoalEditViewModel()
        {
            //this.DefaultViewModel["Lebensmittel"] = ds.CurrentLebensmittel;
            //this.DefaultViewModel["Items"] = ds.LebensmittelConsumed;
            //this.DefaultViewModel["SelectedConsumed"] = ds.SelectedConsumed;
            //this.DefaultViewModel["Search"] = ds.LebensmittelResult;
            //this.DefaultViewModel["CurrentLebensmittel"] = ds.CurrentLebensmittel;
            //this.DefaultViewModel["SummaryConsumedDay"] = ds.SummaryConsumedDay;
            //this.DefaultViewModel["SummaryConsumedDaytime"] = ds.SummaryConsumedDaytime;

            //SelectedConsumed = null;

            _messenger = Mvx.Resolve<IMvxMessenger>();
            //_logintoken = _messenger.Subscribe<LoggedInEvent>(a => LoginChanged(a.LoggedIn));
            _synctoken = _messenger.Subscribe<SyncEvent>(a => RaisePropertyChanged("Sync"));
            SaveDailyCommand = new MvxCommand(SaveDaily, canSaveDaily);
            NewRecord = false;

            WorkoutMinutes = new ObservableCollection<int>() { 20, 40, 60 };
            WorkoutDays = new ObservableCollection<int>() { 1, 3, 5 };

            _goal_Endurance = CurrentGoal.Goal_Endurance;
            _goal_FatLoss = CurrentGoal.Goal_FatLoss;
            _goal_Muscle = CurrentGoal.Goal_Muscle;
            OnPropertyChanged("Goal_Muscle");
            OnPropertyChanged("Goal_Endurance");
            OnPropertyChanged("Goal_FatLoss"); ;
        }
开发者ID:obiwan007,项目名称:bettrdiet,代码行数:28,代码来源:GoalEditViewModel.cs

示例8: FolderControllerViewModel

 public FolderControllerViewModel(IFolderObserver observer, IMvxMessenger hub)
 {
     this.observer = observer;
     this.hub = hub;
     this.files = new Dictionary<string, DateTime>(64);
     this.mvxSubscriptionToken = hub.Subscribe<NewFileMessage>(this.NewFileReceived);
 }
开发者ID:descorp,项目名称:PluginTask,代码行数:7,代码来源:FolderControllerViewModel.cs

示例9: DataViewModel

        public DataViewModel(IMvxMessenger hub, IDataStorage<DataSample> data)
        {
            this.hub = hub;
            this.data = data;

            this.mvxSubscriptionToken = hub.Subscribe<NewDataMessage>(a => this.RaisePropertyChanged(() => this.DataList));
        }
开发者ID:descorp,项目名称:PluginTask,代码行数:7,代码来源:DataViewModel.cs

示例10: ScanViewModel

        public ScanViewModel(IMvxMessenger mvxMessenger)
        {
            _mvxMessenger = mvxMessenger;

            _scanSubscriptionTokenToken =
                _mvxMessenger.Subscribe<ScanMessage>(OnScan);
        }
开发者ID:hellxcz,项目名称:SocialShopper,代码行数:7,代码来源:ScanViewModel.cs

示例11: BaseViewModel

        public BaseViewModel(IMvxMessenger messenger) : base()
        {
            _messenger = messenger;

            _token = _messenger.Subscribe<ReloadDataMessage>(async _ => 
				await ReloadDataAsync());
        }
开发者ID:Ranireddy,项目名称:CodeLabs-MobileDevOps,代码行数:7,代码来源:BaseViewModel.cs

示例12: FlashCardSetListViewModel

 public FlashCardSetListViewModel(IFlashCardManager flashCardManager, IMvxMessenger messenger, IStudySettingsService settingsService)
 {
     _flashCardManager = flashCardManager;
     _messenger = messenger;
     _settingsService = settingsService;
     GetFlashCardSetList();
     _flashCardSetSubscriptionToken = _messenger.Subscribe<FlashCardSetListChangedMessage>(OnListChanged);
 }
开发者ID:j-hayes,项目名称:Flash-Card-App,代码行数:8,代码来源:FlashCardSetListViewModel.cs

示例13: MainViewModel

        public MainViewModel(IOCRService ocrService, IMvxPictureChooserTask pictureChooser, IMvxMessenger messenger)
        {
            OCRService = ocrService;
            PictureChooser = pictureChooser;
            Messenger = messenger;

            Messenger.Subscribe<PictureMessage>(async msg => await OnPictureReceivedAsync(msg));
        }
开发者ID:SamirHafez,项目名称:Nutrition,代码行数:8,代码来源:MainViewModel.cs

示例14: FirstViewModel

        public FirstViewModel(IMvxMessenger messenger, IMvxNFCReadTask readTask, IMvxNFCWatcher watcher)
        {
            _messenger = messenger;
            _nfcReadTask = readTask;
            _watcher = watcher;

            _messageToken = messenger.Subscribe<MvxNFCMessageReceived>(MessageRecieved);
        }
开发者ID:rossdargan,项目名称:MvxPlugins,代码行数:8,代码来源:FirstViewModel.cs

示例15: 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


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