private async void RadioPageChecked(RbBox sender) { RadioItemsList.Opacity = 0; if (sender != null) { mw.OpenLoading(); if (RadioPage_RbLast != null) { RadioPage_RbLast.Check(false); } RadioPage_RbLast = sender; RadioItemsList.Children.Clear(); List <MusicRadioListItem> dat = Radiodata[sender.ContentText].Items; foreach (var d in dat) { RadioItem a = new RadioItem(d) { Margin = new Thickness(12, 0, 12, 20) }; a.MouseDown += mw.GetRadio; a.Width = RadioItemsList.ActualWidth / 5; RadioItemsList.Children.Add(a); } mw.WidthUI(RadioItemsList); mw.CloseLoading(); await Task.Delay(10); mw.RunAnimation(RadioItemsList); } }
/// <summary> /// Initializes a new instance of the <see cref="UsingRadioBatteryEventArgs"/> class. /// </summary> /// <param name="radio"><inheritdoc cref="Radio"/></param> /// <param name="player"><inheritdoc cref="Player"/></param> /// <param name="drain"><inheritdoc cref="Drain"/></param> /// <param name="isAllowed"><inheritdoc cref="IsAllowed"/></param> public UsingRadioBatteryEventArgs(RadioItem radio, Player player, float drain, bool isAllowed = true) { Radio = (Radio)Item.Get(radio); Player = player; Drain = drain; IsAllowed = isAllowed; }
protected void GetNewItem(HtmlNode node) { RadioItem newItem = new RadioItem(); GetFields(node, newItem); Items.Add(newItem); }
protected void GetFields(HtmlNode node, RadioItem newItem) { newItem.Name = GetName(node); newItem.Link = GetLink(node); newItem.Picture = GetPicture(node); newItem.Availability = GetAvailability(node); newItem.Cost = GetCost(node); }
/// <summary> /// Adding shifts to the list. /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { base.OnInit(e); if (this.DesignMode) { return; } this.Items.Clear(); string[] shifts = ConfigurationManager.AppSettings["Shifts"].Split(','); // Raise exception if specified number of shifts exceeds supported number of shifts if (shifts.Length > Enum.GetValues(typeof(Shifts)).Length) { throw new HttpException("Numbers of Shifts specified exceeds the supported number of shifts."); } // Need atleast 2 shift-values to make a shift. if (shifts.Length < 2) { throw new HttpException("Must have 2 or more shifts"); } RadioItem li = new RadioItem() { Text = "All" }; this.Items.Add(li); int nCtr = 0; DateTime dateFrom; DateTime dateTo; string strTootltip = string.Empty; for (; nCtr < shifts.Length - 1; nCtr++) { dateFrom = DateTime.Today + TimeSpan.FromHours(double.Parse(shifts[nCtr])); dateTo = DateTime.Today + TimeSpan.FromHours(double.Parse(shifts[nCtr + 1])); strTootltip = string.Format("{0:t} to {1:t}", dateFrom, dateTo); li = new RadioItem() { Text = string.Format("{0}", Enum.GetName(typeof(Shifts), nCtr)), Value = (nCtr + 1).ToString(), ToolTip = strTootltip }; this.Items.Add(li); } // Adding last shift to the list dateFrom = DateTime.Today + TimeSpan.FromHours(double.Parse(shifts[nCtr])); dateTo = DateTime.Today + TimeSpan.FromHours(double.Parse(shifts[0])); strTootltip = string.Format("{0:t} to {1:t}", dateFrom, dateTo); li = new RadioItem() { Text = string.Format("{0}", Enum.GetName(typeof(Shifts), nCtr)), Value = (nCtr + 1).ToString(), ToolTip = strTootltip }; this.Items.Add(li); }
public StationInfoViewModel(RadioItem item, RadioPlugin plugin) { RadioItem = item; OpenItemCommand = new RelayCommand(async args => { SetResult(null); await plugin.OpenItemAsync(RadioItem); }); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private void BuildItem() { switch (Type) { case HoverboardItemType.Selector: vItem = new SelectorItem(); break; case HoverboardItemType.Sticky: vItem = new StickyItem(); break; case HoverboardItemType.Checkbox: var checkItem = new CheckboxItem(); checkItem.Value = CheckboxValue; vItem = checkItem; break; case HoverboardItemType.Radio: var radItem = new RadioItem(); radItem.Value = RadioValue; radItem.GroupId = RadioGroupId; vItem = radItem; break; case HoverboardItemType.Slider: var sliderItem = new SliderItem(); sliderItem.Ticks = SliderTicks; sliderItem.Snaps = SliderSnaps; sliderItem.RangeMin = SliderRangeMin; sliderItem.RangeMax = SliderRangeMax; sliderItem.Value = Mathf.InverseLerp(SliderRangeMin, SliderRangeMax, SliderValue); sliderItem.AllowJump = SliderAllowJump; sliderItem.FillStartingPoint = SliderFillStartingPoint; vItem = sliderItem; break; case HoverboardItemType.Text: vItem = new TextItem(); break; default: throw new Exception("Unhandled item type: " + Type); } if (!string.IsNullOrEmpty(Id)) { vItem.Id = Id; } vItem.DisplayContainer = gameObject; vItem.Label = (string.IsNullOrEmpty(Label) ? gameObject.name : Label); vItem.Width = Width; vItem.Height = Height; vItem.IsVisible = IsVisible; vItem.IsEnabled = IsEnabled; }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private void BuildItem() { switch ( Type ) { case HoverboardItemType.Selector: vItem = new SelectorItem(); break; case HoverboardItemType.Sticky: vItem = new StickyItem(); break; case HoverboardItemType.Checkbox: var checkItem = new CheckboxItem(); checkItem.Value = CheckboxValue; vItem = checkItem; break; case HoverboardItemType.Radio: var radItem = new RadioItem(); radItem.InitDefaultGroupId(gameObject.transform); radItem.Value = RadioValue; radItem.GroupId = RadioGroupId; vItem = radItem; break; case HoverboardItemType.Slider: var sliderItem = new SliderItem(); sliderItem.Ticks = SliderTicks; sliderItem.Snaps = SliderSnaps; sliderItem.RangeMin = SliderRangeMin; sliderItem.RangeMax = SliderRangeMax; sliderItem.Value = Mathf.InverseLerp(SliderRangeMin, SliderRangeMax, SliderValue); sliderItem.AllowJump = SliderAllowJump; sliderItem.FillStartingPoint = SliderFillStartingPoint; vItem = sliderItem; break; case HoverboardItemType.Text: vItem = new TextItem(); break; default: throw new Exception("Unhandled item type: "+Type); } if ( !string.IsNullOrEmpty(Id) ) { vItem.Id = Id; } vItem.DisplayContainer = gameObject; vItem.Label = (string.IsNullOrEmpty(Label) ? gameObject.name : Label); vItem.Width = Width; vItem.Height = Height; vItem.IsVisible = IsVisible; vItem.IsEnabled = IsEnabled; }
private void RecreateItems(string[] items) { int num = items.Length; fItems = new RadioItem[items.Length]; for (int i = 0; i < num; i++) { fItems[i] = new RadioItem(items[i]); } }
public void AddItem(string text) { if (text.Length > 0) { int num = fItems.Length; Array.Resize(ref fItems, num + 1); fItems[num] = new RadioItem(text); CalcLayout(); Invalidate(); } }
private static bool OnProcessCmd(RadioMessages.RadioCommand command, RadioItem __instance) { try { var item = __instance.GetSynapseItem(); var player = item.ItemHolder; var state = (RadioMessages.RadioRangeLevel)__instance._radio.NetworkcurRangeId; var nextstate = (int)state + 1 >= __instance.Ranges.Length ? 0 : state + 1; Get.Player.InvokeRadio(player, item, ref command, state, ref nextstate, out var allow); if (!allow) { return(false); } switch (command) { case RadioMessages.RadioCommand.Enable: __instance._enabled = true; break; case RadioMessages.RadioCommand.Disable: __instance._enabled = false; __instance._radio.ForceDisableRadio(); break; case RadioMessages.RadioCommand.ChangeRange: __instance._rangeId = (byte)nextstate; __instance._radio.NetworkcurRangeId = __instance._rangeId; break; } __instance.SendStatusMessage(); return(false); } catch (Exception e) { Logger.Get.Error($"Synapse-Event: RadioInteractEvent failed!!\n{e}"); return(true); } }
private void InitRadioItems(string[] datas) { string attrValue = _nodeAttr.GetValueString(); RadioItem item; for (int i = 0; i < datas.Length; i++) { GameObject itemGo = ResourceManager.GetInstance().GetPrefab("Prefabs/Views/EditViews", "EditRadioItem"); RectTransform tf = itemGo.GetComponent <RectTransform>(); tf.SetParent(_itemContainerTf, false); item = new RadioItem { go = itemGo, toggle = tf.Find("Toggle").GetComponent <Toggle>(), value = datas[i], }; Text valueText = tf.Find("ValueText").GetComponent <Text>(); valueText.text = datas[i]; int tmpIndex = i; UIEventListener.Get(item.toggle.gameObject).AddClick(() => { if (_curSelectedIndex != -1) { RadioItem tmpItem = _radioItemList[_curSelectedIndex]; tmpItem.toggle.isOn = false; } _curSelectedIndex = tmpIndex; }); _radioItemList.Add(item); // 默认选择 if (attrValue == datas[i]) { item.toggle.isOn = true; _curSelectedIndex = i; } } }
/// <summary> /// Initializes a new instance of the <see cref="Radio"/> class. /// </summary> /// <param name="itemBase">The base <see cref="RadioItem"/> class.</param> public Radio(RadioItem itemBase) : base(itemBase) { Base = itemBase; }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private void BuildItem() { switch (Type) { case SelectableItemType.Checkbox: var checkItem = new CheckboxItem(); checkItem.Value = CheckboxValue; vItem = checkItem; break; case SelectableItemType.Parent: vItem = new ParentItem(GetChildItems); break; case SelectableItemType.Radio: var radItem = new RadioItem(); radItem.Value = RadioValue; vItem = radItem; break; case SelectableItemType.Selector: vItem = new SelectorItem(); break; case SelectableItemType.Slider: var sliderItem = new SliderItem(); sliderItem.Ticks = SliderTicks; sliderItem.Snaps = SliderSnaps; sliderItem.RangeMin = SliderRangeMin; sliderItem.RangeMax = SliderRangeMax; sliderItem.Value = Mathf.InverseLerp(SliderRangeMin, SliderRangeMax, SliderValue); sliderItem.AllowJump = SliderAllowJump; vItem = sliderItem; break; case SelectableItemType.Sticky: vItem = new StickyItem(); break; default: throw new Exception("Unhandled item type: " + Type); } if (!string.IsNullOrEmpty(Id)) { vItem.Id = Id; } vItem.DisplayContainer = gameObject; vItem.Label = (string.IsNullOrEmpty(Label) ? gameObject.name : Label); vItem.Height = RelativeSize; vItem.IsVisible = IsVisible; vItem.IsEnabled = IsEnabled; ISelectableItem selItem = (vItem as ISelectableItem); if (selItem != null && !(vItem is IParentItem)) { selItem.NavigateBackUponSelect = NavigateBackUponSelect; } }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private void BuildItem() { switch ( Type ) { case HovercastItemType.Checkbox: var checkItem = new CheckboxItem(); checkItem.Value = CheckboxValue; vItem = checkItem; break; case HovercastItemType.Parent: vItem = new ParentItem(); (vItem as ParentItem).InitChildGroup(GetChildItems); break; case HovercastItemType.Radio: var radItem = new RadioItem(); radItem.InitDefaultGroupId(gameObject.transform); radItem.Value = RadioValue; vItem = radItem; break; case HovercastItemType.Selector: vItem = new SelectorItem(); break; case HovercastItemType.Slider: var sliderItem = new SliderItem(); sliderItem.Ticks = SliderTicks; sliderItem.Snaps = SliderSnaps; sliderItem.RangeMin = SliderRangeMin; sliderItem.RangeMax = SliderRangeMax; sliderItem.Value = Mathf.InverseLerp(SliderRangeMin, SliderRangeMax, SliderValue); sliderItem.AllowJump = SliderAllowJump; sliderItem.FillStartingPoint = SliderFillStartingPoint; vItem = sliderItem; break; case HovercastItemType.Sticky: vItem = new StickyItem(); break; case HovercastItemType.Text: vItem = new TextItem(); break; default: throw new Exception("Unhandled item type: "+Type); } if ( !string.IsNullOrEmpty(Id) ) { vItem.Id = Id; } vItem.DisplayContainer = gameObject; vItem.Label = (string.IsNullOrEmpty(Label) ? gameObject.name : Label); vItem.Height = RelativeSize; vItem.IsVisible = IsVisible; vItem.IsEnabled = IsEnabled; ISelectorItem selItem = (vItem as ISelectorItem); if ( selItem != null ) { selItem.NavigateBackUponSelect = NavigateBackUponSelect; } }