Example #1
0
 void OnClick(object Obj, EventArgs EA)
 {
     RunRegistry.SetModel(Filename);
 }
Example #2
0
    public static void Run()
    {
        if (Running)
        {
            if (!Task.HasExited)
            {
                AlreadyRunning();
                return;
            }
        }

        String Controller = RunRegistry.GetController();

        if (!System.IO.File.Exists(Controller))
        {
            CantFind("controller", Controller);
            return;
        }

        String Solver = RunRegistry.GetSolver();
        String Model  = RunRegistry.GetModel();

        String Msg = "";

        Msg += "<root> ";
        Msg += "<model> " + Model + " </model>";
        Msg += "<solver> " + Solver + " </solver>";
        Msg += " </root>";

        Task = new Process();

        Task.StartInfo.FileName  = Controller;
        Task.StartInfo.Arguments = AddQuotes(Msg);

        if (GeneralRegistry.GetWaitForExit())
        {
            State.WaitForExit();
        }

        bool OK = Task.Start();

        /* Task.Start() starts the named task, but also associates
         * the task with the process object. You can invoke
         * WaitForExit() only after this association has been made.
         * If invoked to early, an exception is thrown.             */

        if (GeneralRegistry.GetWaitForExit())
        {
            Task.WaitForExit();
            State.HaveExit();
        }

        if (!OK)
        {
            FailedToStart(Controller);
            Running = false;
        }
        else
        {
            Running = true;
        }
    }
 private void OnApply(object Obj, EventArgs EA)
 {
     RunRegistry.SetController(Edit.Text);
     RefreshLabel(Edit.Text);
 }