Exemple #1
0
        /// <summary>
        /// 条件判断してカーソルを変更する
        /// </summary>
        /// <param name="ms">現在のキー状態</param>
        private void proc(MouseState ms)
        {
            // そのまま評価する
            for (var de = _resData.GetEnumerator(); de.MoveNext();)
            {
                if (((MouseState.Buttons)de.Key).Equals(ms.Attr))
                {
                    var res = ((Reserve)de.Value);

                    if (res.PreviousButtons != null)
                    {
                        if (res.PreviousButtons.Equals(_prev.Attr) == false)
                        {
                            continue;
                        }
                    }

                    _requestedCursor = res.Cursor;
                    Finalizers.Add(_cursorSet, new FinalizeManager.Finalize(onCursorSet));
                    _state.value = 1;
                    _prev        = _ms;
                    return;
                }
            }
            // カーソルを戻す時の処理
            if (Finalizers.Contains(_cursorSet) == false)
            {
                _requestedCursor = _normalCursor;
                Finalizers.Add(_cursorSet, new FinalizeManager.Finalize(onCursorSet));
                _state.value = 0;
            }
            _prev = _ms;
        }
Exemple #2
0
 public virtual void OnKeyDown(KeyState e)
 {
     if (MouseState.NowButtons.IsButton == false && e.IsControl == true)
     {
         FeatureBase.Cursor = _EventCursor;
         Finalizers.Add(_tokenListenID, new FinalizeManager.Finalize(onCursorSeFinalizert));
     }
 }
Exemple #3
0
 public virtual void OnKeyUp(KeyState e)
 {
     if (e.IsControl == true)
     {
         if (FeatureBase.Cursor == _EventCursor)
         {
             FeatureBase.Cursor = Cursors.Default;
             Finalizers.Add(_tokenListenID, new FinalizeManager.Finalize(onCursorSeFinalizert));
         }
     }
 }
Exemple #4
0
 public override void Start(NamedId who)
 {
     // MouseDownトークン
     if (who.Equals(_tokens[0]))
     {
         Finalizers.Add(new FinalizeManager.Finalize(finalMouseDownPart4Size));  // SezeSelected・・・も継承しているので、ID不指定
     }
     // MouseMoveトークン
     if (who.Equals(_tokens[1]))
     {
         OnMouseMove(null);
     }
 }
Exemple #5
0
        private static void FinalizerRunner()
        {
            NewSubject.WriteLine("Finalizer");

            Finalizers.Run();
            //var thirdClassFinalizer = new ThirdClassFinalizer();
            var finalizer2 = new Finalizer2();

            finalizer2.ShowDuration();

            ExampleClass ex = new ExampleClass();

            ex.ShowDuration();
        }
Exemple #6
0
        /// <summary>
        /// 文字列からパラメータを解析・実行する
        /// </summary>
        /// <param name="param"></param>
        public override void ParseParameter(string param)
        {
            var ss = param.Split(new char[] { ',' });

            foreach (var s in ss)
            {
                var s2 = s.Trim();

                // インターロックグループ
                var id = s2.IndexOf("(");
                if (id >= 0)
                {
                    var gr = s2.Substring(id + 1);
                    _interlockGroup = gr.Substring(0, gr.Length - 2);
                    var fcs = (IList)_interlockGroups[_interlockGroup];
                    if (fcs == null)
                    {
                        _interlockGroups[_interlockGroup] = fcs = new ArrayList();
                    }
                    fcs.Add(this);

                    s2 = s2.Substring(0, id) + "]";
                }
                // チェックボタンのイベント登録
                if (s2.StartsWith("["))
                {
                    var s3  = s2.Substring(1, s2.Length - 2);
                    var sss = s3.Split(new char[] { '=' });
                    s2 = sss[0];
                    if (sss.Length >= 2)
                    {
                        if (Const.IsFalse(sss[1]))
                        {
                            _isOn = false;
                        }
                    }
                    _initialState = _isOn;
                    _checkBox     = (System.Windows.Forms.CheckBox)GetControl(s2);
                    if (_checkBox != null)
                    {
                        AddTrigger(_checkBox, "Click", new EventHandler(onClickCheck));
                        ThreadSafe.SetChecked(_checkBox, _isOn);
                        ThreadSafe.SetEnabled(_checkBox, _canStart);
                    }
                }
            }
            _isNoToken = true;
            Finalizers.Add(new FinalizeManager.Finalize(resetSwitch));
        }
