private void RemoveRakeBack(object obj)
 {
     if (obj is RakeBackModel)
     {
         RakeBackList.Remove(obj as RakeBackModel);
     }
 }
예제 #2
0
        public override object Clone()
        {
            var model = (RakeBackSettingsModel)this.MemberwiseClone();

            model.RakeBackList = RakeBackList.Where(x => x != null).Select(x => (RakeBackModel)x.Clone()).ToList();
            model.BonusesList  = BonusesList.Where(x => x != null).Select(x => (BonusModel)x.Clone()).ToList();

            return(model);
        }
        private void AddRakeBack(RakeBackModel rakeBack)
        {
            if (rakeBack == null)
            {
                return;
            }

            RakeBackList.Add(rakeBack);
            PopupModel.ClosePopup();
        }
        private void SetSettingsModelInternal(ISettingsBase model)
        {
            base.SetSettingsModel(model);

            BonusesList.CollectionChanged  -= BonusesList_CollectionChanged;
            RakeBackList.CollectionChanged -= RakeBackList_CollectionChanged;

            BonusesList.Clear();
            RakeBackList.Clear();

            if (SettingsModel?.BonusesList != null)
            {
                BonusesList.AddRange(SettingsModel.BonusesList);
            }

            if (SettingsModel?.RakeBackList != null)
            {
                RakeBackList.AddRange(SettingsModel.RakeBackList);
            }

            BonusesList.CollectionChanged  += BonusesList_CollectionChanged;
            RakeBackList.CollectionChanged += RakeBackList_CollectionChanged;
        }