コード例 #1
0
        public RegisterRangeEditorViewModel(RangeModel originalRangeModel)
        {
            if (originalRangeModel == null)
                throw new ArgumentNullException(nameof(originalRangeModel));

            _originalRangeModel = originalRangeModel;

            _name = originalRangeModel.Name;
            _startingRegisterIndex = originalRangeModel.StartIndex;
            _registerType = originalRangeModel.RegisterType;

            if (originalRangeModel.Fields != null)
            {
                Fields.AddRange(originalRangeModel.Fields.Select(f => new FieldEditorViewModel(f.Clone())));
            }

            OkCommand = new RelayCommand(Ok, CanOk);
            CancelCommand = new RelayCommand(Cancel);

            MoveUpCommand = new RelayCommand(MoveUp, CanMoveUp);
            MoveDownCommand = new RelayCommand(MoveDown, CanMoveDown);
            DeleteCommand = new RelayCommand(Delete, CanDelete);
            MoveToTopCommand = new RelayCommand(MoveToTop, CanMoveToTop);
            MoveToBottomCommand = new RelayCommand(MoveToBottom, CanMoveToBottom);
            InsertAboveCommand = new RelayCommand(InsertAbove, CanInsertAbove);
            InsertBelowCommand = new RelayCommand(InsertBelow, CanInsertBelow);

            _fields.CollectionChanged += FieldsOnCollectionChanged;
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the MongoDbIndexViewModel class.
 /// </summary>
 public MongoDbIndexViewModel(MongoDbCollectionViewModel collection, string name)
 {
     _collection = collection;
     _name = name;
     ConfirmDropIndex = new RelayCommand(InternalConfirmDropIndex);
     EditIndex = new RelayCommand(InternalEditIndex);
 }
コード例 #3
0
 public ThemeComponentSelectionControl()
 {
     InitializeComponent();
     (Content as FrameworkElement).DataContext = this;
     AddThemeComponentCommand = new RelayCommand(OnAddThemeComponentCommand);
     RemoveThemeComponentCommand = new RelayCommand(OnRemoveThemeComponentCommand);
 }
コード例 #4
0
ファイル: ViewModelCrew.cs プロジェクト: puppyzvezdas/CrFSM
        public ViewModelCrew()
        {
            if (Client.State == CommunicationState.Closed)
            {
                Client.Open();
            }

            crew = new Crew();

            AddEntityCommand = new RelayCommand(AddEntityCommand_Execute, AddEntityCommand_CanExecute);
            RemoveEntityCommand = new RelayCommand(RemoveEntityCommand_Execute, RemoveEntityCommand_CanExecute);
            AddToCrewCommand = new RelayCommand(AddToCrewCommand_Execute, AddToCrewCommand_CanExecute);
            RemoveFromCrewCommand = new RelayCommand(RemoveFromCrewCommand_Execute, RemoveFromCrewCommand_CanExecute);
            AddAllCommand = new RelayCommand(AddAllCommand_Execute, AddAllCommand_CanExecute);
            RemoveAllCommand = new RelayCommand(RemoveAllCommand_Execute, RemoveAllCommand_CanExecute);

            Crews = new ObservableCollection<Crew>(Client.GetEntityByType(EntityType.Crew).Cast<Crew>());
            AllMembers = new ObservableCollection<CrewMember>(Client.GetEntityByType(EntityType.CrewMember).Cast<CrewMember>().Where(member => string.IsNullOrEmpty(member.Crew)));
            CrewMembers = new ObservableCollection<CrewMember>();
            SelectedMembers = new ObservableCollection<CrewMember>();
            SelectedMembersToRemove = new ObservableCollection<CrewMember>();

            MakeProxy(this);

            try
            {
                proxy.Subscribe(EntityType.Crew.ToString());
                proxy.Subscribe(EntityType.CrewMember.ToString());
            }
            catch (Exception ex)
            {
                CrFSMLogger.CrFSMLogger.Instance.WriteToLog(ex);
            }
        }
コード例 #5
0
        public MainWindowViewModel(IDialogService dialogService)
        {
            this.dialogService = dialogService;

            ImplicitShowDialogCommand = new RelayCommand(ImplicitShowDialog);
            ExplicitShowDialogCommand = new RelayCommand(ExplicitShowDialog);
        }
コード例 #6
0
 public EditViewModel()
 {
     LeaveEditModeCommand = new RelayCommand(() =>
       {
     MessengerInstance.Send(new ChangeViewModelMessage() { ViewKind = ViewKind.None });
       });
 }
コード例 #7
0
ファイル: MainViewModel.cs プロジェクト: junhan87/FeedNews
 /// <summary>
 /// Default constructor.  We set the initial view-model to 'FirstViewModel'.
 /// We also associate the commands with their execution actions.
 /// </summary>
 public MainViewModel()
 {
     CurrentViewModel = MainViewModel._firstViewModel;
     ViewRSSFeedCommand = new RelayCommand(param => ExecuteViewRSSFeedCommand());
     SettingViewCommand = new RelayCommand(param => ExecuteSettingViewCommand());
     SearchRSSViewCommand = new RelayCommand(param => ExecuteSearchRSSViewCommand());
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the MongoDbDatabaseViewModel class.
 /// </summary>
 public MongoDbUserViewModel(string name, BsonDocument userDocument)
 {
     _name = name;
     _userDocument = userDocument;
     EditUser = new RelayCommand(InternalEditUser);
     ConfirmDeleteUser = new RelayCommand(InternalConfirmDeleteUser);
 }
コード例 #9
0
        public CustomerListViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) return;

            //Customers = new ObservableCollection<Customer>(_customersRepo.GetCustomersAsync().Result);
            DeleteCommand = new RelayCommand(OnDelete, CanDelete);
        }
