private void button1_Click(object sender, EventArgs e) { //Instantiate a new FogBugz class FogBugz fogBugz = new FogBugz("https://evildolphin.fogbugz.com"); fogBugz.VerifyCertificate = false; //Verify the API if (!fogBugz.VerifyApi()) { MessageBox.Show("FogBugz API not compatible with this plug-in"); } //Now log-in fogBugz.Logon("*****@*****.**", "SemperF1"); //Now retrieve a specific case FogBugzFixFor fogBugzFixFor = fogBugz.GetFixFor(Int32.Parse(this.txtCaseId.Text)); //Display the id of the retrieved case MessageBox.Show("Retrieved fixfor " + fogBugzFixFor.Name.ToString() + "."); //Finally log-off fogBugz.Logoff(); }
private void btnRetrieve_Click(object sender, EventArgs e) { //Instantiate a new FogBugz class FogBugz fogBugz = new FogBugz("https://evildauphin.fogbugz.com"); fogBugz.VerifyCertificate = false; //Verify the API if (!fogBugz.VerifyApi()) { MessageBox.Show("FogBugz API not compatible with this plug-in"); } //Now log-in fogBugz.Logon("*****@*****.**", "zigzag"); //Now retrieve a specific case FogBugzCase fogBugzCase = fogBugz.GetCase(Int32.Parse(this.txtCaseId.Text)); //Display the id of the retrieved case MessageBox.Show("Retrieved case " + fogBugzCase.Id.ToString() + "."); //Finally log-off fogBugz.Logoff(); }
private void loginWithPrompt(bool forceNewCreds) { Utils.Log.DebugFormat("Logging in to FogBugz (with prompt: {0}", forceNewCreds); try { SetState(new StateLoggingIn(this)); if (forceNewCreds || _password.Length == 0 || _username.Length == 0 || _server.Length == 0 || _server == ConfigurationManager.AppSettings["ExampleServerURL"]) { if (string.IsNullOrEmpty(_server)) { string url = ConfigurationManager.AppSettings["FogBugzBaseURL"] ?? ""; _server = (url.Length > 0) ? url : ConfigurationManager.AppSettings["ExampleServerURL"]; } LoginResultInfo info = DoLoginScreen(_username, _password, _server); if (info.UserChoice != DialogResult.Cancel) { _username = info.User; _password = info.Password; _server = info.Server; } } Utils.Log.DebugFormat("Server is at {0}", _server); _fb = new FogBugz(_server); LoginAsync(_username, _password, delegate(bool succeeded) { if (succeeded) { saveSettings(); updateCases(); } else { _password = ""; SetState(new StateLoggedOff(this)); MessageBox.Show("Login failed", "FogBugz", MessageBoxButtons.OK, MessageBoxIcon.Error); } }); } catch (Exception x) { SetState(new StateLoggedOff(this)); throw x; } }
private void loginWithPrompt(bool forceNewCreds = false) { try { SetState(new StateLoggingIn(this)); if (forceNewCreds || _password.Length == 0 || _username.Length == 0 || _server.Length == 0 || _server == ConfigurationManager.AppSettings["ExampleServerURL"]) { if (_server.Length == 0) { string url = ConfigurationManager.AppSettings["FogBugzBaseURL"] ?? ""; _server = (url.Length > 0) ? url : ConfigurationManager.AppSettings["ExampleServerURL"]; } LogonResultInfo info = DoLogonScreen(_username, _password, _server); if (info.UserChoice != DialogResult.Cancel) { _username = info.User; _password = info.Password; _server = info.Server; } } _fb = new FogBugz(_server); LogonAsync(_username, _password, delegate(bool succeeded) { if (succeeded) { saveSettings(); updateCases(); } else { _password = ""; SetState(new StateLoggedOff(this)); MessageBox.Show(@"Login failed", @"FogBugz", MessageBoxButtons.OK, MessageBoxIcon.Error); } }); } catch (Exception) { SetState(new StateLoggedOff(this)); throw; } }
private void LoginButtonClick(object sender, EventArgs e) { this.ServerUrlTextBox.Text = FormatServerAddress(this.ServerUrlTextBox.Text); this.InitialLabel.Text = ""; // TODO: Handle Uri parsing failure FogBugz fb = new FogBugz(new Uri(this.ServerUrlTextBox.Text), null); LoginResult result = fb.Login(this.EmailTextBox.Text, this.PasswordTextBox.Text); switch (result) { case LoginResult.Ok: // Save results m_loginToken = fb.Token; m_serverUrl = this.ServerUrlTextBox.Text; m_emailAddress = this.EmailTextBox.Text; // TODO: Checkboxes m_openBrowserAfterSend = true; m_copyCaseUrlToClipboardAfterSend = true; this.EstablishedPanel.Visible = true; this.InitialPanel.Visible = false; break; case LoginResult.Unknown: this.InitialLabel.Text = "Unknown error connecting to FogBugz"; this.InitialLabel.ForeColor = Color.Red; break; case LoginResult.AccountNotFound: this.InitialLabel.Text = "FogBugz Email/Password not accepted"; this.InitialLabel.ForeColor = Color.Red; break; case LoginResult.ServerNotFound: this.InitialLabel.Text = "The server could not be contacted"; this.InitialLabel.ForeColor = Color.Red; break; case LoginResult.ServerNotCapable: this.InitialLabel.Text = "The server does not appear to serve FogBugz"; this.InitialLabel.ForeColor = Color.Red; break; } }
void SendToButtonClick(object sender, EventArgs e) { BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(Language.GetString("fogbugz", LangKey.fogbugz), Language.GetString("fogbugz", LangKey.communication_wait)); bool success = false; int caseId = 0; if (ResultsListBox.SelectedIndex == 0) { // TODO: Open new case dialog FogBugz fb = new FogBugz(new Uri(m_cfg.FogBugzServerUrl), m_cfg.FogBugzLoginToken); caseId = fb.CreateNewCase(CaptionTextBox.Text, m_filename, m_captureStream.GetBuffer()); success = true; } else { string item = ResultsListBox.SelectedItem.ToString(); caseId = Convert.ToInt32(item.Substring(0, item.IndexOf(" "))); FogBugz fb = new FogBugz(new Uri(m_cfg.FogBugzServerUrl), m_cfg.FogBugzLoginToken); fb.AttachImageToExistingCase(caseId, CaptionTextBox.Text, m_filename, m_captureStream.GetBuffer()); success = true; } // Set the configuration for next time if (success) { m_cfg.LastCaseId = caseId; try { string caseUrl = string.Concat(m_cfg.FogBugzServerUrl, "?", caseId); if (m_cfg.CopyCaseUrlToClipboardAfterSend) { System.Windows.Forms.Clipboard.SetText(caseUrl); } if (m_cfg.OpenBrowserAfterSend) { Process.Start(caseUrl); } } catch { // Throw away "after-upload" exceptions } } backgroundForm.CloseDialog(); }
void searchTimerTick(object sender, EventArgs e) { const int c_maxResultsToRetrieve = 20; m_searchTimer.Stop(); // Retrieve search results from FogBugz FogBugz fb = new FogBugz(new Uri(m_cfg.FogBugzServerUrl), m_cfg.FogBugzLoginToken); SearchResults results = fb.SearchWritableCases(KeywordsTextBox.Text, c_maxResultsToRetrieve); // Insert results foreach (SearchResult r in results.Results) { ResultsListBox.Items.Add(r.CaseId + " - " + r.Title); } ResultsListBox.SelectedIndex = (ResultsListBox.Items.Count == 1) ? 0 : 1; this.Cursor = Cursors.Default; }
private void btnCreate_Click(object sender, EventArgs e) { //Instantiate a new FogBugz class FogBugz fogBugz = new FogBugz("https://evildauphin.fogbugz.com"); fogBugz.VerifyCertificate = false; //Verify the API if (!fogBugz.VerifyApi()) { MessageBox.Show("FogBugz API not compatible with this plug-in"); } //Now log-in fogBugz.Logon("*****@*****.**", "zigzag"); //Now create a new case FogBugzCase newCase = new FogBugzCase(); newCase.Title = "Test Form Case"; newCase.Project = 1; newCase.Priority = 3; newCase.Area = 4; newCase.FixFor = 2; newCase.Category = 1; newCase.Computer = "Windows 2003"; newCase.Version = "Version 1"; newCase.HrsCurrEst = 1; newCase.PersonAssignedTo = 2; newCase.Description = "Long Description"; newCase.Due = DateTime.Now.AddDays(2); newCase = fogBugz.Add(newCase); //Display the id of the newly inserted case MessageBox.Show("Inserted new case " + newCase.Id.ToString() + "."); //Finally log-off fogBugz.Logoff(); }
public FilterDialog(HoverWindow parent, FogBugz fb) { InitializeComponent(); _fb = fb; _parentWindow = parent; }
private void BadLogin() { FogBugz fb = new FogBugz("bad url"); fb.Logon("bad", "bad"); }