/// <summary> /// Initializes a new instance of the <see cref="DisconnectedViewModel"/> class. /// </summary> /// <param name="sdkMonitor">The SDK monitor.</param> /// <param name="eventAggregator">The event aggregator.</param> public DisconnectedViewModel(SDKMonitor sdkMonitor, EventAggregator eventAggregator) { if (IsInDesignMode()) { return; } SDKMonitor = sdkMonitor; _eventAggregator = eventAggregator; }
private void LogOut() { SDKMonitor.LogOut(); RunOnDisplayThread( () => { _eventAggregator.Publish <LogOutEvent>(new LogOutEvent()); CommandManager.InvalidateRequerySuggested(); }); }
/// <summary> /// Initializes a new instance of the <see cref="IsBusyViewModel"/> class. /// </summary> /// <param name="sdkMonitor">The SDK monitor.</param> /// <param name="eventAggregator">The event aggregator.</param> public IsBusyViewModel(SDKMonitor sdkMonitor, EventAggregator eventAggregator) { Aggregator = eventAggregator; SDKMonitor = sdkMonitor; Aggregator.GetEvent <BusyTextEvent>().Subscribe((evt) => { RunOnDisplayThread(() => { BusyText = evt.Text; }); }); }
/// <summary> /// Initializes a new instance of the <see cref="SettingsViewModel"/> class. /// </summary> /// <param name="sdk">The instance of the <see cref="SDKMonitor"/> to use.</param> /// <param name="eventAggregator">The instance of the <see cref="EventAggregator"/> to be bound to.</param> public SettingsViewModel(SDKMonitor sdk, EventAggregator eventAggregator) { InitViews(); if (IsInDesignMode()) { Init(); return; } _eventAggregator = eventAggregator; SDKMonitor = sdk; }
/// <summary> /// Initializes a new instance of the <see cref="MainViewModel"/> class. /// </summary> /// <param name="sdkMonitor">The SDK monitor.</param> /// <param name="eventAggregator">The event aggregator.</param> public MainViewModel(SDKMonitor sdkMonitor, EventAggregator eventAggregator) { if (IsInDesignMode()) { Init(); return; } _eventAggregator = eventAggregator; _registerViewSubscription = _eventAggregator.GetEvent <RegisterViewEvent>().Subscribe((evt) => { RunOnDisplayThread(() => { AvalableViews.Add(evt.View.ID, evt.View); }); }); _showViewSubscription = _eventAggregator.GetEvent <ShowViewEvent>().Subscribe((evt) => { RunOnDisplayThread(() => { NavigationLogic(evt); }); }); _showDialogSubscription = _eventAggregator.GetEvent <ShowDialogEvent>().Subscribe((evt) => { RunOnDisplayThread(() => { ShowDialogLogic(evt); }); }); InitViews(); SDKMonitor = sdkMonitor; if (!SDKMonitor.IsLoggedIn) { _eventAggregator.Publish <ShowViewEvent>(new ShowViewEvent { ID = ViewList.Views.Login }); } else if (!SDKMonitor.ConnectOnStartup) { _eventAggregator.Publish <ShowViewEvent>(new ShowViewEvent { ID = Common.ViewList.Views.Disconnected }); } }
/// <summary> /// Initializes a new instance of the <see cref="LocationListViewModel"/> class. /// </summary> /// <param name="sdkMonitor">The SDK monitor.</param> /// <param name="eventAggregator">The event aggregator.</param> public LocationListViewModel(SDKMonitor sdkMonitor, EventAggregator eventAggregator) { if (IsInDesignMode()) { Init(); return; } SDKMonitor = sdkMonitor; _eventAggregator = eventAggregator; SelectedLocation = SDKMonitor.SelectedLocation; Locations = CollectionViewSource.GetDefaultView(SDKMonitor.Locations) as ListCollectionView; }
/// <summary> /// Initializes a new instance of the <see cref="SettingsGeneralViewModel"/> class. /// </summary> /// <param name="sdk">The instance of the <see cref="SDKMonitor"/> to use.</param> public SettingsGeneralViewModel(SDKMonitor sdk) { if (IsInDesignMode()) { Init(); return; } SdkMonitor = sdk; // get the right values for the fields below from the sdkMonitor class. // we then set them if the user says "save" // some of them may be things we do in the client instead of the sdk. // those we will have to save and restore from local storage. Cancel(); }
/// <summary> /// Initializes a new instance of the <see cref="LoginViewModel"/> class. /// </summary> /// <param name="sdkMonitor">The SDK monitor.</param> /// <param name="eventAggregator">The event aggregator.</param> public LoginViewModel(SDKMonitor sdkMonitor, EventAggregator eventAggregator) { if (IsInDesignMode()) { return; } SDKMonitor = sdkMonitor; _eventAggregator = eventAggregator; _logoutSubscription = _eventAggregator.GetEvent <LogOutEvent>().Subscribe( (msg) => { RunOnDisplayThread(() => { Username = string.Empty; Password = string.Empty; Clear = true; // this is to trigger the password field to clear itself.}); }); }); }
private void Connect() { SDKMonitor.Connect(); }