Example #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>();
        }
Example #8
0
        public ShellViewModel()
        {
            SetVisibilityOfNavigationBack();
            SystemNavigationManager.GetForCurrentView().BackRequested += SystemNavigationManager_BackRequested;

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

            CloseMeCommand = new DelegateCommand<object>(CloseMe);
        }
        /// <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));
        }
 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;
                                });
                        });

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

            LoginCommand = new DelegateCommand(DoLogin);
        }
Example #19
0
 public EditTaskViewModel(ObservableCollection<Task> tasks, ObservableCollection<TaskList> tasksList)
 {
     _tasks = tasks;
     _taskLists = tasksList;
     ValidateEditionCommand = new DelegateCommand(OnValidateEdition);
     DeleteTaskCommand = new DelegateCommand(OnDeleteTask);
 }
Example #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();
 }
Example #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);
 }
Example #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();
        }
        public IfOperationViewModel(Test test, IEventAggregator eventAggregator)
        {
            this.test = test;
            AddToTestCommand = new DelegateCommand(ExecuteAddToTestCommand);

            addTestItemEvent = eventAggregator.GetEvent<AddTestItemEvent>();
        }
Example #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();
            }
        }
        public MainPageViewModel(IMessageService messageService, IBooksService booksService)
        {
            _messageService = messageService;
            _booksService = booksService;

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

            SaveCommand = new DelegateCommand(Save);
            CancelCommand = new DelegateCommand(() => IsWindowOpen = false);
        }
Example #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);
 }
 public SelectProjectViewModel(ILoadProjectService LoadProjectService, IEventAggregator EventAggregator, IList<RecentProjectViewModel> RecentProjects)
 {
     this.RecentProjects = RecentProjects;
     _loadProjectService = LoadProjectService;
     _eventAggregator = EventAggregator;
     OpenFileRequest = new InteractionRequest<OpenFileInteractionContext>();
     LoadProjectCommand = new DelegateCommand(Load);
 }