Пример #1
0
        public MenuView(IMenuViewModel menuViewModel)
            : this()
        {
            _menuViewModel = menuViewModel;

            DataContext = _menuViewModel;
        }
Пример #2
0
        public MenuView(IMenuViewModel menuViewModel)
            : this()
        {
            _menuViewModel = menuViewModel;

            DataContext = _menuViewModel;
        }
Пример #3
0
        public MainWindowViewModel(
            IFilesOperationsMediator filesOperationsMediator,
            IOperationsViewModel operationsViewModel,
            IFilesPanelViewModel leftFilesPanelViewModel,
            IFilesPanelViewModel rightFilesPanelViewModel,
            IMenuViewModel menuViewModel,
            IOperationsStateViewModel operationsStateViewModel,
            ITopOperationsViewModel topOperationsViewModel,
            IDrivesListViewModel drivesListViewModel,
            IFavouriteDirectoriesListViewModel favouriteDirectoriesListViewModel)
        {
            _filesOperationsMediator = filesOperationsMediator;

            OperationsViewModel               = operationsViewModel;
            LeftFilesPanelViewModel           = leftFilesPanelViewModel;
            RightFilesPanelViewModel          = rightFilesPanelViewModel;
            MenuViewModel                     = menuViewModel;
            OperationsStateViewModel          = operationsStateViewModel;
            TopOperationsViewModel            = topOperationsViewModel;
            DrivesListViewModel               = drivesListViewModel;
            FavouriteDirectoriesListViewModel = favouriteDirectoriesListViewModel;

            CreateNewTabCommand    = ReactiveCommand.Create(CreateNewTab);
            CloseCurrentTabCommand = ReactiveCommand.Create(CloseActiveTab);
            SearchCommand          = ReactiveCommand.Create(Search);

            filesOperationsMediator.Register(leftFilesPanelViewModel, rightFilesPanelViewModel);
        }
Пример #4
0
        public MainViewModel(IMenuViewModel menuViewModel, IRoomViewModel roomViewModel)
        {
            MenuViewModel = menuViewModel;
            RoomViewModel = roomViewModel;

            menuViewModel.RoomViewModel = RoomViewModel;
        }
Пример #5
0
    public MainWindowViewModel(
        IFilesOperationsMediator filesOperationsMediator,
        IOperationsViewModel operationsViewModel,
        IFilesPanelViewModel leftFilesPanelViewModel,
        IFilesPanelViewModel rightFilesPanelViewModel,
        IMenuViewModel menuViewModel,
        IOperationsStateViewModel operationsStateViewModel,
        ITopOperationsViewModel topOperationsViewModel,
        IDrivesListViewModel drivesListViewModel,
        IFavouriteDirectoriesListViewModel favouriteDirectoriesListViewModel)
    {
        _filesOperationsMediator = filesOperationsMediator;

        OperationsViewModel               = operationsViewModel;
        LeftFilesPanelViewModel           = leftFilesPanelViewModel;
        RightFilesPanelViewModel          = rightFilesPanelViewModel;
        MenuViewModel                     = menuViewModel;
        OperationsStateViewModel          = operationsStateViewModel;
        TopOperationsViewModel            = topOperationsViewModel;
        DrivesListViewModel               = drivesListViewModel;
        FavouriteDirectoriesListViewModel = favouriteDirectoriesListViewModel;

        SearchCommand                 = ReactiveCommand.Create(Search);
        SwitchPanelCommand            = ReactiveCommand.Create(SwitchPanel);
        FocusDirectorySelectorCommand = ReactiveCommand.Create(FocusDirectorySelector);

        filesOperationsMediator.Register(leftFilesPanelViewModel, rightFilesPanelViewModel);
        filesOperationsMediator.ActiveFilesPanelChanged += FilesOperationsMediatorOnActiveFilesPanelChanged;
    }
