Esempio n. 1
0
        public UnshelveFileDialog(P4ScmProvider scm)
        {
            PreferenceKey = "UnshelveFileDialog";

            _scm = scm;
            InitializeComponent();
            this.Icon  = Images.icon_p4vs_16px;
            ListImages = new System.Windows.Forms.ImageList(components);
            //
            // ListImages
            //
            ListImages.TransparentColor = System.Drawing.Color.Transparent;
            ListImages.Images.Add("noCheckBox.png", Images.noCheckBox);
            ListImages.Images.Add("CheckBox.png", Images.CheckBox);

            ShelvedFilesLV.SmallImageList     = ListImages;
            ShelvedFilesLV.ListViewItemSorter = (System.Collections.IComparer) new FileListViewSorter();

            IList <P4.Changelist> changes = _scm.GetAvailibleChangelists(-1);

            changeMap = new Dictionary <int, P4.Changelist>();

            //add new as the first item in the list
            TargetChangelistCB.Items.Add(Resources.Changelist_New);
            changeMap[-1] = null;

            //add default as the first item in the list if not already there
            TargetChangelistCB.Items.Add(Resources.Changelist_Default);
            changeMap[0] = null;

            // if there are other existing changelists, add them to the list
            if (changes != null)
            {
                foreach (P4.Changelist item in changes)
                {
                    int id = item.Id;
                    if ((id != -1) && (id != 0))
                    {
                        changeMap[id] = item;
                        int idx = TargetChangelistCB.Items.Add(SelectChangelistDlg.ChangeListToString(item));
                    }
                }
            }

            // select the default changelist
            TargetChangelistCB.SelectedIndex = 1;
        }
Esempio n. 2
0
        private void Init(string prompt, IList <string> files, IList <string> actions, IList <P4.Changelist> items)
        {
            PreferenceKey = "SelectChangelistDlg2";

            InitializeComponent();
            this.Icon = Images.icon_p4vs_16px;
            NewChangelistDescription = Resources.SelectChangelistDlg_DefaultNewChangeDesc;

            //PromptLbl.Text = prompt;
            msgText.Text = prompt;

            changeMap = new Dictionary <int, P4.Changelist>();

            //add new as the first item in the list
            ItemsCB.Items.Add(Resources.Changelist_New);
            changeMap[-1] = null;

            //add default as the first item in the list if not already there
            ItemsCB.Items.Add(Resources.Changelist_Default);
            changeMap[-0] = null;

            if ((items != null) && (items.Count > 0))
            {
                foreach (P4.Changelist item in items)
                {
                    int id = item.Id;
                    if ((id != -1) && (id != 0))
                    {
                        changeMap[id] = item;
                        int idx = ItemsCB.Items.Add(SelectChangelistDlg.ChangeListToString(item));
                    }
                }
            }

            Files = files;

            HideActionsColumn = (actions == null);

            if ((files != null) && (files.Count > 0))
            {
                for (int idx = 0; idx < files.Count; idx++)
                {
                    string action = string.Empty;
                    if ((actions != null) && (idx < actions.Count) && (actions[idx] != null))
                    {
                        action = actions[idx];
                    }
                    if (files[idx] != null)
                    {
                        string       fileName = Path.GetFileName(files[idx]);
                        string       path     = Path.GetDirectoryName(files[idx]);
                        ListViewItem item     = new ListViewItem(new string[] { action, fileName, path });

                        FilesList.Items.Add(item);
                    }
                }
            }
            // select the default changelist
            ItemsCB.SelectedIndex = 1;

            OkBtn.Enabled = ItemsCB.SelectedIndex >= 0;
        }