1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Data;
|
---|
5 | using System.Drawing;
|
---|
6 | using System.Text;
|
---|
7 | using System.Windows.Forms;
|
---|
8 | using IndianHealthService.BMXNet.Model;
|
---|
9 | using IndianHealthService.BMXNet.WinForm.Model;
|
---|
10 |
|
---|
11 | namespace IndianHealthService.BMXNet.Forms
|
---|
12 | {
|
---|
13 | internal partial class ChangeDivisionDialog : Form
|
---|
14 | {
|
---|
15 | public ChangeDivisionDialog()
|
---|
16 | {
|
---|
17 | InitializeComponent();
|
---|
18 | }
|
---|
19 |
|
---|
20 | private void cancelButton_Click(object sender, EventArgs e)
|
---|
21 | {
|
---|
22 |
|
---|
23 | }
|
---|
24 |
|
---|
25 | private void okButton_Click(object sender, EventArgs e)
|
---|
26 | {
|
---|
27 | this.DialogResult = DialogResult.OK;
|
---|
28 | this.Close();
|
---|
29 | }
|
---|
30 |
|
---|
31 | private List<SelectableDivision> _divisions = new List<SelectableDivision>();
|
---|
32 |
|
---|
33 | public List<SelectableDivision> Divisions
|
---|
34 | {
|
---|
35 | get { return _divisions; }
|
---|
36 | set { _divisions = value; }
|
---|
37 | }
|
---|
38 |
|
---|
39 | private void ChangeDivisionDialog_Load(object sender, EventArgs e)
|
---|
40 | {
|
---|
41 | this.Icon = this.Owner.Icon;
|
---|
42 |
|
---|
43 | this.divisionList.BeginUpdate();
|
---|
44 | this.divisionList.DataSource=this.Divisions;
|
---|
45 | foreach (WinDivision each in this.Divisions) {
|
---|
46 | if (each.MostRecentLookup)
|
---|
47 | {
|
---|
48 | this.divisionList.SelectedItem = each;
|
---|
49 | }
|
---|
50 | }
|
---|
51 | this.divisionList.EndUpdate();
|
---|
52 |
|
---|
53 | this.divisionList.Focus();
|
---|
54 | this.UpdateCues();
|
---|
55 | }
|
---|
56 |
|
---|
57 | private void divisionList_SelectedIndexChanged(object sender, EventArgs e)
|
---|
58 | {
|
---|
59 | this.UpdateCues();
|
---|
60 | }
|
---|
61 |
|
---|
62 | public void UpdateCues()
|
---|
63 | {
|
---|
64 | this.okButton.Enabled = this.SelectedDivision!= null;
|
---|
65 | }
|
---|
66 |
|
---|
67 | public Division SelectedDivision
|
---|
68 | {
|
---|
69 | get { return (Division)this.divisionList.SelectedItem; }
|
---|
70 | }
|
---|
71 |
|
---|
72 | private void divisionList_DoubleClick(object sender, EventArgs e)
|
---|
73 | {
|
---|
74 | if (this.okButton.Enabled)
|
---|
75 | {
|
---|
76 | this.DialogResult = DialogResult.OK;
|
---|
77 | this.Close();
|
---|
78 | }
|
---|
79 | }
|
---|
80 |
|
---|
81 | }
|
---|
82 | }
|
---|