/// <summary> /// Метод редактирования характеристики /// </summary> public void EditCharacteristic() { var editCharactView = new AddOrEditCharacteristic { btnOk = { Visibility = Visibility.Visible }, btnAddCharact = { Visibility = Visibility .Collapsed }, btnCansel = { Visibility = Visibility .Collapsed } }; var context = (AddOrEditCharacteristicViewModel)editCharactView.DataContext; context.SetSelCha(this); var HotSaveCommand = new RelayCommand(() => { context.OkCommand.Execute(null); editCharactView.Close(); }); editCharactView.InputBindings.Add(new KeyBinding(HotSaveCommand, new KeyGesture(Key.S, ModifierKeys.Control))); // Экспорт характеристики var ExportChaCommand = new RelayCommand(() => context.IsDevMode = true); editCharactView.InputBindings.Add(new KeyBinding(ExportChaCommand, new KeyGesture(Key.E, ModifierKeys.Control))); editCharactView.ShowDialog(); Messenger.Default.Send <string>("Обновить информацию!"); }
/// <summary> /// Добавить новую характеристику /// </summary> /// <returns>Новая характеристика</returns> public static Characteristic AddCharacteristic(string nameOf = "") { var addCharactView = new AddOrEditCharacteristic { btnOk = { Visibility = Visibility .Collapsed }, btnAddCharact = { Visibility = Visibility .Visible }, btnCansel = { Visibility = Visibility .Visible } }; var context = (AddOrEditCharacteristicViewModel)addCharactView.DataContext; context.addCha(); if (string.IsNullOrEmpty(nameOf)) { nameOf = "Название"; } context.SelectedChaProperty.NameOfProperty = nameOf; Messenger.Default.Send <string>("Фокусировка на названии!"); context.SelectedChaProperty.CountVisibleLevelValue(); context.SelectedChaProperty.FirstVal = 0; addCharactView.ShowDialog(); StaticMetods.PersProperty.NewRecountExp(); return(context.SelectedChaProperty); }