/// <summary> /// Open window to add custom mapping /// </summary> private void OnAddCustomMapping() { new CustomMappingViewModel(); var newItem = AnswersMappingHelper.GetAnswersMappings() .FirstOrDefault(x => !this.AnswersMapping.Contains(x)); if (newItem != null) { this.AnswersMapping.Insert(0, newItem); this.SelectedMapping = newItem; } }
/// <summary> /// Initializes question values /// </summary> /// <param name="name">Question name</param> /// <param name="top">Top position on parent canvas</param> /// <param name="left">Left position on parent canvas</param> /// <param name="width">Question's width</param> /// <param name="height">Question's height</param> private void InitializeValues(string name, double top, double left, double width, double height) { this.Bubbles = new ObservableCollection <BubbleViewModel>(); this.AnswersMapping = new ObservableCollection <string>(AnswersMappingHelper.GetAnswersMappings()); this.Name = name; this.Top = top; this.Left = left; this.Width = width; this.Height = height; this.AddCustomMappingCommand = new RelayCommand(x => this.OnAddCustomMapping()); }
/// <summary> /// Open window to add custom mapping /// </summary> private void OnAddCustomMapping() { CustomMappingViewModel vm = new CustomMappingViewModel(); if (!vm.CustomMappingAdded) { return; } this.OnPropertyChanged(nameof(this.AnswersMapping)); string newItem = AnswersMappingHelper.GetAnswersMappings() .FirstOrDefault(x => x.Equals(vm.CustomMappingName)); if (newItem != null) { this.SelectedMapping = newItem; } }