Esempio n. 1
0
        private void ClickNewTopic(object o)
        {
            EditTopicWindow topicDialog = new EditTopicWindow();

            topicDialog.TopicValue = "";
            topicDialog.ShowDialog();
            if (topicDialog.DialogResult == true)
            {
                TopicDTO topic = new TopicDTO()
                {
                    Topic = topicDialog.TopicValue
                };
                long newId = BibleBeliefsRepository.CreateTopic(topic);
                Topics = BibleBeliefsRepository.GetTopics();
                var t = Topics.Single(s => s.Id == newId);
                if (t != null)
                {
                    SelectedTopic = t;
                }
                else
                {
                    SelectedTopic = Topics[0];
                }
            }
        }
Esempio n. 2
0
 private void ClickDeleteTopic(object o)
 {
     if (!BibleBeliefsRepository.DeleteTopic(_SelectedTopic))
     {
         MessageBox.Show("Topic has child beliefs. You must delete the beliefs before you can delete the topic!");
     }
     else
     {
         Topics = BibleBeliefsRepository.GetTopics();
     }
 }
Esempio n. 3
0
 public MainViewModel()
 {
     _BibleRepository    = new BibleRepository();
     Topics              = BibleBeliefsRepository.GetTopics();
     SelectedTopic       = Topics[0];
     NewTopicCommand     = new DelegateCommand <object>(ClickNewTopic, (object o) => true);
     NewBeliefCommand    = new DelegateCommand <object>(ClickNewBelief, (object o) => SelectedTopic != null);
     NewVerseCommand     = new DelegateCommand <object>(ClickNewVerse, (object o) => SelectedBelief != null);
     EditTopicCommand    = new DelegateCommand <object>(ClickEditTopic, (object o) => true);
     EditBeliefCommand   = new DelegateCommand <object>(ClickEditBelief, (object o) => SelectedTopic != null);
     EditVerseCommand    = new DelegateCommand <object>(ClickEditVerse, (object o) => SelectedBelief != null);
     DeleteTopicCommand  = new DelegateCommand <object>(ClickDeleteTopic, (object o) => true);
     DeleteBeliefCommand = new DelegateCommand <object>(ClickDeleteBelief, (object o) => SelectedTopic != null);
     DeleteVerseCommand  = new DelegateCommand <object>(ClickDeleteVerse, (object o) => SelectedBelief != null);
 }