Exemplo n.º 1
0
    public static void Run()
    {
        if (Running)
        {
            if (!Task.HasExited)
            {
                AlreadyRunning();
                return;
            }
        }

        String Executable = RunRegistry.GetCombined();

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

        String Model = RunRegistry.GetModel();

        String Msg = "";

        Msg += "<model> " + Model + " </model>";

        Task = new Process();

        Task.StartInfo.FileName  = Executable;
        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(Executable);
            Running = false;
        }
        else
        {
            Running = true;
        }
    }
Exemplo n.º 2
0
    public Options_Solving_Model()
    {
        Text = " Model Root File ";

        ModelName = new Label();

        ModelName.Parent   = this;
        ModelName.Location = new Point(20, 10);
        ModelName.AutoSize = true;

        RefreshLabel(RunRegistry.GetModel());

        new Note(this, 20, 35, "Edit");

        Edit = new TextBox();

        Edit.Parent   = this;
        Edit.Location = new Point(50, 33);
        Edit.Size     = new Size(240, 20);
        Edit.Text     = RunRegistry.GetModel();

        Button Apply = new Button();

        Apply.Parent   = this;
        Apply.Location = new Point(300, 33);
        Apply.Size     = new Size(60, 20);
        Apply.Text     = "Apply";
        Apply.Click   += new EventHandler(OnApply);

        Button Browse = new Button();

        Browse.Parent   = this;
        Browse.Location = new Point(370, 33);
        Browse.Size     = new Size(60, 20);
        Browse.Text     = "Browse";
        Browse.Click   += new EventHandler(OnBrowse);

        Button Reset = new Button();

        Reset.Parent   = this;
        Reset.Location = new Point(440, 33);
        Reset.Size     = new Size(60, 20);
        Reset.Text     = "Reset";
        Reset.Click   += new EventHandler(OnReset);

        Label DefaultName = new Label();

        DefaultName.Parent   = this;
        DefaultName.Location = new Point(20, 60);
        DefaultName.AutoSize = true;
        DefaultName.Text     = "Default Name : " + RunRegistry.GetDefaultModel();
    }