예제 #1
0
        private void FetchData()
        {
            bool wasSalvatorOn;

            if (DataSalvator.switchedOn)
            {
                DataSalvator.switchedOn = false;
                wasSalvatorOn           = true;
            }
            else
            {
                wasSalvatorOn = false;
            }

            DataSalvator.FlushChanges();
            Model = new DataModel();
            AddEntryCommand.RaiseCanExecuteChanged();

            if (Entries.Count > 0)
            {
                HighlightedEntry = Entries[0];
                IncreaseBookCountCommand.RaiseCanExecuteChanged();
                DecreaseBookCountCommand.RaiseCanExecuteChanged();
                DeleteEntryCommand.RaiseCanExecuteChanged();
            }
            ;
            if (wasSalvatorOn)
            {
                DataSalvator.switchedOn = true;
            }
        }
예제 #2
0
        private void AddEntry()
        {
            Entries.Add(DataSalvator.NewEntry());
            HighlightedEntry = Entries[Entries.Count - 1];

            RaisePropertyChanged("Entries");
            RaisePropertyChanged("HighlightedEntry");
            DecreaseBookCountCommand.RaiseCanExecuteChanged();
            DeleteEntryCommand.RaiseCanExecuteChanged();
            ProvideFeedback("An entry added");
        }