Esempio n. 1
0
        public static void CreateTableUI()
        {
            int StackPointer = Stack.Add("UI.CreateTableUI()");

            Controls.HideControl(GlobalStatic.Dataview);
            Controls.HideControl(GlobalStatic.ListView);
            GlobalStatic.ListView = null;

            HideDisplayResults();
            ClearWindow();

            LDGraphicsWindow.CancelClose = true;
            LDGraphicsWindow.ExitOnClose = false;

            GlobalStatic.Dataview = LDControls.AddDataView((Desktop.Width - 10), (Desktop.Height - 100), "1=Field;2=Type;3=PK;4=AI;5=Unique;6=Not_Null;");
            GraphicsWindow.DrawText(1, 4, "Name: ");
            Controls.Move(GlobalStatic.Dataview, 1, 30);

            _TextBox["Table_Name"] = Controls.AddTextBox(50, 1);
            Controls.SetTextBoxText(_TextBox["Table_Name"], "Table1");

            _Buttons.AddOrReplace("Commit", Controls.AddButton("Commit", 250, 1));
            _Buttons.AddOrReplace("Exit", Controls.AddButton("Exit", 350, 1));

            LDControls.DataViewSetColumnComboBox(GlobalStatic.Dataview, 2, "1=Integer;2=Text;3=Blob;4=Real;5=Numeric;");
            for (int i = 3; i <= 6; i++)
            {
                LDControls.DataViewSetColumnCheckBox(GlobalStatic.Dataview, i);
            }

            Controls.ButtonClicked -= Events.BC;
            Controls.ButtonClicked += CreateTableHandler;
            Stack.Exit(StackPointer);
        }
Esempio n. 2
0
 public static Primitive AddDataView(Primitive width, Primitive height)
 {
     return(LDControls.AddDataView(width, height, ""));
 }
Esempio n. 3
0
            public static void Display(Google_Charts.Chart chart)
            {
                int StackPointer = Stack.Add("UI.Charts.Display()");

                Charts.chart = chart;
                ClearWindow();
                GraphicsWindow.Title = "Charts";

                LDGraphicsWindow.CancelClose = true;
                LDGraphicsWindow.ExitOnClose = false;
                LDGraphicsWindow.Closing    += Events.Closing;
                LDGraphicsWindow.ExitButtonMode(GraphicsWindow.Title, "Disabled");

                XColumns.Clear();
                YColumns.Clear();
                Schema = Export.GenerateSchemaListFromLastQuery();

                //UI Stuff
                GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize + 12;

                GraphicsWindow.DrawText(5, 10, string.Format("Min Columns {0}", chart.MinColumns));
                GraphicsWindow.DrawText(5, 30, string.Format("Max Columns {0}", chart.MaxColumns));

                Inequality = Shapes.AddText("Equation");
                Shapes.Move(Inequality, 400, 5);

                GraphicsWindow.DrawText(5, 70, "X:");
                GraphicsWindow.DrawText(300 + 100, 70, "Columns:");
                GraphicsWindow.DrawText(600 + 200, 70, "Y:");

                GraphicsWindow.DrawText(5, 450, "Title");
                GraphicsWindow.DrawText(5, 500, "SubTitle");
                GraphicsWindow.DrawText(5, 550, "X axis");
                GraphicsWindow.DrawText(5, 600, "Y axis");

                GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize;

                XListBox      = LDControls.AddListBox("", 300, 300);
                SchemaListBox = LDControls.AddListBox(Schema.ToPrimitiveArray(), 300, 300);
                YListBox      = LDControls.AddListBox("", 300, 300);

                DataView = LDControls.AddDataView(300, 300, "1=Column;2=Type;");
                LDControls.DataViewSetColumnComboBox(DataView, 2, "1=Text;2=Number;");

                if (Desktop.Width < 1500)
                {
                    LDScrollBars.Add(1920, 0);
                }

                Controls.Move(XListBox, 5, 100);
                Controls.Move(SchemaListBox, 300 + 100, 100);
                Controls.Move(YListBox, 600 + 200, 100);
                Controls.Move(DataView, 1200, 100);

                Left1  = Controls.AddButton("<", 325, 200);
                Right1 = Controls.AddButton(">", 325, 250);

                Left2  = Controls.AddButton("<", 725, 200);
                Right2 = Controls.AddButton(">", 725, 250);

                GenerateChartButton = Controls.AddButton("Generate Chart", 300, 500);
                Controls.Move(GenerateChartButton, 800, 550);
                Controls.SetSize(GenerateChartButton, 100, 30);

                //TODO Add TextBoxes for Title,SubTitle,X axis caption, and y axis caption
                TitleTB        = Controls.AddTextBox(130, 450);
                SubTitleTB     = Controls.AddTextBox(130, 500);
                XaxisCaptionTB = Controls.AddTextBox(130, 550);
                YaxisCaptionTB = Controls.AddTextBox(130, 600);

                Controls.SetSize(TitleTB, 200, 30);
                Controls.SetSize(SubTitleTB, 200, 30);
                Controls.SetSize(XaxisCaptionTB, 200, 30);
                Controls.SetSize(YaxisCaptionTB, 200, 30);

                Escape = Controls.AddButton("Esc", 50, 500);
                Controls.Move(Escape, 800, 500);
                Controls.SetSize(Escape, 100, 30);

                //TODO Add Region options for GeoCharts
                //TODO Allow users to specify data type (Number,string,eventually Datetime etc).
                //Otherwise attempt to grab that data from the db?
                Controls.SetSize(Left1, 50, 30);
                Controls.SetSize(Right1, 50, 30);
                Controls.SetSize(Left2, 50, 30);
                Controls.SetSize(Right2, 50, 30);

                //Event Handler Unhooking
                Controls.ButtonClicked -= Events.BC;
                //Event Handler Hooking
                Controls.ButtonClicked += Handler;
                AutoHide();
                Stack.Exit(StackPointer);
            }
