Exemple #1
0
        public static int ShowChooseChangelistActions(string prompt, IList <string> files, IList <string> actions, IList <P4.Changelist> items, ref string NewChangeDescription)
        {
            if (Preferences.LocalSettings.GetBool("PromptForChanglist", true))
            {
                if (ActiveChangeList > -1)
                {
                    CurrentChangeListLastUse = DateTime.Now;
                    //					NewChangeDescription = CurrentChangeDescription;
                    return(CurrentChangeList);
                }
                SelectChangelistDlg2 dlg = new SelectChangelistDlg2(prompt, files, actions, items);

                dlg.NewChangelistDescription = NewChangeDescription;

                dlg.OkBtn.Visible     = true;
                dlg.CancelBtn.Visible = true;

                dlg.saveToChangelistBtn.Visible = false;
                dlg.submitBtn.Visible           = false;

                dlg.YesBtn1.Visible = false;
                dlg.NoBtn1.Visible  = false;

                dlg.YesBtn2.Visible = false;
                dlg.NoBtn2.Visible  = false;

                dlg.BtnBar.Controls.Clear();
                dlg.BtnBar.Controls.Add(dlg.BtnSpacer);
                dlg.BtnBar.Controls.Add(dlg.OkBtn);
                dlg.BtnBar.Controls.Add(dlg.CancelBtn);

                dlg.OkBtn.Column     = 1;
                dlg.CancelBtn.Column = 2;
                dlg.BtnBar.InitializeGrid(true);

                if (dlg.ShowDialog() == DialogResult.Cancel)
                {
                    CurrentChangeList = -2;
                    return(CurrentChangeList);
                }
                int changelistId = dlg.Result;
                if (changelistId == -1)
                {
                    NewChangeDescription = dlg.DescriptionTB.Text;
                    //					CurrentChangeDescription = NewChangeDescription;
                }
                CurrentChangeListLastUse = DateTime.Now;
                CurrentChangeList        = changelistId;
                return(changelistId);
            }
            else
            {
                return(P4VsProvider.Instance.ChangeLists.ActiveChangeList);
            }
        }
Exemple #2
0
        public static int ShowChooseChangelistMove(string prompt, IList <string> files, IList <P4.Changelist> items, ref string NewChangeDescription, P4ScmProvider scm)
        {
            if (ActiveChangeList > -1)
            {
                CurrentChangeListLastUse = DateTime.Now;
                //					NewChangeDescription = CurrentChangeDescription;
                return(CurrentChangeList);
            }
            SelectChangelistDlg2 dlg = new SelectChangelistDlg2(prompt, files, items);

            dlg.DontShowAgainCB.Enabled = false;
            dlg.DontShowAgainCB.Visible = false;

            dlg.saveToChangelistBtn.Visible = false;
            dlg.submitBtn.Visible           = false;

            dlg.NewChangelistDescription = NewChangeDescription;

            dlg.OkBtn.Visible     = true;
            dlg.CancelBtn.Visible = true;

            dlg.YesBtn1.Visible = false;
            dlg.NoBtn1.Visible  = false;
            dlg.YesBtn2.Visible = false;
            dlg.NoBtn2.Visible  = false;

            dlg.BtnBar.Controls.Clear();
            dlg.BtnBar.Controls.Add(dlg.BtnSpacer);
            dlg.BtnBar.Controls.Add(dlg.OkBtn);
            dlg.BtnBar.Controls.Add(dlg.CancelBtn);

            dlg.OkBtn.Column     = 1;
            dlg.CancelBtn.Column = 2;
            dlg.BtnBar.InitializeGrid(true);

            if (dlg.ShowDialog() == DialogResult.Cancel)
            {
                CurrentChangeList = -2;
                return(CurrentChangeList);
            }
            int changelistId = dlg.Result;

            if (changelistId == -1)
            {
                P4.Changelist newChange = scm.Connection.Repository.NewChangelist();
                // Make sure files is empty. If default has files in it, a new changelist
                // will automatically get those files.
                newChange.Files       = new List <P4.FileMetaData>();
                newChange.Description = dlg.DescriptionTB.Text;
                newChange             = scm.SaveChangelist(newChange, null);
                if (newChange != null)
                {
                    return(newChange.Id);
                }
                else
                {
                    return(changelistId);
                }
            }
            CurrentChangeListLastUse = DateTime.Now;
            CurrentChangeList        = changelistId;
            return(changelistId);
        }
