コード例 #1
0
        internal MainWindowViewModel(
            WorkingFolder workingFolder,
            WindowOwner owner,
            IRepositoryCommands repositoryCommands,
            IRemoteService remoteService,
            ICommitsService commitsService,
            ILatestVersionService latestVersionService,
            IStartInstanceService startInstanceService,
            IRecentReposService recentReposService,
            IGitInfoService gitInfoService,
            IMessage message,
            IMainWindowService mainWindowService,
            MainWindowIpcService mainWindowIpcService,
            RepositoryViewModel repositoryViewModel)
        {
            this.workingFolder        = workingFolder;
            this.owner                = owner;
            this.repositoryCommands   = repositoryCommands;
            this.remoteService        = remoteService;
            this.commitsService       = commitsService;
            this.startInstanceService = startInstanceService;
            this.recentReposService   = recentReposService;
            this.gitInfoService       = gitInfoService;
            this.message              = message;
            this.mainWindowService    = mainWindowService;
            this.mainWindowIpcService = mainWindowIpcService;

            RepositoryViewModel = repositoryViewModel;

            workingFolder.OnChange += (s, e) => Notify(nameof(WorkingFolder));
            latestVersionService.OnNewVersionAvailable += (s, e) => IsNewVersionVisible = true;
            latestVersionService.StartCheckForLatestVersion();
            IsRepoView = true;
        }
コード例 #2
0
    public ApplicationViewModel(IMainWindowService mainWindowService)
    {
        _mainWindowService = mainWindowService;

        QuitCommand = ReactiveCommand.Create(ShutDown);

        ShowHideCommand = ReactiveCommand.Create(() =>
        {
            if (IsMainWindowShown)
            {
                _mainWindowService.Hide();
            }
            else
            {
                _mainWindowService.Show();
            }
        });

        ShowCommand = ReactiveCommand.Create(() => _mainWindowService.Show());

        AboutCommand = ReactiveCommand.Create(
            () => MainViewModel.Instance.DialogScreen.To(new AboutViewModel(navigateBack: MainViewModel.Instance.DialogScreen.CurrentPage is not null)),
            canExecute: MainViewModel.Instance.DialogScreen.WhenAnyValue(x => x.CurrentPage).Select(x => x is null));

        using var bitmap = AssetHelpers.GetBitmapAsset("avares://WalletWasabi.Fluent/Assets/WasabiLogo.ico");
        TrayIcon         = new WindowIcon(bitmap);
    }
コード例 #3
0
        internal MainWindowViewModel(IMainWindowService service)
        {
            _service                 = service;
            _readOnlyModules         = new ReadOnlyObservableCollection <object>(_modules);
            _openModuleCommand       = new DelegateCommand(OpenModuleCommandExecuted, OpenModuleCommandCanExecute);
            _exitCommand             = new DelegateCommand(ExitCommandExecuted);
            _newProjectCommand       = new DelegateCommand(NewProjectCommandExecuted);
            _openCommand             = new DelegateCommand(OpenCommandExecuted);
            _closeCommand            = new DelegateCommand(CloseCommandExecuted, CloseCommandCanExecute);
            _exportCommand           = new DelegateCommand(ExportCommandExecuted, ExportCommandCanExecute);
            _importCommand           = new DelegateCommand(ImportCommandExecuted);
            _quickStartCommand       = new DelegateCommand(QuickStartExecuted);
            _aboutCommand            = new DelegateCommand(AboutCommandExecuted);
            _buildClientCommand      = new DelegateCommand(BuildClientCommandExecuted, BuildClientCommandCanExecute);
            _runProjectCommand       = new DelegateCommand(RunProjectCommandExecuted, RunProjectCommandCanExecute);
            _installServiceCommand   = new DelegateCommand(InstallServiceCommandExecuted);
            _uninstallServiceCommand = new DelegateCommand(UninstallServiceCommandExecuted);

            _reloadModuleCommand   = new DelegateCommand(ReloadModuleCommandExecuted);
            _saveModuleCommand     = new DelegateCommand(SaveModuleCommandExecuted);
            _closeModuleCommand    = new DelegateCommand(CloseModuleCommandExecuted);
            _addModuleCommand      = new DelegateCommand(AddModuleCommandExecuted);
            _editModuleCommand     = new DelegateCommand(EditModuleCommandExecuted);
            _deleteModuleCommand   = new DelegateCommand(DeleteModuleCommandExecuted);
            _copyModuleCommand     = new DelegateCommand(CopyModuleCommandExecuted);
            _pasteModuleCommand    = new DelegateCommand(PasteModuleCommandExecuted);
            _unselectModuleCommand = new DelegateCommand(UnselectModuleCommandExecuted);
        }
