示例#1
0
            static void Handler()
            {
                string        LastListBox = LDControls.LastListBox;
                string        LCB         = Controls.LastClickedButton;
                int           Node        = LDControls.ListBoxGetSelected(LastListBox) - 1;
                List <string> CurrentList = null;
                string        Item        = null;

                if (LastListBox == SchemaListBox)
                {
                    CurrentList = Schema;
                }
                else if (LastListBox == XListBox)
                {
                    CurrentList = XColumns;
                }
                else if (LastListBox == YListBox)
                {
                    CurrentList = YColumns;
                }

                if (Node >= 0)
                {
                    Item = CurrentList[Node];
                }

                if (LCB == GenerateChartButton)
                {
                    List <string> Columns = new List <string>();
                    Columns.AddRange(XColumns);
                    Columns.AddRange(YColumns);
                    Dictionary <string, string> Types = new Dictionary <string, string>();
                    for (int i = 1; i <= LDControls.DataViewRowCount(DataView); i++)
                    {
                        Types.Add(LDControls.DataViewGetValue(DataView, i, 1), LDControls.DataViewGetValue(DataView, i, 2));
                    }
                    Engines.QuerySettings QS = new Engines.QuerySettings
                    {
                        Database     = Engines.CurrentDatabase,
                        SQL          = Engines.NonSchemaQuery.Last(),
                        FetchRecords = true,
                        User         = GlobalStatic.UserName,
                        Explanation  = "Generating Chart" //TODO Localize
                    };

                    GenerateChart(Columns, Types, Engines.Query(QS));
                    Clear();
                    GraphicsWindow.ShowMessage("Exported Chart!", "Success");
                }
                else if (LCB == Escape)
                {
                    Clear();
                }
                else if (CurrentList?.Count >= Node)
                {
                    try
                    {
                        if (LCB == Left1)
                        {
                            Schema.RemoveAt(Node);
                            XColumns.Add(Item);
                        }
                        else if (LCB == Right1)
                        {
                            XColumns.RemoveAt(Node);
                            Schema.Add(Item);
                        }
                        else if (LCB == Left2)
                        {
                            YColumns.RemoveAt(Node);
                            Schema.Add(Item);
                        }
                        else if (LCB == Right2)
                        {
                            Schema.RemoveAt(Node);
                            YColumns.Add(Item);
                        }
                    }
                    catch (ArgumentOutOfRangeException ex)
                    {
                        Events.LogMessage(ex.Message, Language.Localization["System"]);
                    }
                }

                if (LCB != Escape)
                {
                    Binder();
                    AutoHide();
                }
            }