コード例 #10
0
 public CollectionBindingViewModel(IMessagePresenter messagePresenter)
 {
     Should.NotBeNull(messagePresenter, "messagePresenter");
     _messagePresenter = messagePresenter;
     AddCommand = new RelayCommand(Add);
     RemoveCommand = RelayCommandBase.FromAsyncHandler<CollectionItemModel>(Remove, CanRemove, this);
 }
コード例 #11
0
        public PlayersViewModel()
        {
            Players = new ObservableCollection<Player>();

            #region RCON Events
            App.ArkRcon.PlayersUpdated += async (s, args) =>
            {
                Players.Clear();
                foreach (Ark.Models.Player player in args.Players)
                {
                    Players.Add(new Models.Player(player));
                }
                await UpdateSteamPlayerInfo();
            };
            #endregion
            
            #region Buttons and Events

            OpenSteamProfileCommand = new RelayCommand(OpenSteamProfile);
            CopySteamIDCommand = new RelayCommand(CopySteamID);
            CopyPlayerNameCommand = new RelayCommand(CopyPlayerName);
            KickSelectedCommand = new RelayCommand(KickSelectedPlayer);
            BanSelectedCommand = new RelayCommand(BanSelectedPlayer);
            WhitelistSelectedCommand = new RelayCommand(WhitelistSelectedPlayer);
            UnWhitelistSelectedCommand = new RelayCommand(UnWhitelistSelectedPlayer);
            PMSelectedPlayerCommand = new RelayCommand(PMSelectedPlayer);
            RefreshPlayersCommand = new RelayCommand(RefreshPlayers);
            
            #endregion

            PrivateMessage = string.Empty;

        }
コード例 #12
0
        /// <summary>
        /// For designer only
        /// </summary>
        public SimpleTextCaptureViewModel()
        {
            RefreshCommand = new RelayCommand(Refresh);

            Packets.Add(new PacketViewModel(new byte[]{ 1, 2, 3, 4, 5 }));
            Packets.Add(new PacketViewModel(new byte[] { 1, 2, 3, 4, 5 }));
        }
コード例 #13
0
        public TranslationAdornment(SnapshotSpan span, TranslationRequest request, Size viewportSize)
        {
            Span = span.Snapshot.CreateTrackingSpan(span, SpanTrackingMode.EdgeExclusive);
            Request = request;
            Request.TranslationComplete += request_TranslationComplete;

            InitializeComponent();
            DataContext = this;

            SetMaxSize(viewportSize);

            _menu = spListBox.ContextMenu;
            _menu.KeyUp += (sender, args) =>
            {
                if (args.Key == Key.Left || args.Key == Key.Escape)
                {
                    CloseMenu();
                }
            };
            _menu.Opened += (sender, args) => { _closeMenuRequested = false; };
            _menu.Closed += (sender, args) => { _ignoreItemCommand = !_closeMenuRequested; };

            ItemCommand = new RelayCommand<ItemCommandParameter>(ItemCommandExecute);
            ItemOptionsCommand = new RelayCommand<ItemCommandParameter>(ItemOptionsCommandExecute);
            MenuCommand = new RelayCommand<MenuItem>(MenuCommandExecute);
        }
コード例 #14
0
 public SwitchLanguageViewModel()
 {
     LangList = StaticDatas.GetLanguageList();
     loadConfigValue();
     ConfirmCommand = new RelayCommand(OnExecuteConfirmCommand, OnCanExecuteConfirmCommand);
     CancelCommand = new RelayCommand(OnExecuteCancelCommand);
 }
コード例 #15
0
        //Constructor 
        public BaseViewModel() {

            CloseWindowCommand = new RelayCommand<Window>(CloseWindow);

            UndoCommand = new RelayCommand(undoRedoController.Undo, undoRedoController.CanUndo);
            RedoCommand = new RelayCommand(undoRedoController.Redo, undoRedoController.CanRedo);

            CutCommand = new RelayCommand(Cut, LampsAreSelected);
            CopyCommand = new RelayCommand(Copy, LampsAreSelected);
            PasteCommand = new RelayCommand(Paste);

            AddLampCommand = new RelayCommand<IList>(AddNewLamp);
            RemoveLampCommand = new RelayCommand(RemoveLamp, LampsAreSelected);

            dialogWindow = new DialogViews();
            NewDrawingCommand = new RelayCommand(NewDrawing);
            LoadDrawingCommand = new RelayCommand(LoadDrawing);
            SaveDrawingCommand = new RelayCommand(SaveDrawing);
            SaveAsDrawingCommand = new RelayCommand(SaveAsDrawing);
        
            LightSwitchCommand = new RelayCommand(LightSwitch);
            SwitchLampLightCommand = new RelayCommand(singleLampLightSwitch, LampsAreSelected);

            toggleSnappingCommand = new RelayCommand(toggleSnapping);
            toggleGridVisibilityCommand = new RelayCommand(toggleVisibility);
        }