Пример #6
0
        public ShellViewModel(IPresentationService presentationService,
                              IShellSettingsService shellSettingsService,
                              IEventAggregator eventAggregator,
                              IMenuViewModel menu,
                              ISettingsViewModel settings,
                              ICodeGenSettingsService codeGenSettingsService,
                              ICodeGenSettings codeGenSettings,
                              IMessageService messageService,
                              IMappingViewModel mapping,
                              ISchemaService schemaService,
                              ICustomSchemaSqlViewModel customSchemaSqlViewModel,
                              ITemplateWriterService templateWriterService)
        {
            this._shellSettingsService   = shellSettingsService;
            this._codeGenSettingsService = codeGenSettingsService;
            this._codeGenSettings        = codeGenSettings;
            this._messageService         = messageService;
            this._templateWriterService  = templateWriterService;
            this.Menu                     = menu;
            this.Settings                 = settings;
            this.Mapping                  = mapping;
            this._schemaService           = schemaService;
            this.CustomSchemaSqlViewModel = customSchemaSqlViewModel;
            this.WindowClosing            = new Command <CancelEventArgs>(OnWindowClosing);
            this.WindowDrop               = new Command <DragEventArgs>(OnWindowDrop);

            this.DisplayText = "IQToolkit CodeGen";
            this.SetWindowPosition(presentationService);

            eventAggregator.GetEvent <LoadSchemaEvent>().Subscribe(this.LoadSchemaEventHandler);
            eventAggregator.GetEvent <GenerateFilesEvent>().Subscribe(_ => this.GenerateFilesEventHandler());
            eventAggregator.GetEvent <CustomSchemaSqlViewVisibilityChangedEvent>().Subscribe(this.CustomSchemaSqlViewVisibilityChangedEvent);
        }
Пример #7
0
        public static IMenuViewModel CreateMenuSeparator(this BindableBase _)
        {
#pragma warning disable CS0612 // 类型或成员已过时
            IMenuViewModel vm = APIHelper.GetIContainer().Resolve <IMenuViewModel>();
#pragma warning restore CS0612 // 类型或成员已过时
            vm.IsSeparator = true;
            return(vm);
        }
        public MenuView(IMenuViewModel viewModel)
        {
            InitializeComponent();

            viewModel.SetParentView(this);

            DataContext = viewModel;
        }
Пример #9
0
 public static bool IsEmpty <TContext>(this IMenuViewModel menu, TContext context)
 {
     if (menu?.Items == null)
     {
         return(true);
     }
     return(menu.Items.All(item => !item.IsEnabled(context)));
 }
Пример #10
0
 public static bool IsEmpty(this IMenuViewModel menu)
 {
     if (menu?.Items == null)
     {
         return(true);
     }
     return(menu.Items.All(item => !item.IsEnabled()));
 }
Пример #11
0
        public MainViewModel(
            IMenuViewModel menuViewModel,
            IPage1ViewModel firstPage,
            IPage2ViewModel secondPage)
        {
            Menu = menuViewModel;
            pages.Add(firstPage);
            pages.Add(secondPage);

            ActivateItemAsync(pages.First());
        }
Пример #12
0
        public static IMenuViewModel CreateMenu(this BindableBase _, string text, ICommand command, string inputgesture = "", ImageSource icon = null, string tooltip = null)
        {
#pragma warning disable CS0612 // 类型或成员已过时
            IMenuViewModel vm = APIHelper.GetIContainer().Resolve <IMenuViewModel>();
#pragma warning restore CS0612 // 类型或成员已过时
            vm.Text        = text;
            vm.Command     = command;
            vm.Icon        = icon;
            vm.GestureText = inputgesture;
            vm.Tooltip     = tooltip;
            return(vm);
        }
Пример #13
0
 public MainWindowViewModel(IMenuViewModel menuViewModel,
                            IGameBoardViewModel gameBoardViewModel,
                            IGameInfoViewModel gameInfoViewModel,
                            IGamePlay gamePlay,
                            IPlayerController playerController)
 {
     _menuViewModel      = menuViewModel ?? throw new ArgumentNullException(nameof(menuViewModel));
     _gameBoardViewModel = gameBoardViewModel ?? throw new ArgumentNullException(nameof(gameBoardViewModel));
     _gameInfoViewModel  = gameInfoViewModel ?? throw new ArgumentNullException(nameof(gameInfoViewModel));
     _gamePlay           = gamePlay ?? throw new ArgumentNullException(nameof(gamePlay));
     _playerController   = playerController ?? throw new ArgumentNullException(nameof(playerController));
 }
