Exemplo n.º 1
0
        //public DelegateCommand SaveProject { get; set; }
        #endregion
        public MainViewModel()
        {
            //Session = new EMSSession();
            Session = new EnumSession();

            //try
            {
                Projects = SimpleProjectViewModel.GetAll(Session);
                //MIGRATE HERE
                //Migration(Projects, 4);

                ViewColProjects = CollectionViewSource.GetDefaultView(Projects);
            }
            //catch (Exception ex)
            //{
            //   while (ex.InnerException != null)
            //      ex = ex.InnerException;
            //   MessageBox.Show("Error with getting projects:" + ex.Message);
            //}

            //Binding b = new Binding("Projects");
            //b.Source = Projects;
            //b.Mode = BindingMode.OneWay;
            //BindingOperations.SetBinding(, CollectionViewSource.SourceProperty, b);

            ViewColProjects.Filter = filterAll;
            FontIncrease           = new Prism.Commands.DelegateCommand(() => ++ FontSize);
            FontDecrease           = new Prism.Commands.DelegateCommand(() => -- FontSize);
            SaveAsExcel            = new Prism.Commands.DelegateCommand(saveToExcel);
            NewProjectCommand      = new Prism.Commands.DelegateCommand(NewProject);
        }
        public ProductSelectorViewModel(ProductDataManager dataManager, IEventAggregator eventAggregator, IRegionManager regionManager)
        {
            this._dataManager     = dataManager;
            this._eventAggregator = eventAggregator;
            this._regionManager   = regionManager;

            this.ViewProductDetailsDelegate = new PrismCommands.DelegateCommand(this.ViewProductDetailsHandler, this.CanExecuteViewDetails);
            this.StartIncomingWithDelegate  = new PrismCommands.DelegateCommand(this.StartWithSelectedHandler, this.CanExecute);
            this.NewProductCommand          = new PrismCommands.DelegateCommand(this.CreateNewProductHandler, this.CanExecute);
            this.SetInIncomingFormDelegate  = new PrismCommands.DelegateCommand(this.SetInIncomingHandler, this.CanExecuteIncoming);
            this.EditProductDelegate        = new PrismCommands.DelegateCommand(this.EditProductHandler, this.CanExecute);
            this.RefreshDataCommand         = new AsyncCommand(this.RefreshHandler, this.CanExecute);
            this.ClearDetailViewsCommand    = new PrismCommands.DelegateCommand(this.ClearDetailViewsHandler, this.CanExecute);
            this.InitializeCommand          = new AsyncCommand(this.PopulateAsync);
            this.BulkImportCommand          = new AsyncCommand(this.BulkImportHandler);

            this.OnCopyingToClipboardCommand = new PrismCommands.DelegateCommand(this.OnCopyingToClipboardHandler);

            this._eventAggregator.GetEvent <StartOutgoingListEvent>().Subscribe(() => this.outgoingInProgress = true);
            this._eventAggregator.GetEvent <DoneOutgoingListEvent>().Subscribe(this.OutgoingListDone);
            this._eventAggregator.GetEvent <CancelOutgoingListEvent>().Subscribe(this.OutgoingListDone);

            this._eventAggregator.GetEvent <DoneIncomingListEvent>().Subscribe(this.CheckInDoneHandler);
            this._eventAggregator.GetEvent <CancelIncomingListEvent>().Subscribe(this.CheckInDoneHandler);

            this._eventAggregator.GetEvent <ProductEditingDoneEvent>().Subscribe(this.EditingDoneHandler);

            this._eventAggregator.GetEvent <LotRankReservationEditingStartedEvent>().Subscribe(() => { this.editInProgress = true; });
            this._eventAggregator.GetEvent <LotRankReservationEditingDoneEvent>().Subscribe(this.EditingDoneHandler);

            //this.Populate();
        }
 public MainWindowViewModel(IRegionManager regionManager, Serilog.ILogger logger)
 {
     this._regionManager    = regionManager;
     this.LoadModuleCommand = new PrismCommands.DelegateCommand <string>(this.LoadModuleHandler);
     this.LoadedCommand     = new Prism.Commands.DelegateCommand(this.LoadedHandler);
     this._logger           = logger;
 }
Exemplo n.º 4
0
        public CategoryDetailsViewModel(IEventAggregator eventAggregator, IRegionManager regionManager)
        {
            this._eventAggregator = eventAggregator;
            this._regionManager   = regionManager;

            this.SaveCommand    = new PrismCommands.DelegateCommand(this.SaveCategoryHandler);
            this.DiscardCommand = new PrismCommands.DelegateCommand(this.DiscardCategoryHandler);
        }
