Пример #1
0
 public ScenarioSelectViewModel()
 {
     CallScenarioCommand = new Commands.RelayCommand(command =>
     {
         ScenarioCalled?.Invoke((Util.Scenario)command);
     });
 }
Пример #2
0
        public ResourceAccessor(Logging.Logger logger)
        {
            mLoggerRef = logger;
            mContent   = "";

            mConfig = Helpers.Serialization.Deserialize <ResourceConfig>(cConfigPath);
            if (mConfig == null)
            {
                mConfig = new ResourceConfig();
            }

            m_Suzuki = new SuzukiLibrary.Suzuki();

            SaveResourceConfigCommand = new Commands.RelayCommand(SaveConfig);
            GetResourceCommand        = new Commands.RelayCommand(GetResource);
            SetResourceCommand        = new Commands.RelayCommand(SetResource);
            StartElectionCommand      = new Commands.RelayCommand(StartElection);
            KillTokenCommand          = new Commands.RelayCommand(m_Suzuki.KillToken);

            m_Suzuki.Init(LogMessage);
        }
 public NewPrivateMessagePageViewModel()
     : base()
 {
     SelectSmileyCommand = new Commands.RelayCommand(SelectSmiley);
     SelectTagCommand    = new Commands.RelayCommand(SelectTag);
 }
Пример #4
0
        public MainWindowViewModel(IDialogService dialogService)
        {
            if (IsInDesignMode)
            {
                Service = new DbServiceMock("designmode");
            }
            else
            {
                String folderPath = System.IO.Directory.GetCurrentDirectory();
                //_DbFilePath = folderPath + @"\FreqDB.mdf";
                //_DbFilePath = @"..\..\FreqDB.mdf";
                _DbFilePath = @"C:\Users\Dirty Harry\Source\FreqMngr\FreqMngr.WPF\FreqMngr\FreqDb.mdf";
                //System.Windows.MessageBox.Show(_DbFilePath);
                Service = new DbService(_DbFilePath);
            }

            this._DialogService = dialogService;

            this.PropertyChanged += MainWindowViewModel_PropertyChanged;

            LoadDatabaseCommand  = new Commands.RelayCommand((item) => { LoadDatabase(); }, (item) => { return(true); });
            CloseDatabaseCommand = new Commands.RelayCommand((item) => { CloseDatabase(); });

            NewGroupCommand = new Commands.RelayCommand((item) => { NewGroup(); }, (item) => { if (_ActiveGroup == null)
                                                                                               {
                                                                                                   return(false);
                                                                                               }
                                                                                               return(true); });
            RenameGroupCommand = new Commands.RelayCommand((item) => { RenameGroup(_ActiveGroup); }, (item) => { if (_ActiveGroup == null)
                                                                                                                 {
                                                                                                                     return(false);
                                                                                                                 }
                                                                                                                 return(true); });

            FreqsSelectionChangedCommand = new Commands.RelayCommand((item) =>
            {
                _SelectedFreqs.Clear();

                IList <object> list = (IList <object>)item;
                if (list != null)
                {
                    foreach (object obj in list)
                    {
                        if (obj != null)
                        {
                            if (obj is Freq)
                            {
                                _SelectedFreqs.Add((obj as Freq));
                            }
                        }
                    }
                }
            });


            NewFreqCommand     = new Commands.RelayCommand((item) => { NewFreq(); }, (item => { return(true); }));
            SaveFreqCommand    = new Commands.RelayCommand((item) => { SaveActiveFreq(); }, (item) => { return(CanSaveActiveFreq()); });
            DeleteFreqsCommand = new Commands.RelayCommand((item) => { DeleteFreqs(); }, (item) => { return(CanDeleteFreqs()); });

            CutFreqsCommand          = new Commands.RelayCommand((item) => { CutFreqs(); }, (item) => { return(CanCutFreqs()); });
            CopyFreqsCommand         = new Commands.RelayCommand((item) => { CopyFreqs(); }, (item) => { return(CanCopyFreqs()); });
            PasteFreqsCommand        = new Commands.RelayCommand((item) => { PasteFreqs(); }, (item) => { return(CanPasteFreqs()); });
            GroupSwitchToEditingMode = new Commands.RelayCommand((item) => { _ActiveGroup.IsEditing = !_ActiveGroup.IsEditing; });

            SearchFreqsCommand = new Commands.RelayCommand((item) => { SearchFreqs(); }, (item) => { return(CanSearchFreqs()); });
            //SearchCommand = new Commands.RelayCommand((item) => {})
        }
Пример #5
0
 public NumericUpDown()
 {
     IncreaseValueCommand = new Commands.RelayCommand(IncreaseValue, CanIncreaseValue);
     DecreaseValueCommand = new Commands.RelayCommand(DecreaseValue, CanDecreaseValue);
 }
 public NewPrivateMessagePageViewModel()
     : base()
 {
     SelectSmileyCommand = new Commands.RelayCommand(SelectSmiley);
     SelectTagCommand = new Commands.RelayCommand(SelectTag);
 }