private static int InsertConnectionStringAtBeginningOfList(SelectableListNodeList list, AltaxoOleDbConnectionString connString) { // look for item in the list var index = list.IndexOfFirst(x => connString.OriginalConnectionString == ((AltaxoOleDbConnectionString)x.Tag).OriginalConnectionString); // add good values to the list if (index < 0) // was not before in the list { list.ClearSelectionsAll(); list.Insert(0, new SelectableListNode(connString.OriginalConnectionString, connString, true)); index = 0; // inserted at index 0 } else if (index > 0) // was in the list before { list.ClearSelectionsAll(); list.RemoveAt(index); list.Insert(0, new SelectableListNode(connString.OriginalConnectionString, connString, true)); index = 0; } // trim list while (list.Count > _cmbConnStringMaxDropDownItems) { list.RemoveAt(list.Count - 1); } return(index); }
private void SetOperatorText(string op) { _operatorChoices.ClearSelectionsAll(); foreach (var node in _operatorChoices) { if (op == (string)node.Tag) { node.IsSelected = true; break; } } if (null != _view) { _view.SetOperatorChoices(_operatorChoices); } }
private void SetSecondaryChoiceToScales() { _listOfScales.ClearSelectionsAll(); _listOfScales[_currentScale].IsSelected = true; _primaryChoice = LayerControllerTabType.Scales; _view.InitializeSecondaryChoice(_listOfScales, _primaryChoice); }
private void EhSelectionChanged(object sender, SelectionChangedEventArgs e) { e.Handled = true; _choices.ClearSelectionsAll(); if (SelectedIndex >= 0) { _choices[SelectedIndex].IsSelected = true; } }
public void EhView_CreateOrMoveAxis(bool moveAxis) { if (!ApplyCurrentController(false, false)) { return; } var creationArgs = new AxisCreationArguments(); creationArgs.InitializeAxisInformationList(_doc.CoordinateSystem, _doc.AxisStyles); creationArgs.TemplateStyle = _currentAxisID; creationArgs.MoveAxis = moveAxis; if (!Current.Gui.ShowDialog(ref creationArgs, "Create/move axis", false)) { return; } if (_axisControl.ContainsKey(creationArgs.CurrentStyle)) { return; // the axis is already present } var oldIdentity = creationArgs.TemplateStyle; var newIdentity = creationArgs.CurrentStyle; var newAxisInfo = _doc.CoordinateSystem.GetAxisStyleInformation(newIdentity); AxisCreationArguments.AddAxis(_doc.AxisStyles, creationArgs); // add the new axis to the document _axisControl.Add(newIdentity, new AxisStyleControllerConditionalGlue(newAxisInfo, _doc.AxisStyles)); SetSecondaryChoiceToUnique(); _listOfAxes.ClearSelectionsAll(); _listOfAxes.Add(new SelectableListNode(newAxisInfo.NameOfAxisStyle, newIdentity, true)); if (creationArgs.MoveAxis && _axisControl.ContainsKey(oldIdentity)) { _axisControl.Remove(oldIdentity); for (int i = _listOfAxes.Count - 1; i >= 0; --i) { if (((CSLineID)_listOfAxes[i].Tag) == oldIdentity) { _listOfAxes.RemoveAt(i); break; } } } _currentAxisID = newIdentity; SetSecondaryChoiceToAxes(); SetCurrentTabController(false); }
/// <summary>Occurs when the user wants to make the preview to the common substring replacement permanent.</summary> private void EhApplySubstringReplacement() { foreach (MyXTableListNode node in _tableList) { if (node.PreviewTableName != null && Current.Project.DataTableCollection.Contains(node.PreviewTableName)) { node.NewTable = Current.Project.DataTableCollection[node.PreviewTableName]; node.PreviewTableName = null; } } _tableList.ClearSelectionsAll(); _view.InitializeExchangeTableList(_tableList); }
private void EhRadioButtonChecked(object sender, RoutedEventArgs e) { var rb = (RadioButton)sender; var node = rb.Tag as SelectableListNode; if (node != null) { _choices.ClearSelectionsAll(); node.IsSelected = true == rb.IsChecked; } if (null != SelectionChanged) { SelectionChanged(); } }
private void Initialize(bool initData) { if (initData) { _groupByChoices = new SelectableListNodeList(); _groupByChoices.FillWithEnumeration(_builder.GroupByExtension); } if (null != _view) { _groupByChoices.ClearSelectionsAll(); if (_builder.GroupBy) { _groupByChoices[(int)_builder.GroupByExtension].IsSelected = true; } _view.UpdateDialogValues(_builder.Distinct, _builder.Top, _groupByChoices); } }
private void EhEndValueChanged() { var endRescaling = (BoundaryRescaling)_endRescalingChoices.FirstSelectedNode.Tag; if (endRescaling == BoundaryRescaling.Auto) { _endRescalingChoices.ClearSelectionsAll(); foreach (var node in _endRescalingChoices) { if (BoundaryRescaling.AutoTempFixed == (BoundaryRescaling)node.Tag) { node.IsSelected = true; break; } } if (null != _view) { _view.EndRescaling = _endRescalingChoices; } } }