private void ChangeVFO(string vfo) { var command = ""; DJControllerControl note = DJControllerControl.None; DJControllerControl[] switchOff = null; // Reset split state _isSplitActive = false; switch (vfo) { case "A": command = "FR0;"; _vfo = VFO.A; note = DJControllerControl.LeftSync; switchOff = new[] { DJControllerControl.LeftCue, DJControllerControl.LeftPad4 }; _activeCommands.Remove(DJControllerControl.LeftPad4); break; case "B": command = "FR1;"; _vfo = VFO.B; note = DJControllerControl.LeftCue; switchOff = new[] { DJControllerControl.LeftSync, DJControllerControl.LeftPad4 }; _activeCommands.Remove(DJControllerControl.LeftPad4); break; } SendToRadio(note, command, switchOff); }
/// <summary> /// Crea fitxers .dic i .aff a partir dels fitxers d'entrades. /// </summary> private void Genera(VFO vfo) { List<string> log = new List<string>(); Thread thread = new Thread(new ParameterizedThreadStart(vfo)); thread.Start(log); string linia; while (!thread.Join(100)) { while ((linia = LlegeixLiniaLog(log)) != null) logGenera.AppendText(linia); Application.DoEvents(); } while ((linia = LlegeixLiniaLog(log)) != null) logGenera.AppendText(linia); }
private void HandleNote(ChannelMessageEventArgs e) { var note = e.Message.Data1; var control = e.Message.Data2; var key = (DJControllerControl)note; switch (key) { // ON/OFF case DJControllerControl.Rec: if (control == 127) { if (_isRadioOn) { // RIT Off SendToRadio("RT0;"); SendToRadio("PS0;"); ControlLights(false); _isRadioOn = false; AppManager.Instance.PushToLog("Communication disabled", AppManager.LogType.Info); } else { SendToRadio(DJControllerControl.Rec, "PS1;"); StartCoroutine(WakeUpRadio()); } } break; // VFO A case DJControllerControl.LeftSync: ChangeVFO("A"); break; // VFO B case DJControllerControl.LeftCue: ChangeVFO("B"); break; // A = B case DJControllerControl.LeftPausePlay: SendToRadio(DJControllerControl.LeftPausePlay, "VV;", control); break; // AT Tune case DJControllerControl.LeftPad1: SendToRadio(DJControllerControl.LeftPad1, "AC111;", control); break; // A/B case DJControllerControl.LeftPad2: if (control == 127) { if (_vfo == VFO.A) { if (_isSplitActive) { SendToRadio(DJControllerControl.LeftPad2, "FR1;FT0;", control, true); _activeCommands[DJControllerControl.LeftPad4] = "FT0;"; } else { SendToRadio(DJControllerControl.LeftPad2, "FR1;FT1;", control, true); _activeCommands[DJControllerControl.LeftPad4] = "FT1;"; } _vfo = VFO.B; WriteOut(new[] { DJControllerControl.LeftCue }); WriteOut(new[] { DJControllerControl.LeftSync }, false); } else { if (_isSplitActive) { SendToRadio(DJControllerControl.LeftPad2, "FR0;FT1;", control, true); _activeCommands[DJControllerControl.LeftPad4] = "FT1;"; } else { SendToRadio(DJControllerControl.LeftPad2, "FR0;FT0;", control, true); _activeCommands[DJControllerControl.LeftPad4] = "FT0;"; } _vfo = VFO.A; WriteOut(new[] { DJControllerControl.LeftSync }); WriteOut(new[] { DJControllerControl.LeftCue }, false); } } break; // SEND case DJControllerControl.LeftPad3: SendToRadio(DJControllerControl.LeftPad3, "TX0;", "RX;", control); break; // SPLIT case DJControllerControl.LeftPad4: SetSplit(control); break; // LSB case DJControllerControl.RightPad1: ChangeRadioMode("LSB"); break; // USB case DJControllerControl.RightPad2: ChangeRadioMode("USB"); break; // CW case DJControllerControl.RightPad3: ChangeRadioMode("CW"); break; // FSK case DJControllerControl.RightPad4: ChangeRadioMode("FSK"); break; // RIT ON case DJControllerControl.RightSync: SendToRadio(DJControllerControl.RightSync, "RT1;", new[] { DJControllerControl.RightCue }); break; // RIT OFF case DJControllerControl.RightCue: SendToRadio(DJControllerControl.RightCue, "RT0;", new[] { DJControllerControl.RightSync }); break; // RIT CLEAR case DJControllerControl.RightPausePlay: SendToRadio(DJControllerControl.RightPausePlay, "RC;", control); break; } }