public virtual void HandleRadio(GumpRadio entry, bool state) { if (RadioHandler != null) { RadioHandler(entry, state); } else if (Radios[entry] != null) { Radios[entry](entry, state); } }
private void SetQuestions() { labelQuestion.Text = Mate.Question; var options = new Queue <string>(Mate.Option); Radios.ToList().ForEach(radio => radio.Text = options.Dequeue()); }
protected virtual void Clear() { NextButtonID = 1; NextSwitchID = 0; NextTextInputID = 0; Buttons.Clear(); TileButtons.Clear(); Switches.Clear(); Radios.Clear(); TextInputs.Clear(); LimitedTextInputs.Clear(); Entries.Clear(); Entries.TrimExcess(); if (Layout == null) { Layout = new SuperGumpLayout(); } else { Layout.Clear(); } }
/// <summary> /// Cambia la IP del sistema operativo al estádo dinámico /// Si ocurre un error se arroja la excepción /// </summary> internal static bool resetAdapter(NetData netData) { Radios radios = Radios.GetRadios(); foreach (IRadio radio in radios) { if (radio.RadioType.Equals(RadioType.WiFi)) { WiFiRadio wifiRadio = (WiFiRadio)radio; wifiRadio.RadioState = RadioState.Off; wifiRadio.RadioState = RadioState.On; } } INetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (INetworkInterface networkInterface in networkInterfaces) { if (netData.NetworkAdapter.Name.Equals(networkInterface.Name)) { networkInterface.Rebind(); return(true); } } return(false); }
private void Tick(object sender, ElapsedEventArgs e) { if (CoolDownTick > 2) { CoolDownTick = 0; CoolDown = null; } else if (CoolDown != null) { CoolDownTick++; } TickOnNewGames++; if (TickOnNewGames > MaxTickOnNewGames) { TickOnNewGames = 0; MaxTickOnNewGames = Rand.Next(10, 30); lock (GamesToPlay) _DiscordClient.SetGame(GamesToPlay[Rand.Next(0, GamesToPlay.Count() - 1)]); } foreach (Server s in _DiscordClient.Servers) { if (Radios.ContainsKey(s.Id)) { Radios[s.Id].VoiceSocket?.SendHeartbeat(); } } _DiscordClient.Servers.Where(x => !_ServerSettings.ContainsKey(x.Id)).ToList().ForEach(x => _ServerSettings.Add(x.Id, new ServerSettings(x))); //_ServerSettings.Keys.Except(_DiscordClient.Servers.) UpdateConsole(); }
static void Main(string[] args) { Radios radios = Radios.GetRadios(); Debug.WriteLine("\nBefore\r\n--------"); foreach (IRadio radio in radios) { Debug.WriteLine(string.Format("Name: {0}, Type: {1}, State: {2}", radio.DeviceName, radio.RadioType.ToString(), radio.RadioState.ToString())); // toggle all radio states radio.RadioState = (radio.RadioState == RadioState.On) ? RadioState.Off : RadioState.On; } // give the radios enough time to change state - some (like BT) seem to be slow Thread.Sleep(1000); radios.Refresh(); // display again Debug.WriteLine("\r\nAfter\r\n--------"); foreach (IRadio radio in radios) { Debug.WriteLine(string.Format("Name: {0}, Type: {1}, State: {2}", radio.DeviceName, radio.RadioType.ToString(), radio.RadioState.ToString())); } Debug.WriteLine("\r\n\n"); Thread.Sleep(100); }
//---by hp end--- private M_QuestionnaireResultDetail RadioToDetail() { if (Radios == null || !Radios.Any()) { return(null); } var score = 0; var result = string.Empty; for (var i = 0; i < Radios.Length; i++) { if (!Radios[i].Checked) { continue; } result = string.Format("{0},", (char)('A' + i)); score = Convert.ToInt32(Radios[i].Tag ?? 0); break; } return(new M_QuestionnaireResultDetail { QuestionResult = result, QuestionScore = score, QuestionType = Type, QuestionCode = Code, PQuestionWeightScore = score * Weight }); }
public RadioEntity Delete(RadioEntity deletedRadio) { var entity = Radios.Attach(deletedRadio); entity.Context.Entry(deletedRadio).State = EntityState.Deleted; return(deletedRadio); }
/// <summary> /// Saves all radio stations to local storage. /// </summary> private void SaveRadios() { try { Radios = Radios.OrderBy(r => r.Title).ToList(); RadiosJson = JsonHelper.ToJson(Radios); } catch { } }
public Automovil(string modelo, string marca, string placa, int fabricacion, string color, Motors motor, Radios radio) { this.Modelo = modelo; this.Marca = marca; this.Placa = placa; this.AFabri = fabricacion; this.Color = color; this.Motor = motor; this.Radio = radio; }
private void CheckEnabled(string name, bool checkEnabled = true) { if (checkEnabled) { var element = Radios.First(radio => radio.GetAttribute("id") == name.ToLower()); if (!element.Enabled) { throw new ElementDisabledException(this); } } }
public async Task StartScanning() { ScanSubscription?.Dispose(); Radios.Clear(); // ScanSubscription = XamarinApp.Instance.PodProvider.ListRadios() // .ObserveOn(XamarinApp.Instance.UiSyncContext) // .Subscribe((radio) => // { // Radios.Add(radio); // }); }
public void Dispose() { if (IsDisposed) { return; } IsDisposed = true; //Console.WriteLine("SuperGump Disposing: {0} (0x{1:X})", GetType(), Serial); //GC.SuppressFinalize(this); VitaNexCore.TryCatch(OnDispose); VitaNexCore.TryCatch(UnregisterInstance); NextButtonID = 1; NextSwitchID = 0; NextTextInputID = 0; if (InstancePoller != null) { VitaNexCore.TryCatch(InstancePoller.Dispose); InstancePoller = null; } VitaNexCore.TryCatch( () => { Buttons.Clear(); TileButtons.Clear(); Switches.Clear(); Radios.Clear(); TextInputs.Clear(); LimitedTextInputs.Clear(); Entries.Clear(); Entries.TrimExcess(); Layout.Clear(); }); VitaNexCore.TryCatch(() => Linked.AsEnumerable().ForEach(Unlink)); VitaNexCore.TryCatch(() => Children.AsEnumerable().ForEach(RemoveChild)); IsOpen = false; Hidden = false; Parent = null; User = null; VitaNexCore.TryCatch(OnDisposed); }
/// <summary> /// Cambia la IP del sistema operativo al estádo dinámico /// Si ocurre un error se arroja la excepción /// </summary> internal static void turnOffAdapter(NetData netData) { Radios radios = Radios.GetRadios(); foreach (IRadio radio in radios) { if (radio.RadioType.Equals(RadioType.WiFi)) { WiFiRadio wifiRadio = (WiFiRadio)radio; wifiRadio.RadioState = RadioState.Off; } } }
/// <summary> /// Adds radio station. /// </summary> /// <param name="radio"></param> /// <returns></returns> public SocketResponse AddRadio(Radio radio) { try { Radios.Add(radio); SaveRadios(); return(new SocketResponse(SocketResponse.StatusCode.OK)); } catch (Exception ex) { return(new SocketResponse(SocketResponse.StatusCode.EXCEPTION, ex.ToString())); } }
/// <summary> /// Deletes radio station. /// </summary> /// <param name="id"></param> /// <returns></returns> public SocketResponse DeleteRadio(string id) { try { Radio radio = GetRadio(id); Radios.Remove(radio); SaveRadios(); return(new SocketResponse(SocketResponse.StatusCode.OK)); } catch (Exception ex) { return(new SocketResponse(SocketResponse.StatusCode.EXCEPTION, ex.ToString())); } }
/// <summary> /// Busca el adaptador de red WIFI /// </summary> /// <returns>El adaptador de red Wifi</returns> public static NetworkAdapter getWifiAdapter() { try { Radios radios = Radios.GetRadios(); foreach (IRadio radio in radios) { if (radio.RadioType.Equals(RadioType.WiFi)) { WiFiRadio wifiRadio = (WiFiRadio)radio; NetworkAdapter adapter = new NetworkAdapter(); adapter.Name = wifiRadio.DeviceName; adapter.Name = adapter.Name.Substring(adapter.Name.IndexOf("\\") + 1); adapter.Description = wifiRadio.DisplayName; INetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (INetworkInterface networkInterface in networkInterfaces) { try { WirelessZeroConfigNetworkInterface Wadapter = (WirelessZeroConfigNetworkInterface)networkInterface; adapter.Name = Wadapter.Name; adapter.Description = Wadapter.Description; break; } catch (Exception) { adapter.Description += "interface NOT FOUND"; } } return(adapter); } } return(null); } catch (ThreadAbortException e) { throw e; } catch (Exception e) { throw e; } }
public MainForm() { InitializeComponent(); Radios.Add(byteRadioButton, ScanType.BYTE); Radios.Add(wordRadioButton, ScanType.WORD); Radios.Add(dwordRadioButton, ScanType.DWORD); Radios.Add(qwordRadioButton, ScanType.QWORD); Radios.Add(floatRadioButton, ScanType.Float); Radios.Add(doubleRadioButton, ScanType.Double); Radios.Add(asciiRadioButton, ScanType.ASCIIString); Radios.Add(cp932RadioButton, ScanType.CP932String); Radios.Add(unicodeLERadioButton, ScanType.UnicodeLEString); Radios.Add(unicodeBERadioButton, ScanType.UnicodeBEString); Radios.Add(utf8RadioButton, ScanType.UTF8String); Radios.Add(byteArrayRadioButton, ScanType.ByteArray); Radios.Add(bitArrayRadioButton, ScanType.BitArray); }
protected void AddRadio(GumpRadio entry, Action <GumpRadio, bool> handler) { if (entry == null) { return; } if (!Radios.ContainsKey(entry)) { Radios.Add(entry, handler); } else { Radios[entry] = handler; } Add(entry); }
/// <summary> /// Cambia la IP del sistema operativo al estádo dinámico /// Si ocurre un error se arroja la excepción /// </summary> internal static void turnOnAdapter(NetData netData, Boolean forced) { Radios radios = Radios.GetRadios(); foreach (IRadio radio in radios) { if (radio.RadioType.Equals(RadioType.WiFi)) { WiFiRadio wifiRadio = (WiFiRadio)radio; if (forced) { wifiRadio.RadioState = RadioState.On; } else if (wifiRadio.RadioState == RadioState.Off) { wifiRadio.RadioState = RadioState.On; } } } }
public bool IsUncheckedOrEmpty() { switch (Type) { case 1: return(Radios.Any(p => p.Checked == true)); case 2: return(CheckBoxs.Any(p => p.Checked)); case 3: return(string.IsNullOrEmpty(Text.Text)); //---by hp--- case 4: return(Texts.All(p => !string.IsNullOrEmpty(p.Text)) && Radios.Any(p => p.Checked)); //---by hp end--- default: return(false); } }
//////////////////////////////////////////////////////////////////////// // Radios //////////////////////////////////////////////////////////////////////// private void HandleRadios(SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE data) { Radios s1 = (Radios)data.dwData[0]; // com1 txtCOM1Active.Text = BCD16ToFrequency(s1.COM1ActiveFrequency); txtCOM1Standby.Text = BCD16ToFrequency(s1.COM1StandbyFrequency); // com2 txtCOM2Active.Text = BCD16ToFrequency(s1.COM2ActiveFrequency); txtCOM2Standby.Text = BCD16ToFrequency(s1.COM2StandbyFrequency); // nav1 txtNAV1Active.Text = BCD16ToFrequency(s1.NAV1ActiveFrequency); txtNAV1Standby.Text = BCD16ToFrequency(s1.NAV1StandbyFrequency); // nav2 txtNAV2Active.Text = BCD16ToFrequency(s1.NAV2ActiveFrequency); txtNAV2Standby.Text = BCD16ToFrequency(s1.NAV2StandbyFrequency); txtTransponder.Text = BCO16ToFrequency(s1.TransponderCode); }
//---by hp--- private M_QuestionnaireResultDetail TextAndRadioToDetail() { if (Texts == null || Texts.Any(p => string.IsNullOrEmpty(p.Text))) { return(null); } if (Radios == null || !Radios.Any()) { return(null); } var score = 0; var result = string.Empty; //先加入填空值 for (int i = 0; i < Texts.Length; i++) { result += Texts[i].Text + ","; } for (var i = 0; i < Radios.Length; i++) { if (!Radios[i].Checked) { continue; } result += string.Format("{0},", (char)('A' + i)); score = Convert.ToInt32(Radios[i].Tag ?? 0); break; } return(new M_QuestionnaireResultDetail { QuestionResult = result, QuestionScore = score, QuestionType = Type, QuestionCode = Code, PQuestionWeightScore = score * Weight }); }
private void SetUpCheckboxesAndRadioButtons(AdminUser user, CentreContractAdminUsage numberOfAdmins) { if (!numberOfAdmins.TrainersAtOrOverLimit || user.IsTrainer) { Checkboxes.Add(AdminRoleInputs.TrainerCheckbox); } if (!numberOfAdmins.CcLicencesAtOrOverLimit || user.IsContentCreator) { Checkboxes.Add(AdminRoleInputs.ContentCreatorCheckbox); } if (!numberOfAdmins.CmsAdministratorsAtOrOverLimit || user.IsCmsAdministrator) { Radios.Add(AdminRoleInputs.CmsAdministratorRadioButton); } if (!numberOfAdmins.CmsManagersAtOrOverLimit || user.IsCmsManager) { Radios.Add(AdminRoleInputs.CmsManagerRadioButton); } Radios.Add(AdminRoleInputs.NoCmsPermissionsRadioButton); }
private void OnTickSelect(object Sender, EventArgs Args) { // Get if the player is leaving the vehicle bool IsExitingVehicle = Function.Call <bool>(Hash.GET_IS_TASK_ACTIVE, Game.Player.Character, 2); bool IsEnteringVehicle = Function.Call <bool>(Hash.GET_IS_TASK_ACTIVE, Game.Player.Character, 160); Vehicle CurrentVehicle = Game.Player.Character.CurrentVehicle; // If there is a vehicle but it does not has a radio stored if (CurrentVehicle != null && !CurrentRadio.ContainsKey(CurrentVehicle)) { // See if the User has configured a radio by trying to get the values Default Custom = DefaultStations.Find(X => X.Hash == CurrentVehicle.Model.GetHashCode()); // If there is an entry on the custom radios and is more than one if (Custom != null && Custom.Radios.Count > 0) { // Try to get a custom radio int RandomRadio = Randomizer.Next(Custom.Radios.Count); Radio CustomRadio = Radios.Find(X => X.UUID == Custom.Radios[RandomRadio]); // If the radio is not valid, play a random radio if (CustomRadio == null) { CurrentRadio[CurrentVehicle] = GetRandomRadio(); } // Otherwise, use the one that we have else { CurrentRadio[CurrentVehicle] = CustomRadio; } } // If there is no custom radio, information, use a random one else { CurrentRadio[CurrentVehicle] = GetRandomRadio(); } // Finally, play the radio PlayRadio(CurrentRadio[CurrentVehicle]); } // If there is a radio stored but the current radio does not match if (CurrentVehicle != null && CurrentRadio[CurrentVehicle] != Selected) { // Set the current radio as selected CurrentRadio[CurrentVehicle] = Selected; } // If the player is not on a vehicle and the selected radio is not OFF, or is leaving the vehicle, or the game is paused else if ((CurrentVehicle == null && Selected != Radios[0]) || IsExitingVehicle || Game.IsPaused) { // Set the radio as off but don't store it PlayRadio(Radios[0], false); // And mark the radio as paused Paused = true; } // If the player is on a vehicle and the radio is paused and is the player is not exiting the vehicle else if (CurrentVehicle != null && Paused && !IsExitingVehicle) { // If the player is on a vehicle PlayRadio(Selected); Paused = false; } }
public void Dispose() { if (IsDisposed) { return; } //Console.WriteLine("SuperGump Disposing: {0} (0x{1:X})", GetType(), Serial); //GC.SuppressFinalize(this); IsDisposed = true; IsOpen = Hidden = false; VitaNexCore.TryCatch(OnDispose); VitaNexCore.TryCatch(UnregisterInstance); VitaNexCore.TryCatch( () => { if (Linked != null) { Linked.ForEachReverse(Unlink); Linked.Free(true); } }); VitaNexCore.TryCatch( () => { if (Children != null) { Children.ForEachReverse(RemoveChild); Children.Free(true); } }); VitaNexCore.TryCatch( () => { if (InstancePoller != null) { InstancePoller.Dispose(); } }); VitaNexCore.TryCatch( () => { if (Entries != null) { Entries.ForEachReverse( e => { if (e is IDisposable) { VitaNexCore.TryCatch(((IDisposable)e).Dispose); } }); } }); VitaNexCore.TryCatch(OnDisposed); VitaNexCore.TryCatch( () => { if (Buttons != null) { Buttons.Clear(); } if (TileButtons != null) { TileButtons.Clear(); } if (Switches != null) { Switches.Clear(); } if (Radios != null) { Radios.Clear(); } if (TextInputs != null) { TextInputs.Clear(); } if (LimitedTextInputs != null) { LimitedTextInputs.Clear(); } if (Entries != null) { Entries.Free(true); } if (Layout != null) { Layout.Clear(); } }); NextButtonID = 1; NextSwitchID = 0; NextTextInputID = 0; OnActionSend = null; OnActionClose = null; OnActionHide = null; OnActionRefresh = null; OnActionDispose = null; OnActionClick = null; OnActionDoubleClick = null; LastButtonClicked = null; Buttons = null; ButtonHandler = null; TileButtons = null; TileButtonHandler = null; Switches = null; SwitchHandler = null; Radios = null; RadioHandler = null; TextInputs = null; TextInputHandler = null; LimitedTextInputs = null; LimitedTextInputHandler = null; Layout = null; Linked = null; Children = null; Parent = null; User = null; InstancePoller = null; }
static void Main(string[] args) { int ccl = 0; string op = ""; Console.Write("Ingrese el modelo del vehiculo: "); string md = Console.ReadLine(); Console.Write("Ingrese la marca del vehiculo: "); string mcv = Console.ReadLine(); Console.Write("Ingrese la placa del vehiculo: "); string pl = Console.ReadLine(); Console.Write("Ingrese el año de fabricacion del vehiculo: "); string afabri = Console.ReadLine(); int anio = Convert.ToInt32(afabri.Substring(0, 4)); do { Console.Write("Ingrese el codigo del color del vehiculo(1-11): "); ccl = Convert.ToInt32(Console.ReadLine()); } while (ccl < 1 || ccl > 11); Colores c = (Colores)ccl; string cad = ""; switch (c) { case Colores.Barcelona_Red_Met: cad += (StringEnum.GetStringValue(Colores.Barcelona_Red_Met)); break; case Colores.Beig_Met: cad += (StringEnum.GetStringValue(Colores.Beig_Met)); break; case Colores.Beige_Met: cad += (StringEnum.GetStringValue(Colores.Beige_Met)); break; case Colores.Beige_Met1: cad += (StringEnum.GetStringValue(Colores.Beige_Met1)); break; case Colores.Blu: cad += (StringEnum.GetStringValue(Colores.Blu)); break; case Colores.Blue: cad += (StringEnum.GetStringValue(Colores.Blue)); break; case Colores.Blue_Met: cad += (StringEnum.GetStringValue(Colores.Blue_Met)); break; case Colores.Blue_Met1: cad += (StringEnum.GetStringValue(Colores.Blue_Met1)); break; case Colores.Blue_Met2: cad += (StringEnum.GetStringValue(Colores.Blue_Met2)); break; case Colores.Blue_Mica: cad += (StringEnum.GetStringValue(Colores.Blue_Mica)); break; case Colores.Blue_Mica_Met: cad += (StringEnum.GetStringValue(Colores.Blue_Mica_Met)); break; default: cad += ("Ingreso un codigo no valido"); break; } //MOTOR Console.WriteLine("Datos del Motor"); Console.Write("\tIngrese el numero de cilindros del motor: "); byte ncil = Convert.ToByte(Console.ReadLine()); do { Console.Write("\tEl vehiculo tiene inyeccion electrica?(s/n): "); op = Console.ReadLine(); } while (op != "s" && op != "n"); string iny; if (op == "s") { iny = op + "i"; } else { iny = op + "o"; } Console.Write("\tIngrese la Capacidad en litros del motor: "); double cap = Convert.ToDouble(Console.ReadLine()); //RADIO Console.WriteLine("Datos de la Radio"); Console.Write("\tIngrese la marca del radio: "); string mcr = Console.ReadLine(); do { Console.Write("\tLa radio tiene DVD?(s/n): "); op = Console.ReadLine(); } while (op != "s" && op != "n"); string dvd; if (op == "s") { dvd = op + "i"; } else { dvd = op + "o"; } do { Console.Write("\tLa radio tiene USB?(s/n): "); op = Console.ReadLine(); } while (op != "s" && op != "n"); string usb; if (op == "s") { usb = op + "i"; } else { usb = op + "o"; } do { Console.Write("\tLa radio tiene pantalla touch?(s/n): "); op = Console.ReadLine(); } while (op != "s" && op != "n"); string pth; if (op == "s") { pth = op + "i"; } else { pth = op + "o"; } do { Console.Write("\tLa radio tiene Bluetooth?(s/n): "); op = Console.ReadLine(); } while (op != "s" && op != "n"); string bth; if (op == "s") { bth = op + "i"; } else { bth = op + "o"; } Console.Write("\tIngrese el precio de la radio: "); double pre = Convert.ToDouble(Console.ReadLine()); Console.Clear(); Console.WriteLine("Generando información..."); Thread.Sleep(3000); Console.WriteLine("Información generada..."); Thread.Sleep(3000); Motors m1 = new Motors(ncil, iny, cap); Radios r1 = new Radios(mcr, dvd, usb, pth, bth, pre); Automovil a1 = new Automovil(md, mcv, pl, anio, cad, m1, r1); Console.WriteLine(a1.ToString()); Console.ReadKey(); }
private async void btnGeXpndrAsync_Click(object sender, EventArgs e) { Radios r = await SimObjectType <Radios> .RequestDataOnSimObjectType(); displayText(JsonConvert.SerializeObject(r.Transponder.ToString("X3"))); }
public new string Selected() { var checkedId = Radios.First(radio => radio.GetAttribute("checked") != null).GetAttribute("id"); return(Labels.First(label => checkedId.Contains(label.GetAttribute("for")))?.Text); }
/// <summary> /// protected constructor for singleton pattern /// </summary> protected RadioController() { radios = Radios.GetRadios(); setWiFiRadio(true); }
/// <summary> /// Gets radio station from id. /// </summary> /// <param name="id"></param> /// <returns></returns> public Radio GetRadio(string id) { return(Radios.Find(r => r.Id == id)); }