Exemplo n.º 5
0
 public WelcomeViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, VersionCheckerResponce installTraveler)
 {
     this._regionManager   = regionManager;
     this._eventAggregator = eventAggregator;
     this._installTraveler = installTraveler;
     this.NextCommand      = new PrismCommands.DelegateCommand(this.GoFoward, () => this._canContinue);
     this.CancelCommand    = new PrismCommands.DelegateCommand(this.Cancel);
     this.BuilderMessage();
 }
 public RegistrationViewViewModel(Student StudentData, IStudentService studentService, INotificationService CustomtNotificationService)
 {
     _CustomtNotificationService = CustomtNotificationService;
     _studentService             = studentService;
     this.StudentData            = StudentData;
     UpdateDelegateCommand       = new DelegateCommand(UpdateStudent);
     //_ev = ev;
     //_ev.GetEvent<EventAggrator>().Subscribe(GetStudent);
 }
Exemplo n.º 7
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void init()
        {
#if  RELEASE  //调试时不执行
            int.TryParse(Utility.ConfigHelper.GetAppSetting("PageSize"), out defaultPageSize);
#endif
            FirstPageCommand    = new Prism.Commands.DelegateCommand(OnExecuteFirstPageCommand, OnCanExecuteFirstPageCommand);
            PreviousPageCommand = new Prism.Commands.DelegateCommand(OnExecutePreviousPageCommand, OnCanExecutePreviousPageCommand);
            NextPageCommand     = new Prism.Commands.DelegateCommand(OnExecuteNextPageCommand, OnCanExecuteNextPageCommand);
            LastPageCommand     = new Prism.Commands.DelegateCommand(OnExecuteLastPageCommand, OnCanExecuteLastPageCommand);
        }
Exemplo n.º 8
0
 public ImportLotsViewModel(ProductDataManager dataManager, IEventAggregator eventAggregator, IRegionManager regionManager)
 {
     this._dataManager             = dataManager;
     this._eventAggregator         = eventAggregator;
     this._regionManager           = regionManager;
     this.SpreadsheetLoadedCommand = new AsyncCommand <Worksheet>(this.SpreadsheetLoadedHandler);
     this.ProcessLotsCommand       = new AsyncCommand(this.ProcessLotsHandler);
     this.InitializeCommand        = new AsyncCommand(this.LoadAsync);
     this.DoneCommand   = new PrismCommands.DelegateCommand(this.FinishedHandler, () => !this.incomingInProgress);
     this.CancelCommand = new PrismCommands.DelegateCommand(this.CancelHandler, () => !this.incomingInProgress);
 }
        public ExportInvestorListViewModel(IRegionManager regionManager)
        {
            this.regionManager = regionManager;
            TabTitle           = "Export Investordaten";

            EditInvestorCommand = new Prism.Commands.DelegateCommand(OnEditInvestor).ObservesCanExecute(() => CanEditInvestor);
            ReloadCommand       = new Prism.Commands.DelegateCommand(OnReload);
            ExportCommand       = new Prism.Commands.DelegateCommand(OnExport).ObservesCanExecute(() => CanExportData);
            BrowseCommand       = new Prism.Commands.DelegateCommand(OnBrowse);
            // an instance of RadGridView is needed to perform export to Excel
            GridViewLoadedCommand = new Prism.Commands.DelegateCommand <object>(OnGridViewLoaded);
            NotificationRequest   = new InteractionRequest <INotification>();
            GetDirectory();
        }
Exemplo n.º 10
0
 public ConsumerTableViewModel(LocationDataManager locationDataManager, IEventAggregator eventAggregator, IRegionManager regionManager)
 {
     this._locationManager        = locationDataManager;
     this._regionManager          = regionManager;
     this._eventAggregator        = eventAggregator;
     this.ConsumerSelectedCommand = new PrismCommands.DelegateCommand(this.ConsumerSelectedHandler);
     this.DeleteConsumerCommand   = new PrismCommands.DelegateCommand(this.DeleteConsumerHandler);
     this.LoadedCommand           = new PrismCommands.DelegateCommand(this.LoadedAsyncHandler);
     this.NewConsumerCommand      = new PrismCommands.DelegateCommand(this.NewConsumerHandler);
     this.PopulateAsync();
     this._eventAggregator.GetEvent <ConsumerUpdateEvent>().Subscribe(this.UpdateConsumerHandler);
     this._eventAggregator.GetEvent <ConsumerSaveEvent>().Subscribe(this.SaveConsumerHandler);
     this._eventAggregator.GetEvent <ConsumerDiscardEvent>().Subscribe(this.DiscardConsumerChangesHandler);
 }
