Subversion Repositories group.NITPanels

Rev

Rev 3 | Rev 19 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 pfowler 1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9
using System.Windows.Forms;
10
 
11
namespace NITNavComm {
12
    public partial class NITAudioSelForm : Form {
13
 
14
        private NITAudioSelDevice device = null;
15
 
16
        public NITAudioSelForm() {
17
            InitializeComponent();
18
 
19
            this.controlStatus(false);
16 pfowler 20
            this.lstAudioDevices.Items.Clear();
3 pfowler 21
        }
22
 
23
        private void controlStatus(bool status) {
24
            cmdUpdate.Enabled = status;
25
            inputTimer.Enabled = status;
26
        }
27
 
28
        public void UpdateDevice() {
29
            this.UpdateInput();
30
            this.UpdateDisplay();
31
        }
32
 
33
        public void UpdateDisplay() {
34
 
35
        }
36
 
37
        public void UpdateInput() {
38
            device.updateInput();
39
            button0.Checked = device.isButtonSet(0);
40
            button1.Checked = device.isButtonSet(1);
41
            button2.Checked = device.isButtonSet(2);
42
            button3.Checked = device.isButtonSet(3);
43
            button4.Checked = device.isButtonSet(4);
44
            button5.Checked = device.isButtonSet(5);
45
            button6.Checked = device.isButtonSet(6);
46
            button7.Checked = device.isButtonSet(7);
47
 
48
            this.led0.On = device.isLedSet(0);
49
            this.led1.On = device.isLedSet(1);
50
            this.led2.On = device.isLedSet(2);
51
            this.led3.On = device.isLedSet(3);
52
            this.led4.On = device.isLedSet(4);
53
            this.led5.On = device.isLedSet(5);
54
            this.led6.On = device.isLedSet(6);
55
            this.led7.On = device.isLedSet(7);
56
        }
57
 
16 pfowler 58
        private void cmdUpdate_Click(object sender, EventArgs e) {
59
            //VolumeControl vc = new VolumeControl();
60
            //txtVol.Text = Convert.ToString(device.volcontrol.deviceCount);
61
            device.volcontrol.setDeviceVolume(1, 0.80F);
62
            txtName.Text = Convert.ToString(device.volcontrol.getDeviceVolume(1));
63
 
64
        }
65
 
3 pfowler 66
        public void setDevice(NITAudioSelDevice audiosel) {
67
            this.device = audiosel;
68
 
16 pfowler 69
            foreach (string audio in device.volcontrol.devices) {
70
                lstAudioDevices.Items.Add(audio);
71
            }
72
 
3 pfowler 73
            if (!this.device.isOpen())
74
                this.device.Open();
75
 
76
            if (this.device.isOpen())
77
                this.controlStatus(true);
78
        }
79
 
80
        private void inputTimer_Tick(object sender, EventArgs e) {
81
            this.UpdateInput();
82
        }
83
 
84
        private void cmdClose_Click(object sender, EventArgs e) {
85
            if (this.device != null && device.isOpen()) {
86
                device.ClearDisplay();
87
            }
88
            this.Close();
89
        }
90
 
91
        private void led0_Click(object sender, EventArgs e) {
92
            bool status = this.device.isLedSet(0);
93
            this.device.setLed(0, !status);
94
            this.device.UpdateDisplay();
95
        }
96
 
97
        private void led1_Click(object sender, EventArgs e) {
98
            bool status = this.device.isLedSet(1);
99
            this.device.setLed(1, !status);
100
            this.device.UpdateDisplay();
101
        }
102
 
103
        private void led2_Click(object sender, EventArgs e) {
104
            bool status = this.device.isLedSet(2);
105
            this.device.setLed(2, !status);
106
            this.device.UpdateDisplay();
107
        }
108
 
109
        private void led3_Click(object sender, EventArgs e) {
110
            bool status = this.device.isLedSet(3);
111
            this.device.setLed(3, !status);
112
            this.device.UpdateDisplay();
113
        }
114
 
115
        private void led4_Click(object sender, EventArgs e) {
116
            bool status = this.device.isLedSet(4);
117
            this.device.setLed(4, !status);
118
            this.device.UpdateDisplay();
119
        }
120
 
121
        private void led5_Click(object sender, EventArgs e) {
122
            bool status = this.device.isLedSet(5);
123
            this.device.setLed(5, !status);
124
            this.device.UpdateDisplay();
125
        }
126
 
127
        private void led6_Click(object sender, EventArgs e) {
128
            bool status = this.device.isLedSet(6);
129
            this.device.setLed(6, !status);
130
            this.device.UpdateDisplay();
131
        }
132
 
133
        private void led7_Click(object sender, EventArgs e) {
134
            bool status = this.device.isLedSet(7);
135
            this.device.setLed(7, !status);
136
            this.device.UpdateDisplay();
137
        }
138
    }
139
}