示例#1
0
        public static void MainMenu()
        {
            int StackReference = Stack.Add("UI.MainMenu()");

            LDGraphicsWindow.ExitButtonMode(GraphicsWindow.Title, "Enabled");
            GraphicsWindow.CanResize = true;

            LDGraphicsWindow.State = 2;
            GraphicsWindow.Title   = GlobalStatic.Title + " ";

            Primitive Sorts = $"1={Language.Localization["Table"]};2={Language.Localization["View"]};3={Language.Localization["Index"]};4={Language.Localization["Master Table"]};";

            if (Engines.CurrentDatabase != null && Engines.CurrentDatabase != null)
            {
                Engines.GetSchema(Engines.CurrentDatabase);
            }
            GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize + 8;
            int UIx = GlobalStatic.Listview_Width - 380;

            string Menu = LDControls.AddMenu(Desktop.Width * 1.5, 30, MenuList, IconList, null);

            Shapes.Move(Shapes.AddText(Language.Localization["Sort"] + ":"), UIx, 1);

            int TextWidth = LDText.GetHeight(Language.Localization["Sort"] + ":");

            GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize;

            try
            {
                GlobalStatic.ComboBox["Table"] = LDControls.AddComboBox(Engines.Tables.ToPrimitiveArray(), 100, 100);
            }
            catch (Exception ex)
            {
                Events.LogMessage(ex.ToString(), "System");
            }

            GlobalStatic.ComboBox["Sorts"]    = LDControls.AddComboBox(Sorts, 100, 100);
            GlobalStatic.ComboBox["Database"] = LDControls.AddComboBox(Engines.DB_ShortName.ToPrimitiveArray(), 100, 100);
            Controls.Move(GlobalStatic.ComboBox["Database"], UIx + TextWidth + 35, 5);
            Controls.Move(GlobalStatic.ComboBox["Sorts"], UIx + TextWidth + 150, 5);
            Controls.Move(GlobalStatic.ComboBox["Table"], UIx + TextWidth + 260, 5);

            //Virtual Call to Handler
            Events.MC(Language.Localization["View"]);

            Title();

            Controls.ButtonClicked         += Events.BC;
            LDControls.MenuClicked         += Events.MC;
            LDControls.ComboBoxItemChanged += Events.CB;
            LDControls.ContextMenuClicked  += Events.MI;

            Stack.Exit(StackReference);
        }
示例#2
0
 public static Primitive GetPixel(Primitive x, Primitive y)
 {
     return(LDGraphicsWindow.GetPixel(x, y));
 }