コード例 #16
0
        /// <summary>
        ///     Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            LoadUrlCommand = new RelayCommand(OnLoadUrl);
            ParseUrlCommand = new RelayCommand(OnParseUrl, () => !string.IsNullOrEmpty(URL));
            ExportCommand = new RelayCommand(OnExport);
            GetUrlsCommand = new RelayCommand(OnGetUrls);

            _catalogObservableList = new ObservableCollection<CatalogNodeViewModel>();
            CatalogCollectionView = new ListCollectionView(_catalogObservableList);

            if (IsInDesignMode)
            {
                // Code runs in Blend --> create design time data.
                URL = "http://hqfz.cnblgos.com";
                CnBlogName = "hqfz";
                var catalog = new CatalogNodeViewModel();
                catalog.CurrentEntity.Title = "Catalog1";
                var article = new ArticleViewModel();
                article.CurrentEntity.Title = "Article1";
                catalog.AddArticle(article);

                _catalogObservableList.Add(catalog);
            }
            else
            {
                // Code runs "for real"
                URL = "http://www.cnblogs.com/artech/default.html?page=1";
                CnBlogName = "artech";
            }
        }
コード例 #17
0
        public PlanSchematicViewModel(RoadwayModel_TabVM parentVM)
            : base()
        {
            parentVM_ = parentVM;
             if (parentVM_ == null) return;

             isPortWindowMoving = false;
             startMovingPoint.X = startMovingPoint.Y = 0.0;

             currentCorridor_ = parentVM_.CurrentCorridor;
             ViewScaleFeetPerInch = 100.0;
             currentCorridor_ = parentVM_.CurrentCorridor;
             AdvanceDistance = 20.0;

             AdvanceStationAheadCmd = new RelayCommand(advanceStationAhead, () => canAdvanceAhead);
             canAdvanceAhead = true;

             AdvanceStationBackCmd = new RelayCommand(advanceStationBack, () => canAdvanceBack);
             canAdvanceBack = true;

             WindowCenterY = 2000.0;

             PlanStation = "";
             PlanOffset = "";
             PlanElevation = "";
             PlanCrossSlope = "";
        }
コード例 #18
0
        public SelectPlayersViewModel(GameCore core) : base(core)
        {
            AutomateSelections = new RelayCommand(() =>
            {
                var draftCards = core.GameState.Leagues.SelectMany(league => league.Teams.SelectMany(team => team.DraftCards));

                double additionalPlayerMultiplier = 1.4f;
                
                int numberOfSeniorPlayersNeeded = Convert.ToInt32(draftCards.Count(x => !x.MaxAge.HasValue) * additionalPlayerMultiplier);
                int numberOfYouthPlayersNeeded = Convert.ToInt32(draftCards.Count(x => x.MaxAge.HasValue) * additionalPlayerMultiplier);

                // Assumed max age value for simplicity
                int maxAge = 19;

                var bestAvailablePlayers = core.QueryService.GetPlayers(passive: false)
                    .OrderByDescending(x => x.CurrentAbility)
                    .Take(numberOfSeniorPlayersNeeded);

                PickedPlayerIds.AddRange(bestAvailablePlayers.Select(x => x.ID));
                PlayersAddedEvent(bestAvailablePlayers);

                var bestAvailableYoungPlayers = core.QueryService.GetPlayers(passive: false, filter: UnpickedPlayerPredicate)
                    .Where(x => x.Age <= maxAge)
                    .OrderByDescending(x => x.CurrentAbility)
                    .Take(numberOfYouthPlayersNeeded);

                PickedPlayerIds.AddRange(bestAvailableYoungPlayers.Select(x => x.ID));
                PlayersAddedEvent(bestAvailableYoungPlayers);
            });

            Reload(core);

            PickedPlayerIds = new List<int>();
        }
コード例 #19
0
 public SelectRequestDatePageViewModel()
 {
     LoadedCommand = new RelayCommand(Loaded);
     UnloadedCommand = new RelayCommand(Unloaded);
     PrevCommand = new RelayCommand(Prev);
     NextCommand = new RelayCommand(Next);
 }
コード例 #20
0
        public AdminVM()
        {
            // Commands:
            AdminLoginCommand = new RelayCommand(DoAdminLogin);
            CloseApplicationCommand = new RelayCommand(CloseApplication);
            AdminChangePasswordCommand = new RelayCommand(ChangeAdminPassword);
            ShowChangePasswordCommand = new RelayCommand(ShowChangePassword);

            // Admin Commands for users
            DeleteSelectedUserCommand = new RelayCommand<User>(DeleteSelectedUser);
            AddNewUserCommand = new RelayCommand(AddNewUser);
            ShowLogForUser = new RelayCommand<User>(UserShowLog);

            // Admin Commands for products
            DeleteSelectedProductCommand = new RelayCommand<Product>(DeleteSelectedProduct);
            AddNewProductCommand = new RelayCommand(AddNewProduct);
            ShowLogForProduct = new RelayCommand<Product>(ProductShowLog);

            // Log commands:
            ShowFullUserLogCommand = new RelayCommand(ShowUsersLog);
            ShowFullAdminLogCommand = new RelayCommand(ShowAdminLog);
            ShowFullTransactionLogCommand = new RelayCommand(ShowTransactionsLog);

            // Admin commands for Load, Save and New
            SaveDataCommand = new RelayCommand(SaveCurrentData);
            LoadDataCommand = new RelayCommand(LoadExistingData);
            NewDataCommand = new RelayCommand(NewData);
            GenerateBillCommand = new RelayCommand(GenerateBill);
        }
