Exemplo n.º 1
0
        public static void AddFlyout <TView>(this IFlyoutService flyoutService, string name, Position position,
                                             UnloadBehavior unloadBehavior = UnloadBehavior.SaveAndCloseViewModel, FlyoutTheme flyoutTheme = FlyoutTheme.Adapt)
        {
            Argument.IsNotNull(() => flyoutService);

            flyoutService.AddFlyout(name, typeof(TView), position, unloadBehavior, flyoutTheme);
        }
Exemplo n.º 2
0
        public DeviceEditingViewModel(Func <IDeviceDefinitionViewModel> deviceDefinitionCreator,
                                      IDevicesContainerService devicesContainerService, ITypesContainer container,
                                      IDialogCoordinator dialogCoordinator, ILocalizerService localizerService, IFlyoutService flyoutService)
        {
            DeviceDefinitions = new ObservableCollection <IDeviceDefinitionViewModel>();
            DeviceConnections = new ObservableCollection <IViewModel>();
            //подгрузка всех файлов с определениями (вынести в асинхронный метод)

            _deviceDefinitionCreator = deviceDefinitionCreator;
            _devicesContainerService = devicesContainerService;
            _container         = container;
            _dialogCoordinator = dialogCoordinator;
            _localizerService  = localizerService;
            _flyoutService     = flyoutService;

            SubmitCommand             = new RelayCommand(OnSubmitCommand, () => _canSubmitCommandExecute);
            OpenDeviceFromFileCommand = new RelayCommand(OnOpenDeviceFromFileExecute);

            //подгрузка всех зарегистрированных фабрик разных видов подключений
            IEnumerable <IDeviceConnectionFactory> deviceConnectionFactories =
                _container.ResolveAll <IDeviceConnectionFactory>();

            foreach (IDeviceConnectionFactory deviceConnectionFactory in deviceConnectionFactories)
            {
                DeviceConnections.Add(deviceConnectionFactory.CreateDeviceConnectionViewModel());
            }
        }
Exemplo n.º 3
0
 public ComPortInterrogationViewModel(Func <IDeviceDefinitionViewModel> deviceDefinitionCreator, IDevicesContainerService devicesContainerService,
                                      IModbusRtuConnection modbusRtuConnection, IComConnectionManager comConnectionManager,
                                      IConnectionService connectionService, IFlyoutService flyoutService)
 {
     _deviceDefinitionCreator   = deviceDefinitionCreator;
     _devicesContainerService   = devicesContainerService;
     _modbusRtuConnection       = modbusRtuConnection;
     _comConnectionManager      = comConnectionManager;
     this._connectionService    = connectionService;
     _flyoutService             = flyoutService;
     InterrogateCommand         = new RelayCommand(OnInterrogateExecute);
     DeviceDefinitionViewModels = new ObservableCollection <IDeviceDefinitionViewModel>();
     SlaveId = 1;
     IsInterrogationNotInProcess = true;
     AddDeviceCommand            = new RelayCommand <object>(OnAddDeviceExecute, (b) =>
     {
         if (b is IDeviceDefinitionViewModel deviceDefinitionViewModel)
         {
             if (deviceDefinitionViewModel.IsAddedToProject)
             {
                 return(false);
             }
         }
         return(IsInterrogationNotInProcess);
     });
     StopInterrogationCommand = new RelayCommand(OnStopInterrogationExecute, (() => !_isInterrogationStopped));
 }
Exemplo n.º 4
0
        public SignInFlyoutViewModel(IGoComicsService gocomics, IFlyoutService flyoutService, IEventAggregator eventAggregator)
        {
            this._gocomics        = gocomics;
            this._flyoutService   = flyoutService;
            this._eventAggregator = eventAggregator;

            this.SignInCommand = new DelegateCommand <object>(this.ExecuteSignIn, this.CanSignIn);
        }
