void bgWorker_DoWork(object sender, DoWorkEventArgs e)
            {
                try
                {
                    ITrac trac = TracCommon.GetTrac((ServerDetails)e.Argument);

                    //TODO: Multicall
                    List <MulticallItem> attributes = new List <MulticallItem>();
                    attributes.Add(new MulticallItem("ticket.component.getAll", new string[] { }));
                    attributes.Add(new MulticallItem("ticket.milestone.getAll", new string[] {}));
                    attributes.Add(new MulticallItem("ticket.severity.getAll", new string[] {}));
                    attributes.Add(new MulticallItem("ticket.type.getAll", new string[] {}));
                    attributes.Add(new MulticallItem("ticket.priority.getAll", new string[] { }));
                    attributes.Add(new MulticallItem("ticket.status.getAll", new string[] { }));
                    attributes.Add(new MulticallItem("ticket.resolution.getAll", new string[] { }));
                    attributes.Add(new MulticallItem("ticket.version.getAll", new string[] { }));

                    object[] result = trac.multicall(attributes.ToArray());

                    e.Result = result;
                }
                catch (Exception ex)
                {
                    e.Result = ex;
                }
            }
 void bgWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         ITrac         trac      = TracCommon.GetTrac((ServerDetails)e.Argument);
         string[]      pages     = trac.getAllPages();
         List <string> wikiPages = new List <string>(pages);
         wikiPages.Sort();
         e.Result = wikiPages;
     }
     catch (Exception ex)
     {
         e.Result = ex;
     }
 }
Пример #3
0
        /// <summary>
        /// Start the background thread and disable all control while it works
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void wizardPage2_ShowFromNext(object sender, EventArgs e)
        {
            this.Cursor         = Cursors.WaitCursor;
            wizard1.NextEnabled = wizard1.BackEnabled = wizard1.CancelEnabled = false;
            pictureBox1.Visible = true;

            lblStatus.Text = Properties.Resources.LabelChecking;
            lblError.Text  = string.Empty;

            UpdateServerDetails();

            ITrac trac = TracCommon.GetTrac(_server);

            IAsyncResult asr = trac.BeginGetAPIVersion();

            while (asr.IsCompleted == false)
            {
                Application.DoEvents();
            }

            try
            {
                object[] ret = trac.EndGetAPIVersion(asr);
                lblStatus.Text = Properties.Resources.LabelCheckingSuccess;
            }
            catch (Exception ex)
            {
                lblStatus.Text = Properties.Resources.LabelCheckingFailure;
                lblError.Text  = ex.Message;
            }

            wizard1.BackEnabled = wizard1.CancelEnabled = true;
            wizard1.NextEnabled = (lblError.Text == string.Empty);

            pictureBox1.Visible = false;
            this.Cursor         = Cursors.Default;
        }
Пример #4
0
        private void bgwTickets_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                ITrac trac = TracCommon.GetTrac(ServerDetails);

                List <int> tickets = new List <int>();

                try
                {
                    for (int i = 1; i < 1000; i++)///TODO: replace 1000 by number of tickets/100
                    {
                        tickets.AddRange(trac.queryTickets(string.Format("{0}&page={1}", TicketDefinition.Filter, i)));
                    }
                }
                catch (XmlRpcFaultException)
                {
                    //There are no more pages left to fetch
                }

                List <MulticallItem> ticketItems = new List <MulticallItem>();

                foreach (int id in tickets)
                {
                    ticketItems.Add(new MulticallItem("ticket.get", new string[] { id.ToString() }));
                }

                object[] results = trac.multicall(ticketItems.ToArray());

                // convert
                SortableBindingList <Ticket> ticketArr = new SortableBindingList <Ticket>();

                foreach (object[] result in results)
                {
                    object[]     items      = result[0] as object[];
                    XmlRpcStruct attributes = items[3] as XmlRpcStruct;

                    Ticket t = new Ticket();

                    t.Id           = int.Parse(items[0].ToString());
                    t.Created      = ParseDate(items[1]);
                    t.LastModified = ParseDate(items[2]);

                    t.Status      = (string)attributes["status"];
                    t.Description = (string)attributes["description"];
                    t.Reporter    = (string)attributes["reporter"];
                    t.CC          = (string)attributes["cc"];
                    t.Resolution  = (string)attributes["resolution"];
                    t.Component   = (string)attributes["component"];
                    t.Summary     = (string)attributes["summary"];
                    t.Priority    = (string)attributes["priority"];
                    t.Keywords    = (string)attributes["keywords"];
                    t.Version     = (string)attributes["version"];
                    t.Milestone   = (string)attributes["milestone"];
                    t.Owner       = (string)attributes["owner"];
                    t.TicketType  = (string)attributes["type"];
                    t.Severity    = (string)attributes["severity"];

                    t.Icon = string.IsNullOrEmpty(t.Resolution) ? Resources.newticket : Resources.closedticket;

                    ticketArr.Add(t);
                }

                e.Result = ticketArr;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }