Esempio n. 1
0
        public override void ViewWillAppear()
        {
            base.ViewWillAppear();

            if (_aggregator != null)
            {
                return;
            }

            _aggregator = TinyIoC.TinyIoCContainer.Current.Resolve <IRepositoryInformationAggregator>();
            var actionProvider = TinyIoC.TinyIoCContainer.Current.Resolve <IRepositoryActionProvider>();

            _monitor               = TinyIoC.TinyIoCContainer.Current.Resolve <IRepositoryMonitor>();
            _appSettingsService    = TinyIoC.TinyIoCContainer.Current.Resolve <IAppSettingsService>();
            _repositoryIgnoreStore = TinyIoC.TinyIoCContainer.Current.Resolve <IRepositoryIgnoreStore>();

            // Do any additional setup after loading the view.
            var datasource = new RepositoryTableDataSource(_aggregator.Repositories);

            RepoTab.DataSource            = datasource;
            datasource.CollectionChanged += Datasource_CollectionChanged;
            RepoTab.Delegate              = new RepositoryTableDelegate(RepoTab, datasource, actionProvider);
            SetControlVisibilityByRepositoryAvailability();

            RepoTab.BackgroundColor = NSColor.Clear;
            RepoTab.EnclosingScrollView.DrawsBackground = false;

            SearchBox.FinishInput += SearchBox_FinishInput;

            SearchBox.NextKeyView = RepoTab;
        }
Esempio n. 2
0
        public MainWindow(StatusCharacterMap statusCharacterMap,
                          IRepositoryInformationAggregator aggregator,
                          IRepositoryMonitor repositoryMonitor,
                          IRepositoryActionProvider repositoryActionProvider)
        {
            InitializeComponent();

            _monitor = repositoryMonitor as DefaultRepositoryMonitor;
            if (_monitor != null)
            {
                _monitor.OnScanStateChanged += OnScanStateChanged;
                ShowScanningState(_monitor.Scanning);
            }

            _repositoryActionProvider = repositoryActionProvider;

            lstRepositories.ItemsSource = aggregator.Repositories;
            var view = CollectionViewSource.GetDefaultView(lstRepositories.ItemsSource);

            view.CollectionChanged += View_CollectionChanged;
            view.Filter             = FilterRepositories;

            lstRepositories.Items.SortDescriptions.Add(
                new SortDescription(nameof(RepositoryView.Name),
                                    ListSortDirection.Ascending));

            txtHelp.Text = GetHelp(statusCharacterMap);

            PlaceFormToLowerRight();
        }
        public DefaultRepositoryMonitor(
            IPathProvider pathProvider,
            IRepositoryReader repositoryReader,
            IRepositoryDetectorFactory repositoryDetectorFactory,
            IRepositoryObserverFactory repositoryObserverFactory,
            IPathCrawlerFactory pathCrawlerFactory,
            IRepositoryStore repositoryStore,
            IRepositoryInformationAggregator repositoryInformationAggregator,
            IAutoFetchHandler autoFetchHandler,
            IRepositoryIgnoreStore repositoryIgnoreStore
            )
        {
            _repositoryReader          = repositoryReader ?? throw new ArgumentNullException(nameof(repositoryReader));
            _repositoryDetectorFactory = repositoryDetectorFactory ?? throw new ArgumentNullException(nameof(repositoryDetectorFactory));
            _repositoryObserverFactory = repositoryObserverFactory ?? throw new ArgumentNullException(nameof(repositoryObserverFactory));
            _pathCrawlerFactory        = pathCrawlerFactory ?? throw new ArgumentNullException(nameof(pathCrawlerFactory));
            _pathProvider    = pathProvider ?? throw new ArgumentNullException(nameof(pathProvider));
            _repositoryStore = repositoryStore ?? throw new ArgumentNullException(nameof(repositoryStore));
            _repositoryInformationAggregator = repositoryInformationAggregator ?? throw new ArgumentNullException(nameof(repositoryInformationAggregator));
            _repositoryObservers             = new Dictionary <string, IRepositoryObserver>();
            _repositoryIgnoreStore           = repositoryIgnoreStore;

            _storeFlushTimer = new Timer(RepositoryStoreFlushTimerCallback, null, Timeout.Infinite, Timeout.Infinite);

            AutoFetchHandler = autoFetchHandler ?? throw new ArgumentNullException(nameof(autoFetchHandler));
        }
