OSDN Git Service

Initial contents of nt2chview
[nt2chview/stable.git] / NT2chCtrl45 / NTResViewPanel_misc.cs
1 using NT2chObject;\r
2 using System;\r
3 using System.Collections.Generic;\r
4 using System.Text;\r
5 using System.Windows.Controls;\r
6 using System.Windows.Documents;\r
7 \r
8 namespace NT2chCtrl\r
9 {\r
10     partial class NTResViewPanel\r
11     {\r
12         private void setTitle(IThread ithread)\r
13         {\r
14             StackPanel sp = new StackPanel();\r
15             sp.Orientation = Orientation.Horizontal;\r
16             string title = ithread.getTitle();\r
17             sp.Children.Add(new TextBlock(new Run(title+" ")));\r
18             IBoard iboard = ithread.getBoard();\r
19             string boardName;\r
20             if (iboard != null)\r
21             {\r
22                 boardName = iboard.getName();\r
23                 if (boardName != null && boardName.Length > 0)\r
24                 {\r
25                     Hyperlink hl = new Hyperlink(new Run("(" + boardName + ")"));\r
26                     sp.Children.Add(new TextBlock(hl));\r
27                     hl.Tag = iboard;\r
28                     hl.Click += hl_Click;\r
29                 }\r
30             }\r
31             mLabelThreadTitle.Content = sp;\r
32         }\r
33 \r
34         void hl_Click(object sender, System.Windows.RoutedEventArgs e)\r
35         {\r
36             Hyperlink hl = sender as Hyperlink;\r
37             if (hl == null)\r
38                 return;\r
39 \r
40             IBoard iboard = hl.Tag as IBoard;\r
41             if (iboard == null)\r
42                 return;\r
43 \r
44             mCommand.TryToOpenBoard(iboard);\r
45             \r
46         }\r
47 \r
48     }\r
49 }\r