static void Binder() { LDControls.ListBoxContent(XListBox, XColumns.ToPrimitiveArray()); LDControls.ListBoxContent(SchemaListBox, Schema.ToPrimitiveArray()); LDControls.ListBoxContent(YListBox, YColumns.ToPrimitiveArray()); List <string> Columns = new List <string>(); Columns.AddRange(XColumns); Columns.AddRange(YColumns); Shapes.SetText(Inequality, $"{chart.MinColumns}≤{Columns.Count}≤{chart.MaxColumns}"); for (int i = 1; i <= LDControls.DataViewRowCount(DataView); i++) { string CurrentColumn = LDControls.DataViewGetValue(DataView, i, 1); if (Columns.Contains(CurrentColumn) == false) { LDControls.DataViewDeleteRow(DataView, i); } else { Columns.Remove(CurrentColumn); } } for (int i = 0; i < Columns.Count; i++) { LDControls.DataViewSetRow(DataView, LDControls.DataViewRowCount(DataView) + 1, string.Format("1={0};2=Text;", Columns[i])); } }
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(); } }