コード例 #1
0
ファイル: Dashboard.cs プロジェクト: GeMesoft/gitextensions
        private void Dashboard_Load(object sender, EventArgs e)
        {
            DonateCategory.Dock = DockStyle.Top;

            // Show buttons
            CommonActions.DisableContextMenu();
            var openItem = new DashboardItem(Resources.IconRepoOpen, _openRepository.Text);

            openItem.Click += openItem_Click;
            CommonActions.AddItem(openItem);

            var cloneItem = new DashboardItem(Resources.IconCloneRepoGit, _cloneRepository.Text);

            cloneItem.Click += cloneItem_Click;
            CommonActions.AddItem(cloneItem);

            foreach (IRepositoryHostPlugin el in RepoHosts.GitHosters)
            {
                IRepositoryHostPlugin gitHoster = el;
                var di = new DashboardItem(Resources.IconCloneRepoGithub, string.Format(_cloneFork.Text, el.Description));
                di.Click += (repoSender, eventArgs) => UICommands.StartCloneForkFromHoster(this, gitHoster, GitModuleChanged);
                CommonActions.AddItem(di);
            }

            var createItem = new DashboardItem(Resources.IconRepoCreate, _createRepository.Text);

            createItem.Click += createItem_Click;
            CommonActions.AddItem(createItem);

            DonateCategory.DisableContextMenu();
            var gitHubItem = new DashboardItem(Resources.develop.ToBitmap(), _develop.Text);

            gitHubItem.Click += GitHubItem_Click;
            DonateCategory.AddItem(gitHubItem);
            var donateItem = new DashboardItem(Resources.dollar.ToBitmap(), _donate.Text);

            donateItem.Click += DonateItem_Click;
            DonateCategory.AddItem(donateItem);
            var translateItem = new DashboardItem(Resources.EditItem, _translate.Text);

            translateItem.Click += TranslateItem_Click;
            DonateCategory.AddItem(translateItem);
            var issuesItem = new DashboardItem(Resources.bug, _issues.Text);

            issuesItem.Click += IssuesItem_Click;
            DonateCategory.AddItem(issuesItem);

            //
            // create Show current branch menu item and add to Dashboard menu
            //
            var showCurrentBranchMenuItem = new ToolStripMenuItem(_showCurrentBranch.Text);

            showCurrentBranchMenuItem.Click  += showCurrentBranchMenuItem_Click;
            showCurrentBranchMenuItem.Checked = AppSettings.DashboardShowCurrentBranch;

            var menuStrip     = FindControl <MenuStrip>(Parent.Parent.Parent, p => true); // TODO: improve: Parent.Parent.Parent == FormBrowse
            var dashboardMenu = (ToolStripMenuItem)menuStrip.Items.Cast <ToolStripItem>().SingleOrDefault(p => p.Name == "dashboardToolStripMenuItem");

            dashboardMenu.DropDownItems.Add(showCurrentBranchMenuItem);
        }
コード例 #2
0
ファイル: Dashboard.cs プロジェクト: hiroponz/gitextensions
        private void Dashboard_Load(object sender, EventArgs e)
        {
            DonateCategory.Dock = DockStyle.Top;
            //Show buttons
            CommonActions.DisableContextMenu();
            var openItem = new DashboardItem(Resources.IconRepoOpen, openRepository.Text);

            openItem.Click += openItem_Click;
            CommonActions.AddItem(openItem);

            var cloneItem = new DashboardItem(Resources.IconCloneRepoGit, cloneRepository.Text);

            cloneItem.Click += cloneItem_Click;
            CommonActions.AddItem(cloneItem);

            var cloneSvnItem = new DashboardItem(Resources.IconCloneRepoSvn, cloneSvnRepository.Text);

            cloneSvnItem.Click += cloneSvnItem_Click;
            CommonActions.AddItem(cloneSvnItem);

            foreach (IRepositoryHostPlugin el in RepoHosts.GitHosters)
            {
                IRepositoryHostPlugin gitHoster = el;
                var di = new DashboardItem(Resources.IconCloneRepoGithub, string.Format(cloneFork.Text, el.Description));
                di.Click += (repoSender, eventArgs) => UICommands.StartCloneForkFromHoster(this, gitHoster, GitModuleChanged);
                CommonActions.AddItem(di);
            }

            var createItem = new DashboardItem(Resources.IconRepoCreate, createRepository.Text);

            createItem.Click += createItem_Click;
            CommonActions.AddItem(createItem);

            DonateCategory.DisableContextMenu();
            var GitHubItem = new DashboardItem(Resources.develop.ToBitmap(), develop.Text);

            GitHubItem.Click += GitHubItem_Click;
            DonateCategory.AddItem(GitHubItem);
            var DonateItem = new DashboardItem(Resources.dollar.ToBitmap(), donate.Text);

            DonateItem.Click += DonateItem_Click;
            DonateCategory.AddItem(DonateItem);
            var TranslateItem = new DashboardItem(Resources.EditItem, translate.Text);

            TranslateItem.Click += TranslateItem_Click;
            DonateCategory.AddItem(TranslateItem);
            var IssuesItem = new DashboardItem(Resources.bug, issues.Text);

            IssuesItem.Click += IssuesItem_Click;
            DonateCategory.AddItem(IssuesItem);
        }