Exemplo n.º 11
0
 public MainPageViewModel(INavigationService navigationService)
     : base(navigationService)
 {
     Title                = "Chris Evans";
     AboutPageCommand     = new DelegateCommand(async() => await NavigationService.NavigateAsync("AboutPage"));
     SkillsPageCommand    = new DelegateCommand(async() => await NavigationService.NavigateAsync("SkillsPage"));
     ContactMePageCommand =
         new DelegateCommand(async() => await NavigationService.NavigateAsync("ContactMePage"));
     DelegateCommands = new ObservableCollection <MainPageButton>()
     {
         new MainPageButton(AboutPageCommand, "About Me", "Who I am and what I do", "Assets/MainTree.png", "Assets/MainPerson.png"),
         new MainPageButton(SkillsPageCommand, "My Skills", "My strength and proficiencies", "Assets/MainCSharp.png", "Assets/MainCode.png"),
         new MainPageButton(ContactMePageCommand, "Contact Me", "Need more information?  Let me know!", "Assets/MainPhone.png", "Assets/MainContact.png")
     };
 }
Exemplo n.º 12
0
        public UsersViewModel(IUserRepository repository, IEventAggregator eventAggregator
                              , IMessageDialogService messageService, IAppLogger appLogger) : base(eventAggregator, messageService, appLogger)
        {
            UsersCollection = new ObservableCollection <User>();

            _repository      = repository;
            _eventAggregator = eventAggregator;
            _messageService  = messageService;

            AddNewUserCommand                = new Prism.Commands.DelegateCommand(OnAddNewUserExecute);
            RemoveUserCommand                = new DelegateCommand <User>(OnRemoveUserExecute);
            ChangePasswordCommand            = new DelegateCommand <User>(OnChangePasswordExecute);
            SetWindowsAuthenticationCommand  = new DelegateCommand <User>(OnSetWindowsAuthenticationExecute);
            SetFacebookAuthenticationCommand = new DelegateCommand <User>(OnSetFacebookAuthenticationExecute);
        }
Exemplo n.º 13
0
 public SDKViewModel(IUnityContainer container, IEventAggregator eventAggregator)
 {
     this._container       = container;
     this._eventAggregator = eventAggregator;
     _reocrdstatus         = new eagle_reocrd_status();
     _ccdRecordModels      = new ObservableCollection <CcdRecordModel>();
     ListRightMenue        = new DelegateCommand <object>(OnRightMenue);
     RecordCmd             = new DelegateCommand <object>(OnRecordCommand);
     FileReportCmd         = new DelegateCommand <CcdRecordModel>(OnFileReort);
     DeleteCmd             = new DelegateCommand <CcdRecordModel>(OnDeleteFile);
     RefreshCmd            = new DelegateCommand <object>(OnFileRefresh);
     StopRecordCmd         = new Prism.Commands.DelegateCommand(OnStopRecod);
     // FileDownloadCmd = new DelegateCommand<DirectoryInfoModel>(OnDownloadFile);
     Menu = new ObservableCollection <MenuItem>();
     Initializer();
 }