Esempio n. 4
0
        public MainWindow(StatusCharacterMap statusCharacterMap,
                          IRepositoryInformationAggregator aggregator,
                          IRepositoryMonitor repositoryMonitor,
                          IRepositoryActionProvider repositoryActionProvider,
                          IRepositoryIgnoreStore repositoryIgnoreStore,
                          IAppSettingsService appSettingsService)
        {
            InitializeComponent();

            DataContext = new MainWindowPageModel(appSettingsService);
            SettingsMenu.DataContext = DataContext;             // this is out of the visual tree

            _monitor = repositoryMonitor as DefaultRepositoryMonitor;
            if (_monitor != null)
            {
                _monitor.OnScanStateChanged += OnScanStateChanged;
                ShowScanningState(_monitor.Scanning);
            }

            _repositoryActionProvider   = repositoryActionProvider ?? throw new ArgumentNullException(nameof(repositoryActionProvider));
            _repositoryIgnoreStore      = repositoryIgnoreStore ?? throw new ArgumentNullException(nameof(repositoryIgnoreStore));
            lstRepositories.ItemsSource = aggregator.Repositories;
            var view = CollectionViewSource.GetDefaultView(lstRepositories.ItemsSource);

            view.CollectionChanged += View_CollectionChanged;
            view.Filter             = FilterRepositories;

            lstRepositories.Items.SortDescriptions.Add(
                new SortDescription(nameof(RepositoryView.Name),
                                    ListSortDirection.Ascending));

            txtHelp.Text = GetHelp(statusCharacterMap);

            PlaceFormToLowerRight();
        }
Esempio n. 5
0
        public DefaultAutoFetchHandler(IAppSettingsService appSettingsService,
                                       IRepositoryInformationAggregator repositoryInformationAggregator,
                                       IRepositoryWriter repositoryWriter)
        {
            AppSettingsService = appSettingsService ?? throw new ArgumentNullException(nameof(appSettingsService));
            RepositoryInformationAggregator = repositoryInformationAggregator ?? throw new ArgumentNullException(nameof(repositoryInformationAggregator));
            RepositoryWriter = repositoryWriter ?? throw new ArgumentNullException(nameof(repositoryWriter));
            AppSettingsService.RegisterInvalidationHandler(() => Mode = AppSettingsService.AutoFetchMode);

            _profiles = new Dictionary <AutoFetchMode, AutoFetchProfile>
            {
                { AutoFetchMode.Off, new AutoFetchProfile()
                  {
                      PauseBetweenFetches = TimeSpan.MaxValue
                  } },
                { AutoFetchMode.Discretely, new AutoFetchProfile()
                  {
                      PauseBetweenFetches = TimeSpan.FromMinutes(5)
                  } },
                { AutoFetchMode.Adequate, new AutoFetchProfile()
                  {
                      PauseBetweenFetches = TimeSpan.FromMinutes(1)
                  } },
                { AutoFetchMode.Aggresive, new AutoFetchProfile()
                  {
                      PauseBetweenFetches = TimeSpan.FromSeconds(2)
                  } }
            };

            _timer = new Timer(FetchNext, null, Timeout.Infinite, Timeout.Infinite);
        }
Esempio n. 6
0
        public MainWindow(StatusCharacterMap statusCharacterMap,
                          IRepositoryInformationAggregator aggregator,
                          IRepositoryMonitor repositoryMonitor,
                          IRepositoryActionProvider repositoryActionProvider,
                          IRepositoryIgnoreStore repositoryIgnoreStore,
                          IAppSettingsService appSettingsService,
                          ITranslationService translationService)
        {
            _translationService = translationService;

            InitializeComponent();

            AcrylicWindow.SetAcrylicWindowStyle(this, AcrylicWindowStyle.None);

            DataContext = new MainWindowPageModel(appSettingsService);
            SettingsMenu.DataContext = DataContext;             // this is out of the visual tree

            _monitor = repositoryMonitor as DefaultRepositoryMonitor;
            if (_monitor != null)
            {
                _monitor.OnScanStateChanged += OnScanStateChanged;
                ShowScanningState(_monitor.Scanning);
            }

            _repositoryActionProvider   = repositoryActionProvider ?? throw new ArgumentNullException(nameof(repositoryActionProvider));
            _repositoryIgnoreStore      = repositoryIgnoreStore ?? throw new ArgumentNullException(nameof(repositoryIgnoreStore));
            lstRepositories.ItemsSource = aggregator.Repositories;
            var view = CollectionViewSource.GetDefaultView(lstRepositories.ItemsSource);

            view.CollectionChanged += View_CollectionChanged;
            view.Filter             = FilterRepositories;

            lstRepositories.Items.SortDescriptions.Add(
                new SortDescription(nameof(RepositoryView.Name),
                                    ListSortDirection.Ascending));

            var appName = System.Reflection.Assembly.GetEntryAssembly().GetName();

            txtHelpCaption.Text = appName.Name + " " + appName.Version.ToString(2);
            txtHelp.Text        = GetHelp(statusCharacterMap);

            PlaceFormByTaskbarLocation();
        }