Exemplo n.º 5
0
        public ShellViewModel
            (ILogService logService,
            ILogServiceViewModel logServiceViewModel,
            IDevicesContainerService devicesContainerService,
            IDialogCoordinator dialogCoordinator,
            IApplicationGlobalCommands applicationGlobalCommands,
            IRegionManager regionManager,
            ILocalizerService localizerService,
            IDeviceViewModelFactory deviceViewModelFactory,
            IFragmentPaneViewModelFactory fragmentPaneViewModelFactory,
            IProjectBrowserViewModel projectBrowserViewModel,
            IUniconProjectService uniconProjectService, ToolBarViewModel toolBarViewModel,
            RecentProjectsViewModelFactory recentProjectsViewModelFactory,
            IMainMenuService mainMenuService,
            DynamicMainMenuViewModel dynamicMainMenuViewModel,
            IFlyoutService flyoutService
            , IGlobalEventManager globalEventManger)
        {
            LogServiceViewModel     = logServiceViewModel;
            ProjectBrowserViewModel = projectBrowserViewModel;
            LogService = logService;
            _devicesContainerService = devicesContainerService;
            _devicesContainerService.ConnectableItemChanged += OnDeviceChanged;
            _dialogCoordinator            = dialogCoordinator;
            _applicationGlobalCommands    = applicationGlobalCommands;
            _regionManager                = regionManager;
            _localizerService             = localizerService;
            _deviceViewModelFactory       = deviceViewModelFactory;
            _fragmentPaneViewModelFactory = fragmentPaneViewModelFactory;
            _uniconProjectService         = uniconProjectService;

            ExitCommand = new RelayCommand(OnExit);
            NavigateToDeviceEditorCommand = new RelayCommand(OnNavigateToDeviceEditor);
            NavigateToDeviceAddingCommand = new RelayCommand(OnNavigateToDeviceAddingExecute);
            NavigateToWebSyncViewCommand  = new RelayCommand(OnNavigateToWebSyncViewExecute);
            AddNewFragmentCommand         = new RelayCommand <IFragmentViewModel>(OnExecuteAddNewFragment);
            _fragmentsOpenedCollection    = new ObservableCollection <IFragmentPaneViewModel>();
            OpenOscillogramCommand        = new RelayCommand(OnOpenOscillogramExecute);
            OnClosingCommand  = new RelayCommand <CancelEventArgs>(OnExecuteClosing);
            AnchorableWindows = new ObservableCollection <IAnchorableWindow>
            {
                ProjectBrowserViewModel, LogServiceViewModel
            };
            ToolBarViewModel                = toolBarViewModel;
            DynamicMainMenuViewModel        = dynamicMainMenuViewModel;
            _recentProjectsViewModelFactory = recentProjectsViewModelFactory;
            _mainMenuService                = mainMenuService;
            StaticOptionsButtonsHelper.InitializeStaticButtons(this);
            NewProjectCommand        = new RelayCommand(OnNewProjectExecute);
            SaveProjectCommand       = new RelayCommand(OnSaveProjectExecute);
            SaveAsProjectCommand     = new RelayCommand(OnSaveAsProjectExecute);
            OpenProjectCommand       = new RelayCommand(OnOpenProjectExecute);
            OpenRecentProjectCommand = new RelayCommand <object>(OnOpenRecentProjectExecute);

            OnLoadedCommand = new RelayCommand(OnLoadedExecute);
            _uniconProjectService.SetDialogContext(this);
            _applicationGlobalCommands.SetGlobalDialogContext(this);
        }
Exemplo n.º 6
0
        public GamesViewModel(IGamesService gamesService, IFlyoutService flyoutService, IGameSourceService gameSourceService,
                              IEventAggregator eventAggregator)
        {
            _gamesService  = gamesService;
            _flyoutService = flyoutService;
            IsSearchReady  = gameSourceService.IsReady;

            eventAggregator.GetEvent <SearchReadinessUpdated> ().Subscribe(sr => { IsSearchReady = sr; });
        }
Exemplo n.º 7
0
        public ShellViewModel(IRegionManager regionManager, IApplicationCommands commands, IFlyoutService flyoutService)
        {
            this._regionManager = regionManager;
            this._flyoutService = flyoutService;

            this.ToggleFlyoutCommand = new DelegateCommand <string>(this.ExecuteToggleFlyout);

            commands.ToggleFlyoutCommand.RegisterCommand(this.ToggleFlyoutCommand);
        }
