private void UpdateSelectedItemsFromSelectedValue() { _surpressSelectionChanged = true; //first we have to unselect everything ClearSelectedItems(); if (!String.IsNullOrEmpty(SelectedValue)) { string[] values = SelectedValue.Split(new string[] { Delimiter }, StringSplitOptions.RemoveEmptyEntries); foreach (string value in values) { var item = ResolveItemByValue(value); if (item != null) { SelectedItems.Add(item); //now try to select it in the list var selectorItem = ItemContainerGenerator.ContainerFromItem(item) as SelectorItem; if (selectorItem != null) { if (!selectorItem.IsSelected) { selectorItem.IsSelected = true; } } } } } _surpressSelectionChanged = false; }
/// <exclude /> protected override void AddAttributesToRender(HtmlTextWriter writer) { writer.AddAttribute("name", this.UniqueID); writer.AddAttribute("callbackid", this.ClientID); if (this.AutoPostBack) { writer.AddAttribute("onchange", "this.dispatchAction(PageBinding.ACTION_DOPOSTBACK)"); } if (this.SelectionRequired) { writer.AddAttribute("required", "true"); string requiredLabel = this.SelectionRequiredLabel; if (string.IsNullOrEmpty(requiredLabel)) { requiredLabel = StringResourceSystemFacade.GetString("Composite.Management", "AspNetUiControl.Selector.SelectValueLabel"); } writer.AddAttribute("label", requiredLabel); } if (!SelectedValue.IsNullOrEmpty()) { writer.AddAttribute("value", SelectedValue); } this.AddClientAttributes(writer); }
public async Task OnSelect(string value) { Value = value; isMenuOpen = false; StateHasChanged(); await SelectedValue.InvokeAsync(value); }
#pragma warning disable CS1591 public override IEnumerable <AssociativeNode> BuildOutputAst(List <AssociativeNode> inputAstNodes) { ClearErrorsAndWarnings(); AssociativeNode resultList; if (IsPartiallyApplied) { resultList = AstFactory.BuildNullNode(); } else { if (Selected.Any(v => v.IsTransient) || Selected.Count == 0) { // Build from persistent selection resultList = AstFactory.BuildFunctionCall( new Func <object[], string[], bool, object[]>(DynamicArgumentDelegation.ExludeBySerializationValue), new List <AssociativeNode>() { inputAstNodes[0], AstFactory.BuildExprList(SelectedValue.Select(v => AstFactory.BuildStringNode(v) as AssociativeNode).ToList()), AstFactory.BuildBooleanNode(false) }); } else { // Build from live AST resultList = AstFactory.BuildExprList( Items.Where(c => !Selected.Contains(c)).Select(c => c.ToAstNode()).ToList()); } } return(new AssociativeNode[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), resultList) }); }
private void setSelectedValues() { if (!string.IsNullOrEmpty(SelectedValue)) { if (SelectionMode == ListSelectionMode.Multiple) { string[] values = SelectedValue.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (ListItem li in this.ListBox.Items) { li.Selected = values.Contains(li.Value); } } else { foreach (ListItem li in this.ListBox.Items) { if (li.Value.Equals(SelectedValue)) { li.Selected = true; break; } } } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Page.IsPostBack) { if (Terms == null) { Terms = new List <Term>(); } else { Terms.Clear(); } if (!string.IsNullOrEmpty(SelectedValue)) { foreach (var id in SelectedValue.Split(',')) { var termId = Convert.ToInt32(id.Trim()); var term = Util.GetTermController().GetTerm(termId); if (term != null) { Terms.Add(term); } } //clear the append item by client side if (Items.Count > 1) { Items.Remove(1); } } } }
/// <summary> /// Updates the SelectedItems collection based on the content of /// the SelectedValue property. /// </summary> private void UpdateFromSelectedValue() { _ignoreSelectedItemsCollectionChanged++; // Just update the SelectedItems collection content // and let the synchronization be made from UpdateFromSelectedItems(); SelectedItems.Clear(); if (!String.IsNullOrEmpty(SelectedValue)) { List <string> selectedValues = SelectedValue.Split(new string[] { Delimiter }, StringSplitOptions.RemoveEmptyEntries).ToList(); ValueEqualityComparer comparer = new ValueEqualityComparer(); foreach (object item in ItemsCollection) { object itemValue = this.GetItemValue(item); bool isSelected = (itemValue != null) && selectedValues.Contains(itemValue.ToString(), comparer); if (isSelected) { SelectedItems.Add(item); } } } _ignoreSelectedItemsCollectionChanged--; this.UpdateFromSelectedItems(); }
private void ToolboxCustomTrackBar_Paint(object sender, PaintEventArgs e) { //when i allow for scrolling into the TrackBar / Timeline, i'll want to repaint all the time backdropPanel.Location = new Point(Min, LabelHeight); backdropPanel.Width = Width; backdropPanel.Height = Height - LabelHeight; foreach (var panel in panels) { if (panel != backdropPanel) { panel.Height = Height - LabelHeight; panel.Width = PanelWidth; } } minPanel.Location = new Point(SelectedMin - (PanelWidth / 2), backdropPanel.Location.Y); maxPanel.Location = new Point((SelectedMax * Width / (Max - Min)) - 1, backdropPanel.Location.Y); valuePanel.Location = new Point((SelectedValue) * Width / (Max - Min), backdropPanel.Location.Y); minLabel.Location = new Point(minPanel.Location.X - (minLabel.Width / 2) + (minPanel.Width / 2), minPanel.Location.Y - LabelHeight); minLabel.Text = SelectedMin.ToString(); maxLabel.Location = new Point(SelectedMax - (maxLabel.Width / 2) + (maxPanel.Width / 2), backdropPanel.Location.Y - LabelHeight); maxLabel.Text = SelectedMax.ToString(); valueLabel.Location = new Point(SelectedValue - (valueLabel.Width / 2) + (valuePanel.Width / 2), backdropPanel.Location.Y - LabelHeight); valueLabel.Text = SelectedValue.ToString(); }
public void SelectedValueElement_WhenTargetIsNotASelectElement_ShouldThrow() { //arrange var target = Target.The("selected element").LocatedBy(By.Id("NotASelectElement")); var question = SelectedValue.Of(target); //act Assert.Throws <UnexpectedTagNameException>(() => Answer(question)); }
private void SaveSelection() { string strSelectionData = string.Format("{{ \"selectedIndex\": \"{0}\", \"selectedValue\": \"{1}\", \"selectedText\": \"{2}\", \"selectedValues\": \"{3}\" }}", SelectedIndex, SelectedValue.Replace("\"", "\\\""), SelectedText.Replace("\"", "\\\""), ToString(GetSelectedValues(), ":")); hidSelectedData.Value = strSelectionData; }
/// <summary> /// IntData[0] - Power of rotor /// StringData[0]-Type of regulation /// !!!!!StringData[1] - Power of engine in STRING type /// </summary> /// <returns></returns> public override DataClass GetPowerData() { var result = new DataClass(); result.IntData.Add(SelectedRotorPower); result.StringData.Add(SelectedValue.ToString()); //3 result.StringData.Add(SelectedSpeedRegulator); //4 result.StringData.Add(SelectedSignal); //5 return(result); }
public void RemoveValueFootnote(PxObject context, PxFootnote footnote) { SelectedValue.ValueFootnotes.Remove((PxValueFootnote)footnote); if (!footnote.IsNew) { SelectedValue.RemovedValueFootnotes.Add((PxValueFootnote)footnote); SelectedValue.MarkAsDirty(); SelectedMainTable.MarkAsDirty(); } }
/// <summary> /// Updates the SelectedValue property based on what is present in the SelectedItems property. /// </summary> private void UpdateSelectedValue() { string newValue = String.Join(Delimiter, SelectedItems.Cast <object>().Select(GetItemValue)); if (String.IsNullOrEmpty(SelectedValue) || !SelectedValue.Equals(newValue)) { _ignoreSelectedValueChanged = true; SelectedValue = newValue; _ignoreSelectedValueChanged = false; } }
private void setSelectedValues() { if (!string.IsNullOrEmpty(SelectedValue)) { string[] values = SelectedValue.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (ListItem li in this.CheckBoxList.Items) { li.Selected = values.Contains(li.Value); } } }
public void SelectedValueElement_ShouldReturnCorrectValue(string id, string expected) { //arrange var target = Target.The("selected element").LocatedBy(By.Id(id)); var question = SelectedValue.Of(target); //act var actual = Answer(question); //assert Assert.Equal(expected, actual); }
/// <summary> /// Updates the SelectedItems collection based on the content of /// the SelectedValue property. /// </summary> private void UpdateFromSelectedValue() { List <string> selectedValues = null; if (!String.IsNullOrEmpty(SelectedValue)) { selectedValues = SelectedValue.Split(new string[] { Delimiter }, StringSplitOptions.RemoveEmptyEntries).ToList(); } this.UpdateFromList(selectedValues, this.GetItemValue); }
private void UpdateSelectedValue() { string text = string.Join(Delimiter, from object x in SelectedItems select GetItemValue(x)); if (string.IsNullOrEmpty(SelectedValue) || !SelectedValue.Equals(text)) { _ignoreSelectedValueChanged = true; SelectedValue = text; _ignoreSelectedValueChanged = false; } }
public void SelectByIndexAction_ShouldSelectCorrectElement(int index, string expected) { //arrange Fixture.WebDriver.Navigate().Refresh(); var action = Select.TheIndex(index).Into(SelectElementTarget); //act Fixture.Actor.When(action); var actual = Answer(SelectedValue.Of(SelectElementTarget).Value); //assert Assert.Equal(expected, actual); }
private void EnumComboBox_SelectedIndexChanged(object sender, EventArgs e) { var convertedValue = SelectedValue as EnumData; if (convertedValue != null) { return; } if (EnumType != null && !string.IsNullOrEmpty(SelectedValue.ToString())) { SelectedEnumValue = Convert.ToInt32(Enum.Parse(EnumType, SelectedValue.ToString())); } }
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) { if (e.Property == SelectedValueDP) { if (Editable == true) { xValeur.Visibility = System.Windows.Visibility.Visible; xValeur.IsHitTestVisible = true; xValeur.Background = Brushes.White; } else { xValeur.Visibility = System.Windows.Visibility.Visible; xValeur.IsHitTestVisible = false; xValeur.ToolTip = null; } if (Intitule == true) { xIntitule.Visibility = System.Windows.Visibility.Visible; } else { xIntitule.Visibility = System.Windows.Visibility.Collapsed; } String Objet = ""; String Propriete = ""; String TypePropriete = ""; if (InfosBinding(e.Property, ref Objet, ref Propriete, ref TypePropriete)) { String pIntitule = DicIntitules.Intitule(Objet, Propriete); xIntitule.Text = pIntitule + " :"; if (String.IsNullOrWhiteSpace(SelectedValue.ToString()) && (Editable == false)) { xBase.Visibility = System.Windows.Visibility.Collapsed; } String ToolTip = DicIntitules.Info(Objet, Propriete); if (!String.IsNullOrWhiteSpace(ToolTip)) { xBase.ToolTip = ToolTip; } } } base.OnPropertyChanged(e); }
/// <summary> /// Updates the SelectedValue property based on what is present in the SelectedItems property. /// </summary> private void UpdateSelectedValue() { #if VS2008 string newValue = String.Join(Delimiter, SelectedItems.Cast <object>().Select(x => GetItemValue(x).ToString()).ToArray()); #else string newValue = String.Join(Delimiter, SelectedItems.Cast <object>().Select(x => GetItemValue(x))); #endif if (String.IsNullOrEmpty(SelectedValue) || !SelectedValue.Equals(newValue)) { _ignoreSelectedValueChanged = true; SelectedValue = newValue; _ignoreSelectedValueChanged = false; } }
private void UIXCombobox_SelectedValueChanged(object sender, EventArgs e) { String selectedValue = this.SelectedValue.ToString(); Form frm = FindForm(); foreach (Control ctr in frm.Controls) { if (ctr.Name == ControlId) { ctr.Text = SelectedValue.ToString(); } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Page.IsPostBack) { if (Terms == null) { Terms = new List <Term>(); } else { Terms.Clear(); } if (!string.IsNullOrEmpty(SelectedValue)) { foreach (var id in SelectedValue.Split(',')) { var termId = Convert.ToInt32(id.Trim()); var term = Util.GetTermController().GetTerm(termId); if (term != null) { Terms.Add(term); } } //clear the append item by client side if (Items.Count > 1) { Items.Remove(1); } } } if (!Page.IsPostBack) { Page.ClientScript.RegisterClientScriptResource(GetType(), "DotNetNuke.Web.UI.WebControls.Resources.TermsSelector.js"); ClientResourceManager.RegisterStyleSheet(Page, Page.ClientScript.GetWebResourceUrl(GetType(), "DotNetNuke.Web.UI.WebControls.Resources.TermsSelector.css")); ClientAPI.RegisterClientVariable(Page, "TermsSelectorCallback", ClientAPI.GetCallbackEventReference(this, "'[PARAMS]'", "webcontrols.termsSelector.itemDataLoaded", "this", "webcontrols.termsSelector.itemDataLoadError"), true); } }
public PxValueFootnote CreateValueFootnote(PxObject context) { PxValueFootnote vf = new PxValueFootnote(); vf.FootnoteNo = FootnoteNo; FootnoteNo++; vf.FootnoteText = "Shenim i ri"; vf.FootnoteTextEnglish = "New Footnote"; vf.MandOption = "O"; vf.ShowFootnote = "B"; vf.IsNew = true; vf.Value = SelectedValue; SelectedValue.ValueFootnotes.Add(vf); SelectedValue.MarkAsDirty(); ((PxValueSet)lbValuesets.SelectedItem).MarkAsDirty(); return(vf); }
protected override void OnPreviewMouseWheel(MouseWheelEventArgs e) { if ((Keyboard.Modifiers & ModifierKeys.Control) > 0) { var Value = SelectedValue.To <double>(); if (e.Delta > 0) { if (WheelTick == 0) { var i = Sizes.IndexOf(SelectedValue.To <double>()) + 1; if (i <= Sizes.Count - 1) { Value = Sizes[i]; } } else { if (Value + WheelTick <= WheelTickMax) { Value += WheelTick; } } } else { if (WheelTick == 0) { var i = Sizes.IndexOf(SelectedValue.To <double>()) - 1; if (i >= 0) { Value = Sizes[i]; } } else { if (Value - WheelTick >= WheelTickMin) { Value -= WheelTick; } } } SelectedValue = Value; } }
public IList <AutoCompleteDataItem <TOption> > GetOptionItems() { if (_optionDataItems != null) { if (FilterExpression != null && AllowFilter == true && SelectedValue != null) { return(_optionDataItems.Where(x => FilterExpression(x, SelectedValue?.ToString())).ToList()); } else { return(_optionDataItems); } } else { return(new List <AutoCompleteDataItem <TOption> >()); } }
public PxMainTableValueFootnote CreateMainTableValueFootnote(PxObject context) { PxMainTableValueFootnote mtvf = new PxMainTableValueFootnote(); mtvf.FootnoteNo = FootnoteNo; FootnoteNo++; mtvf.FootnoteText = "Shenim i ri"; mtvf.FootnoteTextEnglish = "New Footnote"; mtvf.MandOption = "O"; mtvf.ShowFootnote = "B"; mtvf.IsNew = true; mtvf.Variable = SelectedVariable; mtvf.Value = SelectedValue; SelectedMainTable.MainTableValueFootnotes.Add(mtvf); SelectedMainTable.MarkAsDirty(); SelectedValue.MarkAsDirty(); return(mtvf); }
private void UpdateSelectedValue() { //get out of here if we don't want to set the SelectedValue if (_ignoreSetSelectedValue) { return; } _surpressSelectedValueChanged = true; string newValue = String.Join(Delimiter, SelectedItems.Cast <object>().Select(x => GetItemValue(x).ToString()).ToArray()); if (String.IsNullOrEmpty(SelectedValue) || !SelectedValue.Equals(newValue)) { SelectedValue = newValue; } _surpressSelectedValueChanged = false; }
public QuickDropdown(Transform parent = null, string name = "QuickDropdown", GameObject altPrototype = null) { var exampleDropdown = altPrototype ?? Prefabs.QuickDropdown; if (exampleDropdown == null) { throw IEDebug.Exception(null, "You must initialize the ExampleDropdown to create a dropdown.", null); } GameObject = (GameObject)Object.Instantiate(exampleDropdown); GameObject.transform.parent = parent; GameObject.name = name; //! You have to explicitly set localPosition and localScale to something after Instantiate!!! //! Otherwise, the UI will broken, but no exception will be reported. GameObject.transform.localPosition = Vector3.zero; GameObject.transform.localScale = Vector3.one; SelectedValue = BindingValue.Member(() => this.selectedValue).ToBindable(); Options = new List <DropdownChoice <T> >(); DropdownComponent.OnDropdownOptionChangedEvent += x => SelectedValue.NotifyChange(); IEDebug.Log("Created: " + name); }
private void ModifyField() { if (SelectedValue.ModifyAsList) { //TODO: New prompt that handles lists. } else if (!SelectedValue.CanOverwrite) { //Implies the only action that can be done is to modify the subobject ISaveable subobject = SelectedValue.SubObject(objectToModify); if (subobject != null) { NextPrompt = new AdminSelectModify(this, User, subobject); } else { User.sendMessage("Error: No subobject found for a modify-only field."); } } else { NextPrompt = new AdminModifyField(this, User, objectToModify, SelectedValue); } }