コード例 #1
0
        private void ExecuteGitClicky()
        {
            string error = null;

            try
            {
                var urls = SelectedItemPaths
                           .Select(x => _gitRepositoryService.GetFetchRemoteForPath(x))
                           .Join(Environment.NewLine);
                Clipboard.SetText(urls);
            }
            catch (NotInGitRepositoryException)
            {
                error = "The specified path does not exist within a Git repository";
            }
            catch (RepositoryHasNoRemotesException)
            {
                error = "The repository doesn't have any remotes configured";
            }
            catch (UnknownRemoteProviderException e)
            {
                error = "The repository's remote provider is unknown: {0}".FormatWith(e.Message);
            }

            if (!string.IsNullOrEmpty(error))
            {
                MessageBox.Show(error, "GitClicky", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }