Example #1
0
        /// <summary>
        /// マウスダウンイベント転送
        /// </summary>
        public virtual void OnMouseDown(Tono.GuiWinForm.MouseState e)
        {
            if (Parts == null)
            {
                return;
            }

            if (_clickPos == null)
            {
                _clickPos = (MouseState)Share.Get("ClickPosition", typeof(MouseState));   // 移動中のパーツ一覧
            }
            SerializerEx.CopyObject(_clickPos, e);

            // パーツを取得する
            ClickParts = Parts.GetPartsAt(e.Pos, true, out var clickPane);
            ClickPane  = clickPane;

            //lock(_children.SyncRoot)	// 途中でAddChildしないので、スレッドセーフ。途中でAddChildしてしまうと下のループでAssertされる
            {
                foreach (var c in _children)
                {
                    if (c is FeatureBase && ((FeatureBase)c).Enabled == false)
                    {
                        continue;
                    }

                    if (c is IMouseListener)
                    {
#if DEBUG
                        if (c is FeatureBase)
                        {
                            TimeKeeper.SetStart(TimeKeeper.RecordType.MouseDown, ((FeatureBase)c).ID);
                        }
#endif
#if DEBUG == false
                        try
#endif
                        {
                            ((IMouseListener)c).OnMouseDown(e);
                        }
#if DEBUG == false
                        catch (Exception ex)
                        {
                            LOG.WriteLineException(ex);
                        }
#endif
#if DEBUG
                        if (c is FeatureBase)
                        {
                            TimeKeeper.SetEnd(TimeKeeper.RecordType.MouseDown, ((FeatureBase)c).ID);
                        }
#endif
                    }
                }
            }
            checkAndFireDataChanged();  // パーツ削除イベント
        }
Example #2
0
        /// <summary>
        /// マウスアップイベント転送
        /// </summary>
        public virtual void OnMouseUp(Tono.GuiWinForm.MouseState e)
        {
            //lock(_children.SyncRoot)	// 途中でAddChildしないので、スレッドセーフ。途中でAddChildしてしまうと下のループでAssertされる
            {
                foreach (var c in _children)
                {
                    if (c is FeatureBase && ((FeatureBase)c).Enabled == false)
                    {
                        continue;
                    }

                    if (c is IMouseListener)
                    {
#if DEBUG
                        if (c is FeatureBase)
                        {
                            TimeKeeper.SetStart(TimeKeeper.RecordType.MouseUp, ((FeatureBase)c).ID);
                        }
#endif
#if DEBUG == false
                        try
#endif
                        {
                            ((IMouseListener)c).OnMouseUp(e);
                        }
#if DEBUG == false
                        catch (Exception ex)
                        {
                            LOG.WriteLineException(ex);
                        }
#endif
#if DEBUG
                        if (c is FeatureBase)
                        {
                            TimeKeeper.SetEnd(TimeKeeper.RecordType.MouseUp, ((FeatureBase)c).ID);
                        }
#endif
                    }
                }
            }
            checkAndFireDataChanged();  // パーツ削除イベント
        }