コード例 #4
0
        internal MainWindowViewModel(
            ModelMetadata modelMetadata,
            ILatestVersionService latestVersionService,
            IMainWindowService mainWindowService,
            ModelViewModel modelViewModel,
            OpenModelViewModel openModelViewModel,
            IOpenModelService openModelService,
            IRecentModelsService recentModelsService,
            IModelMetadataService modelMetadataService,
            IStartInstanceService startInstanceService,
            IModelViewService modelViewService,
            IProgressService progress)
        {
            this.modelMetadata = modelMetadata;

            this.mainWindowService    = mainWindowService;
            this.openModelService     = openModelService;
            this.recentModelsService  = recentModelsService;
            this.modelMetadataService = modelMetadataService;
            this.startInstanceService = startInstanceService;
            this.modelViewService     = modelViewService;
            this.progress             = progress;

            ModelViewModel     = modelViewModel;
            OpenModelViewModel = openModelViewModel;

            modelMetadata.OnChange += (s, e) => Notify(nameof(MainTitle));
            latestVersionService.OnNewVersionAvailable += (s, e) => IsNewVersionVisible = true;
            latestVersionService.StartCheckForLatestVersion();
            SearchItems = new ObservableCollection <SearchEntry>();
            ClearSelectionItems();
        }
コード例 #5
0
        public PassengersInfoPresenter(IKernel kernel, IPassengersInfoView view, IMainWindowService service)
        {
            _kernel  = kernel;
            _view    = view;
            _service = service;

            _service.PassengersInfoUpdated += PassengersInfoUpdated;
        }
コード例 #6
0
        public SetUpPresenter(IKernel kernel, ISetUpView view, IMainWindowService service)
        {
            _kernel  = kernel;
            _view    = view;
            _service = service;

            _view.SetUp += () => SetUp(_view.NumberOfFloors);
        }
コード例 #7
0
        /// <summary>コンストラクタ。</summary>
        /// <param name="winService"></param>
        public StartUpPanelViewModel(IMainWindowService winService)
        {
            this.mainWindowService = winService;

            this.HamburgerMenuDisplayMode = this.mainWindowService.HamburgerMenuDisplayMode
                                            .AddTo(this.disposable);
            this.IsHamburgerMenuPanelOpened = this.mainWindowService.IsHamburgerMenuPanelOpened
                                              .AddTo(this.disposable);
            this.ContentControlTransition = this.mainWindowService.ContentControlTransition
                                            .AddTo(this.disposable);
        }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the MainWindow class
        /// </summary>
        public MainWindow()
        {
            WpfGlobals.RegisterDependencies();

            InitializeComponent();

            // Resolve objects of needed types (ask the WpfGlobals.Container for an instance).
            // This is analagous to calling new() in a non-IoC application.
            _service = WpfGlobals.Container.Resolve <IMainWindowService>();

            DataContext = WpfGlobals.Container.Resolve <IMainWindowViewModel>();
        }
