public FilterModel(KeeperDb db, AccNameSelectionControlInitializer accNameSelectionControlInitializer) { AvailableAccNames = new List <AccName> { new AccName().PopulateFromAccount(db.SeekAccount("Мои"), new List <string>()) }; IsAccNamePosition12 = true; AmountEqualTo = true; IsCurrencyPosition12 = true; MyTagPickerVm = new TagPickerVm { TagSelectorVm = accNameSelectionControlInitializer.ForFilter(), Tags = MyTags }; IsTagsJoinedByAnd = true; CleanAll(); MyTags.CollectionChanged += MyTags_CollectionChanged; }
public void SetTran(TranWithTags tran) { TranInWork = tran; TranInWork.PropertyChanged += TranInWork_PropertyChanged; MyAccNameSelectorVm = _accNameSelectionControlInitializer.ForMyAccount(TranInWork); MyAccNameSelectorVm.PropertyChanged += MyAccNameSelectorVm_PropertyChanged; MySecondAccNameSelectorVm = _accNameSelectionControlInitializer.ForMySecondAccount(TranInWork); MySecondAccNameSelectorVm.PropertyChanged += MySecondAccNameSelectorVm_PropertyChanged; MyAmountInputControlVm = new AmountInputControlVm { LabelContent = GetAmountActionLabel(TranInWork), AmountColor = TranInWork.Operation.FontColor(), Amount = TranInWork.Amount, Currency = TranInWork.Currency }; MyAmountInputControlVm.PropertyChanged += MyAmountInputcControlVm_PropertyChanged; MyAmountInReturnInputControlVm = new AmountInputControlVm { LabelContent = "Получил", AmountColor = TranInWork.Operation.FontColor(), Amount = TranInWork.AmountInReturn, Currency = TranInWork.CurrencyInReturn }; MyAmountInReturnInputControlVm.PropertyChanged += MyAmountInReturnInputControlVm_PropertyChanged; MyTagPickerVm = new TagPickerVm { TagSelectorVm = _accNameSelectionControlInitializer.ForTags(TranInWork) }; foreach (var tag in tran.Tags) { var alreadyChosenTag = MyTagPickerVm.TagSelectorVm.AvailableAccNames.FindThroughTheForest(tag.Name); if (alreadyChosenTag != null) { MyTagPickerVm.Tags.Add(alreadyChosenTag); } } MyTagPickerVm.Tags.CollectionChanged += Tags_CollectionChanged; MyDatePickerVm = new DatePickerWithTrianglesVm() { SelectedDate = TranInWork.Timestamp }; MyDatePickerVm.PropertyChanged += MyDatePickerVm_PropertyChanged; }