コード例 #21
0
        public PasswordEditorViewModel( IPasswordEditorModel model,
                                        DerivedPasswordViewModel.Factory derivedPasswordFactory,
                                        IExclusiveDelayedScheduler scheduler,
                                        IClipboardService clipboardService,
                                        IDialogService dialogService,
                                        IGuidToColorConverter guidToColor )
        {
            _model = model;
            _scheduler = scheduler;
            _clipboardService = clipboardService;
            _dialogService = dialogService;
            _guidToColor = guidToColor;
            _derivedPasswords = new ObservableCollection<DerivedPasswordViewModel>(
                _model.DerivedPasswords.Select( dp => derivedPasswordFactory( dp, _model ) ) );

            foreach ( DerivedPasswordViewModel passwordSlotViewModel in DerivedPasswords )
                passwordSlotViewModel.PropertyChanged += OnDerivedPasswordPropertyChanged;

            _saveCommand = new RelayCommand( ExecuteSave, CanExecuteSave );
            _copyCommand = new RelayCommand( ExecuteCopy, CanExecuteCopy );
            _deleteCommand = new RelayCommand( ExecuteDelete, CanExecuteDelete );

            _closeSelfCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.Self ) );
            _closeAllCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.All ) );
            _closeAllButSelfCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.AllButSelf ) );
            _closeToTheRightCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.RightOfSelf ) );
            _closeInsecureCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.Insecure ) );

            Refresh( );
        }
コード例 #22
0
        public BluetoothConnectionManager()
        {
            BluetoothCancelCommand = new RelayCommand(AbortConnection);
            BluetoothDisconnectCommand = new RelayCommand(Disconnect);
            //reader = new DataReader(socket.InputStream);

        }
コード例 #23
0
 public SearchViewModel(ISearchService searchService)
 {
     this.searchService = searchService;
     Search = new RelayCommand(SearchExecuted);
     ShowDetails = new RelayCommand<SearchResult>(ShowDetailsExecuted);
     Results = new List<SearchResult>();
 }
コード例 #24
0
 public TerminalWindowViewModel()
     : base()
 {
     HomeCommand = new RelayCommand(Home);
     SearchServiceCommand = new RelayCommand(SearchService);
     UnloadedCommand = new RelayCommand(Dispose);
 }
コード例 #25
0
        public ViewModel_MainWindow()
        {
            if (!DesignerProperties.GetIsInDesignMode(Application.Current.MainWindow))
            {
                this.TrackDetails.Title = "Initializing Spotify ...";
                if (Wrapper_Spotify.Init())
                {
                    Wrapper_Skype.Init();

                    Updater.I.Start();
                    StatusEffects.I.Start();

                    NameEffect.I.Start();
                    NameEffect.I.UpdateEffect(2);
                    NameEffect.I.UpdateTrackDetails("Jayson Ragasa ");

                    Wrapper_Spotify.TrackChanged += Wrapper_Spotify_TrackChanged;

                    Command_Update = new RelayCommand(Commnad_Update_Click);

                    this.Pattern = Properties.Settings.Default.Pattern;
                    this.SelectedEffect = Properties.Settings.Default.SelectedEffect;
                }
                else
                {
                    this.TrackDetails.Title = "Make sure you're running Spotify. Please restart this app";
                    Process.GetCurrentProcess().Kill();
                }
            }
        }
コード例 #26
0
 public AllSongsViewModel()
 {
     GoBackCommand = new RelayCommand(GoBack);
     AddToQueueCommand = new RelayCommand(AddToQueue);
     PlayCommand = new RelayCommand(Play);
     SongHits = (List<Song>)NavigationService.GetInstance().Content;   
 }
コード例 #27
0
 /// <summary>
 /// Register commands
 /// </summary>
 private void RegisterCommands()
 {
     StopPlayingMediaCommand = new RelayCommand(() =>
     {
         Messenger.Default.Send(new StopPlayingMovieMessage());
     });
 }
コード例 #28
0
        public IntroductionViewModel(GenericDataAccess<string> dataAccess)
        {
            this.dataAccess = dataAccess;
            introduction = dataAccess.TryLoad();

            SaveCommand = new RelayCommand<object>(_ => Save());
        }
コード例 #29
0
ファイル: UserPageViewModel.cs プロジェクト: xbadcode/Rubezh
		public UserPageViewModel()
		{
			Title = "Пользователи";
			Users = new ObservableCollection<CheckedItemViewModel<User>>(ClientManager.SecurityConfiguration.Users.Select(item => new CheckedItemViewModel<User>(item)));
			SelectAllCommand = new RelayCommand(() => Users.ForEach(item => item.IsChecked = true));
			SelectNoneCommand = new RelayCommand(() => Users.ForEach(item => item.IsChecked = false));
		}
コード例 #30
0
        public SuppliersListViewModel()
        {
            if (DesignerProperties.GetIsInDesignMode(
                new System.Windows.DependencyObject())) return;

            try
            {
                var suppliers = db.Suppliers.Include(s => s.Suburb);
                Suppliers = new ObservableCollection<Supplier>(suppliers.ToList());
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message.ToString());
            }
            try
            {
                var suburbs = db.Suburbs.ToList();
                Suburbs = new ObservableCollection<Suburb>(suburbs);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message.ToString());
            }

            _newSupplier = new Supplier();
            _searchResults = new ObservableCollection<Supplier>();

            DeleteSupplierCommand = new RelayCommand<Supplier>(onDeleteSupplier);
            UpdateSupplierCommand = new RelayCommand<Supplier>(onUpdateSupplier);
            AddSupplierCommand = new RelayCommand<Supplier>(onAddSupplier);
            FindSuppliersCommand = new RelayCommand<string>(onFindSuppliers);
        }