コード例 #9
0
        public MetroWindowPanelViewModel(IMainWindowService mainWindow)
        {
            this.mainWindowService = mainWindow;

            this.IgnoreTaskbarOnMaximize = this.mainWindowService.IgnoreTaskbarOnMaximize
                                           .AddTo(this.disposable);
            this.IsCloseButtonEnabled = this.mainWindowService.IsCloseButtonEnabled
                                        .AddTo(this.disposable);
            this.IsMaxRestoreButtonEnabled = this.mainWindowService.IsMaxRestoreButtonEnabled
                                             .AddTo(this.disposable);
            this.IsMinButtonEnabled = this.mainWindowService.IsMinButtonEnabled
                                      .AddTo(this.disposable);
            this.IsWindowDraggable = this.mainWindowService.IsWindowDraggable
                                     .AddTo(this.disposable);
            this.ShowCloseButton = this.mainWindowService.ShowCloseButton
                                   .AddTo(this.disposable);
            this.ShowMaxRestoreButton = this.mainWindowService.ShowMaxRestoreButton
                                        .AddTo(this.disposable);
            this.ShowMinButton = this.mainWindowService.ShowMinButton
                                 .AddTo(this.disposable);
            this.ShowSystemMenuOnRightClick = this.mainWindowService.ShowSystemMenuOnRightClick
                                              .AddTo(this.disposable);
            this.ShowTitleBar = this.mainWindowService.ShowTitleBar
                                .AddTo(this.disposable);
            this.TitleAlignment = this.mainWindowService.TitleAlignment
                                  .AddTo(this.disposable);
            this.TitleCharacterCasing = this.mainWindowService.TitleCharacterCasing
                                        .AddTo(this.disposable);
            this.WindowTransitionsEnabled = this.mainWindowService.WindowTransitionsEnabled
                                            .AddTo(this.disposable);
            this.ShowIconOnTitleBar = this.mainWindowService.ShowIconOnTitleBar
                                      .AddTo(this.disposable);

            this.IsEnabledCloseEnable = new[] { this.mainWindowService.ShowTitleBar, this.mainWindowService.ShowCloseButton }
            .CombineLatestValuesAreAllTrue()
            .ToReadOnlyReactivePropertySlim()
            .AddTo(this.disposable);
            this.IsEnabledMaxEnable = new[] { this.mainWindowService.ShowTitleBar, this.mainWindowService.ShowMaxRestoreButton }
            .CombineLatestValuesAreAllTrue()
            .ToReadOnlyReactivePropertySlim()
            .AddTo(this.disposable);
            this.IsEnableMinEnable = new[] { this.mainWindowService.ShowTitleBar, this.mainWindowService.ShowMinButton }
            .CombineLatestValuesAreAllTrue()
            .ToReadOnlyReactivePropertySlim()
            .AddTo(this.disposable);

            this.WindowClose = new ReactiveCommand()
                               .WithSubscribe(() => this.mainWindowService.WindowCloseRequest.Value = true)
                               .AddTo(this.disposable);
        }
コード例 #10
0
ファイル: StatusService.cs プロジェクト: waie123/GitMind
        public StatusService(
            IFolderMonitorService folderMonitorService,
            IMainWindowService mainWindowService,
            IGitStatusService gitStatusService,
            IProgressService progress,
            Lazy <IRepositoryService> repositoryService)
        {
            this.folderMonitorService = folderMonitorService;
            this.mainWindowService    = mainWindowService;
            this.gitStatusService     = gitStatusService;
            this.progress             = progress;
            this.repositoryService    = repositoryService;


            folderMonitorService.FileChanged += (s, e) => OnFileChanged(e);
            folderMonitorService.RepoChanged += (s, e) => OnRepoChanged(e);
        }
コード例 #11
0
 public MainWindowPresenter(IKernel kernel, IMainWindowView view, IMainWindowService service)
 {
     _kernel  = kernel;
     _view    = view;
     _service = service;
     _view.AddButtonClicked += AddButtonClicked;
     _view.SetUp            += SetUp;
     _service.OuterActiveFloorButtonActivated += OuterActiveFloorButtonActivated;
     _view.StartSimulation  += StartSimulation;
     _view.StopSimulation   += StopSimulation;
     _service.ElevatorMoved += ElevatorMoved;
     _service.InnerActiveFloorButtonActivated += InnerActiveFloorButtonActivated;
     _service.PassengerEnterElevator          += PassengerEnterElevator;
     _service.PassengerOutFromElevator        += PassengerOutFromElevator;
     _service.PassengerDisappeared            += PassengerDisappeared;
     _service.TotalMovedMassIncreased         += TotalMovedMassIncreased;
     _service.TimeUpdated           += UpdateTime;
     _service.ElevatorMadeRide      += ElevatorMadeRide;
     _service.ElevatorMadeIddleRide += ElevatorMadeIddleRide;
     _service.OverWeightActivated   += OverWeightActivated;
     _service.OverWeightDeactivated += OverWeightDeactivated;
     _view.PassengersInfoShown      += PassengersInfoShown;
 }
