コード例 #1
0
ファイル: NotifyMenu.cs プロジェクト: Soju06/NUMC
        private void MenuItem_Click(object sender, EventArgs e)
        {
            if (sender.GetType() != typeof(ToolStripMenuItem))
            {
                return;
            }
            var menu = (ToolStripMenuItem)sender;

            switch (menu.Tag)
            {
            case "Open":
                Service.GetService().Show();
                break;

            case "Exit":
                Application.Exit();
                break;

            case "Info":
                if (InfoShowed)
                {
                    return;
                }
                InfoShowed = true;
                using (ProgramInformation dialog = new ProgramInformation())
                    dialog.ShowDialog();
                InfoShowed = false;
                break;

            case "StartProgram":
                Service.StartProgram = menu.Checked = !Service.StartProgram;
                break;
            }
        }
コード例 #2
0
 public static extern Result GetProgramInformation(
     [In] IntPtr program,
     [In][MarshalAs(UnmanagedType.U4)] ProgramInformation parameterName,
     [In] UIntPtr parameterValueSize,
     [Out] byte[] parameterValue,
     [Out] out UIntPtr parameterValueSizeReturned
     );
コード例 #3
0
        /// <summary>
        /// Output program usage information to the console.
        /// </summary>
        private void ShowUsage()
        {
            var programinfo = new ProgramInformation();

            Console.WriteLine("{0} {1} - {2}", programinfo.ProgramName, programinfo.Version, programinfo.Description);
            Console.WriteLine("{0}", programinfo.Copyright);
            Console.WriteLine();
            Console.WriteLine("Usage: DragonDos COMMAND COMMAND-ARGS [OPTIONS]");
            Console.WriteLine();
            Console.WriteLine("Commands:");
            Console.WriteLine("  check <diskimage>");
            Console.WriteLine("  create <diskimage> [<tracks> [<sectors>]]");
            Console.WriteLine("  dump <diskimage> <head> <track> <sector>");
            Console.WriteLine("  delete <diskimage> {<filename>}");
            Console.WriteLine("  dir <diskimage> [-raw]");
            Console.WriteLine("  freemap <diskimage>");
            Console.WriteLine("  read <diskimage> <filename> [<local filename>] [-ascii]");
            Console.WriteLine("  read <diskimage> <filename> <tape image>.CAS [<local filename>] [-ascii}");
            Console.WriteLine("  write <diskimage> <filename> [<local filename>] [-basic] [-native load start]");
            Console.WriteLine("  write <diskimage> <filename> <tape image>.CAS [<localfilename>]");
            Console.WriteLine();
            Console.WriteLine("Options:");
            Console.WriteLine("  -d   Enable debug output.");
            Console.WriteLine("  -v   Enable more verbose operation.");
            Console.WriteLine();
            Console.WriteLine("Visit www.rolfmichelsen.com/dragontools for more information.");
            Console.WriteLine();
        }
        /// <summary>
        /// Get's a <see cref="T:TwiddleToe.Foundation.Models.ProgramInformation" /> object
        /// </summary>
        /// <returns>
        /// A ProgramInformation object
        /// </returns>
        public ProgramInformation Get()
        {
            var returnValue = new ProgramInformation
            {
                DataFolder = this.testContext.DeploymentDirectory + @"\"
            };

            returnValue.DataFile = returnValue.DataFolder + "TestData.json";

            return(returnValue);
        }
コード例 #5
0
 public bool AOTCompileProgram(ProgramInformation program)
 {
     foreach (var file in program.DllFiles)
     {
         File.Create(System.IO.Path.Combine(program.Path, file + ".so")).Close();
         System.Threading.Thread.Sleep(AOTCompileTimeMs);
     }
     File.Create(System.IO.Path.Combine(program.Path, program.ExeFile + ".so")).Close();
     System.Threading.Thread.Sleep(AOTCompileTimeMs);
     return(true);
 }
コード例 #6
0
 public ProgramItem(ProgramInformation programInformation, bool useEscToStop) : base(programInformation.Name)
 {
     this.programInformation = programInformation;
     this.useEscToStop       = useEscToStop;
     programSelectDialog     = new ItemWithDialog <SelectDialog <string> >(new SelectDialog <string> (selectArray, "Options", true));
     aotQuestionDialog       = new ItemWithDialog <QuestionDialog> (new QuestionDialog("Progran already compiled. Recompile?", "AOT recompile"));
     compileDialog           = new ItemWithDialog <StepDialog>(new StepDialog("Compiling", new List <IStep> ()
     {
         new StepContainer(CompileProgram, "compiling program", "Failed to compile")
     }));
     deleteQuestionDialog = new ItemWithDialog <QuestionDialog> (new QuestionDialog("Are you sure?", "Delete"));
     deleteDialog         = new ItemWithDialog <ProgressDialog> (new ProgressDialog("", new StepContainer(DeleteProgram, "Deleting ", "Error deleting program")));
 }
コード例 #7
0
 private static void ShowExceptionDialog(Exception ex)
 {
     try
     {
         var progInfo        = new ProgramInformation("Wsapm.exe", VersionInformation.Version.ToString(3));
         var exceptionDialog = new UnhandledExceptionWindow(ex, progInfo, Wsapm.Resources.Wsapm.General_MessageBoxErrorTitle, new BitmapImage(new Uri("pack://application:,,,/Resources/app.ico")));
         exceptionDialog.ShowDialog();
     }
     catch (Exception)
     {
         // If something fails when showing dialog, the application has to be shut down.
         // Use specific return coded to signal severe error.
         Application.Current.Shutdown(ReturnCodeSevereError);
     }
 }
