Ejemplo n.º 1
0
 public BattlesViewModel()
 {
     AddActionCommand = new DelegateCommand(AddAction);
     DeleteActionCommand = new DelegateCommand(DeleteAction);
     ClearActionsCommand = new DelegateCommand(ClearActions);
     ViewName = "Battles";
 }
        public ComplexCustomViewViewModel( Model model )
        {
            Model = model;

            ShowConfirmationCommand = new DelegateCommand( OnShowConfirmation );
            ConfirmationRequest = new InteractionRequest<INotification>();
        }
        public AddEditPropertyListNameViewModel(AddEditPropertyListNameDialog view, PropertyListName propertyListName, CommonUtils.Operation operation)
        {
            View = view;
            mPropertyListName = propertyListName;

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanModifyConfig);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true);

            if (operation == CommonUtils.Operation.Update)
            {
                CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint);

                cmsWebServiceClient.GetPropertyListNameCompleted +=
                    (s1, e1) =>
                    {
                        mPropertyListName = e1.Result;
                        LoadPropertyListNames(mPropertyListName.PropertyListId);
                        mExistingPropertyListNamesLoaded = true;
                        FireLoaded();
                    };
                cmsWebServiceClient.GetPropertyListNameAsync(mPropertyListName.Id);
            }
            else
            {
                LoadPropertyListNames(mPropertyListName.PropertyListId);
            }
        }
 public CredentialModelView()
 {
     Users = new ObservableCollection<CredentialUser>();
     RefreshCommand = new DelegateCommand(RefreshUsers);
     SaveCommand = new DelegateCommand<PasswordBox>(SaveObject);
     RefreshUsers();
 }
        public FlyoutService(IRegionManager regionManager, IApplicationCommands applicationCommands)
        {
            _regionManager = regionManager;

            ShowFlyoutCommand = new DelegateCommand<string>(ShowFlyout, CanShowFlyout);
            applicationCommands.ShowFlyoutCommand.RegisterCommand(ShowFlyoutCommand);
        }
        public AddEditMobilePlantComponentTypeViewModel(MobilePlantComponentType mct)
        {
            mMobilePlantComponentType = mct;

            OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanModifyConfig);
            CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander, x => true);
        }
        public RegionWithPopupWindowActionExtensionsViewModel( Model model )
        {
            Model = model;

            ShowConfirmationCommand = new DelegateCommand( OnShowConfirmation );
            ConfirmationRequest = new InteractionRequest<INotification>();
        }
Ejemplo n.º 8
0
        public ShellViewModel()
        {
            SetVisibilityOfNavigationBack();
            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;

            OpenPaneCommand = new DelegateCommand(OpenPaneCommandDelegate);
        }
Ejemplo n.º 9
0
 public MainWindow()
 {
     InitializeComponent();
     OpenHelpPageCommand = new DelegateCommand(ExecuteOpenHelpPage);
     this.DataContext = OpenHelpPageCommand;
     this.InputBindings.Add(new KeyBinding(this.OpenHelpPageCommand, new KeyGesture(Key.F1)));
 }