コード例 #12
0
        /// <summary>デフォルトコンストラクタ。</summary>
        /// <param name="regionMan">IRegionManager。</param>
        /// <param name="winService">IMainWindowService。</param>
        public MainWindowViewModel(IRegionManager regionMan, IMainWindowService winService) : base(regionMan)
        {
            this.mainWindowService = winService;

            this.initialilzeMenu();

            this.SelectedMenu = new ReactivePropertySlim <HamburgerMenuItemViewModel>(null)
                                .AddTo(this.disposable);
            this.SelectedMenu.Subscribe(i => this.onSelectedMenu(i));

            this.SelectedMenuIndex = new ReactivePropertySlim <int>(-1)
                                     .AddTo(this.disposable);

            this.SelectedOption = new ReactivePropertySlim <HamburgerMenuItemViewModel>(null)
                                  .AddTo(this.disposable);
            this.SelectedOption.Subscribe(o => this.onSelectedMenu(o));

            this.SelectedOptionIndex = new ReactivePropertySlim <int>(-1)
                                       .AddTo(this.disposable);

            this.ContentControlTransition = this.mainWindowService.ContentControlTransition
                                            .ToReadOnlyReactivePropertySlim()
                                            .AddTo(this.disposable);
            this.HamburgerMenuDisplayMode = this.mainWindowService.HamburgerMenuDisplayMode
                                            .ToReadOnlyReactivePropertySlim()
                                            .AddTo(this.disposable);
            this.IsHamburgerMenuPanelOpened = this.mainWindowService.IsHamburgerMenuPanelOpened
                                              .AddTo(this.disposable);

            this.ContentRendered = new ReactiveCommand()
                                   .WithSubscribe(() => this.regionManager.RequestNavigate("ContentRegion", "StartUpPanel"))
                                   .AddTo(this.disposable);

            this.HomeCommand = new ReactiveCommand()
                               .WithSubscribe(() => this.onHome())
                               .AddTo(this.disposable);
        }
コード例 #13
0
 public MainWindowViewModel()
 {
     _mainWindowService = App.AppContainer.Resolve <IMainWindowService>();
 }