Пример #14
0
        public ShellViewModel(
            IProjectData projectData,
            IBusy busy,
            IMenuViewModel menu,
            IFullJournalViewModel fullJournal,
            IAccountJournalViewModel accountJournal,
            IAccountsViewModel accounts,
            IApplicationUpdate applicationUpdate)
        {
            this.ProjectData       = projectData;
            this.Busy              = busy;
            this.Menu              = menu;
            this.FullJournal       = fullJournal;
            this.AccountJournal    = accountJournal;
            this.Accounts          = accounts;
            this.applicationUpdate = applicationUpdate;

            this.version = this.GetType().GetInformationalVersion();

            // TODO SVM is too much responsible
            this.ProjectData.DataLoaded += (sender, args) =>
            {
                this.Accounts.OnDataLoaded();
                this.Menu.OnDataLoaded();
            };
            this.ProjectData.YearChanged += (_, __) =>
            {
                this.UpdateDisplayName();
                this.FullJournal.Rebuild();
                this.Accounts.SelectFirstAccount();
            };
            this.ProjectData.JournalChanged += (_, args) =>
            {
                this.FullJournal.Rebuild();
                this.FullJournal.Select(args.ChangedBookingId);

                if (this.Accounts.SelectedAccount == null ||
                    !args.AffectedAccounts.Contains(this.Accounts.SelectedAccount.Identifier))
                {
                    return;
                }

                this.AccountJournal.Rebuild(this.Accounts.SelectedAccount.Identifier);
                this.AccountJournal.Select(args.ChangedBookingId);
            };
            this.Accounts.PropertyChanged += (_, args) =>
            {
                if (args.PropertyName == nameof(this.Accounts.SelectedAccount))
                {
                    this.AccountJournal.Rebuild(this.Accounts.SelectedAccount?.Identifier ?? 0);
                }
            };
        }
Пример #15
0
        /// <summary>
        /// Refreshes the CanExecute state of a menu item
        /// </summary>
        /// <param name="menuItem">The menu item of which to refresh the CanExecute state</param>
        private void RefreshCanExecute(IMenuViewModel menuItem)
        {
            if (menuItem != null)
            {
                foreach (var item in menuItem.SubMenuItems)
                {
                    this.RefreshCanExecute(item);
                }

                menuItem.OnClickCommand.RefreshCanExecuteChanged();
            }
        }
Пример #16
0
        private void Draw()
        {
            IMenuViewModel menu = menuViewModel;
            int            i    = 8;

            foreach (var item in menu.Items)
            {
                bool isCurrent = (item == menu.CurrentItem);
                Text name      = writer.PrepareMenuItem(item.Name, i, isCurrent);
                writer.Render.Draw(name);
                ++i;
            }
        }
Пример #17
0
        public MapViewModel(IMenuViewModel menuViewModel)
        {
            ItemsSource        = new ObservableCollection <Shape>();
            EntitysItemsSource = new ObservableCollection <Entity>();
            ShapesItemsSource  = new ObservableCollection <Shape>();

            FilePath = ConfigurationManager.AppSettings["Map"];
            //FilePath = "http://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer";

            DrawMode = DrawMode.None;

            Messenger.Default.Register <SelectedMissionMessenger>(this, SelectedMissionMessengerFunction);
            Messenger.Default.Register <VehicleSelected>(this, VehicleSelectedAction);
            Messenger.Default.Register <MapMouseRightButtonDownMessenger>(this, MapMouseRightButtonDownMessengerFunction);
            Logger.Info("MapViewModel init");
        }
 /// <summary>
 /// Default ctor
 /// </summary>
 public XmlMenuDesignerControl(IIde ide, IServiceProvider serviceProvider, IMenuViewModel viewModel)
 {
     if (ide != null)
     {
         selectionContainer = ide.CreateSelectionContainer(serviceProvider);
     }
     if (viewModel != null)
     {
         DataContext = viewModel;
     }
     InitializeComponent();
     // wait until we're initialized to handle events
     if (viewModel != null)
     {
         viewModel.PropertyChanged += OnViewModelPropertyChanged;
     }
 }
