Esempio n. 1
0
        public Context()
        {
            _main = new Main();

            _settings = Settings.Load();

            var azureProviders = _settings.AzureProviders
                                 .Select(provider => (RemoteProvider) new AzureProvider(provider));
            var gitHubProviders = _settings.GitHubProviders
                                  .Select(provider => (RemoteProvider) new GitHubProvider(provider));

            _remoteProviders = azureProviders.Concat(gitHubProviders).ToArray();

            var directoryInfo = new DirectoryInfo(_settings.RepositoryFolder);

            _repositoryDirectory          = new RepositoryDirectory(directoryInfo);
            _repositoryDirectory.Added   += RepositoryAdded;
            _repositoryDirectory.Removed += RepositoryRemoved;
            _repositoryDirectory.Renamed += RepositoryRenamed;

            _icon              = new NotifyIcon();
            _icon.DoubleClick += Icon_DoubleClick;
            _icon.Visible      = true;
            _icon.Icon         = LoadIcon();
            _icon.ContextMenu  = MakeContextMenu();
        }
Esempio n. 2
0
        private MenuItem MakeCloneItem(RepositoryDirectory existingRepositories)
        {
            var items = new List <MenuItem>();

            foreach (var provider in _remoteProviders)
            {
                var item = provider.MakeRemoteProviderItem(
                    _settings.RepositoryFolder,
                    existingRepositories);

                items.Add(item);
            }

            const string name      = "Clone";
            var          itemArray = items.ToArray();

            return(new MenuItem(name, itemArray)
            {
                Name = "1_CLONE"
            });
        }