Ejemplo n.º 10
0
        public WeighDataCamerasPresenter(ModalViewManager modal, IEventAggregator eventAgrigator)
        {
            _modalManager = modal;
            _eventAgrigator = eventAgrigator;

            CloseMeCommand = new DelegateCommand<object>(CloseMe);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Initializes the services and commands.
        /// </summary>
        /// <param name="bibleRepository">A repository of <see cref="Bible"/>.</param>
        /// <param name="navigationService">A implementation of Navigation</param>
        public MainPageViewModel(IBibleRepository bibleRepository, INavigationService navigationService)
        {
            _bibleRepository = bibleRepository;

            LoadChaptersCommand = new DelegateCommand<Book>(LoadChapters);
            ShowChapterCommand = new DelegateCommand<Chapter>(ShowChapter);
        }
        public RegionOnPopupWindowContentControlViewModel( Model model )
        {
            Model = model;

            ShowConfirmationCommand = new DelegateCommand( OnShowConfirmation );
            ConfirmationRequest = new InteractionRequest<INotification>();
        }
        public SearchResultsPageViewModel(ApplicationSettings settings, INavigationService navigationService, IImageSearchService imageSearchService, IHub hub, IAccelerometer accelerometer, IStatusService statusService, IShareDataRequestedPump shareMessagePump)
        {
            _settings = settings;
            _navigationService = navigationService;
            _imageSearchService = imageSearchService;
            _hub = hub;
            _accelerometer = accelerometer;
            _statusService = statusService;

            HomeCommand = _navigationService.GoBackCommand;
            ViewDetailsCommand = new DelegateCommand(ViewDetails, () => SelectedImage != null);
            LoadMoreCommand = new AsyncDelegateCommand(LoadMore);
            ThumbnailViewCommand = new DelegateCommand(ThumbnailView);
            ListViewCommand = new DelegateCommand(ListView);
            SplitViewCommand = new DelegateCommand(SplitView);
            SettingsCommand = new DelegateCommand(Settings);

            AddImages(_settings.SelectedInstance.Images);
            shareMessagePump.DataToShare = _settings.SelectedInstance.QueryLink;
            _statusService.Title = _settings.SelectedInstance.Query;
            _accelerometer.Shaken += accelerometer_Shaken;
            _navigationService.Navigating += NavigatingFrom;

            UpdateCurrentView(CurrentView);
            _hub.Send(new UpdateTileImageCollectionMessage(_settings.SelectedInstance));
        }
Ejemplo n.º 14
0
 public CompareFilesViewModel(ReadOnlyObservableCollection<HexFileViewModel> files)
 {
     this.files = files;
     CloseCommand = new DelegateCommand(OnClose);
     IndexOfTheSelectedLeftFile = 0;
     IndexOfTheSelectedRightFile = 1;
 }
 private void InitializeCommands()
 {
     NewAlbumCommand = new DelegateCommand(NewAlbum);
     DeleteAlbumCommand = new DelegateCommand(DeleteSelectedAlbum);
     EditAlbumCommand = new DelegateCommand(EditSelectedAlbum);
     PowerShellConsoleCommand = new DelegateCommand(_powerShellConsoleLauncher.Launch);
 }
        public RecentViewModel()
        {
            fetchMoreDataCommand = new DelegateCommand(
                obj =>
                {
                    ThreadPool.QueueUserWorkItem(
                        delegate
                        {
                            /* This is just to demonstrate a slow operation. */
                            Thread.Sleep(10000);
                            /* We invoke back to the UI thread. */
                            Deployment.Current.Dispatcher.BeginInvoke(
                                delegate
                                {
                                    GlobalLoading.Instance.IsLoading = true;

                                    foreach (PictureInfo p in App.ContinuedRecentPictures)
                                    {
                                        App.RecentPictures.Add(p);
                                    }

                                    App.ContinuedRecentPictures.Clear();

                                    GlobalLoading.Instance.IsLoading = false;
                                });
                        });

                });
        }
Ejemplo n.º 17
0
 protected ContentViewModel(AbstractWorkspace workspace, ICommandManager commandManager, ILoggerService logger)
 {
     _workspace = workspace;
     _commandManager = commandManager;
     _logger = logger;
     CloseCommand = new DelegateCommand(CloseDocument);
 }
Ejemplo n.º 18
0
        public LoginViewModel(IEventAggregator eventAggregator, ISecurity security)
        {
            EventAggregator = eventAggregator;
            _security = security;

            LoginCommand = new DelegateCommand(DoLogin);
        }
Ejemplo n.º 19
0
 public EditTaskViewModel(ObservableCollection<Task> tasks, ObservableCollection<TaskList> tasksList)
 {
     _tasks = tasks;
     _taskLists = tasksList;
     ValidateEditionCommand = new DelegateCommand(OnValidateEdition);
     DeleteTaskCommand = new DelegateCommand(OnDeleteTask);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExpensesViewModel"/> class.
 /// </summary>
 /// <param name="container">The container.</param>
 public ExpensesViewModel(IUnityContainer container)
     : base(container)
 {
     Edit = new DelegateCommand<object>(OnEdit);
     Create = new DelegateCommand<object>(OnCreate);
     LoadExpenses();
 }
Ejemplo n.º 21
0
 public ZapScroller()
 {
     m_firstCommand = new DelegateCommand(First, canFirst);
     m_previousCommand = new DelegateCommand(Previous, canPrevious);
     m_nextCommand = new DelegateCommand(Next, canNext);
     m_lastCommand = new DelegateCommand(Last, canLast);
 }
Ejemplo n.º 22
0
        public void PropertiesWithNotification()
        {
            MainViewModel viewModel = Container.GetExportedValue<MainViewModel>();

            ICommand exitCommand = new DelegateCommand(() => { });
            AssertHelper.PropertyChangedEvent(viewModel, x => x.ExitCommand, () => viewModel.ExitCommand = exitCommand);
            Assert.AreEqual(exitCommand, viewModel.ExitCommand);

            ICommand settingCommand = new DelegateCommand(() => { });
            AssertHelper.PropertyChangedEvent(viewModel, x => x.SettingCommand, () => viewModel.SettingCommand = settingCommand);
            Assert.AreEqual(settingCommand, viewModel.SettingCommand);

            ICommand aboutCommand = new DelegateCommand(() => { });
            AssertHelper.PropertyChangedEvent(viewModel, x => x.AboutCommand, () => viewModel.AboutCommand = aboutCommand);
            Assert.AreEqual(aboutCommand, viewModel.AboutCommand);

            ICommand refreshBugsCommand = new DelegateCommand(() => { });
            AssertHelper.PropertyChangedEvent(viewModel, x => x.RefreshBugsCommand, () => viewModel.RefreshBugsCommand = refreshBugsCommand);
            Assert.AreEqual(refreshBugsCommand, viewModel.RefreshBugsCommand);

            ICommand englishCommand = new DelegateCommand(() => { });
            AssertHelper.PropertyChangedEvent(viewModel, x => x.EnglishCommand, () => viewModel.EnglishCommand = englishCommand);
            Assert.AreEqual(englishCommand, viewModel.EnglishCommand);

            ICommand chineseCommand = new DelegateCommand(() => { });
            AssertHelper.PropertyChangedEvent(viewModel, x => x.ChineseCommand, () => viewModel.ChineseCommand = chineseCommand);
            Assert.AreEqual(chineseCommand, viewModel.ChineseCommand);
        }
 public SelectionFileForDownloadingViewModel(ReadOnlyObservableCollection<HexFileViewModel> files)
 {
     this.files = files;
     IndexOfTheSelectedFile = 0;
     OkCommand = new DelegateCommand(OnOk);
     CloseCommand = new DelegateCommand(OnClose);
 }
        public PostfixOptionsViewModel([NotNull] Lifetime lifetime,
                                   [NotNull] OptionsSettingsSmartContext settings,
                                   [NotNull] PostfixTemplatesManager templatesManager)
        {
            mySettingsStore = settings;
              myTemplatesManager = templatesManager;
              Templates = new ObservableCollection<PostfixTemplateViewModel>();

              ShowPostfixTemplates = new Property<bool>(lifetime, "ShowPostfixTemplates");
              ShowStaticMembers = new Property<bool>(lifetime, "ShowStaticMembers");
              ShowEnumHelpers = new Property<bool>(lifetime, "ShowEnumHelpers");
              ShowLengthCountItems = new Property<bool>(lifetime, "ShowLengthCountItems");
              UseBracesForStatements = new Property<bool>(lifetime, "UseBracesForStatements");
              InvokeParameterInfo = new Property<bool>(lifetime, "InvokeParameterInfo");
              SearchVarOccurrences = new Property<bool>(lifetime, "SearchVarOccurrences");

              Reset = new DelegateCommand(ResetExecute);

              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowPostfixItems, ShowPostfixTemplates);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowStaticMethods, ShowStaticMembers);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowEnumHelpers, ShowEnumHelpers);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.BracesForStatements, UseBracesForStatements);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.InvokeParameterInfo, InvokeParameterInfo);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.ShowLengthCountItems, ShowLengthCountItems);
              settings.SetBinding(lifetime, PostfixSettingsAccessor.SearchVarOccurrences, SearchVarOccurrences);

              FillTemplates();
        }
