private void OnSelectDialogExit(SelectDialog <string> dialog)
        {
            if (!dialog.EscPressed)
            {
                switch (dialog.GetSelectionIndex())
                {
                case 0:
                    var startDialog = new ExecuteProgramDialog(this.programInformation, false, useEscToStop);
                    startDialog.Start(Parent);
                    break;

                case 1:
                    if (!programInformation.IsAOTCompiled)
                    {
                        compileBeforeExecution.SetFocus(Parent, OnCompileInfoDialogExit);
                    }
                    else
                    {
                        var start = new ExecuteProgramDialog(this.programInformation, true, useEscToStop);
                        start.Start(Parent);
                    }
                    break;

                case 2:
                    if (programInformation.IsAOTCompiled)
                    {
                        aotQuestionDialog.SetFocus(Parent, OnCompileDialogExit);
                    }
                    else
                    {
                        compileDialog.SetFocus(Parent);
                    }
                    break;

                case 3:
                    deleteQuestionDialog.SetFocus(Parent, OnDeleteDialogExit);
                    break;
                }
            }
        }
Beispiel #2
0
        static bool ShowProgramOptions(string programFolder)
        {
            string fileName = "";

            try {
                fileName = Directory.EnumerateFiles(programFolder, "*.exe").First();
            } catch {
                var info = new InfoDialog(programFolder + "is not executable", true, "Program");
                info.Show();
                Directory.Delete(programFolder, true);
                updateProgramList = true;
                return(true);
            }

            var dialog = new SelectDialog <string> (new string[] {
                "Run Program",
                "Debug Program",
                "Run In AOT",
                "AOT Compile",
                "Delete Program",
            }, "Options", true);

            dialog.Show();
            if (!dialog.EscPressed)
            {
                Action programAction = null;
                switch (dialog.GetSelectionIndex())
                {
                case 0:
                    Lcd.Instance.Clear();
                    Lcd.Instance.DrawBitmap(monoLogo, new Point((int)(Lcd.Width - monoLogo.Width) / 2, 5));
                    Rectangle textRect = new Rectangle(new Point(0, Lcd.Height - (int)Font.SmallFont.maxHeight - 2), new Point(Lcd.Width, Lcd.Height - 2));
                    Lcd.Instance.WriteTextBox(Font.SmallFont, textRect, "Running...", true, Lcd.Alignment.Center);
                    Lcd.Instance.Update();
                    programAction = () => RunAndWaitForProgram(fileName, ExecutionMode.Normal);
                    break;

                case 1:
                    programAction = () => RunAndWaitForProgram(fileName, ExecutionMode.Debug);
                    break;

                case 2:
                    if (!AOTHelper.IsFileCompiled(fileName))
                    {
                        if (AOTCompileAndShowDialog(programFolder))
                        {
                            programAction = () => RunAndWaitForProgram(fileName, ExecutionMode.AOT);
                        }
                    }
                    else
                    {
                        programAction = () => RunAndWaitForProgram(fileName, ExecutionMode.AOT);
                    }
                    break;

                case 3:

                    if (AOTHelper.IsFileCompiled(fileName))
                    {
                        var questionDialog = new QuestionDialog("Progran already compiled. Recompile?", "AOT recompile");
                        if (questionDialog.Show())
                        {
                            AOTCompileAndShowDialog(programFolder);
                        }
                    }
                    else
                    {
                        AOTCompileAndShowDialog(programFolder);
                    }
                    break;

                case 4:
                    var question = new QuestionDialog("Are you sure?", "Delete");
                    if (question.Show())
                    {
                        var step = new StepContainer(() => {
                            Directory.Delete(programFolder, true);
                            return(true);
                        }, "Deleting ", "Error deleting program");
                        var progressDialog = new ProgressDialog("Program", step);
                        progressDialog.Show();
                        updateProgramList = true;
                    }
                    break;
                }
                if (programAction != null)
                {
                    Console.WriteLine("Starting application");
                    programAction();
                    Console.WriteLine("Done running application");
                }
                return(updateProgramList);
            }
            return(false);
        }
		private void OnSelectDialogExit(SelectDialog<string> dialog)
		{
			if (!dialog.EscPressed) {
				switch (dialog.GetSelectionIndex ()) {
				case 0:
					var startDialog = new ExecuteProgramDialog (this.programInformation, false, useEscToStop);
					startDialog.Start (Parent);
					break;
				case 1:
					if (!programInformation.IsAOTCompiled)
					{
						compileBeforeExecution.SetFocus (Parent, OnCompileInfoDialogExit); 
					} 
					else 
					{
						var start = new ExecuteProgramDialog (this.programInformation, true, useEscToStop);
						start.Start (Parent);
					}
					break;
				case 2:
					if (programInformation.IsAOTCompiled)
					{
						aotQuestionDialog.SetFocus (Parent,OnCompileDialogExit);
					} 
					else 
					{
						compileDialog.SetFocus (Parent);
					}
					break;
				case 3:
					deleteQuestionDialog.SetFocus (Parent,OnDeleteDialogExit);
					break;
				}
			}		
		}