コード例 #31
0
        public Group99SettingsViewModel(IUserInterfaceRoot uiRoot, ILogger logger,
                                        IAinSettingsReaderWriter ainSettingsReaderWriter, IAinSettingsReadNotify ainSettingsReadNotify,
                                        IAinSettingsStorage ainSettingsStorage, IAinSettingsStorageUpdatedNotify ainSettingsStorageUpdatedNotify,
                                        IAinsCounter ainsCounter,
                                        IEngineSettingsReader engineSettingsReader, IEngineSettingsWriter engineSettingsWriter,
                                        IEngineSettingsReadNotify engineSettingsReadNotify, IEngineSettingsStorage engineSettingsStorage,
                                        IEngineSettingsStorageUpdatedNotify engineSettingsStorageUpdatedNotify,
                                        ImcwParameterViewModel imcwParameterVm)
        {
            _uiRoot = uiRoot;
            _logger = logger;

            _ainSettingsReaderWriter         = ainSettingsReaderWriter;
            _ainSettingsReadNotify           = ainSettingsReadNotify;
            _ainSettingsStorage              = ainSettingsStorage;
            _ainSettingsStorageUpdatedNotify = ainSettingsStorageUpdatedNotify;
            _ainsCounter = ainsCounter;

            _engineSettingsReader               = engineSettingsReader;
            _engineSettingsWriter               = engineSettingsWriter;
            _engineSettingsReadNotify           = engineSettingsReadNotify;
            _engineSettingsStorage              = engineSettingsStorage;
            _engineSettingsStorageUpdatedNotify = engineSettingsStorageUpdatedNotify;

            _imcwParameterVm = imcwParameterVm;


            Parameter01Vm =
                new ParameterDecimalEditCheckViewModel(
                    "99.01. Номинальное напряжение обмотки статора (действующее) [В]", "f0", 0, 10000);
            Parameter02Vm =
                new ParameterDecimalEditCheckViewModel("99.02. Номинальный ток обмотки статора [А]", "f0", 0, 10000);
            Parameter03Vm =
                new ParameterDecimalEditCheckViewModel("99.03. Номинальная частота напряжения питающей сети [Гц]", "f1",
                                                       8, 300);
            Parameter04Vm =
                new ParameterDecimalEditCheckViewModel("99.04. Номинальная скорость вращения двигателя [об/мин]", "f0",
                                                       0, 18000);
            Parameter05Vm =
                new ParameterDecimalEditCheckViewModel("99.05. Максимальная скорость вращения двигателя [об/мин]", "f0",
                                                       0, 18000);
            Parameter06Vm =
                new ParameterDecimalEditCheckViewModel("99.06. Номинальная мощность на валу двигателя [кВт]", "f3", 0,
                                                       9000);
            Parameter07Vm = new ParameterComboEditableViewModel <int>("99.07. Режим управления двигателем",
                                                                      new[]
            {
                new ComboItemViewModel <int> {
                    ComboText = "Скалярный", ComboValue = 0
                },
                new ComboItemViewModel <int> {
                    ComboText = "Векторный", ComboValue = 1
                }
            });
            Parameter07Vm.PropertyChanged += Parameter07VmOnPropertyChanged;

            _imcwParameterVm.PropertyChanged += ImcwParameterVmOnPropertyChanged;

            Parameter08Vm =
                new ParameterDecimalEditCheckViewModel("99.08. Номинальный коэффициент мощности cos(ϕ)", "f2", 0, 1.0m);
            Parameter09Vm =
                new ParameterDecimalEditCheckViewModel("99.09. Номинальный КПД двигателя [%]", "f1", 0, 100.0m);
            Parameter10Vm = new ParameterDecimalEditCheckViewModel("99.10. Масса двигателя [кг]", "f0", 0, 10000);
            Parameter11Vm = new ParameterDecimalEditCheckViewModel("99.11. Кратность максимального момента (Mmax/Mnom)",
                                                                   "f0", 0, 10000);
            Parameter12Vm = new ParameterDecimalEditCheckViewModel("99.12. Конструктивная высота [мм]", "f0", 0, 10000);

            ReadSettingsCmd  = new RelayCommand(ReadSettings, () => true); // TODO: read only when connected to COM
            WriteSettingsCmd =
                new RelayCommand(WriteSettings, () => IsWriteEnabled);     // TODO: read only when connected to COM

            _ainSettingsReadNotify.AinSettingsReadComplete      += AinSettingsReadNotifyOnAinSettingsReadComplete;
            _ainSettingsStorageUpdatedNotify.AinSettingsUpdated += (zbAinNuber, settings) =>
            {
                _uiRoot.Notifier.Notify(() => WriteSettingsCmd.RaiseCanExecuteChanged());
            };

            _engineSettingsReadNotify.EngineSettingsReadComplete +=
                EngineSettingsReadNotifyOnEngineSettingsReadComplete;
            _engineSettingsStorageUpdatedNotify.EngineSettingsUpdated += settings =>
            {
                _uiRoot.Notifier.Notify(() => WriteSettingsCmd.RaiseCanExecuteChanged());
            };
        }
コード例 #32
0
 public SonViewModel()
 {
     InvokeEventCommand = new RelayCommand(() => Event(this, new EventArgs()));
 }
コード例 #33
0
 public BackupFileFormatErrorViewModel()
 {
     OkCommand = new RelayCommand(Ok);
 }
