void muteValue_OnValueChanged(MuteValue sender, object origin) { ((Activity)this.Context).RunOnUiThread (() => { Checked = sender.GetValue() == 0x7F; Invalidate (); }); }
void initAllMixerValues(List<string> initValues) { // all mute values are off by default foreach (Qu16_Channels channel in Enum.GetValues(typeof(Qu16_Channels))) { MuteValue muteValue = new MuteValue (channel, 0); Mute_values [channel] = muteValue; muteValue.MuteValueChanged += OnMuteValueChanged; foreach (Qu16_Buses mix in Enum.GetValues(typeof(Qu16_Buses))) { Qu16_Commands command = Qu16_Commands.Chn_PAFL_Sw; MixerValue mixValue = new MixerValue (channel, command, (byte) mix); mixValue.MixerValueChanged += OnMixerValueChanged; if (!Channel_values.ContainsKey (channel)) Channel_values [channel] = new Dictionary<Qu16_Commands, Dictionary<byte, MixerValue>> (); if (!Channel_values [channel].ContainsKey (command)) Channel_values [channel] [command] = new Dictionary<byte, MixerValue> (); Channel_values [channel] [command] [(byte) mix] = mixValue; } } // we get all mix values from a text file (Asset qu16_init.txt in Android helper) // these values are the default mix settings when doing a "Reset Mix Settings" on the Qu-16 // this is the "initial scene" for this app, when in demo mode string[] sep = { "," }; foreach (string line in initValues) { string[] parts = line.Split(sep, StringSplitOptions.None); Qu16_Channels channel = (Qu16_Channels) (Enum.Parse(typeof(Qu16_Channels), parts[0])); Qu16_Commands command = (Qu16_Commands) (Enum.Parse(typeof(Qu16_Commands), parts[1])); byte mix = byte.Parse(parts[2]); byte value = byte.Parse(parts[3]); if (!Channel_values.ContainsKey (channel)) Channel_values [channel] = new Dictionary<Qu16_Commands, Dictionary<byte, MixerValue>> (); if (!Channel_values [channel].ContainsKey (command)) Channel_values [channel] [command] = new Dictionary<byte, MixerValue> (); MixerValue mixValue = new MixerValue(channel, command, mix, value); Channel_values[channel][command][mix] = mixValue; mixValue.MixerValueChanged += OnMixerValueChanged; } }