예제 #1
0
        public StartPageView(IWorkingEnvironment environment, StartPageViewFactory factory)
            : base(Guids.StartPageView, environment)
        {
            Verify.Argument.IsNotNull(factory, "factory");

            InitializeComponent();

            _picLogo.Image  = GetLogo();
            _picLogo2.Image = GetGradient();

            _factory = factory;

            Text = Resources.StrStartPage;

            _lstLocalRepositories.ItemActivated  += OnLocalRepositoriesListItemActivated;
            _lstRecentRepositories.ItemActivated += OnRecentRepositoriesListItemActivated;

            _lstLocalRepositories.DragEnter += OnLocalRepositoriesDragEnter;
            _lstLocalRepositories.DragDrop  += OnLocalRepositoriesDragDrop;

            _lstLocalRepositories.KeyDown  += OnLocalRepositoriesKeyDown;
            _lstRecentRepositories.KeyDown += OnRecentRepositoriesKeyDown;

            _chkClosePageAfterRepositoryLoad                   = GitterApplication.Style.CreateCheckBox();
            _chkClosePageAfterRepositoryLoad.Text              = Resources.StrsClosePageAfterRepositoryLoad;
            _chkClosePageAfterRepositoryLoad.Control.Bounds    = new Rectangle(9, 491, 199, 20);
            _chkClosePageAfterRepositoryLoad.Control.Anchor    = AnchorStyles.Left | AnchorStyles.Bottom;
            _chkClosePageAfterRepositoryLoad.Control.Parent    = this;
            _chkClosePageAfterRepositoryLoad.IsChecked         = _factory.CloseAfterRepositoryLoad;
            _chkClosePageAfterRepositoryLoad.IsCheckedChanged += _chkClosePageAfterRepositoryLoad_CheckedChanged;

            _chkShowPageAtStartup                   = GitterApplication.Style.CreateCheckBox();
            _chkShowPageAtStartup.Text              = Resources.StrsShowPageOnStartup;
            _chkShowPageAtStartup.Control.Bounds    = new Rectangle(9, 511, 199, 20);
            _chkShowPageAtStartup.Control.Anchor    = AnchorStyles.Left | AnchorStyles.Bottom;
            _chkShowPageAtStartup.Control.Parent    = this;
            _chkShowPageAtStartup.IsChecked         = _factory.ShowOnStartup;
            _chkShowPageAtStartup.IsCheckedChanged += _chkShowPageAtStartup_CheckedChanged;

            _separator1.BackColor = GitterApplication.Style.Colors.Separator;
            _separator2.BackColor = GitterApplication.Style.Colors.Separator;

            _recentRepositoriesBinding = new NotifyCollectionBinding <RepositoryLink>(
                _lstRecentRepositories.Items,
                WorkingEnvironment.RepositoryManagerService.RecentRepositories,
                repo => new RecentRepositoryListItem(repo));
        }
