Example #1
0
        private void Register()
        {
            buttons = new Dictionary <Entry, CheckBox>(18);
            var tree = new TreeNode("Dead-Alive setting")
            {
                DefaultOpened = true,
                FrameType     = IToolTreeNode.TreeNodeFrameType.Framed
            };

            Group.AddComponent(tree);
            for (int i = 0; i <= 8; i++)
            {
                var value       = i;
                var check_Alive = new CheckBox($"{value}-Alive", DataBase.LiveDeadTable[new Entry(value, true)]);
                var check_Dead  = new CheckBox($"{value}-Dead", DataBase.LiveDeadTable[new Entry(value, false)]);
                check_Alive.ChangeChecked += (x, y) => DataBase.LiveDeadTable[new Entry(value, true)] = y.NewValue;
                check_Dead.ChangeChecked  += (x, y) => DataBase.LiveDeadTable[new Entry(value, false)] = y.NewValue;
                var line = new Line();
                line.AddComponent(check_Alive);
                line.AddComponent(check_Dead);
                buttons.Add(new Entry(i, true), check_Alive);
                buttons.Add(new Entry(i, false), check_Dead);
                tree.AddComponent(line);
            }
        }
Example #2
0
        private void IOBinary()
        {
            var tree = new TreeNode("I/O")
            {
                FrameType = IToolTreeNode.TreeNodeFrameType.Framed
            };
            var line_Load       = new Line();
            var tool_LoadBinary = new Button("Load Binary");

            tool_LoadBinary.Clicked += new EventHandler(Tool_LoadBinary);
            line_Load.AddComponent(tool_LoadBinary);
            tool_load_Error = new Text()
            {
                IsUpdated = false
            };
            line_Load.AddComponent(tool_load_Error);
            tree.AddComponent(line_Load);
            var line_Save       = new Line();
            var tool_SaveBinary = new Button("Save Binary");

            tool_SaveBinary.Clicked += new EventHandler(Tool_SaveBinary);
            line_Save.AddComponent(tool_SaveBinary);
            tool_save_Error = new Text()
            {
                IsUpdated = false
            };
            line_Save.AddComponent(tool_save_Error);
            var tool_Export = new Button("Export as csv");

            tree.AddComponent(line_Save);
            tool_Export.Clicked += new EventHandler(Tool_Export);
            tree.AddComponent(tool_Export);
            Group.AddComponent(tree);
        }
Example #3
0
        private void Tool_MA_Button_Do(object sender, EventArgs e)
        {
            var count = tool_MA_Count.Value;

            if (movingAves.ContainsKey(count) || DataBase.Data.Count <= 0)
            {
                return;
            }
            var array   = new Vector2F[DataBase.Data.Count - count];
            var rawData = this.rawData.Data;
            var current = 0f;

            for (int i = 0; i < count; i++)
            {
                current += rawData[i].Y;
            }
            for (int i = count; i < rawData.Length; i++)
            {
                array[i - count] = new Vector2F(i, current / count);
                current         += rawData[i].Y - rawData[i - count].Y;
            }
            var graphLine = graph.AddData(array);
            var color     = tool_MA_LineColor.Color;

            graphLine.Color = color;
            movingAves.Add(count, graphLine);
            var button = new CheckBox(count.ToString(), true);

            button.ChangeChecked += (x, y) =>
            {
                var c = graphLine.Color;
                c.A             = y.NewValue ? byte.MaxValue : default;
                graphLine.Color = c;
            };
            var lineComponent = new Line();

            lineComponent.AddComponent(button);
            var colorEdit = new ColorEdit(count.ToString(), color)
            {
                EditAlpha = false,
                InputType = IToolColorEdit.ColorEditInputType.None,
                ShowLabel = false
            };

            colorEdit.ColorChanged += (x, y) =>
            {
                var c = y.NewValue;
                c.A             = graphLine.Color.A;
                graphLine.Color = c;
            };
            lineComponent.AddComponent(colorEdit);
            graphButtonGroup.AddComponent(lineComponent);
        }