예제 #1
0
        private void bg_bitIssuesWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;
            List<String> list = e.Argument as List<String>;
            BitBucketRest bit = new BitBucketRest(list[0],list[1]);
            if (closedGitMilestones != null && closedGitMilestones.Count > 0)
            {
                String textData1 = ("This repo has closed Milestones. Porting them:->\n");
                Dispatcher.Invoke(new Action(() => logger.AppendText(textData1)));
                foreach (Git2Bit.GitModels.Milestone amilestone in closedGitMilestones)
                {
                    Git2Bit.BitModels.Milestone bitMilestone = bit.PostMilestone(selectedBitRepository, amilestone);
                    if (bitMilestone != null)
                    {
                        String textData2 = ("Ported closed Milestone: " + bitMilestone.name + "\n");
                        Dispatcher.Invoke(new Action(() => logger.AppendText(textData2)));
                    }
                }
            }

            if (openGitMilestones != null && openGitMilestones.Count > 0)
            {
                String textData1 = ("This repo has open Milestones. Porting them:->\n");
                Dispatcher.Invoke(new Action(() => logger.AppendText(textData1)));
                foreach (Git2Bit.GitModels.Milestone amilestone in openGitMilestones)
                {
                    Git2Bit.BitModels.Milestone bitMilestone = bit.PostMilestone(selectedBitRepository, amilestone);
                    if (bitMilestone != null)
                    {
                        String textData2 = ("Ported open Milestone: " + bitMilestone.name + "\n");
                        Dispatcher.Invoke(new Action(() => logger.AppendText(textData2)));
                    }
                }
            }

            if (closedGitIssues != null && closedGitIssues.Count > 0)
            {
                String textData1 = ("This repo has closed Git Issues. Porting them:->\n");
                Dispatcher.Invoke(new Action(() => logger.AppendText(textData1)));
                foreach (Git2Bit.GitModels.Issue aissue in closedGitIssues)
                {
                    List<Git2Bit.GitModels.Comments> issueComments = null;
                    if (gitComments.ContainsKey(aissue.number))
                    {
                        issueComments = gitComments[aissue.number];
                    }

                    Git2Bit.BitModels.Issue bitIssue = bit.PostIssue(selectedBitRepository, aissue, issueComments);
                    if (bitIssue != null)
                    {
                        String textData2 = ("Ported closed Issue: " + bitIssue.title + "\n");
                        Dispatcher.Invoke(new Action(() => logger.AppendText(textData2)));
                    }
                }
            }

            if (openGitIssues != null && openGitIssues.Count > 0)
            {
                String textData1 = ("This repo has open Git Issues. Porting them:->\n");
                Dispatcher.Invoke(new Action(() => logger.AppendText(textData1)));
                foreach (Git2Bit.GitModels.Issue aissue in openGitIssues)
                {
                    List<Git2Bit.GitModels.Comments> issueComments = null;
                    if (gitComments.ContainsKey(aissue.number))
                    {
                        issueComments = gitComments[aissue.number];
                    }

                    Git2Bit.BitModels.Issue bitIssue = bit.PostIssue(selectedBitRepository, aissue, issueComments);
                    if (bitIssue != null)
                    {
                        String textData2 = ("Ported open Issue: " + bitIssue.title + "\n");
                        Dispatcher.Invoke(new Action(() => logger.AppendText(textData2)));
                    }
                }
            }
        }
        private void portGitIssuesToBit_Click(object sender, RoutedEventArgs e)
        {
            BitBucketRest bit = new BitBucketRest(bitUsername.Text, bitPassword.Password);
            if (closedGitMilestones != null && closedGitMilestones.Count > 0)
            {
                logger.AppendText("This repo has closed Milestones. Porting them:->\n");
                foreach (Git2Bit.GitModels.Milestone amilestone in closedGitMilestones)
                {
                    Git2Bit.BitModels.Milestone bitMilestone = bit.PostMilestone(selectedBitRepository,amilestone);
                    logger.AppendText("Ported closed Milestone: " + bitMilestone.name + "\n");
                }
            }

            if (openGitMilestones != null && openGitMilestones.Count > 0)
            {
                logger.AppendText("This repo has open Milestones. Porting them:->\n");
                foreach (Git2Bit.GitModels.Milestone amilestone in openGitMilestones)
                {
                    Git2Bit.BitModels.Milestone bitMilestone = bit.PostMilestone(selectedBitRepository, amilestone);
                    logger.AppendText("Ported open Milestone: " + bitMilestone.name + "\n");
                }
            }

            if (closedGitIssues != null && closedGitIssues.Count > 0)
            {
                logger.AppendText("This repo has closed Git Issues. Porting them:->\n");
                foreach (Git2Bit.GitModels.Issue aissue in closedGitIssues)
                {
                    List<Git2Bit.GitModels.Comments> issueComments = null;
                    if (gitComments.ContainsKey(aissue.number))
                    {
                        issueComments = gitComments[aissue.number];
                    }

                    Git2Bit.BitModels.Issue bitIssue = bit.PostIssue(selectedBitRepository, aissue, issueComments);
                    logger.AppendText("Ported closed Issue: " + bitIssue.title + "\n");
                }
            }

            if (openGitIssues != null && openGitIssues.Count > 0)
            {
                logger.AppendText("This repo has open Git Issues. Porting them:->\n");
                foreach (Git2Bit.GitModels.Issue aissue in openGitIssues)
                {
                    List<Git2Bit.GitModels.Comments> issueComments = null;
                    if (gitComments.ContainsKey(aissue.number))
                    {
                        issueComments = gitComments[aissue.number];
                    }

                    Git2Bit.BitModels.Issue bitIssue = bit.PostIssue(selectedBitRepository, aissue, issueComments);
                    logger.AppendText("Ported open Issue: " + bitIssue.title + "\n");
                }
            }
        }