Subversion Repositories group.electronics

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
156 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 audiosel = null;
15
 
16
        public NITAudioSelForm() {
17
            InitializeComponent();
18
 
19
            this.controlStatus(false);
20
        }
21
 
22
        private void controlStatus(bool status) {
23
            cmdUpdate.Enabled = status;
24
            inputTimer.Enabled = status;
25
        }
26
 
27
        public void UpdateDevice() {
28
            this.UpdateInput();
29
            this.UpdateDisplay();
30
        }
31
 
32
        public void UpdateDisplay() {
33
 
34
        }
35
 
36
        public void UpdateInput() {
37
            audiosel.updateInput();
38
            button0.Checked = audiosel.isButtonSet(0);
39
            button1.Checked = audiosel.isButtonSet(1);
40
            button2.Checked = audiosel.isButtonSet(2);
41
            button3.Checked = audiosel.isButtonSet(3);
42
            button4.Checked = audiosel.isButtonSet(4);
43
            button5.Checked = audiosel.isButtonSet(5);
44
            button6.Checked = audiosel.isButtonSet(6);
45
            button7.Checked = audiosel.isButtonSet(7);
46
 
47
            this.led0.On = audiosel.isLedSet(0);
48
            this.led1.On = audiosel.isLedSet(1);
49
            this.led2.On = audiosel.isLedSet(2);
50
            this.led3.On = audiosel.isLedSet(3);
51
            this.led4.On = audiosel.isLedSet(4);
52
            this.led5.On = audiosel.isLedSet(5);
53
            this.led6.On = audiosel.isLedSet(6);
54
            this.led7.On = audiosel.isLedSet(7);
55
        }
56
 
57
        public void setDevice(NITAudioSelDevice audiosel) {
58
            this.audiosel = audiosel;
59
 
60
            if (!audiosel.isOpen())
61
                audiosel.Open();
62
 
63
            if (audiosel.isOpen())
64
                this.controlStatus(true);
65
        }
66
 
67
        private void inputTimer_Tick(object sender, EventArgs e) {
68
            this.UpdateInput();
69
        }
70
 
71
        private void cmdClose_Click(object sender, EventArgs e) {
72
            this.Close();
73
        }
74
 
75
        private void led0_Click(object sender, EventArgs e) {
76
            bool status = this.audiosel.isLedSet(0);
77
            this.audiosel.setLed(0, !status);
78
            this.audiosel.UpdateDisplay();
79
        }
80
 
81
        private void led1_Click(object sender, EventArgs e) {
82
            bool status = this.audiosel.isLedSet(1);
83
            this.audiosel.setLed(1, !status);
84
            this.audiosel.UpdateDisplay();
85
        }
86
 
87
        private void led2_Click(object sender, EventArgs e) {
88
            bool status = this.audiosel.isLedSet(2);
89
            this.audiosel.setLed(2, !status);
90
            this.audiosel.UpdateDisplay();
91
        }
92
 
93
        private void led3_Click(object sender, EventArgs e) {
94
            bool status = this.audiosel.isLedSet(3);
95
            this.audiosel.setLed(3, !status);
96
            this.audiosel.UpdateDisplay();
97
        }
98
 
99
        private void led4_Click(object sender, EventArgs e) {
100
            bool status = this.audiosel.isLedSet(4);
101
            this.audiosel.setLed(4, !status);
102
            this.audiosel.UpdateDisplay();
103
        }
104
 
105
        private void led5_Click(object sender, EventArgs e) {
106
            bool status = this.audiosel.isLedSet(5);
107
            this.audiosel.setLed(5, !status);
108
            this.audiosel.UpdateDisplay();
109
        }
110
 
111
        private void led6_Click(object sender, EventArgs e) {
112
            bool status = this.audiosel.isLedSet(6);
113
            this.audiosel.setLed(6, !status);
114
            this.audiosel.UpdateDisplay();
115
        }
116
 
117
        private void led7_Click(object sender, EventArgs e) {
118
            bool status = this.audiosel.isLedSet(7);
119
            this.audiosel.setLed(7, !status);
120
            this.audiosel.UpdateDisplay();
121
        }
122
 
123
    }
124
}