private void DisplaysTabRadioButton_Click(object sender, RoutedEventArgs e) { if (!(sender is Button)) { return; } Button button = (Button)sender; string operatorName = (string)button.Tag; DisplaySelection content = (DisplaySelection)displayDataGrid.CurrentItem; bool allOperator = (string.Compare(operatorName, "All") == 0); RadioButtonType newValue = RadioButtonType.Off; RadioButtonType currentValue = RadioButtonType.Off; bool isOperator = operatorName.Contains("Operator"); int operatorIndex = 0; if (string.Compare("All", operatorName) == 0) { currentValue = content.All; } else if (isOperator) { operatorIndex = int.Parse(operatorName.Replace("Operator", "")) - 1; currentValue = content[operatorIndex]; } else { return; } if ((currentValue == RadioButtonType.Off) || (currentValue == RadioButtonType.Partial)) { newValue = RadioButtonType.On; } else { newValue = RadioButtonType.Off; } if (allOperator) { content.All = newValue; for (int i = 0; i < displayDataModel.NumOperators; i++) { content[i] = newValue; } } else if (isOperator) { content[operatorIndex] = newValue; } // Recalculate all rollups displayDataModel.RefreshAllCol(); }
private GUIContent contentFunc(ControlPanelTabs tab, bool selected, RadioButtonType buttonType) { switch (tab) { case ControlPanelTabs.ManualSlicing: return(new GUIContent($"<size=16>Manual Slicing</size>")); case ControlPanelTabs.ScriptableSclicing: return(new GUIContent($"<size=16>Scriptable Slicing</size>")); default: throw new ApplicationException($"Unknown tab type: {tab}"); } }
public RadioButtonSet(RadioButtonType radioButtonType, Vector2 position, Vector2 elementOffset, List <SpriteText> attatchedTextList, Vector2 attatchedTextOffset, int defaultValue, float layerDepth) { radioButtonElementList = new List <RadioButtonElement>(); selectedButtonPreset = radioButtonStatePresets[radioButtonType]; this.attatchedTextOffset = attatchedTextOffset; for (int i = 0; i < attatchedTextList.Count; i++) { //Sprite Sprite sprite = new Sprite(selectedButtonPreset.SpritePath, layerDepth: layerDepth, sourceRectangle: selectedButtonPreset.StatePreset[ButtonAnimationState.Normal]); sprite.Pivot = new Vector2(6, 6); //SpriteText attatchedTextList[i].Alignment = Alignment.Left; //TransparentButton TransparentButton button = new TransparentButton(default, default)
/// <summary> /// Parses a radio button control group element. /// </summary> /// <param name="node">Element to parse.</param> /// <param name="property">Property associated with this radio button group.</param> /// <param name="groupType">Specifies the current type of radio buttons in the group.</param> /// <returns>The current type of radio buttons in the group.</returns> private RadioButtonType ParseRadioButtonGroupElement(XmlNode node, string property, RadioButtonType groupType) { SourceLineNumberCollection sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); int order = 0; foreach (XmlAttribute attrib in node.Attributes) { if (0 == attrib.NamespaceURI.Length || attrib.NamespaceURI == this.schema.TargetNamespace) { switch (attrib.LocalName) { case "Property": property = this.core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); this.core.CreateWixSimpleReferenceRow(sourceLineNumbers, "Property", property); break; default: this.core.UnexpectedAttribute(sourceLineNumbers, attrib); break; } } else { this.core.UnsupportedExtensionAttribute(sourceLineNumbers, attrib); } } if (null == property) { this.core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name, "Property")); } foreach (XmlNode child in node.ChildNodes) { if (XmlNodeType.Element == child.NodeType) { if (child.NamespaceURI == this.schema.TargetNamespace) { switch (child.LocalName) { case "RadioButton": RadioButtonType type = this.ParseRadioButtonElement(child, property, ref order); if (RadioButtonType.NotSet == groupType) { groupType = type; } else if (groupType != type) { SourceLineNumberCollection childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); this.core.OnMessage(WixErrors.RadioButtonTypeInconsistent(childSourceLineNumbers)); } break; default: this.core.UnexpectedElement(node, child); break; } } else { this.core.UnsupportedExtensionElement(node, child); } } } return groupType; }
private GUIStyle styleFunc(ControlPanelTabs tab, bool selected, RadioButtonType buttonType) => selected ? _radioButtonDefaultSelectedStyle : _radioButtonDefaultStyle;
private void RadioButton_Click(object sender, RoutedEventArgs e) { if (!(sender is Button)) { return; } TabItem ti = (TabItem)experimentTabControl.ItemContainerGenerator.ContainerFromIndex(experimentTabControl.SelectedIndex); if (ti.Name == "displaysTab") { DisplaysTabRadioButton_Click(sender, e); return; } Button button = (Button)sender; string operatorName = (string)button.Tag; MeasureSelection content = (MeasureSelection)measuresDataGrid.CurrentItem; bool allOperator = (string.Compare(operatorName, "All") == 0); bool isCategory = (content.MeasureRowType == MeasureRowType.CategoryType); bool isSubCategory = (content.MeasureRowType == MeasureRowType.SubCategoryType); RadioButtonType newValue = RadioButtonType.Off; RadioButtonType currentValue = RadioButtonType.Off; bool isOperator = operatorName.Contains("Operator"); int operatorIndex = 0; if (string.Compare("All", operatorName) == 0) { currentValue = content.All; } else if (isOperator) { operatorIndex = int.Parse(operatorName.Replace("Operator", "")) - 1; currentValue = content[operatorIndex]; } else { return; } if ((currentValue == RadioButtonType.Off) || (currentValue == RadioButtonType.Partial)) { newValue = RadioButtonType.On; } else { newValue = RadioButtonType.Off; } if (content.MeasureRowType == MeasureRowType.CategoryType) { string categoryName = content.MeasureName; for (int j = 0; j < measureDataModel.Count; j++) { if ((measureDataModel[j].MeasureRowType == MeasureRowType.DataValue) && (string.Compare(categoryName, measureDataModel[j].Category) == 0)) { if (string.Compare("All", operatorName) == 0) { measureDataModel[j].All = newValue; for (int i = 0; i < measureDataModel.NumOperators; i++) { measureDataModel[j][i] = newValue; } } else if (isOperator) { measureDataModel[j][operatorIndex] = newValue; } } } } else if (content.MeasureRowType == MeasureRowType.SubCategoryType) { string subCategoryName = content.MeasureName; for (int j = 0; j < measureDataModel.Count; j++) { if ((measureDataModel[j].MeasureRowType == MeasureRowType.DataValue) && (string.Compare(subCategoryName, measureDataModel[j].SubCategory) == 0)) { if (string.Compare("All", operatorName) == 0) { measureDataModel[j].All = newValue; for (int i = 0; i < measureDataModel.NumOperators; i++) { measureDataModel[j][i] = newValue; } } else if (isOperator) { measureDataModel[j][operatorIndex] = newValue; } } } } else if (content.MeasureRowType == MeasureRowType.DataValue) { if (string.Compare("All", operatorName) == 0) { content.All = newValue; for (int i = 0; i < measureDataModel.NumOperators; i++) { content[i] = newValue; } } else if (isOperator) { content[operatorIndex] = newValue; } } // Recalculate all rollups measureDataModel.RefreshAllCol(); // Recalculate Subcategory rollups measureDataModel.RefreshSubCategory(); // Recalculated Category rollups measureDataModel.RefreshCategory(); }