Ejemplo n.º 25
0
        public IfOperationViewModel(Test test, IEventAggregator eventAggregator)
        {
            this.test = test;
            AddToTestCommand = new DelegateCommand(ExecuteAddToTestCommand);

            addTestItemEvent = eventAggregator.GetEvent<AddTestItemEvent>();
        }
Ejemplo n.º 26
0
        public MainViewModel(IEventAggregator eventAggregator, ISignalRClient signalRClient, IAuthStore authStore,
            IProductsRepository productsRepository)
        {
            this.eventAggregator = eventAggregator;
            this.signalRClient = signalRClient;
            this.productsRepository = productsRepository;

            deleteRequest = new InteractionRequest<Confirmation>();
            CreateProductCommand = new DelegateCommand(CreateProduct);
            OpenProductCommand = new DelegateCommand<Product>(EditProduct);
            changePriceCommand = new DelegateCommand(ChangePrice, HasSelectedProducts);
            deleteCommand = new DelegateCommand(PromtDelete, HasSelectedProducts);

            cvs = new CollectionViewSource();
            items = new ObservableCollection<Product>();
            cvs.Source = items;
            cvs.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            cvs.SortDescriptions.Add(new SortDescription("Size", ListSortDirection.Ascending));

            var token = authStore.LoadToken();
            if (token != null)
            {
                IsEditor = token.IsEditor();
                IsAdmin = token.IsAdmin();
            }
        }
