Beispiel #1
0
        private void Initialize(bool initData)
        {
            if (initData)
            {
                _itemsShown.Clear();

                for (int i = 0; i < _doc.ObjectsToRenameCount; ++i)
                {
                    _itemsShown.Add(new MyNode(_doc, i));
                }

                _columNames = new string[_doc.ColumnsOfObjectInformation.Count];
                for (int i = 0; i < _doc.ColumnsOfObjectInformation.Count; ++i)
                {
                    _columNames[i] = _doc.ColumnsOfObjectInformation[i].Key;
                }

                // Description list
                _shortcutDescriptionList.Clear();
                var scList = _doc.GetIntegerShortcuts();
                foreach (string s in scList)
                {
                    _shortcutDescriptionList.Add(new DescriptionNode("Number", s, _doc.GetShortcutDescription(s)));
                }
                scList = _doc.GetStringShortcuts();
                foreach (string s in scList)
                {
                    _shortcutDescriptionList.Add(new DescriptionNode("Text", s, _doc.GetShortcutDescription(s)));
                }
                scList = _doc.GetDateTimeShortcuts();
                foreach (string s in scList)
                {
                    _shortcutDescriptionList.Add(new DescriptionNode("DateTime", s, _doc.GetShortcutDescription(s)));
                }
                scList = _doc.GetArrayShortcuts();
                foreach (string s in scList)
                {
                    _shortcutDescriptionList.Add(new DescriptionNode("Array", s, _doc.GetShortcutDescription(s)));
                }
            }

            if (null != _view)
            {
                _view.RenameStringTemplate = _doc.DefaultPatternString;
                _view.InitializeItemListColumns(_columNames);
                _view.InitializeItemListItems(_itemsShown);
                _view.InitializeAvailableShortcuts(_shortcutDescriptionList);
            }
        }
    void Initialize(bool bInit)
    {
      if (_view != null)
      {
        // look for coordinate system types
        Type[] subtypes = Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(G2DCoordinateSystem));

        ListNodeList list = new ListNodeList();
        foreach(Type t in subtypes)
          list.Add(new ListNode(Current.Gui.GetUserFriendlyClassName(t), t));

        // look for a controller-control
        _view.TypeLabel="Type";
        _view.InitializeTypeNames(list, list.IndexOfObject(_tempdoc.GetType()));

        // To avoid looping when a dedicated controller is unavailable, we first instantiate the controller alone and compare the types
        _instanceController = (IMVCAController)Current.Gui.GetController(new object[] { _tempdoc }, typeof(IMVCAController));
        if (_instanceController != null && (_instanceController.GetType() != this.GetType()))
        {
          Current.Gui.FindAndAttachControlTo(_instanceController);
          if (_instanceController.ViewObject != null)
            _view.SetInstanceControl(_instanceController.ViewObject);
        }
        else
        {
          _instanceController = null;
          _view.SetInstanceControl(null);
        }
      }
    }
Beispiel #3
0
        void Initialize(bool bInit)
        {
            if (_view != null)
            {
                // look for coordinate system types
                Type[] subtypes = Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(G2DCoordinateSystem));

                ListNodeList list = new ListNodeList();
                foreach (Type t in subtypes)
                {
                    list.Add(new ListNode(Current.Gui.GetUserFriendlyClassName(t), t));
                }

                // look for a controller-control
                _view.TypeLabel = "Type";
                _view.InitializeTypeNames(list, list.IndexOfObject(_tempdoc.GetType()));

                // To avoid looping when a dedicated controller is unavailable, we first instantiate the controller alone and compare the types
                _instanceController = (IMVCAController)Current.Gui.GetController(new object[] { _tempdoc }, typeof(IMVCAController));
                if (_instanceController != null && (_instanceController.GetType() != this.GetType()))
                {
                    Current.Gui.FindAndAttachControlTo(_instanceController);
                    if (_instanceController.ViewObject != null)
                    {
                        _view.SetInstanceControl(_instanceController.ViewObject);
                    }
                }
                else
                {
                    _instanceController = null;
                    _view.SetInstanceControl(null);
                }
            }
        }