Example #1
0
        public AddProjects(Project[] projects)
        {
            InitializeComponent();

            foreach (Project project in projects)
            {
                if (!lbServer.Items.Contains(project.ServerDisplayName))
                    lbServer.Items.Add(project.ServerDisplayName);
            }
        }
 public ProjectConfigurationListViewItemAdaptor(Project project)
 {
     this.project = project;
     item = new ListViewItem(new string[] {project.ServerDisplayName, project.ProjectName});
     item.Tag = this;
 }
Example #3
0
        private void lbServer_SelectedIndexChanged(object sender, EventArgs e)
        {
            string serverName = lbServer.Text;
            selectedServer = new Project();
            selectedServer.SetServerUrlFromDisplayName(serverName);

            RetrieveListOfProjects(selectedServer);
        }
Example #4
0
        private void RetrieveListOfProjects(Project server)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                lbProject.Items.Clear();

                RemoteCruiseManagerFactory factory = new RemoteCruiseManagerFactory();
                ICruiseManager manager = factory.GetCruiseManager(server.ServerUrl);
                ProjectStatus[] projectStatuses = manager.GetProjectStatus();

                foreach (ProjectStatus status in projectStatuses)
                {
                    lbProject.Items.Add(status.Name);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Unable to connect to server " + server.ServerDisplayName + ": " + ex.Message, "Error");
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
        private Project[] BuildProjectListFromListView()
        {
            Project[] newProjectList = new Project[lvProjects.Items.Count];

            for (int i = 0; i < lvProjects.Items.Count; i++)
            {
                ProjectConfigurationListViewItemAdaptor adaptor = (ProjectConfigurationListViewItemAdaptor) lvProjects.Items[i].Tag;
                newProjectList[i] = adaptor.Project;
            }
            return newProjectList;
        }