Beispiel #4
0
        static bool ShowProgramOptions(string programFolder)
        {
            string fileName = "";
            try {
                fileName = Directory.EnumerateFiles (programFolder, "*.exe").First ();
            } catch {
                var info = new InfoDialog (programFolder + "is not executable", true, "Program");
                info.Show ();
                Directory.Delete (programFolder, true);
                updateProgramList = true;
                return true;
            }

            var dialog = new SelectDialog<string> (new string[] {
                "Run Program",
                "Debug Program",
                "Run In AOT",
                "AOT Compile",
                "Delete Program",
            }, "Options", true);
            dialog.Show ();
            if (!dialog.EscPressed) {
                Action programAction = null;
                switch (dialog.GetSelectionIndex ()) {
                case 0:
                    Lcd.Instance.Clear ();
                    Lcd.Instance.DrawBitmap (monoLogo, new Point ((int)(Lcd.Width - monoLogo.Width) / 2, 5));
                    Rectangle textRect = new Rectangle (new Point (0, Lcd.Height - (int)Font.SmallFont.maxHeight - 2), new Point (Lcd.Width, Lcd.Height - 2));
                    Lcd.Instance.WriteTextBox (Font.SmallFont, textRect, "Running...", true, Lcd.Alignment.Center);
                    Lcd.Instance.Update ();
                    programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.Normal);
                    break;
                case 1:
                    programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.Debug);
                    break;
                case 2:
                    if (!AOTHelper.IsFileCompiled (fileName)) {
                        if (AOTCompileAndShowDialog (programFolder)) {
                            programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.AOT);
                        }
                    } else {
                        programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.AOT);
                    }
                    break;
                case 3:

                    if (AOTHelper.IsFileCompiled (fileName)) {
                        var questionDialog = new QuestionDialog ("Progran already compiled. Recompile?", "AOT recompile");
                        if (questionDialog.Show ()) {
                            AOTCompileAndShowDialog (programFolder);
                        }
                    } else {
                        AOTCompileAndShowDialog (programFolder);
                    }
                    break;
                case 4:
                    var question = new QuestionDialog ("Are you sure?", "Delete");
                    if (question.Show ()) {
                        var step = new StepContainer (() => {
                            Directory.Delete (programFolder, true);
                            return true;
                        }, "Deleting ", "Error deleting program");
                        var progressDialog = new ProgressDialog ("Program", step);
                        progressDialog.Show ();
                        updateProgramList = true;
                    }
                    break;
                }
                if (programAction != null)
                {
                    Console.WriteLine("Starting application");
                    programAction();
                    Console.WriteLine ("Done running application");
                }
                return updateProgramList;
            }
            return false;
        }