Ejemplo n.º 27
0
        public MainPageViewModel(IMessageService messageService, IBooksService booksService)
        {
            _messageService = messageService;
            _booksService = booksService;

            AddBookCommand = new DelegateCommand(OnAddBook);
            InitBooks();
        }
Ejemplo n.º 28
0
        public ChangePriceWindowViewModel(IProductsRepository repository, IEventAggregator eventAggregator)
        {
            this.repository = repository;
            this.eventAggregator = eventAggregator;

            SaveCommand = new DelegateCommand(Save);
            CancelCommand = new DelegateCommand(() => IsWindowOpen = false);
        }
Ejemplo n.º 29
0
 public ScriptViewModel(ObservableCollection<Script> scripts)
 {
     Scripts = scripts;
     AddExpressionCommand = new DelegateCommand(ExecuteAddExpression);
     AddFileCommand = new DelegateCommand(ExecuteAddFile);
     RemoveScriptCommand = new AutomaticCommand<Script>(ExecuteRemoveScript, CanExecuteRemoveScript);
     EditScriptCommand = new AutomaticCommand<Script>(ExecuteEditScript, CanExecuteEditScript);
 }
Ejemplo n.º 30
0
 public SelectProjectViewModel(ILoadProjectService LoadProjectService, IEventAggregator EventAggregator, IList<RecentProjectViewModel> RecentProjects)
 {
     this.RecentProjects = RecentProjects;
     _loadProjectService = LoadProjectService;
     _eventAggregator = EventAggregator;
     OpenFileRequest = new InteractionRequest<OpenFileInteractionContext>();
     LoadProjectCommand = new DelegateCommand(Load);
 }