本文整理汇总了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});
});
}
示例2: LiveCardPresenter
public LiveCardPresenter()
{
_messenger = Mvx.Resolve<IMvxMessenger>();
_messenger.Subscribe<ServiceStartedMessage>(onServiceStart);
_messenger.Subscribe<ServiceDestroyedMessage>(onServiceDestroyed);
_messenger.Subscribe<GlassShowViewModelMessage>(onShowViewModel);
}
示例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 ();
}
示例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);
}
示例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;
//}
}
示例6: MainViewModel
public MainViewModel(ISampleAppService sampleappservice, IMvxMessenger messenger)
{
_sampleAppService = sampleappservice;
ReloadList();
_messenger = messenger;
_listChangedToken = _messenger.Subscribe<SampleAppChangedMessage>(OnListChanged);
}
示例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"); ;
}
示例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);
}
示例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));
}
示例10: ScanViewModel
public ScanViewModel(IMvxMessenger mvxMessenger)
{
_mvxMessenger = mvxMessenger;
_scanSubscriptionTokenToken =
_mvxMessenger.Subscribe<ScanMessage>(OnScan);
}
示例11: BaseViewModel
public BaseViewModel(IMvxMessenger messenger) : base()
{
_messenger = messenger;
_token = _messenger.Subscribe<ReloadDataMessage>(async _ =>
await ReloadDataAsync());
}
示例12: FlashCardSetListViewModel
public FlashCardSetListViewModel(IFlashCardManager flashCardManager, IMvxMessenger messenger, IStudySettingsService settingsService)
{
_flashCardManager = flashCardManager;
_messenger = messenger;
_settingsService = settingsService;
GetFlashCardSetList();
_flashCardSetSubscriptionToken = _messenger.Subscribe<FlashCardSetListChangedMessage>(OnListChanged);
}
示例13: MainViewModel
public MainViewModel(IOCRService ocrService, IMvxPictureChooserTask pictureChooser, IMvxMessenger messenger)
{
OCRService = ocrService;
PictureChooser = pictureChooser;
Messenger = messenger;
Messenger.Subscribe<PictureMessage>(async msg => await OnPictureReceivedAsync(msg));
}
示例14: FirstViewModel
public FirstViewModel(IMvxMessenger messenger, IMvxNFCReadTask readTask, IMvxNFCWatcher watcher)
{
_messenger = messenger;
_nfcReadTask = readTask;
_watcher = watcher;
_messageToken = messenger.Subscribe<MvxNFCMessageReceived>(MessageRecieved);
}
示例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;
}