OSDN Git Service

Add support for 'Use system locale for date/time'.
[tortoisegit/TortoiseGitJp.git] / contrib / issue-tracker-plugins / ExampleCsPlugin / MyIssuesForm.cs
1 using System;\r
2 using System.Collections;\r
3 using System.Collections.Generic;\r
4 using System.ComponentModel;\r
5 using System.Data;\r
6 using System.Drawing;\r
7 using System.Linq;\r
8 using System.Text;\r
9 using System.Windows.Forms;\r
10 using System.Xml;\r
11 \r
12 namespace ExampleCsPlugin\r
13 {\r
14     partial class MyIssuesForm : Form\r
15     {\r
16         private readonly IEnumerable<TicketItem> _tickets;\r
17         private readonly List<TicketItem> _ticketsAffected = new List<TicketItem>();\r
18 \r
19         public MyIssuesForm(IEnumerable<TicketItem> tickets)\r
20         {\r
21             InitializeComponent();\r
22             _tickets = tickets;\r
23         }\r
24 \r
25         public IEnumerable<TicketItem> TicketsFixed\r
26         {\r
27             get { return _ticketsAffected; }\r
28         }\r
29 \r
30         private void MyIssuesForm_Load(object sender, EventArgs e)\r
31         {\r
32             listView1.Columns.Add("");\r
33             listView1.Columns.Add("#");\r
34             listView1.Columns.Add("Summary");\r
35 \r
36             foreach(TicketItem ticketItem in _tickets)\r
37             {\r
38                 ListViewItem lvi = new ListViewItem();\r
39                 lvi.Text = "";\r
40                 lvi.SubItems.Add(ticketItem.Number.ToString());\r
41                 lvi.SubItems.Add(ticketItem.Summary);\r
42                 lvi.Tag = ticketItem;\r
43 \r
44                 listView1.Items.Add(lvi);\r
45             }\r
46 \r
47             listView1.Columns[0].Width = -1;\r
48             listView1.Columns[1].Width = -1;\r
49             listView1.Columns[2].Width = -1;\r
50         }\r
51 \r
52         private void okButton_Click(object sender, EventArgs e)\r
53         {\r
54             foreach (ListViewItem lvi in listView1.Items)\r
55             {\r
56                 TicketItem ticketItem = lvi.Tag as TicketItem;\r
57                 if (ticketItem != null && lvi.Checked)\r
58                     _ticketsAffected.Add(ticketItem);\r
59             }\r
60         }\r
61     }\r
62 }\r