예제 #1
0
        // Generic method to run previewWinform because it is in a different disk location to all the rest and takes additional parameters.
        private void RunPreviewWinform(ref int NumFailures, ref int NumWarnings)
        {
            NantTask task = new NantTask(NantTask.TaskItem.previewWinform);

            ProgressDialog dlg = new ProgressDialog();

            dlg.lblStatus.Text = task.StatusText;
            dlg.Show();

            NumFailures = 0;
            NumWarnings = 0;
            OutputText.AppendText(OutputText.OutputStream.Both, String.Format("~~~~~~~~~~~~~~~~ {0} ...\r\n", task.LogText));
            dlg.Refresh();

            if (NantExecutor.RunPreviewWinform(BranchLocation, txtYAMLPath.Text))
            {
                // It ran successfully - let us check the output ...
                OutputText.AddLogFileOutput(BranchLocation + @"\csharp\ICT\Petra\Client\opda.txt", ref NumFailures, ref NumWarnings);
            }
            else
            {
                NumFailures++;
            }

            dlg.Close();
        }
예제 #2
0
        // Generic method to run generateWinform because it is in a different disk location to all the rest and takes additional parameters.
        private void RunGenerateWinform(ref int NumFailures, ref int NumWarnings)
        {
            NantTask task = new NantTask(NantTask.TaskItem.generateWinform);

            ProgressDialog dlg = new ProgressDialog();

            dlg.lblStatus.Text = task.StatusText;
            dlg.Show();

            NumFailures = 0;
            NumWarnings = 0;
            OutputText.AppendText(OutputText.OutputStream.Both, String.Format("~~~~~~~~~~~~~~~~ {0} ...\r\n", task.LogText));
            dlg.Refresh();

            if (NantExecutor.RunGenerateWinform(BranchLocation, txtYAMLPath.Text))
            {
                // It ran successfully - let us check the output ...
                OutputText.AddLogFileOutput(BranchLocation + @"\csharp\ICT\Petra\Client\opda.txt", ref NumFailures, ref NumWarnings);
            }
            else
            {
                NumFailures++;
            }

            if ((NumFailures == 0) && ((NumWarnings == 0) || !chkTreatWarningsAsErrors.Checked) && chkCompileWinform.Checked)
            {
                RunNestedTask(NantTask.TaskItem.quickCompileClient, dlg, ref NumFailures, ref NumWarnings);

                if ((NumFailures == 0) && ((NumWarnings == 0) || !chkTreatWarningsAsErrors.Checked) && chkStartClientAfterGenerateWinform.Checked)
                {
                    GetServerState();

                    if (!_serverIsRunning)
                    {
                        RunNestedTask(NantTask.TaskItem.startPetraServer, dlg, ref NumFailures, ref NumWarnings);
                    }

                    RunNestedTask(NantTask.TaskItem.startPetraClient, dlg, ref NumFailures, ref NumWarnings);
                }
            }

            dlg.Close();
        }
예제 #3
0
        /// <summary>
        /// Method that will run a task inside the context of another task
        /// </summary>
        /// <param name="NestedTask">Task to run</param>
        /// <param name="SplashDialog">Reference to the splash dialog that the parent task launched</param>
        /// <param name="NumFailures">Ongoing number of failures</param>
        /// <param name="NumWarnings">Ongoing number of errors/warnings</param>
        private void RunNestedTask(NantTask.TaskItem NestedTask, ProgressDialog SplashDialog, ref int NumFailures, ref int NumWarnings)
        {
            NantTask nestedTask = new NantTask(NestedTask);

            OutputText.AppendText(OutputText.OutputStream.Both, String.Format("~~~~~~~~~~~~~~~~ {0} ...\r\n", nestedTask.LogText));
            SplashDialog.lblStatus.Text = nestedTask.StatusText;
            SplashDialog.lblStatus.Refresh();

            if (NestedTask == NantTask.TaskItem.startPetraServer)
            {
                if (NantExecutor.StartServer(BranchLocation, chkMinimizeServer.Checked))
                {
                    // It ran successfully - let us check the output ...
                    OutputText.AddLogFileOutput(BranchLocation + @"\opda.txt", ref NumFailures, ref NumWarnings);
                    GetServerState();
                    SetEnabledStates();
                }
                else
                {
                    NumFailures++;
                }
            }
            else
            {
                if (NantExecutor.RunGenericNantTarget(BranchLocation, nestedTask.TargetName))
                {
                    // It ran successfully - let us check the output ...
                    OutputText.AddLogFileOutput(BranchLocation + @"\opda.txt", ref NumFailures, ref NumWarnings);
                }
                else
                {
                    NumFailures++;
                }
            }
        }
예제 #4
0
        private void RunSimpleNantTarget(NantTask Task, string WorkingFolder, ref int NumFailures, ref int NumWarnings)
        {
            // Basic routine that runs a simple target with no parameters
            ProgressDialog dlg = new ProgressDialog();

            dlg.lblStatus.Text = Task.StatusText;
            dlg.Show();

            NumFailures = 0;
            NumWarnings = 0;
            OutputText.AppendText(OutputText.OutputStream.Both, String.Format("~~~~~~~~~~~~~~~~ {0} ...\r\n", Task.LogText));
            dlg.Refresh();

            bool bOk;

            switch (Task.Item)
            {
                case NantTask.TaskItem.startPetraServer:
                    bOk = NantExecutor.StartServer(WorkingFolder, chkMinimizeServer.Checked);
                    break;

                case NantTask.TaskItem.stopPetraServer:
                    bOk = NantExecutor.StopServer(WorkingFolder);
                    break;

                case NantTask.TaskItem.runAdminConsole:
                    bOk = NantExecutor.RunServerAdminConsole(WorkingFolder, String.Empty);
                    break;

                case NantTask.TaskItem.refreshCachedTables:
                    bOk = NantExecutor.RunServerAdminConsole(WorkingFolder, "-Command:RefreshAllCachedTables");
                    break;

                default:
                    bOk = NantExecutor.RunGenericNantTarget(WorkingFolder, Task.TargetName);
                    break;
            }

            if (bOk)
            {
                // It ran successfully - let us check the output ...
                OutputText.AddLogFileOutput(WorkingFolder + @"\opda.txt", ref NumFailures, ref NumWarnings);

                if ((Task.Item == NantTask.TaskItem.startPetraServer) || (Task.Item == NantTask.TaskItem.stopPetraServer))
                {
                    GetServerState();
                    SetEnabledStates();
                }
            }
            else
            {
                NumFailures++;
            }

            dlg.Close();
        }