main
1using System;
2using ComponentFactory.Krypton.Toolkit;
3using MoMoney.Presentation.Winforms.Helpers;
4
5namespace MoMoney.Presentation.Winforms.Krypton
6{
7 public class KryptonTextControl<T> : ITextControl<T>
8 {
9 readonly KryptonTextBox textbox;
10 T bound_item;
11
12 public KryptonTextControl(KryptonTextBox textbox)
13 {
14 this.textbox = textbox;
15 when_text_is_changed = () => { };
16 textbox.TextChanged += (sender, args) => when_text_is_changed();
17 }
18
19 public void set_selected_item(T item)
20 {
21 textbox.Text = item.ToString();
22 bound_item = item;
23 }
24
25 public T get_selected_item()
26 {
27 return bound_item;
28 }
29
30 public string text()
31 {
32 return textbox.Text;
33 }
34
35 public Action when_text_is_changed { get; set; }
36 }
37}