Exemplo n.º 8
0
        private void SetupFlyouts(IFlyoutService flyoutService)
        {
            var flyouts = new FlyoutsControl();

            foreach (var flyout in flyoutService.GetFlyouts())
            {
                flyouts.Items.Add(flyout);
            }

            Flyouts = flyouts;
        }
Exemplo n.º 9
0
        public MainWindowViewModel(IFlyoutService flyoutService, IEventAggregator eventAggregator, IGameSourceService gameSourceService,
                                   IGamesService gamesService)
        {
            _flyoutService = flyoutService;
            _gamesService  = gamesService;

            eventAggregator.GetEvent <SearchReadinessUpdated> ().Subscribe(sr => { IsSearchReady = sr; }, true);
            eventAggregator.GetEvent <GameCompletionUpdated> ().Subscribe(game => { CalculateShouldIStatus(); });
            eventAggregator.GetEvent <GameListUpdated> ().Subscribe(game => { CalculateShouldIStatus(); });

            WhenStateUpdated(() => IsSearchReady, () => {
                SearchReadinessMessage = IsSearchReady ? "GiantBomb search is ready." :
                                         "GiantBomb search is NOT ready. Please senter an API key in the settings or check your internet connection.";
            });
            IsSearchReady = gameSourceService.IsReady;
            CalculateShouldIStatus();
        }
        public CheckoutHubPageViewModel(INavigationService navigationService, IAccountService accountService, IOrderRepository orderRepository, IShoppingCartRepository shoppingCartRepository,
                                        IShippingAddressUserControlViewModel shippingAddressViewModel, IBillingAddressUserControlViewModel billingAddressViewModel, IPaymentMethodUserControlViewModel paymentMethodViewModel,
                                        IFlyoutService flyoutService, IResourceLoader resourceLoader, IAlertMessageService alertMessageService)
        {
            _navigationService = navigationService;
            _accountService = accountService;
            _orderRepository = orderRepository;
            _shoppingCartRepository = shoppingCartRepository;
            _shippingAddressViewModel = shippingAddressViewModel;
            _billingAddressViewModel = billingAddressViewModel;
            _paymentMethodViewModel = paymentMethodViewModel;
            _flyoutService = flyoutService;
            _alertMessageService = alertMessageService;
            _resourceLoader = resourceLoader;

            GoBackCommand = new DelegateCommand(navigationService.GoBack, navigationService.CanGoBack);
            GoNextCommand = new DelegateCommand(GoNext);
        }
Exemplo n.º 11
0
        public PersonsViewModel(IFlyoutService flyoutService, IMessageService messageService, IDispatcherService dispatcherService)
        {
            Argument.IsNotNull(() => flyoutService);
            Argument.IsNotNull(() => messageService);
            Argument.IsNotNull(() => dispatcherService);

            _flyoutService     = flyoutService;
            _messageService    = messageService;
            _dispatcherService = dispatcherService;

            Persons = new ObservableCollection <Person>();
            Persons.Add(new Person
            {
                FirstName = "John",
                LastName  = "Doe"
            });

            Add    = new Command(OnAddExecute);
            Edit   = new Command(OnEditExecute, OnEditCanExecute);
            Remove = new TaskCommand(OnRemoveExecuteAsync, OnRemoveCanExecute);
        }
