Ejemplo n.º 1
0
        public JobDefinition Add()
        {
            JobDefinition NewItem = new JobDefinition();

            m_Items.Add(NewItem);
            return(NewItem);
        }
Ejemplo n.º 2
0
 public void LoadInfo(JobDefinition Job)
 {
     this.Text              = Job.Caption;
     AppEdit.Text           = Job.Application;
     ArgEdit.Text           = Job.Arguments;
     HintEdit.Text          = Job.Hint;
     SuccessStatusEdit.Text = Convert.ToString(Job.SuccessStatus);
     WorkingDirEdit.Text    = Job.WorkingDir;
 }
Ejemplo n.º 3
0
        private void LoadFromXml(System.Xml.XmlTextReader xml)
        {
            Clear();
            JobDefinitionGroup LastGroup = null;
            JobDefinition      LastJob   = null;

            while (!xml.EOF)
            {
                xml.Read();
                if (xml.NodeType == System.Xml.XmlNodeType.Element)
                {
                    if (xml.Depth == 1)
                    {
                        System.Diagnostics.Debug.Assert(xml.Name == "Menu");
                        m_Caption = xml.GetAttribute("Caption");
                    }
                    else if (xml.Depth == 2)
                    {
                        System.Diagnostics.Debug.Assert(xml.Name == "Group");
                        LastGroup         = AddGroup();
                        LastGroup.Caption = xml.GetAttribute("Caption");
                        LastGroup.Hint    = xml.GetAttribute("Hint");
                    }
                    else if (xml.Depth == 3)
                    {
                        System.Diagnostics.Debug.Assert(xml.Name == "Job");
                        LastJob             = LastGroup.Add();
                        LastJob.Caption     = xml.GetAttribute("Caption");
                        LastJob.Hint        = xml.GetAttribute("Hint");
                        LastJob.Application = xml.GetAttribute("Application");
                        string OptVal;
                        OptVal = xml.GetAttribute("WorkingDir");
                        if (OptVal != null)
                        {
                            LastJob.WorkingDir = OptVal;
                        }
                        OptVal = xml.GetAttribute("SuccessStatus");
                        if (OptVal != null)
                        {
                            LastJob.SuccessStatus = Convert.ToInt32(OptVal);
                        }
                    }
                    else if (xml.Depth == 4)
                    {
                        System.Diagnostics.Debug.Assert(xml.Name == "Arguments");
                        LastJob.Arguments = xml.ReadString();
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private void TreeView_DoubleClick(object sender, System.EventArgs e)
 {
     try
     {
         System.Windows.Forms.TreeNode Node = TreeView.SelectedNode;
         if (Node.Parent != null)
         {
             JobDefinition JobDef = (JobDefinition)Node.Tag;
             QueueJob(JobDef);
         }
     }
     catch (Exception x)
     {
         m_Prefs.ShowError(x.Message);
     }
 }
Ejemplo n.º 5
0
 // Adds a job to the queue for each selected job node.
 //
 private void AddSelectedItemsToQueue()
 {
     foreach (System.Windows.Forms.TreeNode Node in TreeView.Nodes)
     {
         if (Node.Checked)
         {
             foreach (System.Windows.Forms.TreeNode Subnode in Node.Nodes)
             {
                 if (Subnode.Checked)
                 {
                     JobDefinition JobDef = (JobDefinition)Subnode.Tag;
                     QueueJob(JobDef);
                 }
             }
         }
     }
 }
Ejemplo n.º 6
0
 private void TreeView_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
 {
     System.Windows.Forms.TreeNode Node = e.Node;
     if (Node == null || Node.Tag == null)
     {
         HintLabel.Text = "";
     }
     else if (Node.Parent == null)
     {
         // group node
         JobDefinitionGroup JobDefGroup = (JobDefinitionGroup)Node.Tag;
         HintLabel.Text = JobDefGroup.Hint;
     }
     else
     {
         // job node
         JobDefinition JobDef = (JobDefinition)Node.Tag;
         HintLabel.Text = JobDef.Hint;
     }
 }
Ejemplo n.º 7
0
        // Adds a job to the job queue.
        //
        private void QueueJob(JobDefinition Job)
        {
            string WorkingDir = System.IO.Path.Combine
                                    (System.IO.Path.GetDirectoryName(m_JobDefSet.FilePath),
                                    Job.WorkingDir);

            JobDefinition QJob = new JobDefinition();

            QJob.Application   = Job.Application;
            QJob.Arguments     = Job.Arguments;
            QJob.Caption       = m_JobDefSet.Caption + ": " + Job.Caption;
            QJob.Hint          = Job.Hint;
            QJob.SuccessStatus = Job.SuccessStatus;
            QJob.WorkingDir    = WorkingDir;
            JobInformation QJobInfo = new JobInformation(QJob);

            System.Windows.Forms.ListViewItem Item = m_QueueList.Items.Add(QJob.Caption);
            Item.Tag = QJobInfo;
            Item.SubItems.Add("Pending");
            Item.SubItems.Add(Job.Application + " " + Job.Arguments);
        }
Ejemplo n.º 8
0
 public JobInformation(JobDefinition Definition)
 {
     Debug.Assert(Definition != null);
     m_Def = Definition;
 }