Exemple #1
0
        public Shell(IContainerProvider container, IWindowsIntegrationService windowsIntegrationService, II18nService i18nService,
                     INotificationService notificationService, IWin32InputService win32InputService, IAppearanceService appearanceService,
                     IPlaybackService playbackService, IMetadataService metadataService, IEventAggregator eventAggregator)
        {
            InitializeComponent();

            this.container = container;
            this.windowsIntegrationService = windowsIntegrationService;
            this.notificationService       = notificationService;
            this.win32InputService         = win32InputService;
            this.playbackService           = playbackService;
            this.metadataService           = metadataService;
            this.appearanceService         = appearanceService;
            this.i18nService     = i18nService;
            this.eventAggregator = eventAggregator;

            this.shellService = container.Resolve <Func <string, string, string, string, string, IShellService> >()(
                typeof(NowPlaying.NowPlaying).FullName, typeof(FullPlayer.FullPlayer).FullName, typeof(CoverPlayer).FullName,
                typeof(MicroPlayer).FullName, typeof(NanoPlayer).FullName);

            this.InitializeServices();
            this.InitializeWindows();
            this.InitializeTrayIcon();
            this.InitializeCommands();
        }
Exemple #2
0
        public Shell(IUnityContainer container, IWindowsIntegrationService windowsIntegrationService,
                     INotificationService notificationService, IWin32InputService win32InputService, IAppearanceService appearanceService,
                     IPlaybackService playbackService, IMetadataService metadataService, IEventAggregator eventAggregator)
        {
            InitializeComponent();

            this.container = container;
            this.windowsIntegrationService = windowsIntegrationService;
            this.notificationService       = notificationService;
            this.win32InputService         = win32InputService;
            this.playbackService           = playbackService;
            this.metadataService           = metadataService;
            this.appearanceService         = appearanceService;
            this.eventAggregator           = eventAggregator;

            this.shellService = container.Resolve <IShellService>(
                new ParameterOverride("nowPlayingPage", typeof(NowPlaying.NowPlaying).FullName),
                new ParameterOverride("fullPlayerPage", typeof(FullPlayer.FullPlayer).FullName),
                new ParameterOverride("coverPlayerPage", typeof(CoverPlayer).FullName),
                new ParameterOverride("microplayerPage", typeof(MicroPlayer).FullName),
                new ParameterOverride("nanoPlayerPage", typeof(NanoPlayer).FullName)
                );

            this.InitializeServices();
            this.InitializeWindows();
            this.InitializeTrayIcon();
            this.InitializeCommands();
        }
Exemple #3
0
        public Shell(IUnityContainer container, IRegionManager regionManager, IAppearanceService appearanceService, II18nService i18nService, IJumpListService jumpListService, IEventAggregator eventAggregator, INoteService noteService)
        {
            InitializeComponent();

            // Dependency injection
            this.container         = container;
            this.regionManager     = regionManager;
            this.appearanceService = appearanceService;
            this.i18nService       = i18nService;
            this.jumplistService   = jumpListService;
            this.eventAggregator   = eventAggregator;
            this.noteService       = noteService;

            // Theming
            this.appearanceService.ApplyTheme(SettingsClient.Get <string>("Appearance", "Theme"));
            this.appearanceService.ApplyColorScheme(SettingsClient.Get <bool>("Appearance", "FollowWindowsColor"), SettingsClient.Get <string>("Appearance", "ColorScheme"));

            // I18n
            this.i18nService.ApplyLanguageAsync(SettingsClient.Get <string>("Appearance", "Language"));

            // Events
            this.eventAggregator.GetEvent <ShowMainWindowEvent>().Subscribe((x) => this.ActivateNow());

            // Geometry
            this.SetGeometry(SettingsClient.Get <int>("General", "Top"), SettingsClient.Get <int>("General", "Left"), SettingsClient.Get <int>("General", "Width") > 50 ? SettingsClient.Get <int>("General", "Width") : Defaults.DefaultMainWindowWidth, SettingsClient.Get <int>("General", "Height") > 50 ? SettingsClient.Get <int>("General", "Height") : Defaults.DefaultMainWindowHeight, Defaults.DefaultMainWindowLeft, Defaults.DefaultMainWindowTop);

            // Main window state
            this.WindowState = SettingsClient.Get <bool>("General", "IsMaximized") ? WindowState.Maximized : WindowState.Normal;
        }