Esempio n. 7
0
        public DefaultRepositoryMonitor(
            IPathProvider pathProvider,
            IRepositoryReader repositoryReader,
            IRepositoryDetectorFactory repositoryDetectorFactory,
            IRepositoryObserverFactory repositoryObserverFactory,
            IPathCrawlerFactory pathCrawlerFactory,
            IRepositoryStore repositoryStore,
            IRepositoryInformationAggregator repositoryInformationAggregator)
        {
            _repositoryReader          = repositoryReader;
            _repositoryDetectorFactory = repositoryDetectorFactory;
            _repositoryObserverFactory = repositoryObserverFactory;
            _pathCrawlerFactory        = pathCrawlerFactory;
            _pathProvider    = pathProvider;
            _repositoryStore = repositoryStore;
            _repositoryInformationAggregator = repositoryInformationAggregator;

            _repositoryObservers = new Dictionary <string, IRepositoryObserver>();

            _storeFlushTimer = new Timer(RepositoryStoreFlushTimerCallback, null, Timeout.Infinite, Timeout.Infinite);
        }
Esempio n. 8
0
        public override void ViewWillAppear()
        {
            base.ViewWillAppear();

            if (_aggregator != null)
            {
                return;
            }

            _aggregator = TinyIoC.TinyIoCContainer.Current.Resolve <IRepositoryInformationAggregator>();
            var actionProvider = TinyIoC.TinyIoCContainer.Current.Resolve <IRepositoryActionProvider>();

            _monitor = TinyIoC.TinyIoCContainer.Current.Resolve <IRepositoryMonitor>();
            _monitor.OnScanStateChanged += _monitor_OnScanStateChanged;

            _stringCommandHandler.Define(new string[] { "help", "man", "?" }, ShowCommandReference, "Shows this help page");
            _stringCommandHandler.Define(new string[] { "scan" }, async() => await _monitor.ScanForLocalRepositoriesAsync(), "Scans this Mac for git repositories");
            _stringCommandHandler.Define(new string[] { "reset" }, _monitor.Reset, "Resets the repository cache");
            _stringCommandHandler.Define(new string[] { "info", "stats" }, ShowStats, "Shows process informations");
            _stringCommandHandler.Define(new string[] { "quit", "close", "exit" }, () => NSApplication.SharedApplication.Terminate(this), "Closes the application");

            // Do any additional setup after loading the view.
            var datasource = new RepositoryTableDataSource(_aggregator.Repositories);

            RepoTab.DataSource            = datasource;
            datasource.CollectionChanged += Datasource_CollectionChanged;
            RepoTab.Delegate              = new RepositoryTableDelegate(RepoTab, datasource, actionProvider);
            SetControlVisibilityByRepositoryAvailability();

            RepoTab.BackgroundColor = NSColor.Clear;
            RepoTab.EnclosingScrollView.DrawsBackground = false;

            SearchBox.FinishInput += SearchBox_FinishInput;

            SearchBox.NextKeyView = RepoTab;
        }
Esempio n. 9
0
 public AppendRepositoryStatusTitleActor(IRepositoryInformationAggregator repositoryInfoAggregator)
 {
     _repositoryInfoAggregator = repositoryInfoAggregator;
 }
Esempio n. 10
0
 public WindowsExplorerHandler(IRepositoryInformationAggregator repositoryInfoAggregator)
 {
     _repositoryInfoAggregator = repositoryInfoAggregator;
 }