示例#1
0
        public ShellViewModel(
            ISystemService systemService,
            ISettingsViewController settingsViewController,
            GeneralSettingsViewModel generalSettingsVm,
            HotkeySettingsViewModel hotkeySettingsVm,
            CompositionContainer container,
            EventAggregator eventAggregator,
            ProcessMonitor processMonitor)
        {
            this.MainMenu = new ObservableCollection<IMenuItem>();
            this.container = container;

            generalSettingsVm.InitializeHotkeyCommandHandlers();

            this.hotkeySettingsVm = hotkeySettingsVm;
            this.hotkeySettingsVm.InitializeHotkeys();

            this.settingsViewController = settingsViewController;
            this.settingsViewController.Initialize();

            // Initialize the process monitor
            GW2PAO.Views.OverlayWindow.EventAggregator = eventAggregator;

            // Initialize shutdown handling
            Commands.ApplicationShutdownCommand.RegisterCommand(new DelegateCommand(this.Shutdown));

            // Start the game type monitor to monitor for player entering PvE/WvW
            this.processMonitor = processMonitor;
            this.processMonitor.Start();

            Properties.Settings.Default.PropertyChanged += (o, e) => this.OnPropertyChanged(() => this.IsOverlayMenuIconVisible);
            eventAggregator.GetEvent<GW2ProcessStarted>().Subscribe(o => this.OnPropertyChanged(() => this.IsOverlayMenuIconVisible));
            eventAggregator.GetEvent<GW2ProcessClosed>().Subscribe(o => this.OnPropertyChanged(() => this.IsOverlayMenuIconVisible));
            eventAggregator.GetEvent<GW2ProcessFocused>().Subscribe(o => this.OnPropertyChanged(() => this.IsOverlayMenuIconVisible));
            eventAggregator.GetEvent<GW2ProcessLostFocus>().Subscribe(o => this.OnPropertyChanged(() => this.IsOverlayMenuIconVisible));
        }