OSDN Git Service

8e395d3a5a272e8392b014779c39a1bb5102fa81
[kancollesniffer/KancolleSniffer.git] / KancolleSniffer / ErrorDialog.cs
1 // Copyright (C) 2015 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
2 //\r
3 // This program is part of KancolleSniffer.\r
4 //\r
5 // KancolleSniffer is free software: you can redistribute it and/or modify\r
6 // it under the terms of the GNU General Public License as published by\r
7 // the Free Software Foundation, either version 3 of the License, or\r
8 // (at your option) any later version.\r
9 //\r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 //\r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, see <http://www.gnu.org/licenses/>.\r
17 \r
18 using System.Drawing;\r
19 using System.Windows.Forms;\r
20 \r
21 namespace KancolleSniffer\r
22 {\r
23     public partial class ErrorDialog : Form\r
24     {\r
25         public ErrorDialog()\r
26         {\r
27             InitializeComponent();\r
28 \r
29             var icon = new Icon(SystemIcons.Error, 32, 32);\r
30             labelSystemIcon.Image = icon.ToBitmap();\r
31         }\r
32 \r
33         public DialogResult ShowDialog(IWin32Window owner, string message, string details)\r
34         {\r
35             if (Visible)\r
36                 return DialogResult.Ignore;\r
37             labelMessage.Text = message;\r
38             textBoxDetails.Text = details.Length < 1500 ? details : details.Substring(0, 1500) + "...";\r
39             return ShowDialog(owner);\r
40         }\r
41     }\r
42 }