Exemplo n.º 14
0
        public PartsNavigationViewModel(IPartNavigationEditUseCase partEdit, IEventAggregator eventAggregator, IRegionManager regionManager)
        {
            this._partEdit              = partEdit;
            this._eventAggregator       = eventAggregator;
            this._regionManager         = regionManager;
            this.InitializeCommand      = new AsyncCommand(this.PopulateAsync);
            this.RefreshDataCommand     = new AsyncCommand(this.RefreshDataHandler);
            this.ViewPartDetailsCommand = new PrismCommands.DelegateCommand(this.ViewPartDetailsHandler, this.CanNew);
            this.EditPartCommand        = new PrismCommands.DelegateCommand(this.EditPartDetailsHandler, this.CanNew);
            this.NewPartCommand         = new AsyncCommand(this.NewPartHandler, this.CanNew);
            this.DoubleClickViewCommand = new PrismCommands.DelegateCommand(this.ViewPartDetailsHandler, this.CanNew);

            this._eventAggregator.GetEvent <PartEditDoneEvent>().Subscribe(async(partId) => await this.ReloadEditDoneHandler(partId));
            this._eventAggregator.GetEvent <PartEditCancelEvent>().Subscribe(async() => await this.ReloadEditCancelHandle());
            //this._eventAggregator.GetEvent<GlobalReload>().Subscribe(async () => await this.ReloadEditCancelHandle());
        }
        public WarehouseTableViewModel(LocationDataManager locationDataManager, IEventAggregator eventAggregator, IRegionManager regionManager)
        {
            this._locationManager         = locationDataManager;
            this._regionManager           = regionManager;
            this._eventAggregator         = eventAggregator;
            this.WarehouseSelectedCommand = new PrismCommands.DelegateCommand(this.WarehouseSelectedHandler);
            this.DeleteWarehouseCommand   = new PrismCommands.DelegateCommand(this.DeleteWarehouseHandler);
            this.LoadedCommand            = new PrismCommands.DelegateCommand(this.LoadedAsyncHandler);
            this.NewWarehouseCommand      = new PrismCommands.DelegateCommand(this.NewWarehouseHandler);

            this._eventAggregator.GetEvent <WarehouseSaveEvent>().Subscribe(this.SaveWarehouseHandler);
            this._eventAggregator.GetEvent <WarehouseUpdateEvent>().Subscribe(this.UpdateWarehouseHandler);
            this._eventAggregator.GetEvent <WarehouseDiscardEvent>().Subscribe(this.DiscardWarehouseChangesHandler);

            this.PopulateAsync();
        }
        public ProductTypeTableViewModel(CategoryDataManager dataManager, IEventAggregator eventAggregator, IRegionManager regionManager)
        {
            this._dataManager     = dataManager;
            this._eventAggregator = eventAggregator;
            this._regionManager   = regionManager;

            this.NewPackageTypeCommand    = new PrismCommands.DelegateCommand(this.NewPackageTypeHandler);
            this.CategorySelectedCommand  = new PrismCommands.DelegateCommand(this.CategorySelectedHandler);
            this.DeletePackageTypeCommand = new PrismCommands.DelegateCommand(this.DeleteCategoryHandler);

            this._eventAggregator.GetEvent <SaveNewCategoryEvent>().Subscribe(this.SaveNewCategoryHandler);
            this._eventAggregator.GetEvent <SaveCategoryEvent>().Subscribe(this.SaveCategoryHandler);
            this._eventAggregator.GetEvent <DiscardCategoryEvent>().Subscribe(this.DiscardCategoryHandler);

            this.PopulateAsync();
        }
Exemplo n.º 17
0
        public MainWindowViewModel()
        {
            ExecuteDelegateCommand = new Prism.Commands.DelegateCommand(Execute, CanExecute);

            // 指定监视属性,当该属性发生变化时,自动调用RaiseCanExecuteChanged方法通知界面状态已改变
            DelegateCommandObservesProperty = new Prism.Commands.DelegateCommand(Execute, CanExecute).ObservesProperty(() => IsEnabled);

            // 如果程序中的CanExcute委托的结果是简单的布尔值,可以省去CanExcute委托的声明。不仅能够通过UI状态改变,而且使用与真实的CanExcute委托相同的属性
            DelegateCommandObservesCanExecute = new Prism.Commands.DelegateCommand(Execute).ObservesCanExecute(() => IsEnabled);

            // 为命令指定参数
            ExecuteGenericDelegateCommand = new Prism.Commands.DelegateCommand <string>(ExecuteGeneric).ObservesCanExecute(() => IsEnabled);



            AsyncMethodCommandOne = new DelegateCommand(ExecuteCommandNameOne, CanExecute).ObservesProperty(() => IsEnabled);

            AsyncMethodCommandTwo = new DelegateCommand(async() => await ExecuteCommandName(), CanExecute).ObservesProperty(() => IsEnabled);
        }
