示例#1
0
 /// <summary>Creates a new instance of the class to perform the work.</summary>
 /// <param name="spiraProject">The SpiraTeam project to use for importing.</param>
 /// <param name="jamaProject">The Jama Contour project used for importing.</param>
 /// <param name="ProgressForm">The ProgressForm. Should probably be a delegate, but the form will work for now.</param>
 /// <param name="ExistingMappings">Mappings already defined for this combination.</param>
 public ProcessThread(SpiraProject spiraProject, JamaProjectInfo jamaProject)
 {
     this._JamaProject  = jamaProject;
     this._SpiraProject = spiraProject;
 }
示例#2
0
        /// <summary>Hit when the users wants to get projects from the server or cancel an existing connection.</summary>
        /// <param name="sender">btnConnect</param>
        /// <param name="e">EventArgs</param>
        private void btnConnect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                e.Handled = true;
                //They asked for it!
                if ((bool)btnConnect.Tag)
                {
                    //Ignore the operation
                }
                else
                {
                    //Error check, first.
                    if (this.CheckEntryFields())
                    {
                        //Set display.
                        this.setDisplayforProgress(true);

                        //Save in settings
                        Properties.Settings.Default.JamaUrl      = this.txbServer.Text.Trim();
                        Properties.Settings.Default.JamaLogin    = this.txbUserID.Text.Trim();
                        Properties.Settings.Default.JamaPassword = (chkRememberPassword.IsChecked.Value) ? this.txbUserPass.Password : "";

                        //Fire off a new client.
                        this.msgStatus.Text = "Connecting to server...";
                        JamaManager        jamaManager = new JamaManager(Properties.Settings.Default.JamaUrl, Properties.Settings.Default.JamaLogin, Properties.Settings.Default.JamaPassword);
                        List <JamaProject> projects    = jamaManager.GetProjects();

                        //Update status.
                        this.msgStatus.Text    = "Projects retrieved from server.";
                        this.msgStatus.ToolTip = null;
                        this.setDisplayforProgress(false);

                        //Load combobox.
                        List <JamaProjectInfo> list = new List <JamaProjectInfo>();
                        list.Clear();
                        if (projects != null && projects.Count > 0)
                        {
                            foreach (JamaProject project in projects)
                            {
                                JamaProjectInfo newProj = new JamaProjectInfo();
                                if (project.Fields != null)
                                {
                                    newProj.ProjectName = project.ProjectKey + " - " + project.Fields.Name;
                                }
                                else
                                {
                                    newProj.ProjectName = project.ProjectKey;
                                }
                                newProj.ProjectNum = project.Id;
                                newProj.UserName   = this.txbUserID.Text.Trim();
                                newProj.UserPass   = this.txbUserPass.Password;
                                newProj.ServerURL  = this.txbServer.Text.Trim();

                                list.Add(newProj);
                            }
                            this.grdAvailProjs.IsEnabled    = true;
                            this.cmbProjectList.ItemsSource = list;
                        }
                        else
                        {
                            this.msgStatus.Text = "No projects available for that user.";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                this.msgStatus.Text = "Error connecting to server.";
                if (ex.InnerException == null)
                {
                    this.msgStatus.ToolTip = ex.Message;
                }
                else
                {
                    this.msgStatus.ToolTip = ex.Message + "\n (" + ex.InnerException.Message + ")";
                }
                this.setDisplayforProgress(false);
            }
        }