示例#1
0
        private void btnNext_Click(object sender, System.EventArgs e)
        {
            if (String.IsNullOrEmpty(txtName.Text))
            {
                MessageBox.Show("Please specify a name for the Task");
                return;
            }

            if (String.IsNullOrEmpty(txtCmd.Text))
            {
                MessageBox.Show("Please specify a commandline for the Task");
                return;
            }

            try
            {
                task = new TaskEntities.Task(txtName.Text, txtCmd.Text);
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(string.Format(
                                                   "{0} Caught\nTask Name is a required field. Please enter a valid name", ex));
            }

            if (!txtAffinityInfo.Text.Equals(""))
            {
                task.AffinityInfo = new AffinityInfo();

                try
                {
                    task.AffinityInfo.AffinityId = txtAffinityInfo.Text;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Create Task: Affinity Info:\n{0}", ex));
                }
            }
            else
            {
                task.AffinityInfo = null;
            }

            task.TaskConstraints = new TaskConstraints();

            try
            {
                if (!txtMaxTaskRetryCount.Text.Equals(""))
                {
                    task.TaskConstraints.MaxTaskRetryCount = int.Parse(txtMaxTaskRetryCount.Text);
                }
                else
                {
                    task.TaskConstraints.MaxTaskRetryCount = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Create Task: Max Retry Count error:\n{0}", ex));
            }

            try
            {
                if (Time.CanParse(dataTableWallClock))
                {
                    TimeSpan span = Time.ParseTimeSpan(dataTableWallClock);
                    task.TaskConstraints.MaxWallClockTime = span;
                }
                else
                {
                    task.TaskConstraints.MaxWallClockTime = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Create Task: Max Wall Clock Time error:\n{0}", ex));
            }

            try
            {
                if (Time.CanParse(dataTableWallClock))
                {
                    TimeSpan span = Time.ParseTimeSpan(dataTableRetention);
                    task.TaskConstraints.RetentionTime = span;
                }
                else
                {
                    task.TaskConstraints.RetentionTime = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Create Task: Retention Time error:\n{0}", ex));
            }

            page2 = new FilesEnv(Sender, task, txtName.Text);
            NavigationService.Navigate(page2);
        }
        private void btnNext_Click(object sender, System.EventArgs e)
        {
            if (String.IsNullOrEmpty(txtName.Text))
            {
                MessageBox.Show("Please specify a name for the Task");
                return;
            }

            if (String.IsNullOrEmpty(txtCmd.Text))
            {
                MessageBox.Show("Please specify a commandline for the Task");
                return;
            }

            try
            {
                task = new TaskEntities.Task(txtName.Text, txtCmd.Text);
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(string.Format(
                    "{0} Caught\nTask Name is a required field. Please enter a valid name", ex));
            }

            if (!txtAffinityInfo.Text.Equals(""))
            {
                task.AffinityInfo = new AffinityInfo();

                try
                {
                    task.AffinityInfo.AffinityId = txtAffinityInfo.Text;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Create Task: Affinity Info:\n{0}", ex));
                }
            }
            else
            {
                task.AffinityInfo = null;
            }

            task.TaskConstraints = new TaskConstraints();

            try
            {
                if (!txtMaxTaskRetryCount.Text.Equals(""))
                {
                    task.TaskConstraints.MaxTaskRetryCount = int.Parse(txtMaxTaskRetryCount.Text);
                }
                else
                {
                    task.TaskConstraints.MaxTaskRetryCount = 0;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Create Task: Max Retry Count error:\n{0}", ex));
            }

            try
            {
                if (Time.CanParse(dataTableWallClock))
                {
                    TimeSpan span = Time.ParseTimeSpan(dataTableWallClock);
                    task.TaskConstraints.MaxWallClockTime = span;
                }
                else
                {
                    task.TaskConstraints.MaxWallClockTime = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Create Task: Max Wall Clock Time error:\n{0}", ex));
            }

            try
            {
                if (Time.CanParse(dataTableWallClock))
                {
                    TimeSpan span = Time.ParseTimeSpan(dataTableRetention);
                    task.TaskConstraints.RetentionTime = span;
                }
                else
                {
                    task.TaskConstraints.RetentionTime = null;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Create Task: Retention Time error:\n{0}", ex));
            }

            page2 = new FilesEnv(Sender, task, txtName.Text);
            NavigationService.Navigate(page2);
        }
        private void btnNext_Click(object s, System.EventArgs e)
        {
            if (String.IsNullOrEmpty(txtName.Text))
            {
                MessageBox.Show("Please specify a name for the JobManager");
                return;
            }

            if (String.IsNullOrEmpty(txtCmd.Text))
            {
                MessageBox.Show("Please specify a command line for the JobManager");
                return;
            }

            workitem.JobSpecification.JobManager = new JobManager();
            try
            {
                workitem.JobSpecification.JobManager.Name = txtName.Text;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(string.Format("{0}", ex));
            }

            try
            {
                workitem.JobSpecification.JobManager.CommandLine = txtCmd.Text;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(string.Format("{0}", ex));
            }

            workitem.JobSpecification.JobManager.TaskConstraints = new TaskConstraints();

            try
            {
                if (!String.IsNullOrEmpty(txtMaxTaskRetryCount.Text))
                {
                    workitem.JobSpecification.JobManager.TaskConstraints.MaxTaskRetryCount
                        = int.Parse(txtMaxTaskRetryCount.Text);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}", ex));
            }

            try
            {
                if (Time.CanParse(dataTableWallClock))
                {
                    TimeSpan span = Time.ParseTimeSpan(dataTableWallClock);
                    workitem.JobSpecification.JobManager.TaskConstraints.MaxWallClockTime = span;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}", ex));
            }

            try
            {
                if (Time.CanParse(dataTableRetention))
                {
                    TimeSpan span = Time.ParseTimeSpan(dataTableRetention);
                    workitem.JobSpecification.JobManager.TaskConstraints.RetentionTime = span;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}", ex));
            }

            try
            {
                workitem.JobSpecification.JobManager.KillJobOnCompletion =
                    (rbtnKillT.IsChecked == true) ? true :
                    (rbtnKillF.IsChecked == true) ? false : false;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(string.Format("{0}", ex));
            }

            try
            {
                FilesEnv p4 = new FilesEnv(this.Sender, workitem, "1");
                NavigationService.Navigate(p4);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}", ex));
            }
        }
        private void btnNext_Click(object s, System.EventArgs e)
        {
            if (String.IsNullOrEmpty(txtName.Text))
            {
                MessageBox.Show("Please specify a name for the JobManager");
                return;
            }

            if (String.IsNullOrEmpty(txtCmd.Text))
            {
                MessageBox.Show("Please specify a command line for the JobManager");
                return;
            }

            workitem.JobSpecification.JobManager = new JobManager();
            try
            {
                workitem.JobSpecification.JobManager.Name = txtName.Text;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(string.Format("{0}", ex));
            }

            try
            {
                workitem.JobSpecification.JobManager.CommandLine = txtCmd.Text;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(string.Format("{0}", ex));
            }

            workitem.JobSpecification.JobManager.TaskConstraints = new TaskConstraints();

            try
            {
                if (!String.IsNullOrEmpty(txtMaxTaskRetryCount.Text))
                {
                    workitem.JobSpecification.JobManager.TaskConstraints.MaxTaskRetryCount
                        = int.Parse(txtMaxTaskRetryCount.Text);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}", ex));
            }

            try
            {
                if (Time.CanParse(dataTableWallClock))
                {
                    TimeSpan span = Time.ParseTimeSpan(dataTableWallClock);
                    workitem.JobSpecification.JobManager.TaskConstraints.MaxWallClockTime = span;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}", ex));
            }

            try
            {
                if (Time.CanParse(dataTableRetention))
                {
                    TimeSpan span = Time.ParseTimeSpan(dataTableRetention);
                    workitem.JobSpecification.JobManager.TaskConstraints.RetentionTime = span;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}", ex));
            }

            try
            {
                workitem.JobSpecification.JobManager.KillJobOnCompletion = 
                    (rbtnKillT.IsChecked == true) ? true :
                    (rbtnKillF.IsChecked == true) ? false : false;
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(string.Format("{0}", ex));
            }

            try
            {
                FilesEnv p4 = new FilesEnv(this.Sender, workitem, "1");
                NavigationService.Navigate(p4);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}", ex));
            }
        }
        private void btnNext_Click(object s, System.EventArgs e)
        {
            if (String.IsNullOrEmpty(txtCmd.Text))
            {
                MessageBox.Show("Please specify a commandline for the StartTask");
                return;
            }

            if (pool != null)
            {
                pool.StartTask = new StartTask();
            }
            else if (workitem != null)
            {
                workitem.JobExecutionEnvironment.AutoPoolSpecification.Pool.StartTask =
                    new StartTask();
            }
            else if (starttask != null)
            {
                // we already declare it above
            }

            try
            {
                if (pool != null)
                {
                    pool.StartTask.CommandLine = txtCmd.Text;
                }
                else if (workitem != null)
                {
                    workitem.JobExecutionEnvironment.AutoPoolSpecification.Pool.
                    StartTask.CommandLine = txtCmd.Text;
                }
                else if (starttask != null)
                {
                    starttask.CommandLine = txtCmd.Text;
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(string.Format(
                                                   "{0} Caught\nCommand Line is a required field. Please enter a valid name", ex));
            }

            try
            {
                if (pool != null)
                {
                    pool.StartTask.MaxTaskRetryCount = int.Parse(txtMaxTaskRetryCount.Text);
                }
                else if (workitem != null)
                {
                    workitem.JobExecutionEnvironment.AutoPoolSpecification.Pool.
                    StartTask.MaxTaskRetryCount = int.Parse(txtMaxTaskRetryCount.Text);
                }
                else if (starttask != null)
                {
                    starttask.MaxTaskRetryCount = int.Parse(txtMaxTaskRetryCount.Text);
                }
            }
            catch (Exception) {            }

            try
            {
                if (pool != null)
                {
                    pool.StartTask.WaitForSuccess = (rbtnWaitT.IsChecked == true) ? true : false;
                }
                else if (workitem != null)
                {
                    workitem.JobExecutionEnvironment.AutoPoolSpecification.Pool.StartTask.WaitForSuccess = (rbtnWaitT.IsChecked == true) ? true : false;
                }
                else if (starttask != null)
                {
                    starttask.WaitForSuccess = (rbtnWaitT.IsChecked == true) ? true : false;
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(string.Format(
                                                   "{0} Caught\nThis is not a proper Wait argument.", ex));
            }

            if (pool != null)
            {
                FilesEnv p3 = new FilesEnv(this.Sender, pool, "Client SDK has problemsss...");
                NavigationService.Navigate(p3);
            }
            else if (workitem != null)
            {
                FilesEnv p8 = new FilesEnv(this.Sender, workitem, "2");
                NavigationService.Navigate(p8);
            }
            else if (starttask != null)
            {
                FilesEnv p2 = new FilesEnv(this.Sender, starttask, "Client SDK has problemsss...");
                NavigationService.Navigate(p2);
            }
        }