示例#1
0
        private static void HandleCLIMode(string[] args)
        {
            try
            {
                var request  = ParseArgs(args);
                var response = ChangesetManager.GetChangesetHistory(request);

                const string OUTPUTFORMATHEADER = "{0,-9} {1,-20} {2,10}  {3}";
                Console.WriteLine(OUTPUTFORMATHEADER, "Changeset", "Author", "Check-In", "Comments");

                const string OUTPUTFORMAT = "{0,-9} {1,-20} {2:yyyy-MM-dd}  {3}";
                foreach (var changeset in response)
                {
                    Console.WriteLine(OUTPUTFORMAT, changeset.ChangesetId, changeset.Owner, changeset.CheckInDateTime, changeset.Comment.Replace("\r", " ").Replace("\n", " "));
                }
            }
            catch (ArgumentException aex)
            {
                PrintUsage();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unknown error");
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
        }
示例#2
0
文件: Form1.cs 项目: vasantbala/TFS
        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtRelBranch.Text))
            {
                MessageBox.Show("Enter release branch to continue", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (string.IsNullOrEmpty(txtTFSUrl.Text))
            {
                MessageBox.Show("Enter TFS URL to continue", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }


            ChangesetHistoryRequest request = new ChangesetHistoryRequest();

            request.TFSUrl                = txtTFSUrl.Text.Trim();
            request.ReleaseBranchUrl      = txtRelBranch.Text.Trim();
            request.IgnoreFromUsersString = txtIgnoreUsers.Text.Trim();
            request.FromDate              = fromDate.Value;
            request.ToDate                = toDate.Value;

            try
            {
                bindList.Clear();
                var response = ChangesetManager.GetChangesetHistory(request);
                foreach (var changeItem in response)
                {
                    bindList.Add(changeItem);
                }
            }
            catch (ArgumentException aex)
            {
                MessageBox.Show("Check your inputs and try again", "Valdiation error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Message: {0}; Stacktrace: {1}", ex.Message, ex.StackTrace), "Error occured", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }