Exemple #1
0
        private void OnActionSelected(object sender, EventArgs e)
        {
            //Event handler for change in selected action
            try {
                this.txtAction.Text = "";
                this.lsvAttachments.Items.Clear();
                if (this.lsvActions.SelectedItems.Count > 0)
                {
                    //Action
                    long actionID = Convert.ToInt64(this.lsvActions.SelectedItems[0].Name);

                    //Show the attachments
                    Attachment[] attachments = CustomerProxy.GetAttachments(this.mIssue.ID, actionID);
                    this.lsvAttachments.Items.Clear();
                    for (int i = 0; i < attachments.Length; i++)
                    {
                        this.lsvAttachments.Items.Add(attachments[i].ID.ToString(), attachments[i].Filename, -1);
                    }
                    this.lsvAttachments.View = View.List;

                    //Show the selected action
                    Action[] actions = this.mActions;
                    int      start   = 0;
                    bool     go      = false;
                    for (int i = 0; i < actions.Length; i++)
                    {
                        Action action = actions[i];
                        if (!go && action.ID == actionID)
                        {
                            go = true;
                        }
                        if (go)
                        {
                            string header = action.Created.ToString("f") + "     " + action.UserID + ", " + action.TypeName;
                            this.txtAction.AppendText(header);
                            this.txtAction.Select(start, header.Length);
                            this.txtAction.SelectionFont = new Font(this.txtAction.Font, FontStyle.Bold);
                            this.txtAction.AppendText("\r\n\r\n");
                            this.txtAction.AppendText(action.Comment);
                            this.txtAction.AppendText("\r\n");
                            this.txtAction.AppendText("".PadRight(75, '-'));
                            this.txtAction.AppendText("\r\n");
                            start = this.txtAction.Text.Length;
                        }
                    }
                }
            }
            catch (Exception ex) { reportError(new ControlException("Unexpected error on change of selected issue action in the IssueInspector control.", ex)); }
            finally { setUserServices(); };
        }