Esempio n. 4
0
        private void buttonTest_Click(object sender, EventArgs e)
        {
            Primitive shp = Microsoft.SmallBasic.Library.Controls.AddButton("Button", 10, 10);

            LDShapes.ReSize(shp, 100, 100);
            LDShapes.ReSize(shp, 200, 200);

            Primitive xx = LDFastArray.Add();

            LDFastArray.Set(xx, "1 2 3", 24);
            FieldInfo _primitive = typeof(Primitive).GetField("_primitive", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.Instance);
            Primitive aa         = "1 23 45";
            string    bb         = (string)_primitive.GetValue(aa);
            Primitive sb         = "1=1\\=\"hello\"\\;2\\=1\\;3\\=2\\;;2=1\\=3\\;2\\=test\\;3\\=3\\;;";
            Primitive arr        = LDFastArray.CreateFromValues(sb);
            Primitive sb1        = LDFastArray.ToArray(arr);

            Primitive a = LDFastArray.Add();

            LDFastArray.Set2D(a, 2, 5, 10);
            LDFastArray.Set2D(a, 2, 2, 20);
            LDFastArray.Set2D(a, 1, 8, 30);
            LDFastArray.Collapse(a);
            Primitive b = LDFastArray.ToArray(a);

            Primitive img = Microsoft.SmallBasic.Library.ImageList.LoadImage("https://upload.wikimedia.org/wikipedia/commons/thumb/d/d6/STS120LaunchHiRes-edit1.jpg/153px-STS120LaunchHiRes-edit1.jpg");
            Primitive x1  = LDImage.Copy(img);

            LDImage.EffectCharcoal(x1);



            Primitive image = LDImage.NewImage(100, 100, "Red");

            LDImage.OpenWorkingImage(image);
            Primitive xml  = LDxml.Open("C:\\Users\\Steve\\Documents\\SmallBasic\\steve\\sample.xml");
            Primitive data = LDxml.ToArray();

            LDxml.FromArray(data);
            LDxml.Save("C:\\Users\\Steve\\Documents\\SmallBasic\\steve\\sample1.xml");
            Primitive txt = Microsoft.SmallBasic.Library.File.ReadContents("C:\\Users\\Steve\\Documents\\SmallBasic\\steve\\txt.txt");

            LDSearch.GetProof(txt, "");
            LDSearch.GetWeb("bill gates");
            return;

            //TextWindow.Show();
            //LDTextWindow.SetColours("Pink", "Orange");
            //TextWindow.WriteLine("Hello World");

            LDPhysics.ReadJson("C:\\Users\\Steve\\Documents\\SmallBasic\\steve\\LDPysics.json", 1, "False", "False", 0, 0);

            LDWaveForm.PlayWave(256, 1000, "0=-1;1=1;5=0;");

            Primitive shape = Shapes.AddRectangle(100, 100);

            LDEffect.Bloom(shape, "");
            Program.Delay(1000);

            LDControls.AddDataView(GraphicsWindow.Width, GraphicsWindow.Height, "1=Hello;2=World;");

            //string _urlTemplate = "https://api.flickr.com/services/rest/?sort=interestingness-desc&safe_search=1&license=1,2,3,4,5,6,7&api_key=";
            //string _picUrlTemplate = "http://farm{0}.static.flickr.com/{1}/{2}_{3}.jpg";
            byte[] array = Convert.FromBase64String("MWY5ZmI5ODE4Mjk2NzAwNTgwYmYzMzQwMjc5MzQ2YjY=");
            //_urlTemplate += Encoding.UTF8.GetString(array, 0, array.Length);
            TextWindow.WriteLine(Encoding.UTF8.GetString(array, 0, array.Length));

            Primitive rtb = LDControls.AddRichTextBox(100, 100);

            LDControls.RichTextBoxSetText(rtb, "Hello", "True");
            LDCall.Compile("C:\\Users\\Steve\\Documents\\SmallBasic\\steve\\testinclude.sb");
            Primitive include = LDCall.Include("C:\\Users\\Steve\\Documents\\SmallBasic\\steve\\testinclude.exe");

            TextWindow.WriteLine(include);

            LDUtilities.FixFlickr();//FCClipboard.GetText
            LDCall.CallAsync("SmallBasicLibrary.dll", "Microsoft.SmallBasic.Library", "Flickr", "GetRandomPicture", "Car");

            string      tempFileName = Path.GetTempFileName();
            Stream      stream       = null;
            Stream      stream2      = null;
            WebResponse webResponse  = null;

            try
            {
                string     url        = "https://a75b9da71f50095fc4dc527d860da4427f274b07.googledrive.com/host/0B9s0FFxEQDb6T3VUdEw3QTJDS1E/efecast00.mp3";
                Uri        uri        = new Uri(url);
                WebRequest webRequest = WebRequest.Create(url);
                webResponse = webRequest.GetResponse();
                stream      = System.IO.File.Open(tempFileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read);
                byte[] buffer = new byte[16384];
                long   num    = webResponse.ContentLength;
                stream2 = webResponse.GetResponseStream();
                int readCount = stream2.Read(buffer, 0, 16384);
                while (readCount > 0L)
                {
                    stream.Write(buffer, 0, readCount);
                    readCount = stream2.Read(buffer, 0, 16384);
                }
            }
            catch (Exception ex)
            {
                TextWindow.WriteLine(ex.Message);
            }
            finally
            {
                if (stream != null)
                {
                    stream.Close();
                }
                if (stream2 != null)
                {
                    stream2.Close();
                }
                if (webResponse != null)
                {
                    webResponse.Close();
                }
            }

            LDGraphicsWindow.SetFontFromFile("C:\\temp\\04b.ttf");
            TextWindow.Show();
            //Primitive source = "class Evaluator { public static function Eval(expr : String) : String { return eval(expr); } }";
            //LDInline.IncludeJScript(source,"","");
            //Primitive result = LDInline.Call("Eval","5+3");
            //TextWindow.WriteLine(result);

            //TextWindow.Hide();
            Primitive x = LDMath.Evaluate("1e6 + 6/4");
            Primitive y = LDMath.Evaluate2("1e6 + 6/4");

            //TextWindow.Hide();
            TextWindow.WriteLine("HERE " + x + " :" + y);

            LDImage.LoadSVG("C:\\temp\\snowtitle.svg");
            TextWindow.WriteLine(LDNetwork.LAN(1000));

            GraphicsWindow.Show();
            LDText.GetWidth("Hello World");

            Primitive server = LDServer.Start("True");

            LDClient.Connect(server, "True");
            LDClient.SendMessage("Hello1");
            LDClient.SendMessage("World1");
            LDServer.Disconnect("Client1");
            LDClient.Connect(server, "True");
            LDClient.SendMessage("Hello3");
            LDClient.SendMessage("World3");

            GraphicsWindow.Show();
            LDGraphicsWindow.FloodFill(200, 100, "#5588ee");
            //Program.Delay(1000000);
            //Primitive languages = LDTranslate.Languages();
            //Primitive indices = SBArray.GetAllIndices(languages);
            //for (int i = 1; i <= SBArray.GetItemCount(languages); i++)
            //{
            //    TextWindow.WriteLine(indices[i] + " : " + languages[indices[i]]);
            //}
            //Primitive result = LDTranslate.Translate("Hello World", "", "de");
            //TextWindow.WriteLine(result);

            //TextWindow.WriteLine(GraphicsWindow.FontName);
            //GraphicsWindow.DrawText(10, 10, "Hello World");
            //Primitive result = LDGraphicsWindow.SetFontFromFile("C:\\Users\\Public\\Documents\\SmallBasic\\steve\\WWFlakes.ttf");
            //TextWindow.WriteLine(GraphicsWindow.FontName);
            //GraphicsWindow.DrawText(10, 50, "Hello World");

            //PrivateFontCollection fntColl = new PrivateFontCollection();
            //fntColl.AddFontFile("C:\\Users\\Public\\Documents\\SmallBasic\\steve\\WWFlakes.ttf");
            //buttonTest.Font = new Font(fntColl.Families[0], 16, FontStyle.Regular);

            //LDDictionary.GetDefinition("Car");
        }
