protected virtual void TestQueryButtonClicked(object sender, System.EventArgs e) { // we're assuming that the source is a valid one. buttonOk.Sensitive = false; Candidate = null; // Erase any previous successful query candidate Query target = new Query(); // Set the global source ID of the target's source target.SourceID = sourceSelector.Active - 1; // Start setting the parameters that will be set via the filters SearchParams queryParams = new SearchParams(); // iterate over all the filters and get the filters foreach(Widget filterWidget in filterWidgets) { IFilterWidget filter = (IFilterWidget)filterWidget; if(filter != null) { // modify the query parameters filter.SetFilterParams(ref queryParams); } } target.Generator.queryParameters = queryParams; target.Generator.Title = bugTitleEntry.Text; // now try to run the query testQueryButton.Sensitive = false; int output = target.Execute(); if(output == -1) { // the connection failed or something testQueryOutputLabel.Text = "The request to the server failed. Please try later"; testQueryButton.Sensitive = true; } else { testQueryOutputLabel.Text = String.Format("The query returned {0} results", output); // Allow user to press OK button buttonOk.Sensitive = true; // Set the new candidate Candidate = target; testQueryButton.Sensitive = true; } }
void BugTreeRowActivated(object o, RowActivatedArgs args) { Console.WriteLine ("Row activated + " + args.Path.Indices.Length); commentSendButton.Sensitive = false; // Check the length of the indices array in the path. We are ideally looking for something which is // in the first level of nesting. if(args.Path.Indices.Length != 1) { commentSendButton.Sensitive = true; BugReport target = BugReportFromTreePath (args.Path); lock(activeBug) { activeBug = target; activeQuery = SplatterCore.Instance.Queries[args.Path.Indices[0]]; DrawCommentsFromReport (target); } // Set the bug details int row_id = 0; /* * * TODO: Change the number of rows as you add more properties to the table * */ bugPropertyTable.Resize(10, 2); foreach (Widget child in bugPropertyTable.Children) { bugPropertyTable.Remove(child); } StringValueToTable(bugPropertyTable, "Bug ID", target.id.ToString(), ref row_id); StringValueToTable(bugPropertyTable, "Component", target.component, ref row_id); StringValueToTable(bugPropertyTable, "Product", target.product, ref row_id); StringValueToTable(bugPropertyTable, "Assigned To", target.assigned_to, ref row_id); StringValueToTable(bugPropertyTable, "Resolution", target.resolution, ref row_id); StringValueToTable(bugPropertyTable, "Status", target.status, ref row_id); StringValueToTable(bugPropertyTable, "Severity", target.severity, ref row_id); StringValueToTable(bugPropertyTable, "Priority", target.priority, ref row_id); StringValueToTable(bugPropertyTable, "Created", target.creation_time.ToString(), ref row_id); StringValueToTable(bugPropertyTable, "Last Changed", target.last_change_time.ToString(), ref row_id); // Mark bug as having no unread comments target.BugChangedFlag = false; target.NewCommentFlag = false; // Force UI Refresh this.SyncTreeviewWithBugs(); } }