/// <summary> /// Редактирование награды /// </summary> /// <param name="item"></param> public static void EditReward(Revard item) { var showRevard = new AddOrEditRevard { // Topmost = true, btnOk = { Visibility = Visibility.Visible }, btnAdd = { Visibility = Visibility.Collapsed }, btnCansel = { Visibility = Visibility.Collapsed } }; var showRevardVM = new AddOrEditRevardViewModel(item, false, false); showRevard.DataContext = showRevardVM; showRevard.btnOk.Click += (sender, args) => { showRevard.Close(); }; var HotSaveCommand = new RelayCommand(() => { showRevard.Close(); }); showRevard.InputBindings.Add(new KeyBinding(HotSaveCommand, new KeyGesture(Key.S, ModifierKeys.Control))); showRevard.ShowDialog(); StaticMetods.refreshShopItems(StaticMetods.PersProperty); }
private RelaysItem getRelaysItemFromRevard(Revard n) { return(new RelaysItem { IdProperty = n.GUID, ElementToolTipProperty = n.NameOfProperty, PictureProperty = n.PictureProperty }); }
/// <summary> /// Initializes a new instance of the <see cref="AddOrEditRevardViewModel"/> class. /// </summary> /// <param name="_revard">Награда, которую надо отредактировать или добавить</param> /// <param name="isArt">Артефакт</param> /// <param name="isBaige">Это знак отличия</param> public AddOrEditRevardViewModel(Revard _revard, bool isArt, bool isBaige) { ReqvireItemsVm = new ucRelaysItemsVM { IsNeedsProperty = false, IsReqvirementsProperty = true, ParrentDataContext = this }; if (_revard == null) { ObservableCollection <ChangeAbilityModele> changeAbility = new ObservableCollection <ChangeAbilityModele>(); foreach (var cha in this.PersProperty.Abilitis.Select( per => new ChangeAbilityModele { AbilityProperty = per, ChangeAbilityProperty = 0 })) { changeAbility.Add(cha); } ObservableCollection <ChangeCharacteristic> changeCharacteristics = new ObservableCollection <ChangeCharacteristic>(); foreach (var cha in this.PersProperty.Characteristics.Select(per => new ChangeCharacteristic { Charact = per, Val = 0 }) ) { changeCharacteristics.Add(cha); } _revard = new Revard { NameOfProperty = "Название награды", ChangeAbilitis = changeAbility, ChangeCharacteristics = changeCharacteristics, AbilityNeeds = new ObservableCollection <NeedAbility>(), NeedCharacts = new ObservableCollection <NeedCharact>(), NeedQwests = new ObservableCollection <Aim>(), GUID = Guid.NewGuid().ToString(), IsArtefact = isArt, IsBaige = isBaige }; if (!_revard.IsArtefact) { _revard.IsFromeTasksProperty = true; _revard.VeroyatnostProperty = StaticMetods.PersProperty.PersSettings.RedcoRewardProperty; } } if (_revard.NeedCharacts == null) { _revard.NeedCharacts = new ObservableCollection <NeedCharact>(); } if (_revard.AbilityNeeds == null) { _revard.AbilityNeeds = new ObservableCollection <NeedAbility>(); } if (_revard.NeedQwests == null) { _revard.NeedQwests = new ObservableCollection <Aim>(); } this.RevardProperty = _revard; }