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);
        }
      }
    }
Example #2
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);
                }
            }
        }
Example #3
0
        public override bool Test(System.Diagnostics.Stopwatch sw)
        {
            ListNode l1 = new ListNodeList(new int[] { 9, 9, 9, 9, 9, 9, 9 }).first;
            ListNode l2 = new ListNodeList(new int[] { 9, 9, 9, 9 }).first;

            //ListNode l1 = new ListNodeList(new int[] { 1, 2, 3, 4, 5, 6, 7 }).first;
            //ListNode l2 = new ListNodeList(new int[] { 1, 2, 3, 4 }).first;
            ListNode result = AddTwoNumbers(l1, l2);

            List <int> resultlist = new List <int>();

            ListNode node = result;

            while (node != null)
            {
                resultlist.Add(node.val);
                node = node.next;
            }
            System.Diagnostics.Debug.Print("Result = " + string.Join(",", resultlist));
            return(true);
        }