Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.GTK
comparison Widgets/ValidationFailureWidget.cs @ 142:f23e5b40ca9d
Re #344: Show unit requirement failures
* Add new widget for displaying failures nicely
* Use widget for displaying failures in main window
* Use widget for displaying failures in new unit dialog
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 18 Oct 2011 21:03:35 +0100 |
parents | |
children | 929ef50c3919 |
comparison
equal
deleted
inserted
replaced
141:1ce4fe9ae3c1 | 142:f23e5b40ca9d |
---|---|
1 // This file (ValidationFailureWidget.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2011 IBBoard | |
2 // | |
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. | |
4 using System; | |
5 using System.Collections.Generic; | |
6 using System.Text; | |
7 | |
8 namespace IBBoard.WarFoundry.GUI.GTK | |
9 { | |
10 [System.ComponentModel.ToolboxItem(true)] | |
11 public partial class ValidationFailureWidget : Gtk.Bin | |
12 { | |
13 public ValidationFailureWidget() | |
14 { | |
15 this.Build(); | |
16 } | |
17 | |
18 public ValidationFailureWidget(ICollection<string> messages) : this() | |
19 { | |
20 SetMessages(messages); | |
21 } | |
22 | |
23 public void SetMessages(ICollection<string> messages) | |
24 { | |
25 StringBuilder sb = new StringBuilder(); | |
26 | |
27 foreach (string msg in messages) | |
28 { | |
29 sb.AppendLine("• " + msg); | |
30 } | |
31 | |
32 validationMessages.Text = sb.ToString(); | |
33 } | |
34 } | |
35 } | |
36 |