예제 #1
0
        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);
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
        private void SetSecondaryChoiceToScales()
        {
            _listOfScales.ClearSelectionsAll();
            _listOfScales[_currentScale].IsSelected = true;

            _primaryChoice = LayerControllerTabType.Scales;
            _view.InitializeSecondaryChoice(_listOfScales, _primaryChoice);
        }
예제 #4
0
 private void EhSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     e.Handled = true;
     _choices.ClearSelectionsAll();
     if (SelectedIndex >= 0)
     {
         _choices[SelectedIndex].IsSelected = true;
     }
 }
예제 #5
0
        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);
        }
예제 #7
0
        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();
            }
        }
예제 #8
0
 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;
                }
            }
        }