Exemplo n.º 18
0
        public SearchResultViewModel(IEventAggregator eventAggregator
                                     , IMessageDialogService messageDialogService
                                     , IArchiveEntityRepository repository
                                     )
        {
            _repository = repository;

            _eventAggregator                     = eventAggregator;
            _messageDialogService                = messageDialogService;
            SearchResult                         = new SearchResult(new List <ArchiveEntityDto>());
            CloseSearchDetailViewModelCommand    = new DelegateCommand(OnCloseDetailViewExecute);
            OpenSearchResultArchiveEntityCommand = new DelegateCommand <int?>(OnOpenSearchResultArchiveEntityExecute);
            OpenSearchResultDriveCommand         = new DelegateCommand <int?>(OnOpenSearchResultDriveExecute);

            FirstPageCommand = new Prism.Commands.DelegateCommand(FirstPageCommandExecute);
            PrevPageCommand  = new Prism.Commands.DelegateCommand(PrevPageCommandExecute);
            NextPageCommand  = new Prism.Commands.DelegateCommand(NextPageCommandExecute);
            LastPageCommand  = new Prism.Commands.DelegateCommand(LastPageCommandExecute);

            _currentPage = 1;


            // SearchResult.MyProperty = 0;
        }
 public FinishedViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
 {
     this._regionManager   = regionManager;
     this._eventAggregator = eventAggregator;
     this.FinishedCommand  = new PrismCommands.DelegateCommand(this.FinishedHandler);
 }
Exemplo n.º 20
0
        public MainWindowViewModel()
        {
            portList = new List <string>();
            for (int i = 1; i <= 16; i++)
            {
                portList.Add($"COM{i}");
            }
            baudRateList    = "300:600:1200:2400:4800:9600:19200:38400:57600:115200".Split(':').ToList();
            dataBitsList    = "5:6:7:8".Split(':').ToList();
            stopBitsList    = "0:1:1.5:2".Split(':').ToList();
            parityCheckList = "None:Odd:Even:Mark:Space".Split(':').ToList();
            stopBitsDict    = new Dictionary <string, System.IO.Ports.StopBits>();
            stopBitsDict.Add("0", System.IO.Ports.StopBits.None);
            stopBitsDict.Add("1", System.IO.Ports.StopBits.One);
            stopBitsDict.Add("1.5", System.IO.Ports.StopBits.OnePointFive);
            stopBitsDict.Add("2", System.IO.Ports.StopBits.Two);
            port            = "COM1";
            baudRate        = "9600";
            parityCheck     = "None";
            dataBits        = "8";
            stopBits        = "1";
            crcEnabled      = false;
            MessageContent  = "";
            openPortEnabled = true;
            OpenPortCommand = new Prism.Commands.DelegateCommand(() =>
            {
                try
                {
                    spReader = new Utilities.SerialPortReader(port, Convert.ToInt32(baudRate),
                                                              (Parity)Enum.Parse(typeof(Parity), parityCheck),
                                                              Convert.ToInt32(dataBits),
                                                              stopBitsDict[stopBits],
                                                              new SerialDataReceivedEventHandler(SerialPortDataReceivedEventHandler));
                    spReader.Open();
                }
                catch (Exception ex)
                {
                    System.Windows.MessageBox.Show($"打开串口失败,{ex.Message}");
                    return;
                }
                IsOpenPortEnabled = false;
                timeStub          = Environment.TickCount;
                MessageTotal      = 0;
                IsTimerEnabled    = false;
            });

            ClosePortCommand = new DelegateCommand(() =>
            {
                spReader.Close();
                IsOpenPortEnabled = true;
                IsTimerEnabled    = true;
            });

            ClearMessageContentCommand = new DelegateCommand(() =>
            {
                MessageContent = "";
            });

            ReadDataCommand = new DelegateCommand <string>((t) =>
            {
                int timeSpan   = Convert.ToInt32(t);
                IsTimerEnabled = false;
                OpenPortCommand.Execute();
                Task.Run(() =>
                {
                    Thread.Sleep(timeSpan);
                    ClosePortCommand.Execute();
                    IsTimerEnabled = true;
                });
            });
        }
Exemplo n.º 21
0
 /// <summary>
 /// 初始化命令
 /// </summary>
 private void initCommand()
 {
     MoveCommand  = new Prism.Commands.DelegateCommand(executeMoveCommand);
     LoginCommand = new Prism.Commands.DelegateCommand(executeLoginCommand, canExecuteLoginCommand);
     ExitCommand  = new Prism.Commands.DelegateCommand(OnExecuteExitCommand);
 }
 public WarehouseDetailsViewModel(IEventAggregator eventAggregator)
 {
     this._eventAggregator = eventAggregator;
     this.SaveCommand      = new PrismCommands.DelegateCommand(this.SaveHandler);
     this.DiscardCommand   = new PrismCommands.DelegateCommand(this.DiscardHandler);
 }