コード例 #1
0
        public MyTerminalAction <TBlock> EnableAction(string icon, StringBuilder name, WriterDelegate writer = null)
        {
            var action = new MyTerminalAction <TBlock>(Id, name, m_action, writer, icon);

            Actions = new MyTerminalAction <TBlock>[] { action };
            return(action);
        }
コード例 #2
0
        public MyTerminalAction <TBlock> EnableAction(string icon, StringBuilder name, StringBuilder onText, StringBuilder offText)
        {
            var action = new MyTerminalAction <TBlock>(Id, name, SwitchAction, (x, r) => Writer(x, r, onText, offText), icon);

            Actions = new MyTerminalAction <TBlock>[] { action };

            return(action);
        }
コード例 #3
0
        public MyTerminalAction <TBlock> EnableOffAction(string icon, StringBuilder name, StringBuilder onText, StringBuilder offText)
        {
            var action = new MyTerminalAction <TBlock>(Id + "_Off", name, OffAction, (x, r) => Writer(x, r, onText, offText), icon);

            AppendAction(action);

            return(action);
        }
コード例 #4
0
        void AppendAction(MyTerminalAction <TBlock> action)
        {
            var arr = Actions ?? new MyTerminalAction <TBlock> [0];

            Array.Resize(ref arr, arr.Length + 1);
            arr[arr.Length - 1] = action;
            Actions             = arr;
        }
コード例 #5
0
        public void EnableActions(string increaseIcon, string decreaseIcon, StringBuilder increaseName, StringBuilder decreaseName, float step, string resetIcon = null, StringBuilder resetName = null, Func <TBlock, bool> enabled = null)
        {
            var increase = new MyTerminalAction <TBlock>("Increase" + Id, increaseName, (b) => IncreaseAction(b, step), ActionWriter, increaseIcon, enabled);
            var decrease = new MyTerminalAction <TBlock>("Decrease" + Id, decreaseName, (b) => DecreaseAction(b, step), ActionWriter, decreaseIcon, enabled);

            if (resetIcon != null)
            {
                SetActions(increase, decrease, new MyTerminalAction <TBlock>("Reset" + Id, resetName, ResetAction, ActionWriter, resetIcon));
            }
            else
            {
                SetActions(increase, decrease);
            }
        }
コード例 #6
0
 public static void AddAction <TBase, TBlock>(MyTerminalAction <TBase> Action)
     where TBlock : TBase
     where TBase : MyTerminalBlock
 {
     GetList <TBlock>().Actions.Add(Action);
 }
コード例 #7
0
 public static void AddAction <TBlock>(int index, MyTerminalAction <TBlock> Action)
     where TBlock : MyTerminalBlock
 {
     GetList <TBlock>().Actions.Insert(index, Action);
 }