Exemple #4
0
        public Shell(IUnityContainer container, IRegionManager regionManager, IAppearanceService appearanceService, IPlaybackService playbackService, IWin32InputService win32InputService, IEventAggregator eventAggregator, INotificationService notificationService, IMetadataService metadataService, ISearchService searchService)
        {
            InitializeComponent();

            // Dependency injection
            this.container           = container;
            this.regionManager       = regionManager;
            this.appearanceService   = appearanceService;
            this.playbackService     = playbackService;
            this.win32InputService   = win32InputService;
            this.eventAggregator     = eventAggregator;
            this.notificationService = notificationService;
            this.metadataService     = metadataService;
            this.searchService       = searchService;

            // Flags
            this.mustPerformClosingTasks = true;

            // Window
            this.InitializeWindow();

            // Services
            this.InitializeServicesAsync();

            // PubSub Events
            this.InitializePubSubEvents();

            // Commands
            this.InitializeCommands();

            // Tray icon
            this.InitializeTrayIcon();
        }
Exemple #5
0
        public void Init()
        {
            this.ConfigureMapper();
            this.orders = new List <Order>()
            {
                new Order()
                {
                    Id = 1,
                    ApplicationUserId = "a2f23d5c-f9ef-41c0-95d4-52934b9d9dde"
                },
                new Order()
                {
                    Id = 21,
                    ApplicationUserId = "a2f23d5c-f9ef-41c0-95d4-52934b9d9dde"
                }
            };

            this._repository   = new FakeDeletableRepository <Order>();
            this._arepository  = new FakeDeletableRepository <Appearance>();
            this._carepository = new FakeDeletableRepository <Category>();

            foreach (var order in this.orders)
            {
                this._repository.Set.Add(order);
            }

            this._service            = new OrderService(this._repository, this._arepository, this._carepository);
            this._appearanceServices = new AppearancesService(this._arepository);
            this._categoryService    = new CategoryService(this._carepository);
            this._controller         = new OrderController(this._service, this._categoryService, this._appearanceServices);
        }
 public OrderController(IOrderService orderService,
                        ICategoryService categoryService,
                        IAppearanceService appearanceService)
 {
     this.orderService      = orderService;
     this.categoryService   = categoryService;
     this.appearanceService = appearanceService;
 }
Exemple #7
0
 public BackgroundCoverArtControlViewModel(IPlaybackService playbackService,
                                           ICacheService cacheService, IAppearanceService appearanceService,
                                           IMetadataService metadataService) : base(playbackService, cacheService, metadataService)
 {
     this.playbackService   = playbackService;
     this.appearanceService = appearanceService;
     this.cacheService      = cacheService;
     this.metadataService   = metadataService;
 }
Exemple #8
0
        public BackgroundCoverArtControlViewModel(IPlaybackService playbackService, IAppearanceService appearanceService) : base(playbackService)
        {
            this.playbackService   = playbackService;
            this.appearanceService = appearanceService;

            this.appearanceService.ThemeChanged += (_, __) => this.Opacity = XmlSettingsClient.Instance.Get <bool>("Appearance", "EnableLightTheme") ? 1.0 : 0.5;

            this.Opacity = XmlSettingsClient.Instance.Get <bool>("Appearance", "EnableLightTheme") ? 1.0 : 0.5;
        }
Exemple #9
0
        public AppearanceThemeViewModel(IAppearanceService appearanceService)
        {
            this.appearanceService = appearanceService;

            this.GetColorSchemesAsync();
            this.GetCheckBoxesAsync();

            this.appearanceService.ColorSchemesChanged += ColorSchemesChangedHandler;
        }
Exemple #10
0
        public Oobe(IAppearanceService appearanceService, IIndexingService indexingService)
        {
            InitializeComponent();

            this.appearanceService = appearanceService;
            this.indexingService   = indexingService;

            this.appearanceService.ThemeChanged += this.ThemeChangedHandler;
        }
