/// <summary> /// Initializes a new instance of the <see cref="SettingsViewModel"/> class. /// </summary> /// <param name="dialogService">Dialog service instance.</param> /// <param name="navigationService">Navigation service instance.</param> /// <param name="msHealthClient">Microsoft Health service instance.</param> /// <param name="nikePlusClient">Nike+ service instance.</param> public SettingsViewModel(IDialogService dialogService, INavigationService navigationService, IMSHealthClient msHealthClient, INikePlusClient nikePlusClient) { // Initialize services moDialogService = dialogService; moNavigationService = navigationService; moMSHealthClient = msHealthClient; moNikePlusClient = nikePlusClient; // Initialize commands SignInMSHealthCommand = new RelayCommand(SignInMSHealth, () => true); SignOutMSHealthCommand = new RelayCommand(SignOutMSHealth, () => true); NavigationCompletedCommand = new RelayCommand <object>(NavigationCompleted, (args) => true); ValidateNikePlusCredentialCommand = new RelayCommand(ValidateNikePlusCredential, () => !string.IsNullOrEmpty(NikePlusUser) && !string.IsNullOrEmpty(NikePlusPassword)); ClearNikePlusCredentialCommand = new RelayCommand(ClearNikePlusCredential, () => !string.IsNullOrEmpty(NikePlusUser) && !string.IsNullOrEmpty(NikePlusPassword)); // Get AppVersion Package loPackage = Package.Current; PackageId loPackageId = loPackage.Id; PackageVersion loPackageVersion = loPackageId.Version; AppVersion = string.Format("v{0}.{1}.{2}.{3}", loPackageVersion.Major, loPackageVersion.Minor, loPackageVersion.Build, loPackageVersion.Revision); // Handle Back button requests SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) => { e.Handled = true; IsRunningRequest = false; IsMSHealthRunning = false; if (ShowSignIn) { ShowSignIn = false; } else { moNavigationService.GoBack(); } }; }
/// <summary> /// Initializes a new instance of the <see cref="SettingsViewModel"/> class. /// </summary> /// <param name="dialogService">Dialog service instance.</param> /// <param name="navigationService">Navigation service instance.</param> /// <param name="msHealthClient">Microsoft Health service instance.</param> /// <param name="nikePlusClient">Nike+ service instance.</param> public SettingsViewModel(IDialogService dialogService, INavigationService navigationService, IMSHealthClient msHealthClient, INikePlusClient nikePlusClient) { // Initialize services moDialogService = dialogService; moNavigationService = navigationService; moMSHealthClient = msHealthClient; moNikePlusClient = nikePlusClient; // Initialize commands SignInMSHealthCommand = new RelayCommand(SignInMSHealth, () => true); SignOutMSHealthCommand = new RelayCommand(SignOutMSHealth, () => true); NavigationCompletedCommand = new RelayCommand<object>(NavigationCompleted, (args) => true); ValidateNikePlusCredentialCommand = new RelayCommand(ValidateNikePlusCredential, () => !string.IsNullOrEmpty(NikePlusUser) && !string.IsNullOrEmpty(NikePlusPassword)); ClearNikePlusCredentialCommand = new RelayCommand(ClearNikePlusCredential, () => !string.IsNullOrEmpty(NikePlusUser) && !string.IsNullOrEmpty(NikePlusPassword)); // Get AppVersion Package loPackage = Package.Current; PackageId loPackageId = loPackage.Id; PackageVersion loPackageVersion = loPackageId.Version; AppVersion = string.Format("v{0}.{1}.{2}.{3}", loPackageVersion.Major, loPackageVersion.Minor, loPackageVersion.Build, loPackageVersion.Revision); // Handle Back button requests SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) => { e.Handled = true; IsRunningRequest = false; IsMSHealthRunning = false; if (ShowSignIn) { ShowSignIn = false; } else { moNavigationService.GoBack(); } }; }
/// <summary> /// Initializes a new instance of the <see cref="ActivityDetailsViewModel"/> class. /// </summary> /// <param name="dialogService">Dialog service instance.</param> /// <param name="navigationService">Navigation service instance.</param> /// <param name="msHealthClient">Microsoft Health service instance.</param> /// <param name="nikePlusClient">Nike+ service instance.</param> public ActivityDetailsViewModel(IDialogService dialogService, INavigationService navigationService, IMSHealthClient msHealthClient, INikePlusClient nikePlusClient) { moDialogService = dialogService; moNavigationService = navigationService; moMSHealthClient = msHealthClient; moNikePlusClient = nikePlusClient; ExportToGpxCommand = new RelayCommand(ExportToGpx, () => true); ExportToTcxCommand = new RelayCommand(ExportToTcx, () => true); SyncToNikePlusCommand = new RelayCommand(SyncToNikePlus, () => IsNikePlusAvailable); // Handle backbutton requests SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) => { if (!IsRunningRequest) { e.Handled = true; moNavigationService.GoBack(); } }; }