Пример #19
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public XmlMenuDesignerControl(IIde ide, IServiceProvider serviceProvider, IMenuViewModel viewModel)
 {
     if (ide != null)
     {
         selectionContainer = ide.CreateSelectionContainer(serviceProvider);
     }
     if (viewModel != null)
     {
         DataContext = viewModel;
     }
     InitializeComponent();
     // wait until we're initialized to handle events
     if (viewModel != null)
     {
         viewModel.PropertyChanged += OnViewModelPropertyChanged;
     }
 }
Пример #20
0
        public MainWindowViewModel(
            IFilesOperationsMediator filesOperationsMediator,
            IOperationsViewModel operationsViewModel,
            IFilesPanelViewModel leftFilesPanelViewModel,
            IFilesPanelViewModel rightFilesPanelViewModel,
            IMenuViewModel menuViewModel)
        {
            _filesOperationsMediator = filesOperationsMediator;

            OperationsViewModel      = operationsViewModel;
            LeftFilesPanelViewModel  = leftFilesPanelViewModel;
            RightFilesPanelViewModel = rightFilesPanelViewModel;
            MenuViewModel            = menuViewModel;

            CreateNewTabCommand    = ReactiveCommand.Create(CreateNewTab);
            CloseCurrentTabCommand = ReactiveCommand.Create(CloseCurrentTab);

            // TODO: from settings
            filesOperationsMediator.Register(leftFilesPanelViewModel, rightFilesPanelViewModel);
        }
Пример #21
0
        public void Test_Menu_IsEmpty()
        {
            IMenuViewModel menu = null;

            // ReSharper disable once ExpressionIsAlwaysNull
            menu.IsEmpty().Should().BeTrue("menu is null");

            menu = Substitute.For <IMenuViewModel>();
            menu.Items.Returns((IEnumerable <IMenuItemViewModel>)null);
            menu.IsEmpty().Should().BeTrue("items are null");

            menu.Items.Returns(Enumerable.Empty <IMenuItemViewModel>());
            menu.IsEmpty().Should().BeTrue("items are empty");

            var menuItem = Substitute.For <IMenuItemViewModel>();

            menuItem.IsEnabled().Should().BeFalse();
            menu.Items.Returns(new [] { menuItem });
            menu.IsEmpty().Should().BeTrue("item is not enabled");

            menuItem.Command.CanExecute(Arg.Any <object>()).Returns(true);
            menu.IsEmpty().Should().BeFalse("item is enabled");
        }
Пример #22
0
        public Window(IGameEngine game)
        {
            this.game = game; // GAME ENGINE

            settings = Settings.LoadSettings() ?? new Settings();
            Settings.ValidateSettings(settings);
            game.GameConfig.Players = settings.Players.PlayersAmount;

            remotePadMovement = new RemotePadMovement(settings);

            managerScope = game.ManagerScope;

            manyMouseDispatcher = new ManyMouseDispatcher(game.GameConfig.Mouses);

            game.GetScreenSize(out int width, out int height);

            app = new RenderWindow(new VideoMode((uint)width, (uint)height), Name);
            app.SetVerticalSyncEnabled(true);

            app.Closed += OnClose;
            manyMouseDispatcher.MouseMoved += OnManyMouseMove;
            app.MouseButtonPressed         += OnMouseButtonPressed;
            app.KeyPressed += OnKeyPressed;
            app.Resized    += OnResized;

            viewScope = viewScopeFactory.Create(
                app,
                game,
                StartPlayAction,
                managerScope);

            menuViewModel     = viewScope.Resolve <IMenuViewModel>();
            gamePlayfieldView = viewScope.Resolve <IGamePlayfieldView>();
            viewStateMachine  = viewScope.Resolve <IViewStateMachine>();

            viewStateMachine.Initialize(viewScope);
        }