コード例 #8
0
ファイル: Main.cs プロジェクト: jschmutz/monoev3
        static bool AOTCompileAndShowDialog(ProgramInformation program)
        {
            List <IStep> steps = new List <IStep> ();

            steps.Add(new StepContainer(delegate() { return(ProgramManager.Instance.AOTCompileProgram(program)); }, "compiling program", "Failed to compile"));

            /*foreach (string file in Directory.EnumerateFiles(programFolder,"*.*").Where(s => s.EndsWith(".exe") || s.EndsWith(".dll"))) {
             *      steps.Add (new StepContainer (delegate() {
             *              return AOTHelper.Compile (file);
             *      }, new FileInfo(file).Name, "Failed to compile"));
             * }*/
            var dialog = new StepDialog("Compiling", steps);

            return(dialog.Show());
        }
コード例 #9
0
        /// <summary>
        /// Output program usage information to the console.
        /// </summary>
        private void ShowUsage()
        {
            var programinfo = new ProgramInformation();

            Console.WriteLine("{0} {1} - {2}", programinfo.ProgramName, programinfo.Version, programinfo.Description);
            Console.WriteLine("{0}", programinfo.Copyright);
            Console.WriteLine();
            Console.WriteLine("Usage: File2VDK filename {filename}");
            Console.WriteLine();
            Console.WriteLine("Options:");
            Console.WriteLine("  -d   Enable debug output.");
            Console.WriteLine("  -v   Enable more verbose operation.");
            Console.WriteLine();
            Console.WriteLine("Visit www.rolfmichelsen.com/dragontools for more information.");
            Console.WriteLine();
        }
コード例 #10
0
        public bool Run()
        {
            _logger.LogInformation(ProgramInformation.Build(_ftpDumpConfiguration));

            if (!_togglesConfiguration.AgentschapZorgEnGezondheidFtpDumpAvailable)
            {
                return(false);
            }

            // Get XML via API, do a regular HTTP call as a consumer to avoid the entire DI setup
            var xmlDump = FetchXmlDump();

            // Upload to FTP
            UploadFile(xmlDump);

            return(true);
        }
コード例 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProgramInformationProvider" /> class.
        /// </summary>
        /// <returns>A program information object</returns>
        public ProgramInformation Get()
        {
            var programInformation = new ProgramInformation();

            programInformation.DataFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            if (!programInformation.DataFolder.EndsWith(@"\"))
            {
                programInformation.DataFolder += @"\";
            }

            programInformation.DataFolder += @"Data\";

            if (!Directory.Exists(programInformation.DataFolder))
            {
                Directory.CreateDirectory(programInformation.DataFolder);
            }

            programInformation.DataFile = programInformation.DataFolder + "Data.json";

            return(programInformation);
        }
コード例 #12
0
 public bool StartProgram(ProgramInformation program, bool runInAOT = false, Action <Exception> onExit = null)
 {
     if (RunningProgram != null)
     {
         return(false);
     }
     lock (programLock)
     {
         if (LoadDll(program))
         {
             executionThread = new Thread(new ThreadStart(ProgramExecution));
             RunningProgram  = program;
             this.onExit     = onExit;
         }
         else
         {
             return(false);
         }
     }
     executionThread.Start();
     return(true);
 }
コード例 #13
0
        private bool LoadDll(ProgramInformation program)
        {
            bool ok = true;

            foreach (var dll in program.DllFiles)
            {
                //Needs to be tested
                if (!dll.EndsWith("MonoBrickFirmware.dll"))
                {
                    try
                    {
                        AppDomain.CurrentDomain.Load(dll);
                    }
                    catch
                    {
                        ok = false;
                        break;
                    }
                }
            }
            return(ok);
        }
コード例 #14
0
        private void ProgramExecution()
        {
            Exception e = null;

            try
            {
                AppDomain.CurrentDomain.ExecuteAssembly(RunningProgram.ExeFile);
            }
            catch (Exception programException)
            {
                e = programException;
            }
            lock (programLock)
            {
                RunningProgram = null;
                if (onExit != null)
                {
                    onExit(e);
                }
            }
            programDone.Set();
        }
コード例 #15
0
 public ExecuteProgramDialog(ProgramInformation programInfo, bool inAot, bool useEscToStop) : base("")
 {
     this.program      = programInfo;
     this.useEscToStop = useEscToStop;
     this.inAot        = inAot;
 }
コード例 #16
0
 public void DeleteProgram(ProgramInformation program)
 {
     Directory.Delete(program.Path, true);
 }
コード例 #17
0
 public void StopProgram(ProgramInformation program)
 {
     executionThread.Abort();
     executionThread.Join();
 }
コード例 #18
0
ファイル: ProgramModel.cs プロジェクト: smallrobots/monoev3
 public ProgramModel(ProgramInformation programInfo)
 {
     this.programInfo = programInfo;
 }
コード例 #19
0
ファイル: Main.cs プロジェクト: jschmutz/monoev3
        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);
        }