예제 #2
0
        public StartPageView(IWorkingEnvironment environment, StartPageViewFactory factory)
            : base(Guids.StartPageView, environment)
        {
            Verify.Argument.IsNotNull(factory, "factory");

            InitializeComponent();

            _picLogo.Image = GetLogo();
            _picLogo2.Image = GetGradient();

            _factory = factory;

            Text = Resources.StrStartPage;

            _lstLocalRepositories.ItemActivated += OnLocalRepositoriesListItemActivated;
            _lstRecentRepositories.ItemActivated += OnRecentRepositoriesListItemActivated;

            _lstLocalRepositories.DragEnter += OnLocalRepositoriesDragEnter;
            _lstLocalRepositories.DragDrop += OnLocalRepositoriesDragDrop;

            _lstLocalRepositories.KeyDown += OnLocalRepositoriesKeyDown;
            _lstRecentRepositories.KeyDown += OnRecentRepositoriesKeyDown;

            _chkClosePageAfterRepositoryLoad = GitterApplication.Style.CreateCheckBox();
            _chkClosePageAfterRepositoryLoad.Text = Resources.StrsClosePageAfterRepositoryLoad;
            _chkClosePageAfterRepositoryLoad.Control.Bounds = new Rectangle(9, 491, 199, 20);
            _chkClosePageAfterRepositoryLoad.Control.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            _chkClosePageAfterRepositoryLoad.Control.Parent = this;
            _chkClosePageAfterRepositoryLoad.IsChecked = _factory.CloseAfterRepositoryLoad;
            _chkClosePageAfterRepositoryLoad.IsCheckedChanged += _chkClosePageAfterRepositoryLoad_CheckedChanged;

            _chkShowPageAtStartup = GitterApplication.Style.CreateCheckBox();
            _chkShowPageAtStartup.Text = Resources.StrsShowPageOnStartup;
            _chkShowPageAtStartup.Control.Bounds = new Rectangle(9, 511, 199, 20);
            _chkShowPageAtStartup.Control.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            _chkShowPageAtStartup.Control.Parent = this;
            _chkShowPageAtStartup.IsChecked = _factory.ShowOnStartup;
            _chkShowPageAtStartup.IsCheckedChanged += _chkShowPageAtStartup_CheckedChanged;

            _separator1.BackColor = GitterApplication.Style.Colors.Separator;
            _separator2.BackColor = GitterApplication.Style.Colors.Separator;

            _recentRepositoriesBinding = new NotifyCollectionBinding<RepositoryLink>(
                _lstRecentRepositories.Items,
                WorkingEnvironment.RepositoryManagerService.RecentRepositories,
                repo => new RecentRepositoryListItem(repo));
        }
예제 #3
0
파일: MainForm.cs 프로젝트: oqewok/gitter
        /// <summary>Initializes a new instance of the <see cref="MainForm"/> class.</summary>
        public MainForm()
        {
            InitializeComponent();

            _configurationService     = GitterApplication.ConfigurationService;
            _repositoryManagerService = new RepositoryManagerService(SavedRecentRepositories);
            _viewDockService          = new ViewDockService(this, _toolDockGrid, _configurationService.ViewsSection);
            _notificationService      = new BalloonNotificationService();

            _repositoryManagerService.RecentRepositories.Changed += OnRecentRepositoriesChanged;

            ProvideToolbar(new StandardToolbar(this));

            _mnuRepository.DropDownItems.Insert(0,
                                                new ToolStripMenuItem(Resources.StrInit.AddEllipsis(), CachedResources.Bitmaps["ImgRepositoryInitSmall"], OnInitRepositoryClick));
            _mnuRepository.DropDownItems.Insert(1,
                                                new ToolStripMenuItem(Resources.StrClone.AddEllipsis(), CachedResources.Bitmaps["ImgRepositoryCloneSmall"], OnCloneRepositoryClick));
            _mnuRepository.DropDownItems.Insert(2,
                                                new ToolStripSeparator());

            _viewDockService = new ViewDockService(this, _toolDockGrid, _configurationService.ViewsSection);
            _viewDockService.RegisterFactory(
                _startPageFactory = new StartPageViewFactory());
            _viewDockService.RegisterFactory(
                _repositoryExplorerFactory = new RepositoryExplorerViewFactory(this));
            _viewDockService.RegisterFactory(
                _logFactory = new LogViewFactory());

            LoadOptions();
            LoadRecentRepositories();

            _viewDockService.ShowView(Guids.RepositoryExplorerView);

            _repositoryProviders         = new Dictionary <string, IRepositoryProvider>();
            _issueTrackerProviders       = new Dictionary <string, IRepositoryServiceProvider>();
            _activeIssueTrackerProviders = new HashSet <IRepositoryServiceProvider>();
            _additionalGui = new LinkedList <IGuiProvider>();

            LoadProviders();

            _mnuView.DropDownItems.Insert(0, new ViewMenuItem(_repositoryExplorerFactory, this));
            _mnuView.DropDownItems.Insert(1, new ViewMenuItem(_startPageFactory, this));
            _mnuView.DropDownItems.Insert(2, new ToolStripSeparator());

            _mnuView.DropDownItems.Add(new ToolStripSeparator());
            _mnuView.DropDownItems.Add(new ViewMenuItem(_logFactory, this));

            _mnuRepository.Text         = Resources.StrRepository;
            _mnuExit.Text               = Resources.StrExit;
            _mnuOpenRepository.Text     = Resources.StrOpen.AddEllipsis();
            _mnuRecentRepositories.Text = Resources.StrRecent;

            _mnuView.Text     = Resources.StrView;
            _mnuToolbars.Text = Resources.StrToolbars;

            _mnuTools.Text   = Resources.StrTools;
            _mnuOptions.Text = Resources.StrOptions.AddEllipsis();

            _mnuHelp.Text  = Resources.StrHelp;
            _mnuAbout.Text = Resources.StrAbout.AddEllipsis();

            _recentRepositoryPath = string.Empty;
        }
