예제 #1
0
        /// <summary>
        /// Handles the mouse doubleclick event.
        /// </summary>
        /// <param name="position">Mouse position.</param>
        /// <param name="e">EventArgs as provided by the view.</param>
        /// <returns>The next mouse state handler that should handle mouse events.</returns>
        public override void OnDoubleClick(PointD2D position, MouseButtonEventArgs e)
        {
            base.OnDoubleClick(position, e);

            // if there is exactly one object selected, try to open the corresponding configuration dialog
            if (_selectedObjects.Count == 1)
            {
                IEnumerator graphEnum = _selectedObjects.GetEnumerator(); // get the enumerator
                graphEnum.MoveNext();                                     // set the enumerator to the first item
                var graphObject = (IHitTestObject)graphEnum.Current;

                // Set the currently active layer to the layer the clicked object is belonging to.
                if (graphObject.ParentLayer != null && !object.ReferenceEquals(_grac.ActiveLayer, graphObject.ParentLayer))
                {
                    _grac.EhView_CurrentLayerChoosen(graphObject.ParentLayer.IndexOf().ToArray(), false); // Sets the current active layer
                }
                if (graphObject.DoubleClick != null)
                {
                    //EndMovingObjects(); // this will resume the suspended graph so that pressing the "Apply" button in a dialog will result in a visible change
                    ClearSelections(); // this will resume the suspended graph so that pressing the "Apply" button in a dialog will result in a visible change
                    graphObject.OnDoubleClick();

                    //ClearSelections();
                }
            }
        }