コード例 #34
0
 public QueuePageViewModel(ApplicationState appState, INavigation navigation)
 {
     _appState    = appState;
     _navigation  = navigation;
     WatchCommand = new RelayCommand(CanWatch, Watch);
 }
        public ParaSubProcManagementPageViewModel(IMapper mapper, Fanuc fanuc)
        {
            _fanuc  = fanuc;
            _mapper = mapper;

            LoadedCommand             = new RelayCommand(OnLoaded);
            UnloadedCommand           = new RelayCommand(OnUnloaded);
            RefreshFileCommand        = new RelayCommand(OnRefreshFile);
            SaveToPcCommand           = new RelayCommand(OnSaveToPc);
            LoadAndShowCommand        = new RelayCommand(OnLoadAndShow);
            SaveAndApplicationCommand = new RelayCommand(OnSaveAndApplication);
            FileFolderCommand         = new RelayCommand(OnFileFolder);

            GetProcFiles(CurFileFolder);

            Messenger.Default.Register <RecipesInfo>(this, "ParaRecipesInfoMsg2", msg =>
            {
                foreach (var info in msg.PmcBoms)
                {
                    var rec = RecipesInfos.Where(x => x.Id == info.Id && x.PmcType == true).FirstOrDefault();

                    if (rec == null)
                    {
                        DispatcherHelper.CheckBeginInvokeOnUI(() =>
                        {
                            RecipesInfos.Add(new RecipesInfoItemDto()
                            {
                                Id         = info.Id,
                                PmcType    = true,
                                Name       = info.Name,
                                PmcBomItem = new PmcBomItemRecipesDto()
                                {
                                    Id               = info.Id,
                                    Adr              = info.Adr,
                                    AdrType          = info.AdrType,
                                    Bit              = info.Bit,
                                    ConversionFactor = info.ConversionFactor,
                                    DataType         = info.DataType,
                                    IsRecipes        = info.IsRecipes,
                                    Value            = info.Value
                                }
                            });
                        });
                    }
                    else
                    {
                        rec.Value = info.Value;

                        if (rec.Value != null && rec.FileValue != null)
                        {
                            double v1, v2;
                            var ret_v1 = double.TryParse(rec.Value, out v1);
                            var ret_v2 = double.TryParse(rec.FileValue, out v2);

                            if (ret_v1 == false || ret_v2 == false)
                            {
                                bool v3, v4;
                                var ret_v3 = bool.TryParse(rec.Value, out v3);
                                var ret_v4 = bool.TryParse(rec.FileValue, out v4);

                                if (ret_v3 == true && ret_v4 == true)
                                {
                                    if (v3 == v4)
                                    {
                                        rec.UpDown = 0;
                                    }
                                }
                            }
                            else
                            {
                                rec.UpDown = v1 - v2;
                            }
                        }
                        else
                        {
                            rec.UpDown = null;
                        }
                    }
                }

                foreach (var info in msg.MacroBoms)
                {
                    var rec = RecipesInfos.Where(x => x.Id == info.Id && x.MacroType == true).FirstOrDefault();

                    if (rec == null)
                    {
                        DispatcherHelper.CheckBeginInvokeOnUI(() =>
                        {
                            RecipesInfos.Add(new RecipesInfoItemDto()
                            {
                                Id           = info.Id,
                                Name         = info.Name,
                                MacroType    = true,
                                MacroBomItem = new MacroBomItemRecipesDto()
                                {
                                    Id        = info.Id,
                                    Adr       = info.Adr,
                                    IsRecipes = info.IsRecipes,
                                    Value     = info.Value
                                }
                            });
                        });
                    }
                    else
                    {
                        rec.Value = info.Value;

                        if (rec.Value != null && rec.FileValue != null)
                        {
                            double v1, v2;
                            var ret_v1 = double.TryParse(rec.Value, out v1);
                            var ret_v2 = double.TryParse(rec.FileValue, out v2);

                            if (ret_v1 == false || ret_v2 == false)
                            {
                                bool v3, v4;
                                var ret_v3 = bool.TryParse(rec.Value, out v3);
                                var ret_v4 = bool.TryParse(rec.FileValue, out v4);

                                if (ret_v3 == true && ret_v4 == true)
                                {
                                    if (v3 == v4)
                                    {
                                        rec.UpDown = 0;
                                    }
                                }
                            }
                            else
                            {
                                rec.UpDown = v1 - v2;
                            }
                        }
                        else
                        {
                            rec.UpDown = null;
                        }
                    }
                }

                foreach (var info in RecipesInfos.Where(x => x.PmcType == true))
                {
                    if (msg.PmcBoms.Where(x => x.Id == info.Id).Count() == 0)
                    {
                        DispatcherHelper.CheckBeginInvokeOnUI(() =>
                        {
                            RecipesInfos.Remove(info);
                        });
                    }
                }

                foreach (var info in RecipesInfos.Where(x => x.MacroType == true))
                {
                    if (msg.MacroBoms.Where(x => x.Id == info.Id).Count() == 0)
                    {
                        DispatcherHelper.CheckBeginInvokeOnUI(() =>
                        {
                            RecipesInfos.Remove(info);
                        });
                    }
                }
            });
        }