Exemple #3
0
        public static int ShowChooseChangelistSubmit(string prompt, IList <string> files, IList <P4.Changelist> items, ref string NewChangeDescription, out string action)
        {
            action = null;

            //if ((items == null) || (items.Count <= 0))
            //{
            //    return 0;
            //}
            if (Preferences.LocalSettings.GetBool("PromptForChanglist", true))
            {
                SelectChangelistDlg2 dlg = new SelectChangelistDlg2(prompt, files, items);

                dlg.NewChangelistDescription = NewChangeDescription;

                dlg.saveToChangelistBtn.Enabled = true;
                dlg.saveToChangelistBtn.Visible = true;
                dlg.submitBtn.Enabled           = true;
                dlg.submitBtn.Visible           = true;
                dlg.CancelBtn.Visible           = true;

                dlg.YesBtn1.Visible = false;
                dlg.NoBtn1.Visible  = false;
                dlg.YesBtn2.Visible = false;
                dlg.NoBtn2.Visible  = false;

                dlg.OkBtn.Visible = false;

                dlg.BtnBar.Controls.Clear();
                dlg.BtnBar.Controls.Add(dlg.BtnSpacer);
                dlg.BtnBar.Controls.Add(dlg.saveToChangelistBtn);
                dlg.BtnBar.Controls.Add(dlg.submitBtn);
                dlg.BtnBar.Controls.Add(dlg.CancelBtn);

                dlg.saveToChangelistBtn.Column = 1;
                dlg.submitBtn.Column           = 2;
                dlg.CancelBtn.Column           = 2;
                dlg.BtnBar.InitializeGrid(true);

                if (dlg.ShowDialog() == DialogResult.Cancel)
                {
                    return(-2);
                }

                if (dlg.DialogResult == DialogResult.OK)
                {
                    // Save to Changelist
                    return(dlg.Result);
                }

                if (dlg.DialogResult == DialogResult.Yes)
                {
                    // Submit...
                    action = "submit";
                    return(dlg.Result);
                }

                int changelistId = dlg.Result;
                if (changelistId == -1)
                {
                    NewChangeDescription = dlg.DescriptionTB.Text;
                }
                return(changelistId);
            }
            else
            {
                return(P4VsProvider.Instance.ChangeLists.ActiveChangeList);
            }
        }
Exemple #4
0
        public static int ShowChooseChangelistYesNoCancel(string prompt, IList <string> files, IList <P4.Changelist> items, ref string NewChangeDescription)
        {
            //if ((items == null) || (items.Count <= 0))
            //{
            //    return 0;
            //}
            if (ActiveChangeList > -1)
            {
                CurrentChangeListLastUse = DateTime.Now;
                //					NewChangeDescription = CurrentChangeDescription;
                return(CurrentChangeList);
            }
            SelectChangelistDlg2 dlg = new SelectChangelistDlg2(prompt, files, items);

            dlg.NewChangelistDescription = NewChangeDescription;

            dlg.OkBtn.Visible     = false;
            dlg.CancelBtn.Visible = true;

            dlg.saveToChangelistBtn.Visible = false;
            dlg.submitBtn.Visible           = false;

            dlg.YesBtn1.Visible = false;
            dlg.NoBtn1.Visible  = false;

            dlg.YesBtn2.Visible = true;
            dlg.NoBtn2.Visible  = true;

            dlg.DontShowAgainCB.Visible = false;

            dlg.BtnBar.Controls.Clear();
            dlg.BtnBar.Controls.Add(dlg.BtnSpacer);
            dlg.BtnBar.Controls.Add(dlg.YesBtn2);
            dlg.BtnBar.Controls.Add(dlg.NoBtn2);
            dlg.BtnBar.Controls.Add(dlg.CancelBtn);

            dlg.YesBtn2.Column   = 1;
            dlg.NoBtn2.Column    = 2;
            dlg.CancelBtn.Column = 3;
            dlg.BtnBar.InitializeGrid(true);

            DialogResult res = dlg.ShowDialog();

            if (res == DialogResult.Cancel)
            {
                CurrentChangeList = -3;
                return(CurrentChangeList);
            }
            if (res == DialogResult.No)
            {
                CurrentChangeList = -2;
                return(CurrentChangeList);
            }
            int changelistId = dlg.Result;

            if (changelistId == -1)
            {
                NewChangeDescription = dlg.DescriptionTB.Text;
                //					CurrentChangeDescription = NewChangeDescription;
            }
            CurrentChangeListLastUse = DateTime.Now;
            CurrentChangeList        = changelistId;
            return(changelistId);
        }