Exemple #11
0
        public Main(IAppearanceService appearanceService)
        {
            this.InitializeComponent();

            this.appearanceService = appearanceService;
            this.appearanceService.ThemeChanged += AppearanceService_ThemeChanged;

            this.appearanceService.ApplyTheme(SettingsClient.UseLightTheme);
            this.appearanceService.ApplyColorSchemeAsync(SettingsClient.ColorScheme, SettingsClient.FollowWindowsColor, false);
        }
Exemple #12
0
        public Main()
        {
            this.InitializeComponent();

            this.appearanceService = SimpleIoc.Default.GetInstance <IAppearanceService>();
            this.appearanceService.ThemeChanged += AppearanceService_ThemeChanged;

            this.settingsService = SimpleIoc.Default.GetInstance <ISettingsService>();
            this.appearanceService.ApplyTheme(this.settingsService.UseLightTheme);
            this.appearanceService.ApplyColorScheme(this.settingsService.FollowWindowsColor, this.settingsService.ColorScheme);
        }
Exemple #13
0
        public BackgroundCoverArtControlViewModel(IPlaybackService playbackService, ICacheService cacheService, IAppearanceService appearanceService, IMetadataService metadataService) : base(playbackService, cacheService, metadataService)
        {
            this.playbackService   = playbackService;
            this.appearanceService = appearanceService;
            this.cacheService      = cacheService;
            this.metadataService   = metadataService;

            this.appearanceService.ThemeChanged += useLightTheme => this.Opacity = useLightTheme ? 1.0 : 0.5;

            this.Opacity = SettingsClient.UseLightTheme ? 1.0 : 0.5;
        }
        public ShellViewModel(IAppearanceService appearanceService, II18nService i18nService, IDialogService dialogService, IEventAggregator eventAggregator, IRegionManager regionManager)
        {
            // Dependency injection
            this.regionManager     = regionManager;
            this.appearanceService = appearanceService;
            this.i18nService       = i18nService;
            this.dialogService     = dialogService;
            this.eventAggregator   = eventAggregator;

            // Theming
            this.appearanceService.ApplyColorScheme(SettingsClient.Get <bool>("Appearance", "FollowWindowsColor"), SettingsClient.Get <string>("Appearance", "ColorScheme"));

            // I18n
            this.i18nService.ApplyLanguageAsync(SettingsClient.Get <string>("Appearance", "Language"));

            // Commands
            this.OpenPathCommand = new DelegateCommand <string>((string path) =>
            {
                try
                {
                    Actions.TryOpenPath(path);
                }
                catch (Exception ex)
                {
                    LogClient.Error("Could not open the path {0} in Explorer. Exception: {1}", path, ex.Message);
                }
            });

            ApplicationCommands.OpenPathCommand.RegisterCommand(this.OpenPathCommand);

            this.OpenLinkCommand = new DelegateCommand <string>((string link) =>
            {
                try
                {
                    Actions.TryOpenLink(link);
                }
                catch (Exception ex)
                {
                    LogClient.Error("Could not open the link {0}. Exception: {1}", link, ex.Message);
                }
            });

            ApplicationCommands.OpenLinkCommand.RegisterCommand(this.OpenLinkCommand);

            this.NavigateBetweenMainCommand = new DelegateCommand <string>((index) => this.NavigateBetweenMain(index));
            ApplicationCommands.NavigateBetweenMainCommand.RegisterCommand(this.NavigateBetweenMainCommand);

            // Events
            this.dialogService.DialogVisibleChanged += isDialogVisible => this.IsDimmed = isDialogVisible;

            this.SubMenuSlideInFrom = 40;
            this.ContentSlideInFrom = 30;
            this.SearchSlideInFrom  = 20;
        }
