Exemple #1
0
        /// <summary>
        /// Clears current repository object
        /// </summary>
        /// <remarks>if the new settings are "really" different from the current settings, reset</remarks>
        public void MarkDirty()
        {
            bool isReallyDirty;
            IIssueTrackerSettings settings = Settings;

            if (settings == null)
            {
                isReallyDirty = _repository != null;
            }
            else
            {
                IssueRepositorySettings currentRepositorySettings = settings.ToIssueRepositorySettings();
                if (currentRepositorySettings == null)
                {
                    isReallyDirty = _repository != null;
                }
                else
                {
                    isReallyDirty = !currentRepositorySettings.ValueEquals(_repository);
                }
            }
            if (isReallyDirty)
            {
                CurrentIssueRepository = null;
            }
        }
        public void OnExecute(CommandEventArgs e)
        {
            SvnItem               firstVersioned   = null;
            ISvnStatusCache       cache            = e.GetService <ISvnStatusCache>();
            IAnkhSolutionSettings solutionSettings = e.GetService <IAnkhSolutionSettings>();

            if (solutionSettings != null)
            {
                firstVersioned = cache[solutionSettings.ProjectRoot];
            }

            if (firstVersioned == null)
            {
                return; // exceptional case
            }
            using (IssueTrackerConfigDialog dialog = new IssueTrackerConfigDialog(e.Context))
            {
                if (dialog.ShowDialog(e.Context) == System.Windows.Forms.DialogResult.OK)
                {
                    IIssueTrackerSettings currentSettings = e.GetService <IIssueTrackerSettings>();

                    IssueRepository newRepository = dialog.NewIssueRepository;
                    if (newRepository == null ||
                        string.IsNullOrEmpty(newRepository.ConnectorName) ||
                        newRepository.RepositoryUri == null)
                    {
                        DeleteIssueRepositoryProperties(e.Context, firstVersioned);
                    }
                    else if (currentSettings == null ||
                             currentSettings.ShouldPersist(newRepository))
                    {
                        SetIssueRepositoryProperties(e.Context, firstVersioned, newRepository);
                    }
                }
            }
        }