Пример #23
0
 public MenuView(IPrepareTextLine writer,
                 IMenuViewModel menuViewModel)
 {
     this.writer        = writer;
     this.menuViewModel = menuViewModel;
 }
Пример #24
0
        public static IList <ILabelVievModel> GetRandomLabels(Random r, double duration, IMenuViewModel menu)
        {
            var labels = new List <ILabelVievModel>
            {
                new LabelVievModel
                {
                    Position   = 15, Magnitude = -0.5,
                    Text       = "Speaker A",
                    Tooltip    = "Recognition Confidence: 80%",
                    Icon       = IconChar.User, //IconChar.Male, IconChar.Child
                    Background = new SolidColorBrush(Colors.Red)
                    {
                        Opacity = 0.5
                    },
                    Foreground = new SolidColorBrush(Colors.CornflowerBlue)
                },

                new LabelVievModel
                {
                    Position   = 3, Magnitude = 0.5,
                    Text       = "Location",
                    Tooltip    = "Compute from 3 rays with 95% confidence",
                    Icon       = IconChar.Flag, //IconChar.Crosshairs,
                    Background = new SolidColorBrush(Colors.Yellow)
                    {
                        Opacity = 0.5
                    },
                    Foreground = new SolidColorBrush(Colors.DarkGreen)
                },

                new LabelVievModel
                {
                    Position   = 56, Magnitude = -0.8,
                    Text       = "Heading 78.4°",
                    Tooltip    = "From North\r\n@footpoint: 73N74E ",
                    Icon       = IconChar.LocationArrow,
                    Background = new SolidColorBrush(Colors.Green)
                    {
                        Opacity = 0.5
                    },
                    Foreground = new SolidColorBrush(Colors.DarkMagenta)
                }
            };

            // randomly place labels
            foreach (var label in labels)
            {
                label.Position  = (r.NextDouble() * 0.9 + 0.05) * duration;
                label.Magnitude = r.NextDouble() * 1.8 - 0.9;

                label.Background = new SolidColorBrush(RandomColor(r))
                {
                    Opacity = r.NextDouble() * 0.4 + 0.6
                };
                label.Foreground = new SolidColorBrush(RandomColor(r));

                label.Menu = menu;
            }

            return(labels);
        }
Пример #25
0
 public SaveImageCommand(IMenuViewModel viewModel)
 {
     ViewModel = viewModel;
 }
Пример #26
0
 public MainViewModel(IMenuViewModel menuViewModel, INavigationService navigationService, IDialogService dialogService, ISettingsService settingsService) : base(navigationService, dialogService, settingsService)
 {
     _menuViewModel = menuViewModel;
 }
Пример #27
0
 public MenuView(IMenuViewModel viewModel)
 {
     ViewModel = viewModel;
     InitializeComponent();
 }
Пример #28
0
 public ResetChangesCommand GetResetChangesCommand(IMenuViewModel viewModel)
 {
     return(new ResetChangesCommand(viewModel));
 }
Пример #29
0
 public MenuView(IMenuViewModel viewModel)
 {
     DataContext = viewModel;
     InitializeComponent();
 }
 public MenuCenter(IMenuViewModel viewModel) : base(viewModel)
 {
 }
Пример #31
0
 public SaveImageCommand GetSaveImageCommand(IMenuViewModel viewModel)
 {
     return(new SaveImageCommand(viewModel));
 }
Пример #32
0
 private void Resolve(IMenuService menuService, IMenuViewModel menuViewModel, IErrorService errorService)
 {
     _menuService   = menuService;
     _menuViewModel = menuViewModel;
     _errorService  = errorService;
 }
Пример #33
0
 public ResetChangesCommand(IMenuViewModel viewModel)
 {
     ViewModel = viewModel;
 }