Example #1
0
        private void okButton_Click(object sender, EventArgs e)
        {
            CancelEventArgs cea = new CancelEventArgs();

            ValidateAdd(this, cea);

            if (cea.Cancel)
            {
                DialogResult = DialogResult.None;
            }
            else if (Context != null)
            {
                RepositoryTreeNode rtn = repositoryTree.SelectedNode;

                if (rtn != null && rtn.RepositoryRoot != null)
                {
                    IAnkhConfigurationService config = Context.GetService <IAnkhConfigurationService>();

                    RegistryLifoList lifo = config.GetRecentReposUrls();

                    string url = rtn.RepositoryRoot.ToString();
                    if (!lifo.Contains(url))
                    {
                        lifo.Add(url);
                    }
                }
            }
        }
        private void okButton_Click(object sender, EventArgs e)
        {
            RepositoryTreeNode rtn = reposBrowser.SelectedNode;

            if (rtn != null && rtn.Origin != null)
            {
                IAnkhConfigurationService ics  = GetService <IAnkhConfigurationService>();
                RegistryLifoList          lifo = null;

                if (ics != null)
                {
                    lifo = ics.GetRecentReposUrls();
                }

                string url = rtn.Origin.RepositoryRoot.AbsoluteUri;

                if (lifo != null && !lifo.Contains(url))
                {
                    lifo.Add(url);
                }
            }
        }
Example #3
0
        public IEnumerable <Uri> GetRepositoryUris(bool forBrowse)
        {
            HybridCollection <Uri> uris = new HybridCollection <Uri>();

            if (ProjectRootUri != null)
            {
                uris.Add(ProjectRootUri);
            }

            // Global keys (over all versions)
            using (RegistryKey rk = Config.OpenGlobalKey("Repositories"))
            {
                if (rk != null)
                {
                    LoadUris(uris, rk);
                }
            }

            // Per hive
            using (RegistryKey rk = Config.OpenInstanceKey("Repositories"))
            {
                if (rk != null)
                {
                    LoadUris(uris, rk);
                }
            }

            // Per user + Per hive
            using (RegistryKey rk = Config.OpenUserInstanceKey("Repositories"))
            {
                if (rk != null)
                {
                    LoadUris(uris, rk);
                }
            }

            // Finally add the last used list from TortoiseSVN
            try
            {
                using (RegistryKey rk = Registry.CurrentUser.OpenSubKey(
                           "SOFTWARE\\TortoiseSVN\\History\\repoURLS", RegistryKeyPermissionCheck.ReadSubTree))
                {
                    if (rk != null)
                    {
                        LoadUris(uris, rk);
                    }
                }
            }
            catch (SecurityException)
            { /* Ignore no read only access; stupid sysadmins */ }

            IAnkhConfigurationService configSvc = GetService <IAnkhConfigurationService>();

            if (configSvc != null)
            {
                foreach (string u in configSvc.GetRecentReposUrls())
                {
                    Uri uri;
                    if (u != null && Uri.TryCreate(u, UriKind.Absolute, out uri))
                    {
                        if (!uris.Contains(uri))
                        {
                            uris.Add(uri);
                        }
                    }
                }
            }

            return(uris);
        }
Example #4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (urlBox == null)
            {
                return;
            }

            // Add current project root (if available) first
            if (SolutionSettings != null && SolutionSettings.ProjectRootUri != null)
            {
                if (!urlBox.Items.Contains(SolutionSettings.ProjectRootUri))
                {
                    urlBox.Items.Add(SolutionSettings.ProjectRootUri);
                }
            }

            if (Config != null)
            {
                // Add last used url
                using (RegistryKey rk = Config.OpenUserInstanceKey("Dialogs"))
                {
                    if (rk != null)
                    {
                        string value = rk.GetValue("Last Repository") as string;

                        Uri uri;
                        if (value != null && Uri.TryCreate(value, UriKind.Absolute, out uri))
                        {
                            if (!urlBox.Items.Contains(uri))
                            {
                                urlBox.Items.Add(uri);
                            }
                        }
                    }
                }

                foreach (string value in Config.GetRecentReposUrls())
                {
                    Uri uri;
                    if (value != null && Uri.TryCreate(value, UriKind.Absolute, out uri))
                    {
                        if (!urlBox.Items.Contains(uri))
                        {
                            urlBox.Items.Add(uri);
                        }
                    }
                }
            }



            if (SolutionSettings != null)
            {
                foreach (Uri uri in SolutionSettings.GetRepositoryUris(true))
                {
                    if (!urlBox.Items.Contains(uri))
                    {
                        urlBox.Items.Add(uri);
                    }
                }
            }

            if (urlBox.Items.Count > 0 && string.IsNullOrEmpty(urlBox.Text.Trim()))
            {
                urlBox.SelectedIndex = 0;
                UpdateDirectories();
            }

            if (string.IsNullOrEmpty(fileTypeBox.Text) && fileTypeBox.Items.Count > 0)
            {
                fileTypeBox.SelectedItem = fileTypeBox.Items[0];
            }
        }