Esempio n. 5
0
        /// <summary>
        /// Handles Main Menu
        /// </summary>
        /// <param name="Item">Localized Menu Item</param>
        public static void Menu(string Item)
        {
            int StackPointer = Stack.Add($"Handlers.Menu({Item})");

            //Switch and Enum cannot be used because values can change
            //File Menu Items
            if (Item == Language.Localization["New"])
            {
                string Path = LDDialogs.SaveFile(GlobalStatic.Extensions, GlobalStatic.LastFolder);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    GlobalStatic.ListView   = null;
                    GlobalStatic.Dataview   = null;
                    GlobalStatic.LastFolder = System.IO.Path.GetDirectoryName(Path);
                    Settings.Load(GlobalStatic.RestoreSettings, GlobalStatic.SettingsPath);
                    Settings.Save();
                    LDDataBase.ConnectSQLite(Path);
                    Engines.Load.Sqlite(Path);

                    Events.LogMessage("Created DB :" + Path, Language.Localization["Application"]);
                    UI.PreMainMenu();
                    UI.MainMenu();
                    LDDataBase.Connection = null;
                }
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["Open"])
            {
                GlobalStatic.ListView = null;
                GlobalStatic.Dataview = null;
                Settings.Load(GlobalStatic.RestoreSettings, GlobalStatic.SettingsPath); //Reloads Settings
                string Path = UI.GetPath(Engines.EnginesMode.SQLITE);

                if (!string.IsNullOrWhiteSpace(Path))
                {
                    Engines.Load.Sqlite(Path);
                    GlobalStatic.Settings["LastFolder"] = System.IO.Path.GetDirectoryName(Path);
                    Settings.Save();
                    UI.PreMainMenu();
                    UI.MainMenu();

                    int Index = Engines.DB_Name.IndexOf(Engines.CurrentDatabase) + 1;
                    Handlers.ComboBox.CB(GlobalStatic.ComboBox["Database"], Index);
                    LDControls.ComboBoxSelect(GlobalStatic.ComboBox["Database"], Index);
                }
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["Define New Table"])
            {
                Engines.Cache.Clear();
                UI.CreateTableUI();
            }
            else if (Item == Language.Localization["New in Memory Db"])
            {
                Engines.Load.MemoryDB(Engines.EnginesMode.SQLITE);
                UI.PreMainMenu();
                UI.MainMenu();
            }
            else if (Item == Language.Localization["Create Statistics Page"])
            {
                string Name = string.Format("\"Statistics of {0}\"", Engines.CurrentTable.SanitizeFieldName());
                Engines.Transform.CreateStatisticsTable(Engines.CurrentDatabase, Engines.CurrentTable, Name, Export.GenerateSchemaFromLastQuery());

                Engines.QuerySettings QS = new Engines.QuerySettings
                {
                    Database    = Engines.CurrentDatabase,
                    SQL         = $"SELECT * FROM {Name};",
                    ListView    = GlobalStatic.ListView,
                    User        = GlobalStatic.UserName,
                    Explanation = Language.Localization["Statistics Page"]
                };

                Engines.Query(QS);

                Engines.GetSchema(Engines.CurrentDatabase);
                Engines.SetDefaultTable(Name.SanitizeFieldName());
                Engines.GetColumnsofTable(Engines.CurrentDatabase, Name);
                ComboBox.Bind();
            }
            //Main
            else if (Item == Language.Localization["View"] || Item == Language.Localization["View"] + " ")
            {
                Controls.HideControl(GlobalStatic.Dataview);
                GlobalStatic.Dataview = null;
                if (GlobalStatic.ListView == null)
                {
                    bool Bold = GraphicsWindow.FontBold;
                    GraphicsWindow.FontBold = false;
                    GlobalStatic.ListView   = LDControls.AddListView(GlobalStatic.Listview_Width, GlobalStatic.Listview_Height, null);

                    LDControls.AddContextMenu(GlobalStatic.ListView, "1=Ascend;2=Descend;3=Random();", null);
                    Controls.Move(GlobalStatic.ListView, 10, 35);
                    UI.DisplayResults();
                    GraphicsWindow.FontBold = Bold;
                }
                else
                {
                    UI.ShowDisplayResults();
                    Controls.ShowControl(GlobalStatic.ListView);
                }
                if (!string.IsNullOrEmpty(Engines.CurrentTable))
                {
                    Engines.QuerySettings QS = new Engines.QuerySettings
                    {
                        Database    = Engines.CurrentDatabase,
                        SQL         = $"SELECT * FROM {Engines.CurrentTable};",
                        ListView    = GlobalStatic.ListView,
                        User        = Language.Localization["App"],
                        Explanation = Language.Localization["View Function"]
                    };

                    Engines.Query(QS);
                }
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["Save"])
            {
                if (!string.IsNullOrEmpty(Engines.CurrentDatabase) && !string.IsNullOrEmpty(GlobalStatic.Dataview))
                {
                    string SaveStatus = LDDataBase.SaveTable(Engines.CurrentDatabase, GlobalStatic.Dataview);
                    Events.LogMessagePopUp("The save was : " + SaveStatus, Language.Localization["UI"], "Save Status");
                }
                else
                {
                    Events.LogMessagePopUp(Language.Localization["Dataview Error"], Language.Localization["UI"], "Save Error");
                }
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["Edit"])
            {
                if (!string.IsNullOrEmpty(Engines.CurrentDatabase))
                {
                    switch (GlobalStatic.SortBy)
                    {
                    case 2:
                        Events.LogMessagePopUp(Language.Localization["Views Read Only"], Language.Localization["UI"], Language.Localization["Access Denied"]);
                        break;

                    case 4:
                        Events.LogMessagePopUp(Language.Localization["Master Table Protected"], Language.Localization["UI"], Language.Localization["Access Denied"]);
                        break;

                    default:
                        Controls.HideControl(GlobalStatic.ListView);
                        if (String.IsNullOrEmpty(GlobalStatic.Dataview))
                        {
                            GlobalStatic.Dataview = LDControls.AddDataView(GlobalStatic.Listview_Width, GlobalStatic.Listview_Height, null);
                            Controls.Move(GlobalStatic.Dataview, 10, 35);
                        }
                        else
                        {
                            Controls.ShowControl(GlobalStatic.Dataview);
                        }
                        UI.HideDisplayResults();
                        Engines.EditTable(Engines.CurrentTable, GlobalStatic.Dataview);
                        break;
                    }
                }
                else
                {
                    Events.LogMessagePopUp(Language.Localization["Error No DB"], Language.Localization["UI"], Language.Localization["Edit"]);
                }
                Stack.Exit(StackPointer);
                return;
            }
            //Import
            else if (Item == Language.Localization["CSV"])
            {
                string Path = LDDialogs.OpenFile("csv", null);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    //Outputted to a temporary path in the event the import doesn't work...
                    string    TempPath = System.IO.Path.GetTempFileName().Replace(".tmp", ".sql");
                    Stopwatch CSV      = new Stopwatch();
                    CSV.Start();
                    Import.CSV(Path, TempPath);
                    CSV.Stop();

                    Stopwatch SQL = new Stopwatch();
                    SQL.Start();
                    Import.SQL(Engines.CurrentDatabase, TempPath);
                    SQL.Stop();

                    string ToolTip = string.Format("CSV Import Completed!\n CSV:{0}(ms)\nSQL:{1}(ms)",
                                                   CSV.ElapsedMilliseconds,
                                                   SQL.ElapsedMilliseconds);
                    Events.LogMessagePopUp(ToolTip, Language.Localization["UI"], Language.Localization["Importer"]); //TODO Localize

                    Stack.Exit(StackPointer);
                    return;
                }
                Events.LogMessagePopUp(Language.Localization["Error Generic"], Language.Localization["UI"], "Import.CSV");//TODO Localize
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["SQL"])
            {
                string Path = LDDialogs.OpenFile("sql", null);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    Stopwatch SQL = new Stopwatch();
                    SQL.Start();
                    Import.SQL(Engines.CurrentDatabase, Path);
                    SQL.Stop();
                    Events.LogMessagePopUp("SQL Import Completed in " + SQL.ElapsedMilliseconds + "(ms)", Language.Localization["UI"], Language.Localization["Importer"]); //TODO Localize
                    Stack.Exit(StackPointer);
                    return;
                }
                Events.LogMessagePopUp(Language.Localization["Error Generic"], Language.Localization["UI"], "Import.SQL");//TODO Localize
                Stack.Exit(StackPointer);
                return;
            }
            //Export
            else if (Item == Language.Localization["PXML"] + " ")
            {
                string Path = LDDialogs.SaveFile("xml", null);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    Primitive Data = Export.Generate2DArrayFromLastQuery();
                    Export.XML(Data, Export.GenerateSchemaFromQueryData(Data), Engines.CurrentTable, Path);
                    Events.LogMessagePopUp("XML export of " + Engines.CurrentTable + " completed!", "Export", "Success");
                    Stack.Exit(StackPointer);
                    return;
                }
                Events.LogMessagePopUp(Language.Localization["Error Generic"], Language.Localization["UI"], "Export.XML");//TODO Localize
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["HTML"] + " ")
            {
                string Path = LDDialogs.SaveFile("html", null);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    Primitive Data = Export.Generate2DArrayFromLastQuery();
                    Export.HTML(Data, Export.GenerateSchemaFromQueryData(Data), Engines.CurrentTable.SanitizeFieldName(), Path, GlobalStatic.ProductID + " V" + GlobalStatic.VersionID);
                    Events.LogMessagePopUp("HTML export of " + Engines.CurrentTable + " completed!", Language.Localization["Export"], Language.Localization["Success"]);
                    Stack.Exit(StackPointer);
                    return;
                }
                Events.LogMessagePopUp(Language.Localization["Error Generic"], Language.Localization["UI"], "Export.HTML");//TODO Localize
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["SQL"] + " ")
            {
                string Path = LDDialogs.SaveFile("sql", null);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    Primitive Data   = Export.Generate2DArrayFromLastQuery();
                    Primitive Schema = Export.GenerateSchemaFromQueryData(Data);
                    Primitive SchemaQuery;
                    switch (Engines.CurrentEngine)
                    {
                    case Engines.EnginesMode.SQLITE:
                        Engines.SQLite SQLite = new Engines.SQLite();

                        Engines.QuerySettings QS = new Engines.QuerySettings
                        {
                            Database     = Engines.CurrentDatabase,
                            SQL          = SQLite.GetColumnsOfTable(Engines.CurrentTable),
                            FetchRecords = true,
                            User         = GlobalStatic.UserName,
                            Explanation  = "SCHEMA"
                        };

                        SchemaQuery = Engines.Query(QS);
                        break;

                    default:
                        throw new PlatformNotSupportedException("Currently database is not supported");
                    }
                    Dictionary <string, bool>   PK    = Export.SQL_Fetch_PK(SchemaQuery, Schema, Engines.CurrentEngine);
                    Dictionary <string, string> Types = Export.SQL_Fetch_Type(SchemaQuery, Schema, Engines.CurrentEngine);
                    Export.SQL(Data, Schema, PK, Types, Engines.CurrentTable, Path);
                    LDProcess.Start(Path, null);
                    Events.LogMessagePopUp("SQL export of " + Engines.CurrentTable + " completed!", Language.Localization["Export"], Language.Localization["Success"]); //TODO Localize
                    Stack.Exit(StackPointer);
                    return;
                }
                Events.LogMessagePopUp(Language.Localization["Error Generic"], Language.Localization["UI"], "Export.SQL");//TODO Localize
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["CSV"] + " ")
            {
                string Path = LDDialogs.SaveFile("csv", null);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    Primitive Data = Export.Generate2DArrayFromLastQuery();
                    Export.CSV(Data, Export.GenerateSchemaFromQueryData(Data), Path, GlobalStatic.Deliminator);
                    Events.LogMessagePopUp("CSV export of " + Engines.CurrentTable + " completed!", Language.Localization["Export"], Language.Localization["Success"]); //TODO Localize
                    Stack.Exit(StackPointer);
                    return;
                }
                Events.LogMessagePopUp(Language.Localization["Error Generic"], Language.Localization["UI"], "Export.CSV");//TODO Localize
                Stack.Exit(StackPointer);
            }
            else if (Item == "JSON") //TODO Localize
            {
                string Path = LDDialogs.SaveFile("json", null);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    Primitive Data = Export.Generate2DArrayFromLastQuery();
                    Export.JSON(Data, Export.GenerateSchemaFromQueryData(Data), Engines.CurrentTable.SanitizeFieldName(), Path);
                    Events.LogMessagePopUp("JSON export of " + Engines.CurrentTable + " completed!", Language.Localization["Export"], Language.Localization["Success"]); //TODO Localize
                    Stack.Exit(StackPointer);
                    return;
                }
                Events.LogMessagePopUp(Language.Localization["Error Generic"], Language.Localization["UI"], "Export.JSON");//TODO Localize
                Stack.Exit(StackPointer);
            }
            else if (Item == "MarkDown") //TODO Localize
            {
                string Path = LDDialogs.SaveFile("md", null);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    Primitive Data = Export.Generate2DArrayFromLastQuery();
                    Export.MarkDown(Data, Export.GenerateSchemaFromQueryData(Data), Path);
                    Events.LogMessagePopUp("MarkDown export is now complete", Language.Localization["Export"], Language.Localization["Success"]); //TODO Localize
                    Stack.Exit(StackPointer);
                    return;
                }
                Events.LogMessagePopUp(Language.Localization["Error Generic"], Language.Localization["UI"], "Export.MarkDown");//TODO Localize
                Stack.Exit(StackPointer);
            }
            else if (Item == "Wiki MarkUp") //TODO Localize
            {
                string Path = LDDialogs.SaveFile("markup", null);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    Primitive Data = Export.Generate2DArrayFromLastQuery();
                    Export.MarkUp(Data, Export.GenerateSchemaFromQueryData(Data), Path);
                    Events.LogMessagePopUp("Wiki Markup export is now complete", Language.Localization["Export"], Language.Localization["Success"]); //TODO Localize
                    Stack.Exit(StackPointer);
                    return;
                }
                Events.LogMessagePopUp(Language.Localization["Error Generic"], Language.Localization["UI"], "Export.Wiki Markup");//TODO Localize
                Stack.Exit(StackPointer);
            }
            else if (Item == "Excel") //TODO Localize
            {
                string Path = LDDialogs.SaveFile("xlsx", null);
                if (!string.IsNullOrWhiteSpace(Path))
                {
                    Primitive Data = Export.Generate2DArrayFromLastQuery();
                    //Export.Excel(Data, Export.GenerateSchemaFromQueryData(Data), Engines.CurrentTable, Path);
                    Events.LogMessagePopUp("Excel export is now complete", Language.Localization["Export"], Language.Localization["Success"]); //TODO Localize
                    Stack.Exit(StackPointer);
                    return;
                }
                Events.LogMessagePopUp(Language.Localization["Error Generic"], Language.Localization["UI"], "Export.Excel Markup");//TODO Localize
                Stack.Exit(StackPointer);
            }
            //Settings
            else if (Item == Language.Localization["About"])
            {
                Engines.QuerySettings QS = new Engines.QuerySettings
                {
                    Database     = Engines.CurrentDatabase,
                    SQL          = "SELECT SQLITE_VERSION(),sqlite_source_id();",
                    FetchRecords = true,
                    User         = GlobalStatic.UserName,
                    Explanation  = Language.Localization["User Requested"] + ":" + Language.Localization["App"]
                };

                Primitive About_Data = Engines.Query(QS);
                string    About_Msg  = string.Format("DBM C# is a Database Mangement Program developed by Abhishek Sathiabalan. (C){0}. All rights reserved.\n\nYou are running : {1} v{2}\n\n", GlobalStatic.Copyright, GlobalStatic.ProductID, GlobalStatic.VersionID);
                About_Msg += string.Format("SQLite Version : {0}\nSQLITE Source ID : {1}", About_Data[1]["SQLITE_VERSION()"], About_Data[1]["sqlite_source_id()"]);
                Events.LogMessagePopUp(About_Msg, "Debug", "About");//DO NOT LOCALIZE
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["Show Help"])
            {
                string Path = System.IO.Path.Combine(GlobalStatic.AssetPath, "HELP Table.html");
                LDProcess.Start(Path, null);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["Settings Editor"])
            {
                UI.Settings.Display();
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["Refresh Schema"])
            {
                Engines.GetSchema(Engines.CurrentDatabase);
                Engines.GetColumnsofTable(Engines.CurrentDatabase, Engines.CurrentTable);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == Language.Localization["Check for Updates"])
            {
                Updater.CheckForUpdates(GlobalStatic.UpdaterDBpath);
                Stack.Exit(StackPointer);
                return;
            }
            //Charts
            else if (Item == "Bar") //TODO Localize
            {
                Google_Charts.Chart.Bar Bar = new Google_Charts.Chart.Bar();
                UI.Charts.Display(Bar);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == "Column") //TODO Localize
            {
                Google_Charts.Chart.Column Column = new Google_Charts.Chart.Column();
                UI.Charts.Display(Column);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == "Geo") //TODO Localize
            {
                Google_Charts.Chart.GeoCharts Geo = new Google_Charts.Chart.GeoCharts();
                UI.Charts.Display(Geo);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == "Histogram") //TODO Localize
            {
                Google_Charts.Chart.Histograms Histo = new Google_Charts.Chart.Histograms();
                UI.Charts.Display(Histo);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == "Line") //TODO Localize
            {
                Google_Charts.Chart.Line Line = new Google_Charts.Chart.Line();
                UI.Charts.Display(Line);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == "Org") //TODO Localize
            {
                Google_Charts.Chart.OrgChart Org = new Google_Charts.Chart.OrgChart();
                UI.Charts.Display(Org);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == "Pie") //TODO: Localize
            {
                Google_Charts.Chart.Pie Pie = new Google_Charts.Chart.Pie();
                UI.Charts.Display(Pie);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == "Sankey") //TODO Localize
            {
                Google_Charts.Chart.SanKey SanKey = new Google_Charts.Chart.SanKey();
                UI.Charts.Display(SanKey);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == "Scatter Plot") //TODO Localize
            {
                Google_Charts.Chart.Scatter Scatter = new Google_Charts.Chart.Scatter();
                UI.Charts.Display(Scatter);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == "Sortable Table") //TODO Localize
            {
                Google_Charts.Chart.Table Table = new Google_Charts.Chart.Table();
                UI.Charts.Display(Table);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item == "TimeLine") //TODO Localize
            {
                Google_Charts.Chart.TimeLine TL = new Google_Charts.Chart.TimeLine();
                UI.Charts.Display(TL);
                Stack.Exit(StackPointer);
                return;
            }
            else if (Item != null)
            {
                Events.LogMessage(Item + " does not exist in context or is not yet implemented", Language.Localization["UI"]);
            }
            Stack.Exit(StackPointer);
        }