Subversion Repositories group.NITPanels

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7 pfowler 1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
 
7
using System.Windows.Forms;
8
 
9
namespace NITNavComm {
10
    public static class NITPanelsForms {
11
        public static int ReAssignDevice(NITDevice device) {
12
            Form form = new Form();
13
            form.Width = 280;
14
            form.Height = 160;
15
            form.AutoSize = false;
16
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
17
            form.StartPosition = FormStartPosition.CenterParent;
18
            form.MaximizeBox = false;
19
            form.MinimizeBox = false;            
20
 
21
            form.Text = "Re-Assign Device";
22
            string text = "Set new assignment for " + device.type + "-" + device.id;
23
            Label label1 = new Label() { Left = 16, Top = 20, Width = 260, Text = text };
24
 
25
            ComboBox assign = new ComboBox() { Left = 16, Top = 45, Width = 40, TabIndex = 0, TabStop = true };
26
            assign.Items.Add("1");
27
            assign.Items.Add("2");
28
            assign.SelectedIndex = assign.FindString(device.assigned.ToString());
29
            assign.DropDownStyle = ComboBoxStyle.DropDownList;
30
 
31
            Button cmdOk = new Button() { Text = "Ok", Left = 16, Width = 60, Top = 80, TabIndex = 1, TabStop = true };
32
            cmdOk.Click += (sender, e) => { form.Close(); };
33
            form.Controls.Add(label1);
34
            form.Controls.Add(assign);
35
            form.Controls.Add(cmdOk);
36
            form.AcceptButton = cmdOk;
37
            form.ShowDialog();
38
            return int.Parse(assign.SelectedItem.ToString());
39
        }
40
    }
41
}