private void FillProjects()
 {
     listView1.Items.Clear();
     foreach (ProjectInfo p in projects)
     {
         ProcessTemplateProperties ptp = GetProcessTemplateProperties(p);
         ListViewItem lv = new ListViewItem(p.Name);
         lv.SubItems.Add(ptp.CreateVersion);
         lv.SubItems.Add(ptp.CurrentVersion);
         lv.SubItems.Add(ptp.ProcessTemplate);
         lv.Tag = ptp;
         listView1.Items.Add(lv);
     }
 }
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
            {
                return;
            }
            ListViewItem lv = listView1.SelectedItems[0];

            lblTP.Text = lv.Text;
            ProcessTemplateProperties ptp = lv.Tag as ProcessTemplateProperties;

            selectedProjectProps = ptp;
            if (ptp != null)
            {
                textBox1.Text = selectedProjectProps.CreateVersion;
                textBox2.Text = selectedProjectProps.CurrentVersion;
            }
        }
        private ProcessTemplateProperties GetProcessTemplateProperties(ProjectInfo pi)
        {
            ProcessTemplateProperties ptp = new ProcessTemplateProperties();
            // Read the properties
            string projectName  = string.Empty;
            string projectState = string.Empty;
            int    templateId   = 0;

            ProjectProperty[] projectProperties = null;

            css.GetProjectProperties(pi.Uri, out projectName, out projectState, out templateId, out projectProperties);

            // Return the properties
            string currentVersion = projectProperties.Where(p => (p.Name == ProcessTemplateProperties.CURRENTVERSIONSTRING)).Select(p => p.Value).FirstOrDefault();
            string createVersion  = projectProperties.Where(p => (p.Name == ProcessTemplateProperties.CREATEVERSIONSTRING)).Select(p => p.Value).FirstOrDefault();
            string pt             = projectProperties.Where(p => (p.Name == ProcessTemplateProperties.PROCESSTEMPLATESTRING)).Select(p => p.Value).FirstOrDefault();

            ptp.CurrentVersion  = currentVersion;
            ptp.CreateVersion   = createVersion;
            ptp.ProcessTemplate = pt;
            ptp.CurrentProject  = pi;

            return(ptp);
        }
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 0) { return; }
     ListViewItem lv = listView1.SelectedItems[0];
     lblTP.Text = lv.Text;
     ProcessTemplateProperties ptp = lv.Tag as ProcessTemplateProperties;
     selectedProjectProps = ptp;
     if (ptp != null)
     {
         textBox1.Text = selectedProjectProps.CreateVersion;
         textBox2.Text = selectedProjectProps.CurrentVersion;
     }
 }
        private ProcessTemplateProperties GetProcessTemplateProperties(ProjectInfo pi)
        {
            ProcessTemplateProperties ptp = new ProcessTemplateProperties();
            // Read the properties
            string projectName = string.Empty;
            string projectState = string.Empty;
            int templateId = 0;
            ProjectProperty[] projectProperties = null;

            css.GetProjectProperties(pi.Uri, out projectName, out projectState, out templateId, out projectProperties);

            // Return the properties
            string currentVersion = projectProperties.Where(p => (p.Name == ProcessTemplateProperties.CURRENTVERSIONSTRING)).Select(p => p.Value).FirstOrDefault();
            string createVersion = projectProperties.Where(p => (p.Name == ProcessTemplateProperties.CREATEVERSIONSTRING)).Select(p => p.Value).FirstOrDefault();
            string pt = projectProperties.Where(p => (p.Name == ProcessTemplateProperties.PROCESSTEMPLATESTRING)).Select(p => p.Value).FirstOrDefault();

            ptp.CurrentVersion = currentVersion;
            ptp.CreateVersion = createVersion;
            ptp.ProcessTemplate = pt;
            ptp.CurrentProject = pi;

            return ptp;
        }