コード例 #36
0
ファイル: SummaryScanBagItem.cs プロジェクト: lulzzz/iRadiate
 public SummaryScanBagItem(Study s)
 {
     _study = s;
     LoadSelectedPatientImageCommand = new RelayCommand(loadSelectedPatientImage);
     foreach (Appointment a in _study.Appointments.Where(x => x.Deleted == false).OrderBy(z => z.ScheduledArrivalTime))
     {
         AppointmentSummary aSum = new AppointmentSummary();
         aSum.Comments        = a.Comments;
         aSum.AppointmentDate = a.ScheduledArrivalTime;
         aSum.DayNumber       = a.DayNumber;
         foreach (BasicTask b in a.Tasks.Where(y => y.Deleted == false && y.IsCancelled == false).OrderBy(z => z.SchedulingTime))
         {
             if (b is ScanTask)
             {
                 ProcedureEvent p = new ProcedureEvent();
                 if (b.Assignee != null)
                 {
                     p.StaffMember = b.Assignee.FullName;
                 }
                 p.Completed           = b.Completed;
                 p.Summary             = new ScanSummaryControl();
                 p.Summary.DataContext = new ScanTaskSummaryViewModel(b);
                 if (b.Room != null)
                 {
                     p.Description = "Scan on " + b.Room.Name;
                 }
                 p.ProcedureDate = ((ScanTask)b).ValidCommencementTime;
                 aSum.ProcedureEvents.Add(p);
             }
             if (b is DoseAdministrationTask)
             {
                 ProcedureEvent p = new ProcedureEvent();
                 if (!b.Completed)
                 {
                     continue;
                 }
                 if (b.Assignee != null)
                 {
                     p.StaffMember = b.Assignee.FullName;
                 }
                 p.Summary             = new DoseSummaryControl();
                 p.Summary.DataContext = b;
                 p.Completed           = b.Completed;
                 p.Description         = "Dose administered";
                 p.ProcedureDate       = (b as DoseAdministrationTask).UnitDose.AdministrationDate;
                 aSum.ProcedureEvents.Add(p);
             }
             if (b is ArrivalTask)
             {
                 if (!b.Completed)
                 {
                     continue;
                 }
                 ProcedureEvent p = new ProcedureEvent();
                 if (b.Assignee != null)
                 {
                     p.StaffMember = b.Assignee.FullName;
                 }
                 p.Completed     = b.Completed;
                 p.Description   = "Patient arrived";
                 p.ProcedureDate = b.ValidCompletionTime;
                 aSum.ProcedureEvents.Add(p);
             }
         }
         if (a.Completed)
         {
             ProcedureEvent p = new ProcedureEvent();
             p.Completed     = true;
             p.Description   = "Appointment completed";
             p.ProcedureDate = a.CompletionTime;
             aSum.ProcedureEvents.Add(p);
         }
         AppointmentSummaries.Add(aSum);
     }
 }
コード例 #37
0
        public EditViewModel()
        {
            //put the states in the combo box
            try
            {
                // Code a query to retrieve the required information from
                // the States table, and sort the results by state name.
                // Bind the State combo box to the query results.
                var states = (from state in MMABooksEntity.mmaBooks.States orderby state.StateName select state).ToList();
                States = new ObservableCollection <State>(states);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString());
            }

            //register for the messenger sent by MainView
            Messenger.Default.Register <Customer>(this, "CustomerToEdit", (customer) =>
            {
                try
                {
                    // Code a query to retrieve the selected customer
                    // and store the Customer object in the class variable.
                    EditCustomer = customer;
                    //display the customer in the Edit view screeen
                    this.DisplayCustomer();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.GetType().ToString());
                }
            });

            //cancel window command
            CancelCommand = new RelayCommand <Window>((window) =>
            {
                if (window != null)
                {
                    window.Close();
                }
            });

            //accept command that store the changes in the database
            AcceptCommand = new RelayCommand <Window>((window) =>
            {
                //Check customer information before updating
                if (IsValidData())
                {
                    //update the customer
                    PutCustomerData();
                    try
                    {
                        // Update the database.
                        MMABooksEntity.mmaBooks.SaveChanges();

                        //close the window
                        window.Close();

                        //Notify user and send customer back to MainViewModel for display
                        Messenger.Default.Send(new NotificationMessage("Changes Saved!"));
                        Messenger.Default.Send(EditCustomer, "edit");
                    }
                    // Add concurrency error handling.
                    // Place the catch block before the one for a generic exception.
                    catch (DbUpdateConcurrencyException ex)
                    {
                        ex.Entries.Single().Reload();
                        if (MMABooksEntity.mmaBooks.Entry(EditCustomer).State == EntityState.Detached)
                        {
                            MessageBox.Show("Another user has deleted " + "that customer.", "Concurrency Error");
                            window.Close();
                            Messenger.Default.Send(EditCustomer, "clear controls");
                        }
                        else
                        {
                            MessageBox.Show("Another user has updated " + EditCustomer.CustomerID, "Concurrency Error");
                            window.Close();
                            Messenger.Default.Send(EditCustomer, "refresh");
                        }
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, ex.GetType().ToString());
                    }
                }
                else
                {
                    MessageBox.Show("Incomplete / Invalid Data");
                }
            });
        }
コード例 #38
0
 public BookItemViewModel(Book book, IItemsService <Book> booksService)
 {
     Item              = book;
     _booksService     = booksService;
     DeleteBookCommand = new RelayCommand(OnDeleteBook);
 }
コード例 #39
0
 public void GivenSimpleCommand_WhenInvokingCommandWithNullAction_ThenItThrowsProper()
 {
     Assert.Throws <ArgumentNullException>(() => (simpleCommandRelayerSubject = new RelayCommand(null, () => { return(true); })));
     Assert.Throws <ArgumentNullException>(() => (paramsCommandRelayerSubject = new RelayCommand <object>(null, o => { return(true); })));
 }
コード例 #40
0
 public HypnoControllerViewModel()
 {
     ExecuteHyperlinkCommand = new RelayCommand(o => ExecuteHyperlink("http://www.hypnocube.com"));
 }
コード例 #41
0
        public void GivenSimpleCommand_WhenCheckingForCanExec_ThenItReturnsTrue()
        {
            simpleCommandRelayerSubject = new RelayCommand(() => TEST_OUTPUT += "1");

            Assert.True(SimpleCommand.CanExecute(null));
        }