Exemple #7
0
        //Common Language Runtime(CLR) stores items in 2 locations: Stack or Heap
        //Stack: Keeps track of what's executing in code
        //Heap: Keeps track of Objects
        //Stack is automatically cleared at end of method, CLR takes care of it, but
        //The heap is managed by the garbage collector
        //Garbage collctor works with a mark and compact algorithm
        //Mark: Phase of collection checks which items on heap are referenced by items, if collector finds "living" item on heap, it is marked.
        //Compact: Phase starts after Mark phase, when gc moves all living items together and frees memory for all other objects.
        //GC is clever, it automatically cleans items up when there isn't anymore space on heap.
        //When GC Starts, collects only Generation 0(Items that doesn't survive clean-up, the living items are promoted to new generation).
        static void Main(string[] args)
        {
            Console.WriteLine("Simple finalizer: Line 13");

            //Stream.Dispose, GC.Collect
            var f = new Finalizers();

            f.DeleteFile();

            //Implementing Finalizers and IDisposable
            UnmanagedWrapper uw = new UnmanagedWrapper();

            uw.Dispose();

            //Weak References
            WeakReferenceRun();
        }
Exemple #8
0
        /// <summary>
        /// ファイナライザーやトークンをすべて消費する
        /// </summary>
        public void FlushFeatureTriggers()
        {
            for (var cnt = 0; ; cnt++)
            {
                var finalizer = Finalizers.Flush();
                var token     = invokeStartupToken();
                if ((finalizer || token) == false)
                {
                    break;
                }
                System.Diagnostics.Debug.Assert(cnt < 100, "ファイナライザとトークンで循環参照が発生しているかもしれません");
            }
            // パーツ削除イベント
            checkAndFireDataChanged();

            // 全トークン終了イベント
            checkAndFireAllTokenCompleted();
        }
Exemple #9
0
        internal T AddFinalizer <T>(T obj, Binding binding)
            where T : class
        {
            ActionList <object> list = Finalizers.Get(binding);

            if (list != null)
            {
                list.Add(obj);
                return(obj);
            }

            lock (Finalizers)
            {
                list = Finalizers.Get(binding);
                if (list == null)
                {
                    list = new ActionList <object>(binding.Finalizer !);
                    Finalizers.Add(binding, list);
                }
            }
            list.Add(obj !);
            return(obj);
        }
Exemple #10
0
        internal T AddFinalizer <T>(T obj, ServiceBinding serviceBinding)
            where T : class
        {
            ActionList <object> list = Finalizers.GetOrDefault(serviceBinding);

            if (list != null)
            {
                list.Add(obj);
                return(obj);
            }

            lock (Finalizers)
            {
                list = Finalizers.GetOrDefault(serviceBinding);
                if (list == null)
                {
                    list = new ActionList <object>(serviceBinding.Finalizer !);
                    Finalizers.Add(serviceBinding, list);
                }
            }
            list.Add(obj !);
            return(obj);
        }
Exemple #11
0
        /// <summary>
        /// マウス移動をドラッグ中として実装する
        /// </summary>
        public virtual void OnMouseMove(MouseState e)
        {
            if (_mouseDownOriginal != null)
            {
                // UNDO用のデータを記録する
                if (Persister[UNDO].IsStartedChunk == false)
                {
                    Persister[REDO].StartChunk(GetType().Name + ".OnMouseMove");
                    Persister[UNDO].StartChunk(GetType().Name + ".OnMouseMove");

                    Persister[UNDO].Save(_selectedParts, _meansSelectedParts);
                    foreach (DictionaryEntry de in _pos)
                    {
                        var parts = (PartsBase)de.Key;

                        // パーツのUNDO保存
                        Persister[UNDO].Save(parts, _meansSelectedParts);   // partsのフレンド保存は、FeatureDposeCheckOverlappedで行う

                        // レコードのUNDO保存
                        foreach (RecordBase rec in Link.GetRecordset(parts))
                        {
                            Persister[UNDO].Save(rec, _meansSelectedParts);
                        }
                    }
                }

                // すべての選択パーツの座標変更予約を入れる
                if (e != null)
                {
                    _pos.Develop(_mouseDownOriginal, e.Pos, _developmentMode);
                }

                // すべてのフィーチャー実行後に移動させる
                Finalizers.Add(new FinalizeManager.Finalize(onFinalizeMoveParts));
            }
        }
Exemple #12
0
 /// <summary>
 /// マウスアップイベントをドラッグ終了トリガとして実装する
 /// </summary>
 public virtual void OnMouseUp(MouseState e)
 {
     Finalizers.Add(new FinalizeManager.Finalize(OnFinalizeMouseUpJob));
 }
Exemple #13
0
 /// <summary>
 ///  トークンによる起動イベント
 /// </summary>
 /// <param name="who"></param>
 public override void Start(NamedId who)
 {
     Finalizers.Add(new FinalizeManager.Finalize(FinalMouseDownJob));
 }