protected internal override IEnumerator RespondToCommandInternal(string inputCommand) { if (!inputCommand.Trim().RegexMatch(out Match match, "^(?:tx|trans(?:mit)?|submit|xmit) (?:3.)?(5[0-9][25]|600)( ?mhz)?$") || !int.TryParse(match.Groups[1].Value, out int targetFrequency) || !Frequencies.Contains(targetFrequency)) { yield break; } int initialFrequency = CurrentFrequency; MonoBehaviour buttonToShift = targetFrequency < initialFrequency ? _downButton : _upButton; while (CurrentFrequency != targetFrequency && (CurrentFrequency == initialFrequency || Math.Sign(CurrentFrequency - initialFrequency) != Math.Sign(CurrentFrequency - targetFrequency))) { yield return("change frequency"); yield return("trycancel"); yield return(DoInteractionClick(buttonToShift)); } if (CurrentFrequency == targetFrequency) { yield return("transmit"); yield return(DoInteractionClick(_transmitButton)); } }
private void SubscribeFrequencyMessages() { MessagingCenter.Unsubscribe <OrdonnanceFrequence2ViewModel, Frequency>(this, Events.UpdateFrequencies); MessagingCenter.Subscribe <OrdonnanceFrequence2ViewModel, Frequency>(this, Events.UpdateFrequencies, async(sender, args) => { if (args != null) { var frequency = args as Frequency; if (Ordonnance.Frequencies != null) { if (Ordonnance.Frequencies.Contains(frequency)) { } else { Ordonnance.Frequencies.Add(frequency); } } if (Frequencies.Contains(frequency)) { } else { Frequencies.Add(frequency); await ToastService.Show("Fréquence ajoutée avec succès"); MessagingCenter.Send(this, Events.UpdateFrequenciesViewCellHeight, Frequencies); } } }); }
protected override IEnumerator RespondToCommandInternal(string inputCommand) { string[] commandParts = inputCommand.Split(' '); if (commandParts.Length != 2) { yield break; } if (!commandParts[0].Equals("transmit", StringComparison.InvariantCultureIgnoreCase) && !commandParts[0].Equals("trans", StringComparison.InvariantCultureIgnoreCase) && !commandParts[0].Equals("xmit", StringComparison.InvariantCultureIgnoreCase) && !commandParts[0].Equals("tx", StringComparison.InvariantCultureIgnoreCase)) { yield break; } int targetFrequency = 0; if (!int.TryParse(commandParts[1].Substring(commandParts[1].Length - 3), out targetFrequency)) { yield break; } if (!Frequencies.Contains(targetFrequency)) { yield break; } int initialFrequency = CurrentFrequency; MonoBehaviour buttonToShift = targetFrequency < initialFrequency ? _downButton : _upButton; while (CurrentFrequency != targetFrequency && (CurrentFrequency == initialFrequency || Mathf.Sign(CurrentFrequency - initialFrequency) != Mathf.Sign(CurrentFrequency - targetFrequency))) { yield return("change frequency"); if (Canceller.ShouldCancel) { Canceller.ResetCancel(); yield break; } DoInteractionStart(buttonToShift); yield return(new WaitForSeconds(0.1f)); DoInteractionEnd(buttonToShift); } if (CurrentFrequency == targetFrequency) { yield return("transmit"); DoInteractionStart(_transmitButton); yield return(new WaitForSeconds(0.1f)); DoInteractionEnd(_transmitButton); } }
internal async Task <bool> Create(MainViewModel vm, IList frqs, IList deps, IList pols, IList stats) { VectorDic = new Dictionary <int, BDataVector>(); Vectors = new List <BDataVector>(); await Task.Run(() => { //Create a vector foreach (string p in pols) { int pKey = p.ToPolKey(); if (!POLs.Contains(p)) { POLs.Add(p); } // BDataObject child = new BDataObject(p); foreach (double d in deps) { if (!Depressions.Contains(d)) { Depressions.Add(d); } foreach (double f in frqs) { if (!Frequencies.Contains(f)) { Frequencies.Add(f); } vm.VectorCurrent++; BDataVector vector = new BDataVector(d, f, p, pKey); vector.Create360DegData(vm, stats); vector.FinalizePOLKey(pKey); VectorDic.Add(vector.KeyFreqDepPol, vector); Vectors.Add(vector); } } } }); return(true); }
protected override IEnumerator RespondToCommandInternal(string inputCommand) { string[] commandParts = inputCommand.ToLowerInvariant().Split(' '); if (commandParts.Length != 2) { yield break; } if (!commandParts[0].EqualsAny("transmit", "trans", "xmit", "tx", "submit")) { yield break; } if (!int.TryParse(commandParts[1].Substring(commandParts[1].Length - 3), out int targetFrequency)) { yield break; } if (!Frequencies.Contains(targetFrequency)) { yield break; } int initialFrequency = CurrentFrequency; MonoBehaviour buttonToShift = targetFrequency < initialFrequency ? _downButton : _upButton; while (CurrentFrequency != targetFrequency && (CurrentFrequency == initialFrequency || Mathf.Sign(CurrentFrequency - initialFrequency) != Mathf.Sign(CurrentFrequency - targetFrequency))) { yield return("change frequency"); if (Canceller.ShouldCancel) { Canceller.ResetCancel(); yield break; } yield return(DoInteractionClick(buttonToShift)); } if (CurrentFrequency == targetFrequency) { yield return("transmit"); yield return(DoInteractionClick(_transmitButton)); } }