Exemplo n.º 12
0
        public PersonsViewModel(IFlyoutService flyoutService, IMessageService messageService, IDispatcherService dispatcherService)
        {
            Argument.IsNotNull(() => flyoutService);
            Argument.IsNotNull(() => messageService);
            Argument.IsNotNull(() => dispatcherService);

            _flyoutService = flyoutService;
            _messageService = messageService;
            _dispatcherService = dispatcherService;

            Persons = new ObservableCollection<Person>();
            Persons.Add(new Person
            {
                FirstName = "John",
                LastName = "Doe"
            });

            Add = new Command(OnAddExecute);
            Edit = new Command(OnEditExecute, OnEditCanExecute);
            Remove = new TaskCommand(OnRemoveExecuteAsync, OnRemoveCanExecute);
        }
        public CheckoutSummaryPageViewModel(INavigationService navigationService, IOrderService orderService, IOrderRepository orderRepository, IShippingMethodService shippingMethodService, ICheckoutDataRepository checkoutDataRepository, IShoppingCartRepository shoppingCartRepository,
                                            IAccountService accountService, IFlyoutService flyoutService, IResourceLoader resourceLoader, IAlertMessageService alertMessageService)
        {
            _navigationService = navigationService;
            _orderService = orderService;
            _orderRepository = orderRepository;
            _shippingMethodService = shippingMethodService;
            _checkoutDataRepository = checkoutDataRepository;
            _shoppingCartRepository = shoppingCartRepository;
            _flyoutService = flyoutService;
            _resourceLoader = resourceLoader;
            _accountService = accountService;
            _alertMessageService = alertMessageService;

            SubmitCommand = DelegateCommand.FromAsyncHandler(Submit, CanSubmit);
            GoBackCommand = new DelegateCommand(_navigationService.GoBack);

            EditCheckoutDataCommand = new DelegateCommand(EditCheckoutData);
            SelectCheckoutDataCommand = new DelegateCommand(async () => await SelectCheckoutDataAsync());
            AddCheckoutDataCommand = new DelegateCommand(AddCheckoutData);
        }
        public ShoppingCartPageViewModel(IShoppingCartRepository shoppingCartRepository, INavigationService navigationService, IAccountService accountService,
                                         IFlyoutService flyoutService, IResourceLoader resourceLoader, IAlertMessageService alertMessageService,
                                         ICheckoutDataRepository checkoutDataRepository, IOrderRepository orderRepository, IEventAggregator eventAggregator)
        {
            _shoppingCartRepository = shoppingCartRepository;
            _navigationService = navigationService;
            _accountService = accountService;
            _flyoutService = flyoutService;
            _resourceLoader = resourceLoader;
            _alertMessageService = alertMessageService;
            _checkoutDataRepository = checkoutDataRepository;
            _orderRepository = orderRepository;

            CheckoutCommand = DelegateCommand.FromAsyncHandler(CheckoutAsync, CanCheckout);
            EditAmountCommand = new DelegateCommand(OpenEditAmountFlyout);
            RemoveCommand = DelegateCommand<ShoppingCartItemViewModel>.FromAsyncHandler(Remove);
            GoBackCommand = new DelegateCommand(navigationService.GoBack);
            IncrementCountCommand = DelegateCommand.FromAsyncHandler(IncrementCount);
            DecrementCountCommand = DelegateCommand.FromAsyncHandler(DecrementCount, CanDecrementCount);

            // Subscribe to the ShoppingCartUpdated event
            eventAggregator.GetEvent<ShoppingCartUpdatedEvent>().Subscribe(UpdateShoppingCartAsync);
        }
Exemplo n.º 15
0
        public AddGameViewModel(IGamesService gamesService, IFlyoutService flyoutService)
        {
            _gamesService  = gamesService;
            _flyoutService = flyoutService;
            WhenStateUpdated(() => SelectedGame, () => {
                if (SelectedGame == null)
                {
                    return;
                }

                HasExistingGame = false;
                if (gamesService.Games.Any(g => String.Equals(g.Name, SelectedGame.Name, StringComparison.InvariantCultureIgnoreCase)))
                {
                    HasExistingGame = true;
                }
                else
                {
                    NewGame = SelectedGame.ToGame();
                }

                HasNewGame = !HasExistingGame && NewGame != null;
            });
        }
Exemplo n.º 16
0
 public static void AddFlyout <TView>(this IFlyoutService flyoutService, string name, Position position, UnloadBehavior unloadBehavior = UnloadBehavior.SaveAndCloseViewModel)
 {
     AddFlyout <TView>(flyoutService, name, position, unloadBehavior, FlyoutTheme.Adapt);
 }
 public SettingsCharmService(Func<IList<SettingsCharmItem>> getSettingsCharmItems, IFlyoutService flyoutService)
 {
     _getSettingsCharmItems = getSettingsCharmItems;
     _flyoutService = flyoutService;
 }