internal VCAddRemoveUnits(List <VCAdministrator.UnitExistence> units, bool displayVersion, string nextAutoVersion = "")
        {
            nextVersion = nextAutoVersion;

            InitializeComponent();

            if (displayVersion)
            {
                textVersion.Text = nextVersion;
            }
            else
            {
                textVersion.Visible = false;
                chkVersion.Visible  = false;
            }


            colUnit.Width = colType.Width = listUnits.Width / 2 - 3;

            foreach (VCAdministrator.UnitExistence unit in units)
            {
                ListViewItem item = listUnits.Items.Add(unit.unitName);
                item.SubItems.Add(VCContentControl.UnitTypeToString(unit.unitType));
                item.Tag = unit;
            }
        }
        bool GetReleaseContent(out List <long> unitIds, out List <string> units, out List <string> types, out List <string> versions, out List <VCDownloadRelease.UIReleaseCompare> stati)
        {
            units   = new List <string>(); types = new List <string>(); versions = new List <string>();
            unitIds = new List <long>();
            stati   = new List <VCDownloadRelease.UIReleaseCompare>();

            ProjectNode projectInfo = _projectInfos.ElementAt(cmbProjects.SelectedIndex);
            ReleaseInfo releaseInfo = _releaseInfos.ElementAt(cmbReleases.SelectedIndex);

            if (!_vcAdministrator.GetReleaseInfo(projectInfo.Id, releaseInfo.Name, out _unitInfos))
            {
                UserInfoHandler.ShowError(_vcAdministrator._vcAPI.GetErrorMessage());
                return(false);
            }

            //prepare info for the table that displays differences between UI-version and Release-version
            List <string> listStati; if (!_vcAdministrator.CompareLocalProjectWithOnlineBundle(_unitInfos, out listStati))

            {
                return(false);
            }

            for (int i = 0; i < _unitInfos.Count; ++i)
            {
                units.Add(_unitInfos[i].Name);                                        //to be displayed in the 'Unit'-column
                types.Add(VCContentControl.UnitTypeToString(_unitInfos[i].UnitType)); //to be displayed in the 'Type'-column
                versions.Add(releaseInfo.Name);                                       //to be displayed in the 'Version'-column
                unitIds.Add(_unitInfos[i].UnitId);

                switch (listStati[i])
                {
                case VCAdministrator.VC_STATUS_MODIFIED:
                    stati.Add(VCDownloadRelease.UIReleaseCompare.differs);
                    break;

                case VCAdministrator.VC_STATUS_UPTODATE:
                    stati.Add(VCDownloadRelease.UIReleaseCompare.corresponds);
                    break;

                case VCAdministrator.VC_STATUS_OLD:
                    stati.Add(VCDownloadRelease.UIReleaseCompare.older);
                    break;

                case VCAdministrator.VC_STATUS_NEW:
                    stati.Add(VCDownloadRelease.UIReleaseCompare.newer);
                    break;

                case VCAdministrator.VC_STATUS_NOLOCAL:
                    stati.Add(VCDownloadRelease.UIReleaseCompare.missing);
                    break;

                default:
                    stati.Add(VCDownloadRelease.UIReleaseCompare.not_available);
                    break;
                }
            }
            return(true);
        }
Ejemplo n.º 3
0
        void FillUnitList()
        {
            EM_AppContext.Instance.GetActiveCountryMainForm().Cursor = Cursor = Cursors.WaitCursor;
            lvUnits.Items.Clear();
            List <VersionControlUnitInfo> units;

            if (!_vcAdministrator._vcAPI.GetLocalUnits(out units) || units == null)
            {
                UserInfoHandler.ShowError(_vcAdministrator._vcAPI.GetErrorMessage());
                EM_AppContext.Instance.GetActiveCountryMainForm().Cursor = Cursor = Cursors.Default;
                return;
            }
            foreach (VersionControlUnitInfo unitInfo in units)
            {
                lvUnits.Items.Add(string.Format("{0} ({1})", unitInfo.Name, VCContentControl.UnitTypeToString(unitInfo.UnitType)));
            }
            EM_AppContext.Instance.GetActiveCountryMainForm().Cursor = Cursor = Cursors.Default;
        }
 internal VCProjectContent(VCNewProject.ProjectContent projectContent)
 {
     InitializeComponent();
     for (int i = 0; i < projectContent.projectUnits.Count; ++i)
     {
         ListViewItem item = listUnits.Items.Add($"{projectContent.projectUnits[i].Name} ({VCContentControl.UnitTypeToString(projectContent.projectUnits[i].UnitType)})");
         item.Checked = i < projectContent.selections.Count ? projectContent.selections[i] : false;
         item.Tag     = projectContent.projectUnits[i];
     }
     foreach (string year in projectContent.selectedYears)
     {
         listYears.Items.Add(year);
     }
     checkAllYears.Checked = listYears.Items.Count == 0;
 }
Ejemplo n.º 5
0
        internal VCDownloadLatestBundle(VCAdministrator vcAdministrator)
        {
            _vcAdministrator = vcAdministrator;
            InitializeComponent();

            if (!_vcAdministrator._vcAPI.GetProjectList(out _projectInfos, false))
            {
                UserInfoHandler.ShowError(_vcAdministrator._vcAPI.GetErrorMessage()); return;
            }

            List <VersionControlUnitInfo> units;

            foreach (ProjectNode projectInfo in _projectInfos)
            {
                if (projectInfo.Id == _vcAdministrator._vcAPI.vc_projectInfo.ProjectId)

                {
                    _projectNode     = projectInfo;
                    textProject.Text = projectInfo.Name; //select the current project
                    _projectId       = projectInfo.Id;


                    if (!_vcAdministrator._vcAPI.GetLatestReleaseUnitInfo(projectInfo.Id, out _releaseInfo))
                    {
                        UserInfoHandler.ShowError(_vcAdministrator._vcAPI.GetErrorMessage()); Cursor = Cursors.Default; return;
                    }

                    if (_releaseInfo != null)
                    {
                        _releaseId     = _releaseInfo.Id;
                        _bundleName    = _releaseInfo.Name;
                        txtBundle.Text = _releaseInfo.Name + " - " + _releaseInfo.Date.ToShortDateString();
                    }

                    AssessVCBaseProjectContent(out _projectContent);
                    units = _projectContent.projectUnits;

                    foreach (VersionControlUnitInfo unit in units)
                    {
                        ListViewItem item = listUnits.Items.Add(string.Format("{0} ({1})", unit.Name, VCContentControl.UnitTypeToString(unit.UnitType)));
                        item.Checked = true;
                        item.Tag     = unit;
                    }
                }
            }
        }