示例#3
0
文件: DBM.cs 项目: 65001/DBM-CSharp
        public static void DisplayResults()
        {
            int StackPointer = Stack.Add("UI.DisplayResults()");

            LDGraphicsWindow.PauseUpdates();
            //Clears the Dictionary to prevent errors
            _Buttons.Clear();
            _TextBox.Clear();

            /*
             * _CheckBox.Clear();
             * _ComboBox.Clear();
             */

            LDGraphicsWindow.Width  = Desktop.Width;
            LDGraphicsWindow.Height = Desktop.Height;
            GraphicsWindow.Left     = 0;
            GraphicsWindow.Top      = 0;
            GlobalStatic.UIx        = GlobalStatic.Listview_Width + 50;
            DisplayHelper();

            //Sort
            GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize + 1;
            string AscDesc = "1=" + Language.Localization["Asc"] + ";2=" + Language.Localization["Desc"] + ";3=RANDOM();";

            GlobalStatic.ComboBox["Sort"]    = LDControls.AddComboBox(Engines.Schema, 100, 100);
            GlobalStatic.ComboBox["ASCDESC"] = LDControls.AddComboBox(AscDesc, 110, 100);

            _Buttons.AddOrReplace("Sort", Controls.AddButton(Language.Localization["Sort"], GlobalStatic.UIx + 10, 120));

            Controls.Move(GlobalStatic.ComboBox["Sort"], GlobalStatic.UIx + 80, 77);
            Controls.Move(GlobalStatic.ComboBox["ASCDESC"], GlobalStatic.UIx + 190, 77);
            Controls.SetSize(_Buttons["Sort"], 290, 30);

            LDDialogs.ToolTip(_Buttons["Sort"], "Iniates a sort based on user set parameters");                     //Localize
            LDDialogs.ToolTip(GlobalStatic.ComboBox["ASCDESC"], "Sorts Ascending and Decending based on position"); //Localize

            //Search
            GlobalStatic.ComboBox["Search"] = LDControls.AddComboBox(Engines.Schema, 200, 120);
            _TextBox.AddOrReplace("Search", Controls.AddTextBox(GlobalStatic.UIx + 100, 210));
            GlobalStatic.CheckBox["StrictSearch"] = LDControls.AddCheckBox(Language.Localization["Strict Search"]);
            GlobalStatic.CheckBox["InvertSearch"] = LDControls.AddCheckBox(Language.Localization["Invert"]);
            _Buttons.AddOrReplace("Search", Controls.AddButton(Language.Localization["Search"].ToUpper(), GlobalStatic.UIx + 10, 260));

            Controls.Move(GlobalStatic.CheckBox["StrictSearch"], GlobalStatic.UIx + 20, 240);
            Controls.Move(GlobalStatic.CheckBox["InvertSearch"], GlobalStatic.UIx + 150, 240);
            Controls.Move(GlobalStatic.ComboBox["Search"], GlobalStatic.UIx + 100, 180);

            Controls.SetSize(_TextBox["Search"], 200, 25);
            Controls.SetSize(_Buttons["Search"], 290, 30);

            //Functions
            GlobalStatic.ComboBox["FunctionList"] = LDControls.AddComboBox(Engines.Functions(Engines.CurrentEngine).ToPrimitiveArray(), 130, 100);
            GlobalStatic.ComboBox["ColumnList"]   = LDControls.AddComboBox(Engines.Schema, 135, 100);

            Controls.Move(GlobalStatic.ComboBox["FunctionList"], GlobalStatic.UIx + 10, 315);
            Controls.Move(GlobalStatic.ComboBox["ColumnList"], GlobalStatic.UIx + 160, 315);

            _Buttons.AddOrReplace("RunFunction", Controls.AddButton(Language.Localization["Run Function"].ToUpper(), GlobalStatic.UIx + 10, 345));
            Controls.SetSize(_Buttons["RunFunction"], 290, 30);

            //Custom Query
            _TextBox["CustomQuery"] = Controls.AddMultiLineTextBox(GlobalStatic.UIx, 420);
            Controls.SetSize(_TextBox["CustomQuery"], 310, 150);

            _Buttons.AddOrReplace("Query", Controls.AddButton(Language.Localization["Query"].ToUpper(), GlobalStatic.UIx, 580));
            Controls.SetSize(_Buttons["Query"], 310, 30);

            _Buttons.AddOrReplace("Command", Controls.AddButton(Language.Localization["Command"].ToUpper(), GlobalStatic.UIx, 615));

            Controls.SetSize(_Buttons["Command"], 310, 30);
            LDDialogs.ToolTip(_Buttons["Command"], "Executes customized SQL command statements onto the database");                                                      //Localize
            string CustomQueryData = "This Textbox allows you to use Custom\nSQL Queries. Remove this and type in an SQL \nstatement. \nYou also use it to export data"; //Localize

            Controls.SetTextBoxText(_TextBox["CustomQuery"], CustomQueryData);

            //Hide Display Results
            _HideDisplay.Clear();
            _HideDisplay.Add(GlobalStatic.ComboBox["Sort"]);
            _HideDisplay.Add(GlobalStatic.ComboBox["ASCDESC"]);
            _HideDisplay.Add(Buttons["Sort"]);
            _HideDisplay.Add(GlobalStatic.ComboBox["Search"]);
            _HideDisplay.Add(_TextBox["Search"]);
            _HideDisplay.Add(GlobalStatic.CheckBox["StrictSearch"]);
            _HideDisplay.Add(GlobalStatic.CheckBox["InvertSearch"]);
            _HideDisplay.Add(Buttons["Search"]);
            _HideDisplay.Add(GlobalStatic.ComboBox["FunctionList"]);
            _HideDisplay.Add(GlobalStatic.ComboBox["ColumnList"]);
            _HideDisplay.Add(Buttons["RunFunction"]);
            _HideDisplay.Add(_TextBox["CustomQuery"]);
            _HideDisplay.Add(Buttons["Query"]);
            _HideDisplay.Add(Buttons["Command"]);

            LDGraphicsWindow.ResumeUpdates();
            Stack.Exit(StackPointer);
        }
