public CalidadSubMenuView(IApplicationViewModel applicationViewModel, IRegionManager regionManager, IEventAggregator eventAgregator) { ApplicationViewModel = applicationViewModel; RegionManager = regionManager; EventAggregator = eventAgregator; InitializeComponent(); SubscribeToMouseEvents(); }
/// <summary> /// The on startup. /// </summary> /// <param name="e"> /// The e. /// </param> protected override void OnStartup(System.Windows.StartupEventArgs e) { base.OnStartup(e); this.kernel = GetStandardKernel(); this.viewModel = new ApplicationViewModel(); var resolver = (ModernDependencyResolver)RxApp.DependencyResolver; resolver.RegisterConstant(this.viewModel, typeof(IScreen)); resolver.RegisterConstant(this.viewModel.Router, typeof(IRoutingState)); resolver.RegisterLazySingleton(() => new PlayerView(), typeof(IPlayerView)); resolver.RegisterLazySingleton(() => new SettingsView(), typeof(ISettingsView)); resolver.Register(() => new MainViewModel(this.viewModel), typeof(IMainViewModel)); resolver.Register(() => new PlayerViewModel(this.viewModel, this.kernel.Get<IMusicEngine>(), this.kernel.Get<ISettings>()), typeof(IPlayerViewModel)); resolver.Register(() => new SettingsViewModel(this.viewModel, this.kernel.Get<ISettings>()), typeof(ISettingsViewModel)); var welcomeVm = RxApp.DependencyResolver.GetService<IPlayerViewModel>(); this.viewModel.Router.Navigate.Execute(welcomeVm); }
/// <summary> /// Initializes a new instance of the <see cref="MainViewModel"/> class. /// </summary> /// <param name="screen"> /// The screen. /// </param> public MainViewModel(IScreen screen) { this.screen = screen; this.GoToSettings = new ReactiveCommand(); this.GoToSettings.Subscribe(param => this.ShowSettings()); this.GlobalPlayPause = new ReactiveCommand(); this.GlobalPlayPause.Subscribe(param => this.PushGlobalCommand("PlayPause")); this.GlobalPrevious = new ReactiveCommand(); this.GlobalPrevious.Subscribe(param => this.PushGlobalCommand("PreviousSong")); this.GlobalNext = new ReactiveCommand(); this.GlobalNext.Subscribe(param => this.PushGlobalCommand("NextSong")); this.GlobalVolumeDown = new ReactiveCommand(); this.GlobalVolumeDown.Subscribe(param => this.PushGlobalCommand("VolumeDown")); this.GlobalVolumeUp = new ReactiveCommand(); this.GlobalVolumeUp.Subscribe(param => this.PushGlobalCommand("VolumeUp")); this.applicationViewModel = this.screen as IApplicationViewModel; this.applicationViewModel.ObservableForProperty(model => model.StatusBarText) .Subscribe(param => this.StatusText = param.Value); this.StatusText = this.applicationViewModel.StatusBarText; }