コード例 #14
0
        /// <summary>デフォルトコンストラクタ。</summary>
        /// <param name="regionMan">IRegionManager。</param>
        /// <param name="winService">IMainWindowService。</param>
        public MainWindowViewModel(IRegionManager regionMan, IMainWindowService winService, IDialogService dlgService) : base(regionMan)
        {
            this.mainWindowService = winService;
            this.dialogService     = dlgService;

            this.IgnoreTaskbarOnMaximize = this.mainWindowService.IgnoreTaskbarOnMaximize
                                           .ToReadOnlyReactivePropertySlim()
                                           .AddTo(this.disposable);
            this.IsCloseButtonEnabled = this.mainWindowService.IsCloseButtonEnabled
                                        .ToReadOnlyReactivePropertySlim()
                                        .AddTo(this.disposable);
            this.IsMaxRestoreButtonEnabled = this.mainWindowService.IsMaxRestoreButtonEnabled
                                             .ToReadOnlyReactivePropertySlim()
                                             .AddTo(this.disposable);
            this.IsMinButtonEnabled = this.mainWindowService.IsMinButtonEnabled
                                      .ToReadOnlyReactivePropertySlim()
                                      .AddTo(this.disposable);
            this.IsWindowDraggable = this.mainWindowService.IsWindowDraggable
                                     .ToReadOnlyReactivePropertySlim()
                                     .AddTo(this.disposable);
            this.ShowCloseButton = this.mainWindowService.ShowCloseButton
                                   .ToReadOnlyReactivePropertySlim()
                                   .AddTo(this.disposable);
            this.ShowMaxRestoreButton = this.mainWindowService.ShowMaxRestoreButton
                                        .ToReadOnlyReactivePropertySlim()
                                        .AddTo(this.disposable);
            this.ShowMinButton = this.mainWindowService.ShowMinButton
                                 .ToReadOnlyReactivePropertySlim()
                                 .AddTo(this.disposable);
            this.ShowSystemMenuOnRightClick = this.mainWindowService.ShowSystemMenuOnRightClick
                                              .ToReadOnlyReactivePropertySlim()
                                              .AddTo(this.disposable);
            this.ShowTitleBar = this.mainWindowService.ShowTitleBar
                                .ToReadOnlyReactivePropertySlim()
                                .AddTo(this.disposable);
            this.TitleAlignment = this.mainWindowService.TitleAlignment
                                  .ToReadOnlyReactivePropertySlim()
                                  .AddTo(this.disposable);
            this.TitleCharacterCasing = this.mainWindowService.TitleCharacterCasing
                                        .ToReadOnlyReactivePropertySlim()
                                        .AddTo(this.disposable);
            this.WindowTransitionsEnabled = this.mainWindowService.WindowTransitionsEnabled
                                            .ToReadOnlyReactivePropertySlim()
                                            .AddTo(this.disposable);
            this.ShowIconOnTitleBar = this.mainWindowService.ShowIconOnTitleBar
                                      .ToReadOnlyReactivePropertySlim()
                                      .AddTo(this.disposable);

            this.CanMaxmize = new[]
            {
                this.mainWindowService.ShowMaxRestoreButton,
                this.mainWindowService.IsMaxRestoreButtonEnabled
            }
            .CombineLatestValuesAreAllTrue()
            .ToReadOnlyReactivePropertySlim()
            .AddTo(this.disposable);
            this.CanMinimize = new[]
            {
                this.mainWindowService.ShowMinButton,
                this.mainWindowService.IsMinButtonEnabled
            }
            .CombineLatestValuesAreAllTrue()
            .ToReadOnlyReactivePropertySlim()
            .AddTo(this.disposable);

            this.CanClose = this.mainWindowService.CloseEnabled
                            .ToReadOnlyReactivePropertySlim()
                            .AddTo(this.disposable);
            this.RequestClose = this.mainWindowService.WindowCloseRequest
                                .ToReadOnlyReactivePropertySlim()
                                .AddTo(this.disposable);

            this.initialilzeMenu();

            this.SelectedMenu = new ReactivePropertySlim <MetroWindowAndControlsViewModel>(null)
                                .AddTo(this.disposable);
            this.SelectedMenu.Subscribe(i => this.onSelectedMenu(i));

            this.SelectedMenuIndex = new ReactivePropertySlim <int>(-1)
                                     .AddTo(this.disposable);

            this.SelectedOption = new ReactivePropertySlim <MetroWindowAndControlsViewModel>(null)
                                  .AddTo(this.disposable);
            this.SelectedOption.Subscribe(o => this.onSelectedMenu(o));

            this.SelectedOptionIndex = new ReactivePropertySlim <int>(-1)
                                       .AddTo(this.disposable);

            this.ContentControlTransition = this.mainWindowService.ContentControlTransition
                                            .ToReadOnlyReactivePropertySlim()
                                            .AddTo(this.disposable);
            this.HamburgerMenuDisplayMode = this.mainWindowService.HamburgerMenuDisplayMode
                                            .ToReadOnlyReactivePropertySlim()
                                            .AddTo(this.disposable);
            this.IsHamburgerMenuPanelOpened = this.mainWindowService.IsHamburgerMenuPanelOpened
                                              .AddTo(this.disposable);

            this.ContentRendered = new ReactiveCommand()
                                   .WithSubscribe(() => this.regionManager.RequestNavigate("ContentRegion", "StartUpPanel"))
                                   .AddTo(this.disposable);
            this.HomeCommand = new ReactiveCommand()
                               .WithSubscribe(() => this.onHome())
                               .AddTo(this.disposable);
            this.GoGitHub = new ReactiveCommand()
                            .WithSubscribe(() => this.onGoGitHub())
                            .AddTo(this.disposable);
            this.CloseCancel = new ReactiveCommand()
                               .WithSubscribe(() => this.onCloseCancel())
                               .AddTo(this.disposable);
        }
コード例 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MainViewModel"/> class.
 /// </summary>
 /// <param name="mainWindowService">The main window service.</param>
 public MainViewModel(IMainWindowService mainWindowService, IUINavigationService navigationService)
 {
     this.mainWindowService = mainWindowService;
     this.navigationService = navigationService;
 }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the MainWindowViewModel class.
 /// </summary>
 public MainWindowViewModel(IMainWindowService windowService)
     : base(null)
 {
     _windowService = windowService;
 }
コード例 #17
0
 public void SetUp()
 {
     _windowService = A.Fake <IMainWindowService>();
 }