예제 #4
0
        public StartPageView(IWorkingEnvironment environment, StartPageViewFactory factory)
            : base(Guids.StartPageView, environment)
        {
            Verify.Argument.IsNotNull(factory, nameof(factory));

            InitializeComponent();

            _picLogo.Image  = GetLogo();
            _picLogo2.Image = GetGradient();

            _factory      = factory;
            _repositories = new List <RepositoryListItem>();

            Text = Resources.StrStartPage;

            _txtFilter.BackColor     = GitterApplication.Style.Colors.Window;
            _txtFilter.HintForeColor = GitterApplication.Style.Colors.GrayText;
            _txtFilter.TextForeColor = GitterApplication.Style.Colors.WindowText;

            _lstLocalRepositories.SizeChanged += (s, e) =>
            {
                var x = _lstLocalRepositories.Width + _lstLocalRepositories.Left - _txtFilter.Width;
                if (x > _lblLocalRepositories.Left + _lblLocalRepositories.Width)
                {
                    _txtFilter.Left    = x;
                    _txtFilter.Visible = true;
                }
                else
                {
                    _txtFilter.Visible = false;
                }
            };

            _txtFilter.TextChanged += OnFilterTextChanged;

            _lstLocalRepositories.ItemActivated  += OnLocalRepositoriesListItemActivated;
            _lstRecentRepositories.ItemActivated += OnRecentRepositoriesListItemActivated;

            _lstLocalRepositories.DragEnter += OnLocalRepositoriesDragEnter;
            _lstLocalRepositories.DragDrop  += OnLocalRepositoriesDragDrop;

            _lstLocalRepositories.KeyDown  += OnLocalRepositoriesKeyDown;
            _lstRecentRepositories.KeyDown += OnRecentRepositoriesKeyDown;

            _chkClosePageAfterRepositoryLoad                   = GitterApplication.Style.CreateCheckBox();
            _chkClosePageAfterRepositoryLoad.Text              = Resources.StrsClosePageAfterRepositoryLoad;
            _chkClosePageAfterRepositoryLoad.Control.Bounds    = new Rectangle(9, 491, 199, 20);
            _chkClosePageAfterRepositoryLoad.Control.Anchor    = AnchorStyles.Left | AnchorStyles.Bottom;
            _chkClosePageAfterRepositoryLoad.Control.Parent    = this;
            _chkClosePageAfterRepositoryLoad.IsChecked         = _factory.CloseAfterRepositoryLoad;
            _chkClosePageAfterRepositoryLoad.IsCheckedChanged += _chkClosePageAfterRepositoryLoad_CheckedChanged;

            _chkShowPageAtStartup                   = GitterApplication.Style.CreateCheckBox();
            _chkShowPageAtStartup.Text              = Resources.StrsShowPageOnStartup;
            _chkShowPageAtStartup.Control.Bounds    = new Rectangle(9, 511, 199, 20);
            _chkShowPageAtStartup.Control.Anchor    = AnchorStyles.Left | AnchorStyles.Bottom;
            _chkShowPageAtStartup.Control.Parent    = this;
            _chkShowPageAtStartup.IsChecked         = _factory.ShowOnStartup;
            _chkShowPageAtStartup.IsCheckedChanged += _chkShowPageAtStartup_CheckedChanged;

            _separator1.BackColor = GitterApplication.Style.Colors.Separator;
            _separator2.BackColor = GitterApplication.Style.Colors.Separator;

            _recentRepositoriesBinding = new NotifyCollectionBinding <RepositoryLink>(
                _lstRecentRepositories.Items,
                WorkingEnvironment.RepositoryManagerService.RecentRepositories,
                repo => new RecentRepositoryListItem(repo));
        }