コード例 #1
0
 public ThoughtRecordEditModel(int thoughtRecordId, IDatabaseService db)
 {
     stringLoader           = new StringResourceService("PageTitles");
     newThoughtRecordTitle  = stringLoader.GetString("NewThoughtRecordPageTitle");
     editThoughtRecordTitle = stringLoader.GetString("EditThoughtRecordPageTitle");
     Title = editThoughtRecordTitle;
     thoughtRecordService = new ThoughtRecordService();
     SectionTitles        = thoughtRecordService.GetTitleModel();
     database             = db;
     InitializeThoughtRecord(thoughtRecordId);
     DefaultInputText = thoughtRecordService.GetDefaultInputText();
     commandsEnabled  = true;
 }
コード例 #2
0
 public void CreateNewThoughtRecord()
 {
     Title                   = newThoughtRecordTitle;
     thoughtRecord           = new ThoughtRecord();
     thoughtRecord.Situation = new Situation();
     thoughtRecord.Emotions  = new List <Emotion>();
     DefaultInputText        = thoughtRecordService.GetDefaultInputText();
     thoughtRecordService.PopulateWithDefaultValues(thoughtRecord);
     observableEmotions = new ObservableCollection <Emotion>(thoughtRecord.Emotions);
     RegisterForEmotionChangeEvents(observableEmotions);
     observableEmotions.CollectionChanged += UpdateModelEmotionCollection;
     OnPropertyChanged(string.Empty);
     IsCurrentDataSaved = true;
     OnNewThoughtRecordCreated?.Invoke(this, new EventArgs());
 }