Beispiel #1
0
 private void TestConnectionButtonClick(object sender, EventArgs e)
 {
     PopulateViewModel();
     _service = new BambooService(Model.ServerAddress, Model.Username, Model.Password);
     try
     {
         var result = _service.GetServerInfo();
         MessageBox.Show(
             string.Format(
                 "Successfully connected to {0}\n\nServer version is Bamboo {1}, build {2}.",
                 Model.ServerAddress,
                 result.Version,
                 result.BuildNumber),
             "Success!",
             MessageBoxButtons.OK,
             MessageBoxIcon.Asterisk);
     }
     catch (BambooRequestException ex)
     {
         MessageBox.Show(
             string.Format(
                 "An error occurred whilst connecting to the server.\nPlease check your details and try again: \n\n{0}",
                 ex.Message),
             "Unsuccessful!",
             MessageBoxButtons.OK,
             MessageBoxIcon.Error);
     }
 }
        private void PopulateBuildListView(Server model)
        {
            try
            {
                if (model != null)
                {
                    _service = new BambooService(new Uri(model.Address), model.Username, model.PlaintextPassword);

                    var plans = _service.GetAllPlans();

                    GetPlanListViewData(plans);
                }
            }
            catch (BambooRequestException ex)
            {
                MessageBox.Show(
                    string.Format(
                        "An error occurred whilst connecting to the server.\nPlease check your details and try again: \n\n{0}",
                        ex.Message),
                    "Unsuccessful!",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
        }