static bool Download(string URL) { int StackPointer = Stack.Add("Utilities.DownloadUpdate(" + URL + ")"); string DownloadFolder = string.Empty; while (string.IsNullOrWhiteSpace(DownloadFolder) || string.IsNullOrWhiteSpace(LDFile.GetExtension(DownloadFolder))) { GraphicsWindow.ShowMessage("You will be prompted to select the download location.", "Download Location"); DownloadFolder = LDDialogs.SaveFile("1=zip;", Program.Directory); } int UpdaterSize = LDNetwork.DownloadFile(DownloadFolder, URL); switch (UpdaterSize) { case -1: GraphicsWindow.ShowMessage( Language.Localization["Check Log"], Language.Localization["Error"]); Stack.Exit(StackPointer); return(false); default: GraphicsWindow.ShowMessage("SUCCESS", "Update Downloaded"); Stack.Exit(StackPointer); return(true); } }
public void Handler([CallerMemberName] string memberName = "") { string message = "Exception has occurred with:" + Environment.NewLine + memberName; GraphicsWindow.Hide(); System.Media.SystemSounds.Exclamation.Play(); GraphicsWindow.ShowMessage(message, "Exception"); Program.End(); }
public static void SetWallpaper(String assunto) { SmallBasicApplication.BeginProgram(); SmallBasicProgram.foto = Flickr.GetRandomPicture(assunto); Desktop.SetWallPaper(SmallBasicProgram.foto); GraphicsWindow.ShowMessage("Papel de parede mudado para" + SmallBasicProgram.assunto, "OK"); }
static void Main(string[] args) { GraphicsWindow.KeyDown += GraphicsWindow_KeyDown; GraphicsWindow.MouseDown += GraphicsWindow_MouseDown; GraphicsWindow.MouseUp += GraphicsWindow_MouseUp; Turtle.PenUp(); GraphicsWindow.BrushColor = "Red"; var eat = Shapes.AddRectangle(10, 10); Shapes.Move(eat, 200, 200); int eatX = 200; int eatY = 200; Random rnd = new Random(); int count = 0; double step = 3; GraphicsWindow.DrawText(0, 0, "Очки: " + Convert.ToString(count)); while (true) { Turtle.Move(step); if ((Turtle.X <= eatX + 15) && (Turtle.X >= eatX - 5) && (Turtle.Y <= eatY + 15) && (Turtle.Y >= eatY - 5)) { GraphicsWindow.BrushColor = "White"; GraphicsWindow.DrawText(0, 0, "Очки: " + Convert.ToString(count)); eatX = rnd.Next(10, GraphicsWindow.Width); eatY = rnd.Next(10, GraphicsWindow.Height); Shapes.Move(eat, eatX, eatY); count++; Turtle.Speed = Turtle.Speed + 0.1; step = step + 0.1; GraphicsWindow.BrushColor = "Red"; GraphicsWindow.DrawText(0, 0, "Очки: " + Convert.ToString(count)); } if (Turtle.X < 0) { break; } else if (Turtle.X > GraphicsWindow.Width) { break; } else if (Turtle.Y < 0) { break; } else if (Turtle.Y > GraphicsWindow.Height) { break; } //GraphicsWindow.DrawText(10, 10, "Очки: " + Convert.ToString(count)); } GraphicsWindow.ShowMessage("Ваши очки: " + Convert.ToString(count), "Игра окончена!"); }
/// <summary> /// Converts a text settings file to an XML settings file. /// </summary> static void ConverttoXML(Primitive Settings, string URI) { int StackPointer = Stack.Add("Settings.ConvertToXML"); try { System.IO.File.WriteAllText(URI, ConverttoXML(Settings)); } catch (Exception) { GraphicsWindow.ShowMessage(Language.Localization["Failed Save Settings"], Language.Localization["Error"]); } Stack.Exit(StackPointer); }
static void LogMessage(string Message, string Type, string Caller) { #if DEBUG Console.WriteLine("Log : Caller was : {0}; Type: {1}; Message: {2} ;", Caller, Type, Message); #endif if (string.IsNullOrWhiteSpace(Type)) { Type = "Unknown"; } if (Type == "Debug" && GlobalStatic.DebugMode == false) { return; } if (Type == "PopUp") { GraphicsWindow.ShowMessage(Message, Caller); } else if (Message.Contains("LDDataBase.Query") == true || Message.Contains("LDDataBase.Command") == true) { if (Message.Contains("logic error")) { Type = "SQL Error"; GraphicsWindow.ShowMessage(Message, Type); } } else if (Message.Contains("Shape not found")) { Type = "Shape"; } int StackPointer = Stack.Add($"Events.LogMessage({Message},{Type},{Caller})"); string LogCMD = "INSERT INTO LOG ([UTC DATE],[UTC TIME],DATE,TIME,USER,ProductID,ProductVersion,Event,Type) VALUES(DATE(),TIME(),DATE('now','localtime'),TIME('now','localtime'),'" + GlobalStatic.UserName + "','" + GlobalStatic.ProductID + "','" + GlobalStatic.VersionID + "','" + Message.Replace("\n", "") + "','" + Type + "');";; var CS = new Engines.CommandSettings() { Database = GlobalStatic.LogDB, SQL = LogCMD, User = Language.Localization["App"], Explanation = Language.Localization["Auto Log"] }; Engines.Command(CS); Stack.Exit(StackPointer); }
public static void CheckForUpdates(string downloadlocation, string URI = GlobalStatic.OnlineDB_Refrence_Location, bool UI = true) { int StackReference = Stack.Add($"Utilities.Updater.CheckForUpdates({UI})"); if (string.IsNullOrWhiteSpace(UpdaterDB) == false || LDNetwork.DownloadFile(downloadlocation, URI) != -1) { int LatestVersion = LatestUpdate(); int.TryParse(GlobalStatic.VersionID, out int CurrentVersion); string[] Locations = FetchLinks(); string DownloadLocation = Locations[0]; string DownloadLocation2 = Locations[1]; if (CurrentVersion == LatestVersion && UI == true) { GraphicsWindow.ShowMessage("There are no updates available", Language.Localization["NoUpdates"] ?? "No Updates"); //TODO LOCALIZE } else if (CurrentVersion > LatestVersion && UI == true) { GraphicsWindow.ShowMessage("You have a more recent edition of the program than that offered to the public.\nYou have version " + CurrentVersion + " while the most recent public release is version " + LatestVersion, Language.Localization["NoUpdates"] ?? "No Updates"); } else if (CurrentVersion < LatestVersion) { if (LDDialogs.Confirm($"Do you wish to download Version {LatestVersion }? You have Version {CurrentVersion}.", "Download Update") == "Yes") //TODO LOCALIZE { if (Download(DownloadLocation) == false) { Download(DownloadLocation2); } } } Primitive Temp = GlobalStatic.Settings["Updates"]; Temp["LastCheck"] = DateTime.Now.ToString("yyyy-MM-dd"); GlobalStatic.Settings["Updates"] = Temp; Settings.Save(); Settings.Load(GlobalStatic.RestoreSettings, GlobalStatic.SettingsPath); } else { GraphicsWindow.ShowMessage( Language.Localization["Check Log"], Language.Localization["Error"]); } Stack.Exit(StackReference); }
public static void LogMessagePopUp(string Message, string Type, string Title) { GraphicsWindow.ShowMessage(Message, Title); LogMessage(Message, Type); }
/// <param name="UI_Message">Message Shown on the popup</param> /// <param name="Message">Message passed to the low</param> /// <param name="Title">Title of the popup</param> /// <param name="Type">Type</param> public static void LogMessagePopUp(Primitive UI_Message, Primitive Message, Primitive Title, Primitive Type) { GraphicsWindow.ShowMessage(UI_Message, Title); LogMessage(Message, Type); }
public static void CreateTableHandler() { int StackPointer = Stack.Add("UI.CreateTableHandler()"); string LastButton = Controls.LastClickedButton; string Name = Controls.GetTextBoxText(_TextBox["Table_Name"]); if (LastButton == _Buttons["Commit"]) { if (!string.IsNullOrWhiteSpace(Name)) { Name = Name.Replace("[", "").Replace("]", "").Replace("\"", ""); int Max = LDControls.DataViewRowCount(GlobalStatic.Dataview); StringBuilder Define_SQL = new StringBuilder(); Define_SQL.Append("CREATE TABLE \"" + Name + "\"("); for (int i = 1; i <= Max; i++) { Primitive _Data = LDControls.DataViewGetRow(GlobalStatic.Dataview, i); if (!string.IsNullOrWhiteSpace(_Data[1])) { if (_Data[4] == true) { _Data[3] = true; } string Field = ((string)_Data[1]).Replace("[", "").Replace("]", "").Replace("\"", ""); Define_SQL.AppendFormat("\"{0}\" {1}", Field, (string)_Data[2]); if (_Data[6] == true) { Define_SQL.Append(" NOT NULL"); } if (_Data[3] == true) { Define_SQL.Append(" PRIMARY KEY"); } if (_Data[4] == true) { Define_SQL.Append(" AUTOINCREMENT"); } if (_Data[5] == true) { Define_SQL.Append(" UNIQUE"); } if (i != Max) { Define_SQL.Append(","); } else { Define_SQL.Append(");"); } } } if (!string.IsNullOrWhiteSpace(Engines.CurrentDatabase)) { string Confirmation = LDDialogs.Confirm("Do you wish to commit the following SQL:\n" + Define_SQL.ToString() + "\n to " + Engines.DB_ShortName[Engines.DB_Name.IndexOf(Engines.CurrentDatabase)], "Commit SQL"); if (Confirmation == "Yes") { Engines.CommandSettings CS = new Engines.CommandSettings() { Database = Engines.CurrentDatabase, SQL = Define_SQL.ToString(), User = GlobalStatic.UserName, Explanation = "User Defining a Table" //Localize }; Engines.Command(CS); } } } else { GraphicsWindow.ShowMessage("Table Name is not empty, please fill it!", "NAME"); } Stack.Exit(StackPointer); return; } if (LastButton == _Buttons["Exit"]) { Controls.ButtonClicked -= CreateTableHandler; Controls.ButtonClicked += Events.BC; ClearWindow(); DisplayResults(); ShowDisplayResults(); MainMenu(); //Events.MC("View"); Stack.Exit(StackPointer); return; } Stack.Exit(StackPointer); }
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(); } }