/// <summary> /// Invoked when the application is about to start when it's launched normally by end user. /// Override this method to implement state restoration and other application-level initialization. /// </summary> /// <param name="args"></param> protected override async void OnApplicationStarting(LaunchActivatedEventArgs args) { // By default, RootFrame will automatically instantiate a new Frame object when it's accessed for the first time // To specify a custom frame, please override the RootFrame property. // Obtains the registered application state service IApplicationStateService stateService = this.GetService <IApplicationStateService>(); // Associate the frame with an ApplicationStateService key stateService.RegisterFrame(this.RootFrame, "AppFrame"); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { // Restore the saved session state only when appropriate try { await stateService.RestoreAsync(); } catch (ApplicationStateServiceException) { //Something went wrong restoring state. //Assume there is no state and continue } } }
protected PlaylistsPageViewPresenterBase( IApplicationResources resources, IPlaylistsService playlistsService, INavigationService navigationService, IPlayQueueService playQueueService, ISongsCachingService cachingService, IApplicationStateService stateService, IRadioStationsService radioStationsService, ISettingsService settingsService) { this.resources = resources; this.playlistsService = playlistsService; this.navigationService = navigationService; this.playQueueService = playQueueService; this.cachingService = cachingService; this.stateService = stateService; this.radioStationsService = radioStationsService; this.settingsService = settingsService; Func <bool> canExecute = () => this.BindingModel.SelectedItems.Count > 0 && this.BindingModel.SelectedItems.All(x => (x.Playlist.PlaylistType == PlaylistType.UserPlaylist && !((UserPlaylist)x.Playlist).IsShared)); this.PlayCommand = new DelegateCommand(this.Play); this.QueueCommand = new DelegateCommand(this.Queue, canExecute); this.DownloadCommand = new DelegateCommand(this.Download, canExecute); this.UnPinCommand = new DelegateCommand(this.UnPin, canExecute); this.StartRadioCommand = new DelegateCommand(this.StartRadio, () => this.BindingModel != null && this.BindingModel.SelectedItems.Count == 1); }
public TerminalViewModel(ICTimeService cTimeService, IApplicationStateService applicationStateService) { Guard.NotNull(cTimeService, nameof(cTimeService)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); this._cTimeService = cTimeService; this._applicationStateService = applicationStateService; var canStamp = this.WhenAnyValue(f => f.RfidKey, (string rfidKey) => string.IsNullOrWhiteSpace(rfidKey) == false); this.Stamp = UwCoreCommand.Create(canStamp, this.StampImpl) .HandleExceptions() .ShowLoadingOverlay("Stempeln..."); this.StampMode = TerminalStampMode.Normal; this.WhenAnyValue(f => f.StampMode) .Subscribe(stampMode => { if (stampMode == TerminalStampMode.Normal) { //Stop the timer this._resetModeTimer?.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromSeconds(10)); } else { //Start the timer this._resetModeTimer?.Change(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10)); } }); this._timer = new Timer(this.Tick, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(100)); this._resetModeTimer = new Timer(this.ResetModeTick, null, TimeSpan.FromMilliseconds(-1), TimeSpan.FromSeconds(10)); this.DisplayName = "Terminal"; }
public AttendingUserDetailsViewModel(ICTimeService cTimeService, IApplicationStateService applicationStateService, IContactsService contactsService, IDialogService dialogService, IPhoneService phoneService, IEmailService emailService) { Guard.NotNull(cTimeService, nameof(cTimeService)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); Guard.NotNull(contactsService, nameof(contactsService)); Guard.NotNull(dialogService, nameof(dialogService)); Guard.NotNull(phoneService, nameof(phoneService)); Guard.NotNull(emailService, nameof(emailService)); this._cTimeService = cTimeService; this._applicationStateService = applicationStateService; this._contactsService = contactsService; this._dialogService = dialogService; this._phoneService = phoneService; this._emailService = emailService; this.LoadAttendingUser = UwCoreCommand.Create(this.LoadAttendingUserImpl) .HandleExceptions() .ShowLoadingOverlay(CTime2Resources.Get("Loading.Employee")); this.LoadAttendingUser.ToProperty(this, f => f.AttendingUser, out this._attendingUserHelper); var canCall = Observable .Return(this._phoneService.CanCall) .CombineLatest(this.WhenAnyValue(f => f.AttendingUser), (serviceCanCall, user) => serviceCanCall && string.IsNullOrWhiteSpace(user?.PhoneNumber) == false); this.Call = UwCoreCommand.Create(canCall, this.CallImpl) .HandleExceptions(); var canSendMail = this.WhenAnyValue(f => f.AttendingUser, selector: user => string.IsNullOrWhiteSpace(user?.EmailAddress) == false); this.SendMail = UwCoreCommand.Create(canSendMail, this.SendMailImpl) .HandleExceptions(); this.AddAsContact = UwCoreCommand.Create(this.AddAsContactImpl) .HandleExceptions(); }
public SetSelectedRowsCommandHandler( IApplicationStateService stateService, IEventBus eventBus) { _stateService = stateService; _eventBus = eventBus; }
protected override void SaveState(IApplicationStateService applicationStateService) { base.SaveState(applicationStateService); applicationStateService.Set(nameof(this.StartDate), this.StartDate, ApplicationState.Temp); applicationStateService.Set(nameof(this.EndDate), this.EndDate, ApplicationState.Temp); }
public LoginViewModel(ICTimeService cTimeService, IApplicationStateService applicationStateService, IShell shell, IDialogService dialogService, IBiometricsService biometricsService) { Guard.NotNull(cTimeService, nameof(cTimeService)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); Guard.NotNull(shell, nameof(shell)); Guard.NotNull(dialogService, nameof(dialogService)); Guard.NotNull(biometricsService, nameof(biometricsService)); this._cTimeService = cTimeService; this._applicationStateService = applicationStateService; this._shell = shell; this._dialogService = dialogService; this._biometricsService = biometricsService; var canLogin = this.WhenAnyValue(f => f.EmailAddress, f => f.Password, (email, password) => string.IsNullOrWhiteSpace(email) == false && string.IsNullOrWhiteSpace(password) == false); this.Login = UwCoreCommand.Create(canLogin, this.LoginImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.LoggingIn")) .HandleExceptions() .TrackEvent("Login"); var deviceAvailable = this._biometricsService.BiometricAuthDeviceIsAvailableAsync().ToObservable(); var userAvailable = this._biometricsService.HasUserForBiometricAuthAsync().ToObservable(); var canRememberedLogin = deviceAvailable .CombineLatest(userAvailable, (deviceAvail, userAvail) => deviceAvail && userAvail) .ObserveOnDispatcher(); this.RememberedLogin = UwCoreCommand.Create(canRememberedLogin, this.RememberedLoginImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.LoggingIn")) .HandleExceptions() .TrackEvent("LoginRemembered"); this.DisplayName = CTime2Resources.Get("Navigation.Login"); }
public PlayerMorePopupViewBindingModel( IMediaElementContainer mediaElementContainer, IPlayQueueService playQueueService, IEventAggregator eventAggregator, IApplicationStateService stateService, IApplicationResources applicationResources, IDispatcher dispatcher) { this.mediaElementContainer = mediaElementContainer; this.playQueueService = playQueueService; this.eventAggregator = eventAggregator; this.stateService = stateService; this.applicationResources = applicationResources; this.dispatcher = dispatcher; this.RegisterForDispose(this.eventAggregator.GetEvent <QueueChangeEvent>().Subscribe( async(e) => await this.dispatcher.RunAsync(() => { this.RaisePropertyChanged(() => this.IsShuffleEnabled); this.RaisePropertyChanged(() => this.IsRepeatAllEnabled); }))); this.RegisterForDispose(this.eventAggregator.GetEvent <ApplicationStateChangeEvent>().Subscribe( async(e) => await this.dispatcher.RunAsync(() => this.RaisePropertyChanged(() => this.IsOnlineMode)))); }
public YourTimesViewModel(IApplicationStateService applicationStateService, ICTimeService cTimeService, ISharingService sharingService) { Guard.NotNull(applicationStateService, nameof(applicationStateService)); Guard.NotNull(cTimeService, nameof(cTimeService)); Guard.NotNull(sharingService, nameof(sharingService)); this._applicationStateService = applicationStateService; this._cTimeService = cTimeService; this._sharingService = sharingService; this.WhenAnyValue(f => f.StartDate, f => f.EndDate) .Select(f => CTime2Resources.GetFormatted("MyTimes.TitleFormat", this.StartDate, this.EndDate)) .Subscribe(name => this.DisplayName = name); this.LoadTimes = UwCoreCommand.Create(this.LoadTimesImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.Times")) .HandleExceptions() .TrackEvent("LoadTimes"); this.LoadTimes.ToProperty(this, f => f.Times, out this._timesHelper); this.Share = UwCoreCommand.Create(this.ShareImpl) .HandleExceptions() .TrackEvent("ShareMyTimes"); this.StartDate = DateTimeOffset.Now.StartOfMonth(); this.EndDate = DateTimeOffset.Now.WithoutTime(); }
public LastFmCurrentSongPublisher( IApplicationStateService stateService, ILastfmWebService webService) { this.stateService = stateService; this.webService = webService; }
/// <summary> /// <see cref="WebApiServiceBase"/> クラスの新しいインスタンスを作成します。 /// </summary> /// <param name="http">シングルトン <see cref="HttpClient"/>。</param> /// <param name="applicationState">シングルトン <see cref="ApplicationStateService"/>。</param> public WebApiServiceBase( HttpClient http, IApplicationStateService applicationState ) { this._http = http; this._applicationState = applicationState; }
public EmployeeGroupService(IEventAggregator eventAggregator, IApplicationStateService applicationStateService) { Guard.NotNull(eventAggregator, nameof(eventAggregator)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); this._eventAggregator = eventAggregator; this._applicationStateService = applicationStateService; }
public AlbumArtCacheService( ILogManager logManager, IApplicationStateService stateService, ICachedAlbumArtsRepository cachedAlbumArtsRepository) { this.logger = logManager.CreateLogger("AlbumArtCacheService"); this.stateService = stateService; this.cachedAlbumArtsRepository = cachedAlbumArtsRepository; }
/// <summary> /// <see cref="CustomerMaintenanceSettingApiService"/> クラスの新しいインスタンスを作成します。 /// </summary> /// <param name="http">シングルトン <see cref="HttpClient"/>。</param> /// <param name="applicationState">シングルトン <see cref="ApplicationStateService"/>。</param> public CustomerMaintenanceSettingApiService( HttpClient http, IApplicationStateService applicationState ) : base( http: http, applicationState: applicationState ) { }
public RemoveFilterCommandHandler( IApplicationStateService stateService, IFilterRepository repository, IEventBus eventBus) { _stateService = stateService; _repository = repository; _eventBus = eventBus; }
public SelectFilterTreeNodeCommandHandler( IFilterRepository repository, IApplicationStateService service, IEventBus eventBus) { _repository = repository; _service = service; _eventBus = eventBus; }
public BandService(IApplicationStateService applicationStateService, ICTimeService cTimeService) { this._applicationStateService = applicationStateService; this._cTimeService = cTimeService; BackgroundTileEventHandler.Instance.TileOpened += this.OnTileOpened; BackgroundTileEventHandler.Instance.TileButtonPressed += this.OnTileButtonPressed; BackgroundTileEventHandler.Instance.TileClosed += this.OnTileClosed; }
public UploadImagePageViewModel(IApplicationStateService applicationStateService) { ApplicationStateService = applicationStateService; UploadMediaCommand = new DelegateCommand(UploadMedia, CanUploadMedia); ApplicationStateService.PropertyChanged += (s, e) => UploadMediaCommand.RaiseCanExecuteChanged(); PostCommand = new DelegateCommand(PostPicture, CanPostPicture); ApplicationStateService.PropertyChanged += (s, e) => PostCommand.RaiseCanExecuteChanged(); MapViewChangedCommand = new DelegateCommand <LocationRect>(ChangeLocation); }
public static bool IsOnline(this IApplicationStateService @this) { if (@this == null) { throw new ArgumentNullException("this"); } return(@this.CurrentState == ApplicationState.Online); }
public NavigationPaneViewModel( IStartMenuViewModel startMenuViewModel, INavigationTreeViewModel navigationTreeViewModel, IApplicationStateService stateService) { _startMenuViewModel = startMenuViewModel; _navigationTreeViewModel = navigationTreeViewModel; _stateService = stateService; }
public CloseProjectCommandHandler( IEventBus eventBus, IApplicationStateService stateService, IDataContext dataContext) { _dataContext = dataContext; _eventBus = eventBus; _stateService = stateService; }
public ForTypeApplicationStateService(IApplicationStateService parent, Type forType, string additionalPrefix = null) { Guard.NotNull(parent, nameof(parent)); Guard.NotNull(forType, nameof(forType)); this._parent = parent; this._forType = forType; this._additionalPrefix = additionalPrefix; }
/// <summary> /// <see cref="ProductCategoriesApiService"/> クラスの新しいインスタンスを作成します。 /// </summary> /// <param name="http">シングルトン <see cref="HttpClient"/>。</param> /// <param name="applicationState">シングルトン <see cref="ApplicationStateService"/>。</param> public ProductCategoriesApiService( HttpClient http, IApplicationStateService applicationState ) : base( http: http, applicationState: applicationState ) { }
/// <summary> /// <see cref="JWTApiService"/> クラスの新しいインスタンスを作成します。 /// </summary> /// <param name="http">シングルトン <see cref="HttpClient"/>。</param> /// <param name="applicationState">シングルトン <see cref="ApplicationStateService"/>。</param> public JWTApiService( HttpClient http, IApplicationStateService applicationState ) : base( http: http, applicationState: applicationState ) { }
protected override void RestoreState(IApplicationStateService applicationStateService) { base.RestoreState(applicationStateService); if (applicationStateService.HasValueFor(nameof(this.StartDate), ApplicationState.Temp)) this.StartDate = applicationStateService.Get<DateTimeOffset>(nameof(this.StartDate), ApplicationState.Temp); if (applicationStateService.HasValueFor(nameof(this.EndDate), ApplicationState.Temp)) this.EndDate = applicationStateService.Get<DateTimeOffset>(nameof(this.EndDate), ApplicationState.Temp); }
public PlaylistsPageViewPresenter( IApplicationResources resources, IPlaylistsService playlistsService, INavigationService navigationService, IPlayQueueService playQueueService, ISongsCachingService cachingService, IApplicationStateService stateService) : base(resources, playlistsService, navigationService, playQueueService, cachingService, stateService) { }
public CTimeService(IEventAggregator eventAggregator, IApplicationStateService applicationStateService, IGeoLocationService geoLocationService) { Guard.NotNull(eventAggregator, nameof(eventAggregator)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); Guard.NotNull(geoLocationService, nameof(geoLocationService)); this._eventAggregator = eventAggregator; this._applicationStateService = applicationStateService; this._geoLocationService = geoLocationService; }
/// <summary> /// Invoked when application execution is being suspended. Application state is saved /// without knowing whether the application will be terminated or resumed with the contents /// of memory still intact. /// </summary> /// <param name="sender">The source of the suspend request.</param> /// <param name="e">Details about the suspend request.</param> protected override async void OnSuspending(SuspendingEventArgs args) { // Obtains the registered application state service IApplicationStateService stateService = this.GetService <IApplicationStateService>(); var deferral = args.SuspendingOperation.GetDeferral(); await stateService.SaveAsync(); deferral.Complete(); }
public static void Initialize( IMainFrame applicationToolbar, IApplicationResources resources, IApplicationStateService stateService, IEventAggregator eventAggregator) { eventAggregator.GetEvent <ApplicationStateChangeEvent>().Subscribe( (e) => applicationToolbar.SetMenuItems(GetItems(resources, stateService))); applicationToolbar.SetMenuItems(GetItems(resources, stateService)); }
public CopyDataToClipboardCommandHandler( IColumnRepository columnRepository, IApplicationStateService stateService, ITabExporter exporter, IClipboard clipboard) { _columnRepository = columnRepository; _stateService = stateService; _exporter = exporter; _clipboard = clipboard; }
public AttendanceListViewModel(ICTimeService cTimeService, IApplicationStateService applicationStateService, INavigationService navigationService, IEmployeeGroupService employeeGroupService, IDialogService dialogService) { Guard.NotNull(cTimeService, nameof(cTimeService)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); Guard.NotNull(navigationService, nameof(navigationService)); Guard.NotNull(employeeGroupService, nameof(employeeGroupService)); Guard.NotNull(dialogService, nameof(dialogService)); this._cTimeService = cTimeService; this._applicationStateService = applicationStateService; this._navigationService = navigationService; this._employeeGroupService = employeeGroupService; this._dialogService = dialogService; this.DisplayName = CTime2Resources.Get("Navigation.AttendanceList"); this.SelectedUsers = new ReactiveList<AttendingUser>(); this.State = AttendanceListState.Loading; this.LoadUsers = UwCoreCommand.Create(this.LoadUsersImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.AttendanceList")) .HandleExceptions() .TrackEvent("LoadAttendanceList"); this.LoadUsers.ToProperty(this, f => f.Users, out this._usersHelper); var canShowDetails = this.WhenAnyValue(f => f.SelectedUsers).Select(f => f.Any()); this.ShowDetails = UwCoreCommand.Create(canShowDetails, this.ShowDetailsImpl) .HandleExceptions() .TrackEvent("ShowAttendingUserDetails"); var canCreateGroup = this.WhenAnyValue(f => f.State, mode => mode == AttendanceListState.View); this.CreateGroup = UwCoreCommand.Create(canCreateGroup, this.CreateGroupImpl) .HandleExceptions() .TrackEvent("CreateNewEmployeeGroup"); var canSaveGroup = this .WhenAnyValue(f => f.State, f => f.GroupName, (mode, groupName) => mode == AttendanceListState.CreateGroup && string.IsNullOrWhiteSpace(groupName) == false) .CombineLatest(this.SelectedUsers.Changed, (stateAndName, selectedUsers) => stateAndName && this.SelectedUsers.Any()); this.SaveGroup = UwCoreCommand.Create(canSaveGroup, this.SaveGroupImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.SaveEmployeeGroup")) .HandleExceptions() .TrackEvent("SaveNewEmployeeGroup"); var canCancelCreateGroup = this.WhenAnyValue(f => f.State, mode => mode == AttendanceListState.CreateGroup); this.CancelCreateGroup = UwCoreCommand.Create(canCancelCreateGroup, this.CancelCreateGroupImpl) .HandleExceptions() .TrackEvent("CancelCreateNewEmployeeGroup"); var canDeleteGroup = this.WhenAnyValue(f => f.State, mode => mode == AttendanceListState.ViewGroup); this.DeleteGroup = UwCoreCommand.Create(canDeleteGroup, this.DeleteGroupImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.DeleteEmployeeGroup")) .HandleExceptions() .TrackEvent("DeleteEmployeeGroup"); }
public MainWindow( Func <string, Task <Timetable> > loadTimetableFunc, Func <TrainNumber> windowFactory, EntriesCollection entries, IApplicationStateService appStateService) { Entries = entries; InitializeComponent(); _loadTimetable = loadTimetableFunc; _windowFactory = windowFactory; _appStateService = appStateService; }
public LinksRegionViewPresenter( IApplicationStateService stateService, IApplicationResources resources, ISearchService searchService, IDispatcher dispatcher, IGoogleMusicSynchronizationService googleMusicSynchronizationService, IApplicationSettingViewsService applicationSettingViewsService, IGoogleMusicSessionService sessionService, INavigationService navigationService) { this.stateService = stateService; this.resources = resources; this.dispatcher = dispatcher; this.googleMusicSynchronizationService = googleMusicSynchronizationService; this.sessionService = sessionService; this.navigationService = navigationService; this.ShowSearchCommand = new DelegateCommand(searchService.Activate); this.NavigateToDownloadQueue = new DelegateCommand(async() => { if (!this.disableClickToCache) { await this.dispatcher.RunAsync(() => applicationSettingViewsService.Show("offlinecache")); } }); this.UpdateLibraryCommand = new DelegateCommand( async() => { if (this.UpdateLibraryCommand.CanExecute()) { this.synchronizationTimer.Stop(); await this.Synchronize(forceToDownloadPlaylists: true); } }, () => !this.BindingModel.ShowProgressRing); this.BindingModel = new LinksRegionBindingModel(); this.synchronizationTimer = new DispatcherTimer { Interval = TimeSpan.FromMinutes(5) }; this.synchronizationTimer.Stop(); this.synchronizationTime = 0; this.synchronizationTimer.Tick += this.SynchronizationTimerOnTick; this.Logger.LogTask(this.Synchronize()); this.SetOfflineMessageIfRequired(); this.sessionService.SessionCleared += this.SessionServiceOnSessionCleared; }
public GoogleMusicCurrentSongPublisher( ILogManager logManager, IApplicationStateService stateService, ISongsWebService songsWebService, ISongsRepository songsRepository, IEventAggregator eventAggregator) { this.logger = logManager.CreateLogger("GoogleMusicCurrentSongPublisher"); this.stateService = stateService; this.songsWebService = songsWebService; this.songsRepository = songsRepository; this.eventAggregator = eventAggregator; }
public CheckedInViewModel(ICTimeService cTimeService, IApplicationStateService applicationStateService) : base(cTimeService, applicationStateService) { this.CheckOut = UwCoreCommand.Create(this.CheckOutImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.CheckedOut")) .HandleExceptions() .TrackEvent("CheckOut"); this.Pause = UwCoreCommand.Create(this.PauseImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.Pause")) .HandleExceptions() .TrackEvent("Pause"); }
public LoggedInApplicationMode(IApplicationStateService applicationStateService, ICentronService centronService, ILoadingService loadingService, IHelpdeskGroupsService helpdeskGroupsService, IEventAggregator eventAggregator) { this._applicationStateService = applicationStateService; this._centronService = centronService; this._loadingService = loadingService; this._helpdeskGroupsService = helpdeskGroupsService; this._eventAggregator = eventAggregator; this._dashboardItem = new NavigatingHamburgerItem(SBoardResources.Get("Navigation.Dashboard"), Symbol.Home, typeof(DashboardViewModel)); this._logoutItem = new ClickableHamburgerItem(SBoardResources.Get("Navigation.Logout"), SymbolEx.Logout, this.Logout); this._newHelpdeskGroupItem = new NavigatingHamburgerItem(SBoardResources.Get("Navigation.NewHelpdeskGroup"), Symbol.Add, typeof(NewHelpdeskGroupViewModel)); this._helpdeskGroupItems = new List <NavigatingHamburgerItem>(); }
public OpenProjectCommandHandler( IDialogService dialogService, IEventBus eventBus, IApplicationStateService stateService, IDataContext dataContext, IXmlFileService xmlFileService, IProjectSerializer projectSerializer) { _dialogService = dialogService; _xmlFileService = xmlFileService; _projectSerializer = projectSerializer; _dataContext = dataContext; _eventBus = eventBus; _stateService = stateService; }
public static void Initialize( IMainFrame applicationToolbar, IApplicationResources resources, IApplicationStateService stateService, ISettingsService settingsService, IEventAggregator eventAggregator) { eventAggregator.GetEvent <ApplicationStateChangeEvent>().Subscribe( (e) => applicationToolbar.SetMenuItems(GetItems(resources, stateService, settingsService))); eventAggregator.GetEvent <SettingsChangeEvent>() .Where(x => string.Equals(x.Key, GoogleMusicCoreSettingsServiceExtensions.IsAllAccessAvailableKey, StringComparison.OrdinalIgnoreCase)) .Subscribe( (e) => applicationToolbar.SetMenuItems(GetItems(resources, stateService, settingsService))); applicationToolbar.SetMenuItems(GetItems(resources, stateService, settingsService)); }
internal CurrentPlaylistPageViewPresenter( IApplicationResources resources, IPlayQueueService playQueueService, ISongsService metadataEditService, ISongsCachingService cachingService, IApplicationStateService stateService, INavigationService navigationService, IRadioStationsService radioStationsService, ISettingsService settingsService, SongsBindingModel songsBindingModel) { this.resources = resources; this.playQueueService = playQueueService; this.metadataEditService = metadataEditService; this.cachingService = cachingService; this.stateService = stateService; this.navigationService = navigationService; this.radioStationsService = radioStationsService; this.settingsService = settingsService; this.BindingModel = songsBindingModel; this.playQueueService.QueueChanged += async(sender, args) => await this.Dispatcher.RunAsync(this.UpdateSongs); //this.SaveAsPlaylistCommand = new DelegateCommand(this.SaveAsPlaylist, () => this.BindingModel.Songs.Count > 0); this.RemoveSelectedSongCommand = new DelegateCommand(this.RemoveSelectedSong, () => this.BindingModel.SelectedItems.Count > 0); this.AddToPlaylistCommand = new DelegateCommand(this.AddToPlaylist, () => this.BindingModel.SelectedItems.Count > 0); this.RateSongCommand = new DelegateCommand(this.RateSong); this.DownloadCommand = new DelegateCommand(this.Download, () => this.BindingModel.SelectedItems.Count(x => !x.Metadata.UnknownSong) > 0); this.UnPinCommand = new DelegateCommand(this.UnPin, () => this.BindingModel.SelectedItems.Count(x => !x.Metadata.UnknownSong) > 0); this.StartRadioCommand = new DelegateCommand(this.StartRadio, () => this.BindingModel != null && this.BindingModel.SelectedItems.Count == 1); this.playQueueService.StateChanged += async(sender, args) => await this.Dispatcher.RunAsync(async() => { if (this.BindingModel.SelectedItems.Count == 0) { if (this.BindingModel.Songs != null && args.CurrentSong != null) { var currentSong = this.BindingModel.Songs.FirstOrDefault(x => string.Equals(x.Metadata.SongId, args.CurrentSong.SongId, StringComparison.Ordinal)); if (currentSong != null) { await this.View.ScrollIntoCurrentSongAsync(currentSong); } } } }); }
public RadioPageViewPresenter( IApplicationResources resources, IPlaylistsService playlistsService, INavigationService navigationService, IPlayQueueService playQueueService, ISongsCachingService cachingService, IApplicationStateService stateService, IRadioWebService radioWebService) : base(resources, playlistsService, navigationService, playQueueService, cachingService, stateService) { this.resources = resources; this.navigationService = navigationService; this.playQueueService = playQueueService; this.radioWebService = radioWebService; this.EditRadioNameCommand = new DelegateCommand(this.EditRadioName, () => this.BindingModel.SelectedItems.Count == 1); this.DeleteRadioCommand = new DelegateCommand(this.DeleteRadio, () => this.BindingModel.SelectedItems.Count > 0); }
public UserPlaylistsPageViewPresenter( IApplicationResources resources, INavigationService navigationService, IPlayQueueService playQueueService, IPlaylistsService playlistsService, IUserPlaylistsService userPlaylistsService, ISongsCachingService cachingService, IApplicationStateService stateService) : base(resources, playlistsService, navigationService, playQueueService, cachingService, stateService) { this.resources = resources; this.userPlaylistsService = userPlaylistsService; this.stateService = stateService; this.AddPlaylistCommand = new DelegateCommand(this.AddPlaylist); this.EditPlaylistCommand = new DelegateCommand(this.EditPlaylist, () => this.BindingModel.SelectedItems.Count == 1); this.DeletePlaylistsCommand = new DelegateCommand(this.DeletePlaylists, () => this.BindingModel.SelectedItems.Count > 0); }
public CheckedOutViewModel(ICTimeService cTimeService, IApplicationStateService applicationStateService) : base(cTimeService, applicationStateService) { this.CheckIn = UwCoreCommand.Create(this.CheckInImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.CheckIn")) .HandleExceptions() .TrackEvent("CheckIn"); this.CheckInHomeOffice = UwCoreCommand.Create(this.CheckInHomeOfficeImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.CheckIn")) .HandleExceptions() .TrackEvent("CheckInHomeOffice"); this.CheckInTrip = UwCoreCommand.Create(this.CheckInTripImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.CheckIn")) .HandleExceptions() .TrackEvent("CheckInTrip"); }
public DetailedStatisticViewModel(ICTimeService cTimeService, IApplicationStateService applicationStateService, INavigationService navigationService, ISharingService sharingService) { Guard.NotNull(cTimeService, nameof(cTimeService)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); Guard.NotNull(navigationService, nameof(navigationService)); Guard.NotNull(sharingService, nameof(sharingService)); this._cTimeService = cTimeService; this._applicationStateService = applicationStateService; this._navigationService = navigationService; this._sharingService = sharingService; this.LoadChart = UwCoreCommand.Create(this.LoadChartImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.LoadCharts")) .HandleExceptions(); this.LoadChart.ToProperty(this, f => f.ChartItems, out this._chartItemsHelper); this.GoToMyTimesCommand = UwCoreCommand.Create(this.GoToMyTimes) .HandleExceptions(); this.Share = UwCoreCommand.Create(this.ShareImpl) .HandleExceptions() .TrackEvent("ShareDetailedStatistic"); }
public BiometricsService(IApplicationStateService applicationStateService) { Guard.NotNull(applicationStateService, nameof(applicationStateService)); this._applicationStateService = applicationStateService; }
protected override void RestoreState(IApplicationStateService applicationStateService) { base.RestoreState(applicationStateService); var startDate = applicationStateService.Get<DateTimeOffset?>(nameof(this.StartDate), ApplicationState.Temp); if (startDate != null) this.StartDate = startDate.Value; var endDate = applicationStateService.Get<DateTimeOffset?>(nameof(this.EndDate), ApplicationState.Temp); if (endDate != null) { this.EndDate = endDate.Value; } }
public SettingsViewModel(IBiometricsService biometricsService, IApplicationStateService applicationStateService, IBandService bandService, IShell shell) { Guard.NotNull(biometricsService, nameof(biometricsService)); Guard.NotNull(applicationStateService, nameof(applicationStateService)); Guard.NotNull(bandService, nameof(bandService)); this._biometricsService = biometricsService; this._applicationStateService = applicationStateService; this._bandService = bandService; this._shell = shell; var hasUser = new ReplaySubject<bool>(1); hasUser.OnNext(this._applicationStateService.GetCurrentUser() != null); var deviceAvailable = this._biometricsService.BiometricAuthDeviceIsAvailableAsync().ToObservable(); var canRememberLogin = hasUser.CombineLatest(deviceAvailable, (hasUsr, deviceAvail) => hasUsr && deviceAvail); this.RememberLogin = UwCoreCommand.Create(canRememberLogin, this.RememberLoginImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.RememberedLogin")) .HandleExceptions() .TrackEvent("SetupRememberLogin"); var canToggleTile = this.WhenAnyValue(f => f.State, state => state != BandState.NotConnected); this.ToggleBandTile = UwCoreCommand.Create(canToggleTile, this.ToggleTileImpl) .ShowLoadingOverlay(() => this.State == BandState.Installed ? CTime2Resources.Get("Loading.RemoveTileFromBand") : CTime2Resources.Get("Loading.AddTileToBand")) .HandleExceptions() .TrackEvent("ToggleBandTile"); this.Reload = UwCoreCommand.Create(this.ReloadImpl) .ShowLoadingOverlay(CTime2Resources.Get("Loading.Settings")) .HandleExceptions() .TrackEvent("ReloadSettings"); this.Theme = this._applicationStateService.GetApplicationTheme(); this.SelectedWorkTime = this._applicationStateService.GetWorkDayHours(); this.SelectedBreakTime = this._applicationStateService.GetWorkDayBreak(); this.CompanyId = this._applicationStateService.GetCompanyId(); this.WhenAnyValue(f => f.Theme) .Subscribe(theme => { this._shell.Theme = theme; this._applicationStateService.SetApplicationTheme(theme); }); this.WhenAnyValue(f => f.SelectedWorkTime) .Subscribe(workTime => { this._applicationStateService.SetWorkDayHours(workTime); }); this.WhenAnyValue(f => f.SelectedBreakTime) .Subscribe(breakTime => { this._applicationStateService.SetWorkDayBreak(breakTime); }); this.WhenAnyValue(f => f.CompanyId) .Subscribe(companyId => { this._applicationStateService.SetCompanyId(companyId); }); this.DisplayName = CTime2Resources.Get("Navigation.Settings"); this.WorkTimes = new ReactiveList<TimeSpan>(Enumerable .Repeat((object)null, 4 * 24) .Select((_, i) => TimeSpan.FromHours(0.25 * i))); this.BreakTimes = new ReactiveList<TimeSpan>(Enumerable .Repeat((object)null, 4 * 24) .Select((_, i) => TimeSpan.FromHours(0.25 * i))); }
public CTimeStampHelper(IApplicationStateService applicationStateService, ICTimeService cTimeService) { this._applicationStateService = applicationStateService; this._cTimeService = cTimeService; }