Beispiel #5
0
        static bool ShowProgramOptions(ProgramInformation program)
        {
            var dialog = new SelectDialog <string> (new string[] {
                "Run Program",
                "Run In AOT",
                "AOT Compile",
                "Delete Program",
            }, "Options", true);

            dialog.Show();
            if (!dialog.EscPressed)
            {
                Action programAction = null;
                switch (dialog.GetSelectionIndex())
                {
                case 0:
                    Lcd.Instance.Clear();
                    Lcd.Instance.DrawBitmap(monoLogo, new Point((int)(Lcd.Width - monoLogo.Width) / 2, 5));
                    Rectangle textRect = new Rectangle(new Point(0, Lcd.Height - (int)Font.SmallFont.maxHeight - 2), new Point(Lcd.Width, Lcd.Height - 2));
                    Lcd.Instance.WriteTextBox(Font.SmallFont, textRect, "Running...", true, Lcd.Alignment.Center);
                    Lcd.Instance.Update();
                    programAction = () => ProgramManager.Instance.StartProgram(program, false);
                    break;

                case 1:
                    if (!program.IsAOTCompiled)
                    {
                        if (AOTCompileAndShowDialog(program))
                        {
                            programAction = () => ProgramManager.Instance.StartProgram(program, true);
                        }
                    }
                    else
                    {
                        programAction = () => ProgramManager.Instance.StartProgram(program, true);
                    }
                    break;

                case 3:

                    if (program.IsAOTCompiled)
                    {
                        var questionDialog = new QuestionDialog("Progran already compiled. Recompile?", "AOT recompile");
                        if (questionDialog.Show())
                        {
                            AOTCompileAndShowDialog(program);
                        }
                    }
                    else
                    {
                        AOTCompileAndShowDialog(program);
                    }
                    break;

                case 4:
                    var question = new QuestionDialog("Are you sure?", "Delete");
                    if (question.Show())
                    {
                        var step           = new StepContainer(() => { ProgramManager.Instance.DeleteProgram(program); return(true); }, "Deleting ", "Error deleting program");
                        var progressDialog = new ProgressDialog("Program", step);
                        progressDialog.Show();
                        updateProgramList = true;
                    }
                    break;
                }
                if (programAction != null)
                {
                    Console.WriteLine("Starting application");
                    programAction();
                    Console.WriteLine("Done running application");
                }
                return(updateProgramList);
            }
            return(false);
        }
Beispiel #6
0
		static bool ShowProgramOptions (ProgramInformation program)
		{
			var dialog = new SelectDialog<string> (new string[] {
				"Run Program",
				"Run In AOT",
				"AOT Compile",
				"Delete Program",
			}, "Options", true);
			dialog.Show ();
			if (!dialog.EscPressed) {
				Action programAction = null;
				switch (dialog.GetSelectionIndex ()) {
				case 0:
					Lcd.Instance.Clear ();
					Lcd.Instance.DrawBitmap (monoLogo, new Point ((int)(Lcd.Width - monoLogo.Width) / 2, 5));					
					Rectangle textRect = new Rectangle (new Point (0, Lcd.Height - (int)Font.SmallFont.maxHeight - 2), new Point (Lcd.Width, Lcd.Height - 2));
					Lcd.Instance.WriteTextBox (Font.SmallFont, textRect, "Running...", true, Lcd.Alignment.Center);
					Lcd.Instance.Update ();						
					programAction = () => ProgramManager.Instance.StartProgram(program,false);	
					break;
				case 1:
					if (!program.IsAOTCompiled) 
					{
						if (AOTCompileAndShowDialog (program)) 
						{
							programAction = () => ProgramManager.Instance.StartProgram(program,true);	
						}
					} 
					else 
					{
						programAction = () => ProgramManager.Instance.StartProgram(program, true);
					}
					break;
				case 3:
						
					if (program.IsAOTCompiled) {
						var questionDialog = new QuestionDialog ("Progran already compiled. Recompile?", "AOT recompile");
						if (questionDialog.Show ()) {
							AOTCompileAndShowDialog (program);
						}
					} 
					else 
					{
						AOTCompileAndShowDialog (program);
					}
					break;
				case 4:
					var question = new QuestionDialog ("Are you sure?", "Delete");
					if (question.Show ()) 
					{
						var step = new StepContainer (() => {ProgramManager.Instance.DeleteProgram(program); return true;}, "Deleting ", "Error deleting program"); 
						var progressDialog = new ProgressDialog ("Program", step);
						progressDialog.Show ();
						updateProgramList = true;
					}
					break;
				}
				if (programAction != null) 
				{
					Console.WriteLine("Starting application");
					programAction();					
					Console.WriteLine ("Done running application");
				}
				return updateProgramList;
			}
			return false;
			
		}