private void RefreshExcludedAndIncludedVariables() { var allVariableNames = Element.CustomVariables .Where(item => item.IsShared == false) .Select(item => item.Name) .ToList(); var excludedVariables = category.ExcludedVariables; var includedVariables = allVariableNames.Except(excludedVariables); IncludedVariables.Clear(); foreach (var variable in includedVariables) { this.IncludedVariables.Add(variable); } ignoreExcludedVariableChanges = true; ExcludedVariables.Clear(); foreach (var variable in excludedVariables) { this.ExcludedVariables.Add(variable); } ignoreExcludedVariableChanges = false; }
internal void ExcludeSelected() { if (!string.IsNullOrEmpty(SelectedIncludedVariable)) { var oldSelectedIndex = IncludedVariables.IndexOf(SelectedIncludedVariable); var whatToMove = SelectedIncludedVariable; ExcludedVariables.Add(whatToMove); IncludedVariables.Remove(whatToMove); SelectedExcludedVariable = whatToMove; if (oldSelectedIndex < IncludedVariables.Count) { SelectedIncludedVariable = IncludedVariables[oldSelectedIndex]; } else if (IncludedVariables.Count > 0) { SelectedIncludedVariable = IncludedVariables[IncludedVariables.Count - 1]; } } }