示例#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");
        }
示例#5
0
            public static void Display()
            {
                int StackPointer = Stack.Add("UI.Settings.Display()");

                ClearWindow();
                GraphicsWindow.Title = Language.Localization["Settings"];

                GraphicsWindow.CanResize     = false;
                LDGraphicsWindow.CancelClose = true;
                LDGraphicsWindow.ExitOnClose = false;
                LDGraphicsWindow.Closing    += Events.Closing;
                LDGraphicsWindow.ExitButtonMode(Language.Localization["Settings"], "Disabled");

                GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize + 8;

                GraphicsWindow.DrawText(10, 10, Language.Localization["Listview Width"]);
                _TextBox["Settings_Width"] = Controls.AddTextBox(200, 10);

                GraphicsWindow.DrawText(10, 50, Language.Localization["Listview Height"]);
                _TextBox["Settings_Height"] = Controls.AddTextBox(200, 50);

                GraphicsWindow.DrawText(10, 90, Language.Localization["Extensions"]);
                _TextBox["Settings_Extensions"] = Controls.AddTextBox(200, 90);

                GraphicsWindow.DrawText(10, 130, Language.Localization["Deliminator"]);
                _TextBox["Settings_Deliminator"] = Controls.AddTextBox(200, 130);

                GraphicsWindow.DrawText(10, 175, Language.Localization["Language"]);

                GlobalStatic.ComboBox["Language"] = LDControls.AddComboBox(Language.ISO_Text.ToPrimitiveArray(), 200, 120);
                Controls.Move(GlobalStatic.ComboBox["Language"], 200, 175);

                GraphicsWindow.DrawText(10, 280, Language.Localization["LOG CSV Path"]);
                _Buttons.AddOrReplace("Log_CSV", Controls.AddButton(Language.Localization["Browse"], 320, 280));

                GraphicsWindow.DrawText(10, 330, Language.Localization["LOG DB PATH"]);
                _Buttons.AddOrReplace("Log_DB", Controls.AddButton(Language.Localization["Browse"], 320, 330));

                GraphicsWindow.DrawText(10, 380, Language.Localization["Transaction DB Path"]);
                _Buttons.AddOrReplace("Transaction_DB", Controls.AddButton(Language.Localization["Browse"], 320, 380));

                for (int i = 0; i < Language.ISO_LangCode.Count; i++)
                {
                    if (Language.ISO_LangCode[i] == GlobalStatic.LanguageCode)
                    {
                        int Index = i + 1;
                        LDControls.ComboBoxSelect(GlobalStatic.ComboBox["Language"], Index);
                    }
                }

                _Buttons.AddOrReplace("Settings Save", Controls.AddButton(Language.Localization["Save and Close"], 50, 450));
                _Buttons.AddOrReplace("Settings Close", Controls.AddButton(Language.Localization["Close wo saving"], 50, 500));

                Controls.SetSize(_Buttons["Settings Save"], 280, 40);
                Controls.SetSize(_Buttons["Settings Close"], 280, 40);

                Controls.SetTextBoxText(_TextBox["Settings_Width"], GlobalStatic.Listview_Width);
                Controls.SetTextBoxText(_TextBox["Settings_Height"], GlobalStatic.Listview_Height);
                Controls.SetTextBoxText(_TextBox["Settings_Extensions"], GlobalStatic.Extensions);
                Controls.SetTextBoxText(_TextBox["Settings_Deliminator"], GlobalStatic.Deliminator);

                GraphicsWindow.FontSize = GlobalStatic.DefaultFontSize;

                LDControls.ComboBoxItemChanged -= Events.CB;
                Controls.ButtonClicked         -= Events.BC;
                Controls.ButtonClicked         += Handler;
                Stack.Exit(StackPointer);
            }
示例#6
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);
            }