Exemple #15
0
        public Oobe(IEventAggregator eventAggregator, IAppearanceService appearanceService, IIndexingService indexingService, IRegionManager regionManager)
        {
            InitializeComponent();

            this.eventAggregator   = eventAggregator;
            this.appearanceService = appearanceService;
            this.indexingService   = indexingService;
            this.regionManager     = regionManager;

            this.eventAggregator.GetEvent <CloseOobeEvent>().Subscribe((_) => { this.Close(); });

            this.appearanceService.ThemeChanged += this.ThemeChangedHandler;
        }
        public SpectrumAnalyzerControlViewModel(IPlaybackService playbackService, IAppearanceService appearanceService, IEventAggregator eventAggregator)
        {
            this.playbackService   = playbackService;
            this.eventAggregator   = eventAggregator;
            this.appearanceService = appearanceService;

            this.playbackService.SpectrumVisibilityChanged += isSpectrumVisible => this.ShowSpectrumAnalyzer = isSpectrumVisible;

            this.appearanceService.ColorSchemeChanged += (_, __) =>
                                                         Application.Current.Dispatcher.Invoke(() => this.SetSpectrumStyle((SpectrumStyle)SettingsClient.Get <int>("Playback", "SpectrumStyle")));

            this.playbackService.PlaybackFailed  += (_, __) => this.IsPlaying = false;
            this.playbackService.PlaybackStopped += (_, __) => this.IsPlaying = false;
            this.playbackService.PlaybackPaused  += (_, __) => this.IsPlaying = false;
            this.playbackService.PlaybackResumed += (_, __) => this.IsPlaying = true;
            this.playbackService.PlaybackSuccess += (_, __) => this.IsPlaying = true;

            SettingsClient.SettingChanged += (_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Playback", "SpectrumStyle"))
                {
                    this.SetSpectrumStyle((SpectrumStyle)e.SettingValue);
                }
            };

            // Spectrum analyzer performance is only acceptable with Windows Media Foundation
            this.ShowSpectrumAnalyzer = this.playbackService.SupportsWindowsMediaFoundation &&
                                        SettingsClient.Get <bool>("Playback", "ShowSpectrumAnalyzer");

            // Initial value
            if (!this.playbackService.IsStopped & this.playbackService.IsPlaying)
            {
                this.IsPlaying = true;
            }
            else
            {
                this.IsPlaying = false;
            }

            // Default spectrum
            this.SetSpectrumStyle((SpectrumStyle)SettingsClient.Get <int>("Playback", "SpectrumStyle"));
        }
        public SettingsAppearanceViewModel(IAppearanceService appearanceService, II18nService i18nService, INoteService noteService, IEventAggregator eventAggregator)
        {
            this.appearanceService = appearanceService;
            this.i18nService       = i18nService;
            this.noteService       = noteService;
            this.eventAggregator   = eventAggregator;

            // ColorSchemes
            this.GetColorSchemes();

            // Languages
            this.GetLanguagesAsync();

            // CheckBoxStates
            this.LoadCheckBoxStates();

            // Event handling
            this.appearanceService.ColorSchemesChanged += ColorSchemesChangedHandler;
            this.i18nService.LanguagesChanged          += (sender, e) => this.GetLanguagesAsync();

            this.ColorSchemesDirectory = System.IO.Path.Combine(SettingsClient.ApplicationFolder(), ApplicationPaths.ColorSchemesSubDirectory);
        }