コード例 #42
0
 public SettingsViewModel()
 {
     OnChooseDatabase = new RelayCommand <EventArgs>(ExecuteChooseDatabase);
 }
コード例 #43
0
 public RebootModalViewModel(IOsProcesses osProcesses)
 {
     _osProcesses      = osProcesses;
     RebootCommand     = new RelayCommand(RebootAction);
     SkipRebootCommand = new RelayCommand(SkipRebootAction);
 }
コード例 #44
0
        public void GivenParamCommand_WhenCheckingForCanExec_ThenItReturnsTrue()
        {
            paramsCommandRelayerSubject = new RelayCommand <object>(o => TEST_OUTPUT += "1");

            Assert.True(ParamCommand.CanExecute(null));
        }
コード例 #45
0
 internal void RegistEventHandler(RelayCommand <HotCollection> collectionTapped)
 {
     this._collectionTapped = collectionTapped;
 }
コード例 #46
0
 public ExceptionDialogViewModel()
 {
     ContinueCommand = new RelayCommand(() => InvokeDialogCloseRequest(true));
     QuitCommand     = new RelayCommand(() => InvokeDialogCloseRequest(false));
     ReportCommand   = new RelayCommand(() => { }, () => false);
 }
コード例 #47
0
        public AddStorageDialogViewModel(IStoragesService storagesService)
        {
            this.storagesService = storagesService;

            SaveCommand = new RelayCommand(async() => await CreateWarehouse());
        }
コード例 #48
0
 private void InitializeCommands()
 {
     PrintReportCommand        = new RelayCommand(() => PerformAction(PrintReport));
     GetTillAuditReportCommand = new RelayCommand(() => PerformAction(GetTillAuditReportAsync));
 }
コード例 #49
0
ファイル: LoginViewModel.cs プロジェクト: brucewilkins/PowaWP
 public LoginViewModel()
 {
     LoginCommand   = new RelayCommand(OnLogin);
     ContactCommand = new RelayCommand(OnContact);
 }
コード例 #50
0
 public TimelineViewModel()
 {
     Initialize(Device.RuntimePlatform != Device.UWP);
     SelectSingleCommand = new RelayCommand <NotifyCollectionChangedEventArgs>(SelectSingleAsync);
 }
 protected SLR_DockpaneViewModel()
 {
     _btnSelectLayerBySLRCmd = new RelayCommand(() => SelectLayerBySLR(), () => true);
     SliderValue             = 0;
     CkbLandUseChecked       = true;
 }
コード例 #52
0
        public MainViewModel(Chat tcpChat)
        {
            chat = tcpChat;
            chat.OnMessageRecieved += HandleRecievedMessage;
            chat.OnStrokeRecieved  += HandleRecievedStroke;
            chat.OnUserConnected   += user =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (OnlineUsers.Contains(user))
                    {
                        return;
                    }
                    OnlineUsers.Add(user);
                });
            };
            chat.OnUserLogout += user =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (!OnlineUsers.Contains(user))
                    {
                        return;
                    }
                    OnlineUsers.Remove(user);
                });
            };
            chat.OnUsersListReceived += users =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    foreach (var user in users)
                    {
                        if (OnlineUsers.Contains(user))
                        {
                            continue;
                        }
                        OnlineUsers.Add(user);
                    }
                });
            };

            Messages    = new ObservableCollection <ChatMessage>();
            Strokes     = new ObservableCollection <Stroke>();
            OnlineUsers = new ObservableCollection <string>();

            OpenDrawRoomCommand = new RelayCommand(x => { WindowService.ShowWindow(new DrawingRoomViewModel(chat)); });
            SendMessageCommand  = new RelayCommand(x =>
            {
                if (!chat.IsConnected)
                {
                    MessageBox.Show("Connection Failed");
                    return;
                }
                if (string.IsNullOrWhiteSpace(TextField))
                {
                    return;
                }
                chat.Send(TextField);
                TextField = "";
                OnPropertyChanged("TextField");
            });
        }
コード例 #53
0
 private void CreateShutdownRelayCmd()
 {
     ShutdownCmd = new RelayCommand <object>(OnShutdown, (o) => CanShutdown);
 }
コード例 #54
0
 public CommandVM()
 {
     Send = new RelayCommand(SendExecute);
 }
コード例 #55
0
 public NavigationManager()
     : base()
 {
     this.navigateBackCommand = new RelayCommand(GoBack, () => { return(this.CanGoBack); });
 }
コード例 #56
0
 private void CreateRestartRelayCmd()
 {
     RestartCmd = new RelayCommand <object>(OnRestart, (o) => CanRestart);
 }
コード例 #57
0
 public LoginVM()
 {
     LoginCommand = new RelayCommand(Login);
 }
コード例 #58
0
 public MainWindowVM()
 {
     ButtonClick = new RelayCommand(Click);
     WindowLoaded();
 }
コード例 #59
0
 public StartTrainingViewModel(StartTrainingPage startTrainingPage)
 {
     _startTrainingPage      = startTrainingPage;
     NewTrainingCommand      = new RelayCommand(NewTrainingCommandImpl);
     ExistingTrainingCommand = new RelayCommand(ExistingTrainingCommandImpl);
 }
コード例 #60
0
 public TunInUseModalViewModel(IAppSettings appSettings, IVpnManager vpnManager)
 {
     _vpnManager        = vpnManager;
     _appSettings       = appSettings;
     SwitchToTapCommand = new RelayCommand(SwitchToTapAction);
 }