Exemple #18
0
        public ShellView(
            II18nService i18NService,
            IDialogServiceEx dialogService,
            INotificationService notificationService,
            IAppearanceService appearanceService,
            IUpdateService updateService,
            [Inject(Key = "filelogger")] ILoggerService loggerService)
        {
            InitializeComponent();

            this.i18NService         = i18NService;
            this.dialogService       = dialogService;
            this.notificationService = notificationService;
            this.appearanceService   = appearanceService;
            this.updateService       = updateService;
            this.logger = loggerService;

            InitializeTrayIcon();
            LoadDefaultLanguage();
            appearanceService.ApplyAccentColor();
            ApplyTheme();
        }
        public ViewModelContainer(
            IAppearanceService appearanceService,
            IExceptionHandlingService exceptionHandlingService,
            IExceptionConfigurationService exceptionConfigurationService,
            IInformationConfigurationService informationConfigurationService,
            INavigationConfigurationService navigationConfigurationService,
            IMainNavigationInitializingService mainNavigationInitializer)
        {
            _appearanceService         = appearanceService;
            _exceptionHandlingService  = exceptionHandlingService;
            _mainNavigationInitializer = mainNavigationInitializer;
            exceptionConfigurationService.AddExceptionCallback(ShowExceptionMessageCallback);
            navigationConfigurationService.AddNavigationRequestedCallback(NavigateToViewModelCallback);
            informationConfigurationService.RegisterForTypes(
                ShowInformationMessageCallback,
                InformationType.Error,
                InformationType.Important,
                InformationType.Success,
                InformationType.Warning);

            SelectedAppearanceTheme = _appearanceService.LoadPersistedAppearanceTheme();
            _mainNavigationInitializer.NavigateToMainEntryPoint();
        }
        public SpectrumAnalyzerControlViewModel(IPlaybackService playbackService, IAppearanceService appearanceService, IEventAggregator eventAggregator)
        {
            this.playbackService   = playbackService;
            this.eventAggregator   = eventAggregator;
            this.appearanceService = appearanceService;

            this.appearanceService.ColorSchemeChanged += (_, __) =>
                                                         Application.Current.Dispatcher.Invoke(() => this.SetSpectrumStyle((SpectrumStyle)SettingsClient.Get <int>("Playback", "SpectrumStyle")));

            this.playbackService.PlaybackFailed  += (_, __) => this.IsPlaying = false;
            this.playbackService.PlaybackStopped += (_, __) => this.IsPlaying = false;
            this.playbackService.PlaybackPaused  += (_, __) => this.IsPlaying = false;
            this.playbackService.PlaybackResumed += (_, __) => this.IsPlaying = true;
            this.playbackService.PlaybackSuccess += (_, __) => this.IsPlaying = true;

            SettingsClient.SettingChanged += (_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Playback", "SpectrumStyle"))
                {
                    this.SetSpectrumStyle((SpectrumStyle)e.Entry.Value);
                }
            };

            // Initial value
            if (!this.playbackService.IsStopped & this.playbackService.IsPlaying)
            {
                this.IsPlaying = true;
            }
            else
            {
                this.IsPlaying = false;
            }

            // Default spectrum
            this.SetSpectrumStyle((SpectrumStyle)SettingsClient.Get <int>("Playback", "SpectrumStyle"));
        }
        public SpectrumAnalyzerControlViewModel(IPlaybackService playbackService, IAppearanceService appearanceService, IEventAggregator eventAggregator)
        {
            this.playbackService   = playbackService;
            this.eventAggregator   = eventAggregator;
            this.appearanceService = appearanceService;

            this.playbackService.SpectrumVisibilityChanged += isSpectrumVisible => this.ShowSpectrumAnalyzer = isSpectrumVisible;

            this.appearanceService.ColorSchemeChanged += (_, __) =>
                                                         Application.Current.Dispatcher.Invoke(() => this.SetSpectrumStyle((SpectrumStyle)SettingsClient.Get <int>("Playback", "SpectrumStyle")));

            this.ToggleSpectrumCommand = new DelegateCommand(() => this.ToggleSpectrum());

            this.playbackService.PlaybackFailed  += (_, __) => this.IsPlaying = false;
            this.playbackService.PlaybackStopped += (_, __) => this.IsPlaying = false;
            this.playbackService.PlaybackPaused  += (_, __) => this.IsPlaying = false;
            this.playbackService.PlaybackResumed += (_, __) => this.IsPlaying = true;
            this.playbackService.PlaybackSuccess += (_) => this.IsPlaying = true;

            this.eventAggregator.GetEvent <SettingSpectrumStyleChanged>().Subscribe((spectrumStyle) => this.SetSpectrumStyle(spectrumStyle));

            this.ShowSpectrumAnalyzer = SettingsClient.Get <bool>("Playback", "ShowSpectrumAnalyzer");

            // Initial value
            if (!this.playbackService.IsStopped & this.playbackService.IsPlaying)
            {
                this.IsPlaying = true;
            }
            else
            {
                this.IsPlaying = false;
            }

            // Default spectrum
            this.SetSpectrumStyle((SpectrumStyle)SettingsClient.Get <int>("Playback", "SpectrumStyle"));
        }
 public AppearanceController(IAppearanceService service)
 {
     this.service = service;
 }
        public NotesListsViewModel(IEventAggregator eventAggregator, INoteService noteService, IAppearanceService appearanceService, IJumpListService jumpListService, ISearchService searchService, IDialogService dialogService, I18nService i18nService, IBackupService backupService)
        {
            // Injection
            this.eventAggregator   = eventAggregator;
            this.noteService       = noteService;
            this.appearanceService = appearanceService;
            this.jumpListService   = jumpListService;
            this.searchService     = searchService;
            this.dialogService     = dialogService;
            this.i18nService       = i18nService;
            this.backupService     = backupService;

            // PubSub events
            this.eventAggregator.GetEvent <TriggerLoadNoteAnimationEvent>().Subscribe((_) =>
            {
                this.TriggerRefreshNotesAnimation = false;
                this.TriggerRefreshNotesAnimation = true;
            });

            this.eventAggregator.GetEvent <SettingChangeStorageLocationFromMainChangedEvent>().Subscribe((_) => OnPropertyChanged(() => this.ShowChangeStorageLocationButton));
            this.eventAggregator.GetEvent <RefreshJumpListEvent>().Subscribe((_) => this.jumpListService.RefreshJumpListAsync(this.noteService.GetRecentlyOpenedNotes(SettingsClient.Get <int>("Advanced", "NumberOfNotesInJumpList")), this.noteService.GetFlaggedNotes()));

            this.eventAggregator.GetEvent <OpenNoteEvent>().Subscribe(noteTitle =>
            {
                if (!string.IsNullOrEmpty(noteTitle))
                {
                    this.SelectedNote = new NoteViewModel {
                        Title = noteTitle
                    }
                }
                ;
                this.OpenSelectedNote();
            });

            // Event handlers
            this.i18nService.LanguageChanged        += LanguageChangedHandler;
            this.noteService.FlagUpdated            += async(noteId, isFlagged) => { await this.UpdateNoteFlagAsync(noteId, isFlagged); };
            this.noteService.StorageLocationChanged += (_, __) => this.RefreshNotebooksAndNotes();
            this.backupService.BackupRestored       += (_, __) => this.RefreshNotebooksAndNotes();
            this.noteService.NotesChanged           += (_, __) => Application.Current.Dispatcher.Invoke(() => { this.RefreshNotes(); });
            this.searchService.Searching            += (_, __) => TryRefreshNotesOnSearch();

            this.NoteFilter = ""; // Must be set before RefreshNotes()

            // Initialize notebooks
            this.RefreshNotebooksAndNotes();

            // Commands
            this.DeleteNoteCommand             = new DelegateCommand <object>(async(obj) => await this.DeleteNoteAsync(obj));
            this.ToggleNoteFlagCommand         = new DelegateCommand <object>((obj) => this.ToggleNoteFlag(obj));
            this.DeleteNotebookCommand         = new DelegateCommand <object>((obj) => this.DeleteNotebook(obj));
            this.EditNotebookCommand           = new DelegateCommand <object>((obj) => this.EditNotebook(obj));
            this.DeleteSelectedNotebookCommand = new DelegateCommand(() => this.DeleteSelectedNotebook());
            this.EditSelectedNotebookCommand   = new DelegateCommand(() => this.EditSelectedNotebook());
            this.DeleteSelectedNoteCommand     = new DelegateCommand(async() => await this.DeleteSelectedNoteAync());
            this.ChangeStorageLocationCommand  = new DelegateCommand(async() => await this.ChangeStorageLocationAsync(false));
            this.ResetStorageLocationCommand   = new DelegateCommand(async() => await this.ChangeStorageLocationAsync(true));

            this.NewNotebookCommand = new DelegateCommand <string>((_) => this.NewNotebook());
            Common.Prism.ApplicationCommands.NewNotebookCommand.RegisterCommand(this.NewNotebookCommand);

            this.NewNoteCommand = new DelegateCommand <object>(param => this.NewNote(param));
            Common.Prism.ApplicationCommands.NewNoteCommand.RegisterCommand(this.NewNoteCommand);

            this.ImportNoteCommand = new DelegateCommand <string>((_) => this.ImportNote());
            Common.Prism.ApplicationCommands.ImportNoteCommand.RegisterCommand(this.ImportNoteCommand);

            this.NavigateBetweenNotesCommand = new DelegateCommand <object>(NavigateBetweenNotes);
            Common.Prism.ApplicationCommands.NavigateBetweenNotesCommand.RegisterCommand(this.NavigateBetweenNotesCommand);

            // Process jumplist commands
            this.ProcessJumplistCommands();
        }