protected bool OnlyHasDefaultCommand() { if (_onlyHasDefaultCommand == BooleanOption.NotSet) { String defaultCommand = Control.DefaultCommand; if (defaultCommand.Length > 0) { int commandCount = Control.Commands.Count; if (commandCount == 0 || (commandCount == 1 && String.Compare(defaultCommand, Control.Commands[0].Name, true, CultureInfo.InvariantCulture) == 0)) { _onlyHasDefaultCommand = BooleanOption.True; } else { _onlyHasDefaultCommand = BooleanOption.False; } } else { _onlyHasDefaultCommand = BooleanOption.False; } } return(_onlyHasDefaultCommand == BooleanOption.True); }
/// <include file='doc\HtmlObjectListAdapter.uex' path='docs/doc[@for="HtmlObjectListAdapter.OnlyHasDefaultCommand"]/*' /> protected bool OnlyHasDefaultCommand() { if (_onlyHasDefaultCommand == BooleanOption.NotSet) { String defaultCommand = Control.DefaultCommand; if (defaultCommand.Length > 0) { int commandCount = Control.Commands.Count; if (commandCount == 0 || (commandCount == 1 && String.Compare(defaultCommand, Control.Commands[0].Name, StringComparison.OrdinalIgnoreCase) == 0)) { _onlyHasDefaultCommand = BooleanOption.True; } else { _onlyHasDefaultCommand = BooleanOption.False; } } else { _onlyHasDefaultCommand = BooleanOption.False; } } return(_onlyHasDefaultCommand == BooleanOption.True); }
public IPluginOptionViewModel Construct(IOption option) { if (option is IListOption) { var optionType = option.GetType().FindBaseType(typeof(ListOption <>)); if (optionType != null) { var tValue = optionType.GetGenericArguments().First(); var generic = _constructListOptionMethodInfo.MakeGenericMethod(tValue); var opt = generic.Invoke(this, new object?[] { option }); if (opt != null) { return((IPluginOptionViewModel)opt); } } } return(option switch { BooleanOption bOption => new PluginBooleanOptionViewModel(bOption, _localizationProvider), NumberOption nOption => new PluginNumberOptionViewModel(nOption, _localizationProvider), TextOption tOption => new PluginTextOptionViewModel(tOption, _localizationProvider), CommandOption cOption => new PluginCommandOptionViewModel(cOption, _localizationProvider), EncryptedTextOption eOption => new PluginEncryptedTextOptionViewModel(eOption, _localizationProvider), StringCollectionOption sOption => new PluginStringCollectionOptionViewModel(sOption, _localizationProvider), DisplayOption dOption => new PluginDisplayOptionViewModel(dOption, _localizationProvider), _ => ConstructDisplayOption(option) });
public CfgBoolComponent(string name, BooleanOption option) : this(name) { comboBox_.Items.Clear(); comboBox_.Items.Add(selectedLocale_["boolDisabled"]); comboBox_.Items.Add(selectedLocale_["boolEnabled"]); comboBox_.SelectedIndex = option.Value ? 1 : 0; default_ = option.Default; }
private void SwagItemsControl_Add(object sender, RoutedEventArgs e) { FrameworkElement fe = (FrameworkElement)e.OriginalSource; ICollection <SwagOption> col = (ICollection <SwagOption>)fe.DataContext; SwagOption opt = null; String tag = (fe.Tag ?? "").ToString(); switch (tag) { case "GROUP": opt = new SwagOptionGroup(); break; case "STRING": opt = new StringOption(); break; case "DATE": opt = new DateOption(); break; case "BOOL": opt = new BooleanOption(); break; } col.Add(opt); CollectionViewSource.GetDefaultView(col).Refresh(); }
/// <summary> /// /// </summary> /// <param name="value"></param> /// <param name="language">Ensure language is installed manually with NAPS GUI or via <see cref="InstallOcr(string)"/></param> /// <returns></returns> public Naps2ScanJob ToggleOcr(bool value, string language = "eng") { var disable = new BooleanOption(OcrFlags.OcrDisable); // Implies enabled var lang = new StringOption(OcrFlags.OcrLang, language); Args.Toggle(lang, value); Args.Toggle(disable, !value); return(this); }
public void ConstructorShouldSetCorrectValue(bool expected) { // Arrange var sut = new BooleanOption(expected, "name", "description"); // Act var actual = sut.Value; // Assert Assert.Equal(expected, actual); }
internal ConnectionOptions() { odbc = new BooleanOption(); host = new ListOption(); uid = new StringOption(); pwd = new StringOption(); database = new StringOption(); charset = new StringOption(); encrypt = new StringOption(); persistSecurityInfo = new BooleanOption(); connectionTimeout = new IntegerOption(); connectionLifetime = new IntegerOption(); minPoolSize = new IntegerOption(); maxPoolSize = new IntegerOption(); pooling = new BooleanOption(); enlist = new BooleanOption(); roundrobin = new BooleanOption(); Reset(); options = CollectionsUtil.CreateCaseInsensitiveHashtable(23); options.Add(ODBC, odbc); options.Add(HOST, host); options.Add(DATASOURCE, host); options.Add(SERVER, host); options.Add(ADDRESS, host); options.Add(NETWORKADDRESS, host); options.Add(UID, uid); options.Add(USER_ID, uid); options.Add(USERID, uid); options.Add(PWD, pwd); options.Add(PASSWORD, pwd); options.Add(DATABASE, database); options.Add(INITIALCATALOG, database); options.Add(CHARSET, charset); options.Add(ENCRYPT, encrypt); options.Add(PERSISTSECURITYINFO, persistSecurityInfo); options.Add(PERSIST_SECURITY_INFO, persistSecurityInfo); options.Add(CONNECTTIMEOUT, connectionTimeout); options.Add(CONNECT_TIMEOUT, connectionTimeout); options.Add(CONNECTIONTIMEOUT, connectionTimeout); options.Add(CONNECTION_TIMEOUT, connectionTimeout); options.Add(CONNECTIONLIFETIME, connectionLifetime); options.Add(CONNECTION_LIFETIME, connectionLifetime); options.Add(MINPOOLSIZE, minPoolSize); options.Add(MIN_POOL_SIZE, minPoolSize); options.Add(MAXPOOLSIZE, maxPoolSize); options.Add(MAX_POOL_SIZE, maxPoolSize); options.Add(POOLING, pooling); options.Add(ENLIST, enlist); options.Add(ROUNDROBIN, roundrobin); options.Add(ROUND_ROBIN, roundrobin); }
/// <include file='doc\WmlObjectListAdapter.uex' path='docs/doc[@for="WmlObjectListAdapter.HasItemDetails"]/*' /> protected bool HasItemDetails() { if (Control.Items.Count == 0) { return(false); } if (_hasItemDetails == BooleanOption.NotSet) { // Calculate how many visible fields are shown in list view. int visibleFieldsInListView; int[] tableFieldIndices; if (ShouldRenderAsTable() && (tableFieldIndices = Control.TableFieldIndices).Length != 0) { visibleFieldsInListView = 0; for (int i = 0; i < tableFieldIndices.Length; i++) { if (Control.AllFields[tableFieldIndices[i]].Visible) { visibleFieldsInListView++; } } } else { visibleFieldsInListView = Control.AllFields[Control.LabelFieldIndex].Visible ? 1 : 0; } // Calculate the number of visible fields. _hasItemDetails = BooleanOption.False; int visibleFieldCount = 0; foreach (ObjectListField field in Control.AllFields) { if (field.Visible) { visibleFieldCount++; if (visibleFieldCount > visibleFieldsInListView) { _hasItemDetails = BooleanOption.True; break; } } } } return(_hasItemDetails == BooleanOption.True); }
public static bool ToBool(this BooleanOption value, bool defaultValue = true) { switch (value) { case BooleanOption.True: return(true); case BooleanOption.False: return(false); case BooleanOption.All: default: return(defaultValue); } }
public void UpdateManager(StoryProgressionObject manager) { mManager = manager; mAgeGenderOptions = new List <AgeGenderOption>(); foreach (string name in mUserAgeGenders) { AgeGenderOption option = manager.GetOption <AgeGenderOption>(name); if (option == null) { continue; } mAgeGenderOptions.Add(option); } StoryProgressionObject valueTestManager = manager; if (!string.IsNullOrEmpty(mClan)) { valueTestManager = manager.Personalities.GetPersonality(mClan); } List <IValueTestOption> values = new List <IValueTestOption>(); if (valueTestManager != null) { foreach (ValueTestLoadStore store in mValueTestLoads) { IntegerOption intOption = manager.GetOption <IntegerOption>(store.mName); if (intOption != null) { values.Add(new IntegerOption.ValueTest(intOption, store.mMinimum, store.mMaximum)); } else { BooleanOption boolOption = manager.GetOption <BooleanOption>(store.mName); if (boolOption != null) { values.Add(new BooleanOption.ValueTest(boolOption, store.mMatch)); } } } } mValueTestOptions = values; }
private void InitializeOptions(SetOptionDelegate setOption) { var makeByteOption = ByteOption.CreateFactory(BaseAddress, this.onChange, "SoundPlay Settings", setOption); var makeBooleanOption = BooleanOption.CreateFactory(BaseAddress, this.onChange, "SoundPlay Settings", setOption); PlayMusicWhenMounted = makeBooleanOption(OptionKind.PlayMusicWhenMounted, OptionOffsets.PlayMusicWhenMounted, null); PlayMusicWhenMounted.Hack = false; EnableNormalBattleMusic = makeBooleanOption(OptionKind.EnableNormalBattleMusic, OptionOffsets.EnableNormalBattleMusic, null); EnableNormalBattleMusic.Hack = false; EnableCityStateBGM = makeBooleanOption(OptionKind.EnableCityStateBGM, OptionOffsets.EnableCityStateBGM, null); EnableCityStateBGM.Hack = false; PlaySystemSounds = makeBooleanOption(OptionKind.PlaySystemSounds, OptionOffsets.PlaySystemSounds, null); PlaySystemSounds.Hack = false; MasterVolume = makeByteOption(OptionKind.Master, OptionOffsets.MasterVolume, "SoundMaster"); Bgm = makeByteOption(OptionKind.Bgm, OptionOffsets.Bgm, "SoundBgm"); SoundEffects = makeByteOption(OptionKind.SoundEffects, OptionOffsets.SoundEffects, "SoundSe"); Voice = makeByteOption(OptionKind.Voice, OptionOffsets.Voice, "SoundVoice"); SystemSounds = makeByteOption(OptionKind.SystemSounds, OptionOffsets.SystemSounds, "SoundSystem"); AmbientSounds = makeByteOption(OptionKind.AmbientSounds, OptionOffsets.AmbientSounds, "SoundEnv"); Performance = makeByteOption(OptionKind.Performance, OptionOffsets.Performance, "SoundPerform"); Self = makeByteOption(OptionKind.Self, OptionOffsets.Self, "SoundPlayer"); Party = makeByteOption(OptionKind.Party, OptionOffsets.Party, "SoundParty"); OtherPCs = makeByteOption(OptionKind.OtherPCs, OptionOffsets.OtherPCs, "SoundOther"); MasterVolumeMuted = makeBooleanOption(OptionKind.MasterMuted, OptionOffsets.MasterVolumeMuted, "IsSndMaster"); BgmMuted = makeBooleanOption(OptionKind.BgmMuted, OptionOffsets.BgmMuted, "IsSndBgm"); SoundEffectsMuted = makeBooleanOption(OptionKind.SoundEffectsMuted, OptionOffsets.SoundEffectsMuted, "IsSndSe"); VoiceMuted = makeBooleanOption(OptionKind.VoiceMuted, OptionOffsets.VoiceMuted, "IsSndVoice"); SystemSoundsMuted = makeBooleanOption(OptionKind.SystemSoundsMuted, OptionOffsets.SystemSoundsMuted, "IsSndSystem"); AmbientSoundsMuted = makeBooleanOption(OptionKind.AmbientSoundsMuted, OptionOffsets.AmbientSoundsMuted, "IsSndEnv"); PerformanceMuted = makeBooleanOption(OptionKind.PerformanceMuted, OptionOffsets.PerformanceMuted, "IsSndPerform"); EqualizerMode = new EqualizerModeOption { BaseAddress = BaseAddress, Offset = OptionOffsets.EqualizerMode, Kind = OptionKind.EqualizerMode, CfgSection = "SoundPlay Settings", CfgSetting = "SoundEqualizerType", OnChange = this.onChange, SetFunction = setOption, }; }
/// <include file='doc\XhtmlBasicTextViewAdapter.uex' path='docs/doc[@for="XhtmlTextViewAdapter.RenderElement"]/*' /> public void RenderElement(XhtmlMobileTextWriter writer, int index, int beginSubstring, int endSubstring) { TextViewElement element = Control.GetElement(index); writer.WritePendingBreak(); if (endSubstring == -1) { endSubstring = element.Text.Length; } String text = element.Text; if (beginSubstring > 0 || endSubstring < text.Length) { text = text.Substring(beginSubstring, endSubstring - beginSubstring); } BooleanOption prevBold = Style.Font.Bold; BooleanOption prevItalic = Style.Font.Italic; if (element.IsBold) { Style.Font.Bold = BooleanOption.True; } if (element.IsItalic) { Style.Font.Italic = BooleanOption.True; } ConditionalEnterStyle(writer, Style); if (element.Url != null) { RenderBeginLink(writer, element.Url); writer.WriteEncodedText(text); RenderEndLink(writer); } else { writer.WriteEncodedText(text); } if (element.BreakAfter) { writer.SetPendingBreak(); } ConditionalExitStyle(writer, Style); Style.Font.Bold = prevBold; Style.Font.Italic = prevItalic; }
private void RenderElement(HtmlMobileTextWriter writer, int index, int begin, int end) { TextViewElement element = Control.GetElement(index); if (end == -1) { end = element.Text.Length; } String text = element.Text; if (begin > 0 || end < text.Length) { text = text.Substring(begin, end - begin); } BooleanOption previousBold = Style.Font.Bold; BooleanOption previousItalic = Style.Font.Italic; if (element.IsBold) { Style.Font.Bold = BooleanOption.True; } if (element.IsItalic) { Style.Font.Italic = BooleanOption.True; } writer.EnterStyle(Style); if (element.Url != null) { RenderBeginLink(writer, element.Url); writer.WriteText(text, true); RenderEndLink(writer); } else { writer.WriteText(text, true); } writer.ExitStyle(Style, element.BreakAfter); Style.Font.Bold = previousBold; Style.Font.Italic = previousItalic; }
/// <include file='doc\HtmlObjectListAdapter.uex' path='docs/doc[@for="HtmlObjectListAdapter.HasItemDetails"]/*' /> protected bool HasItemDetails() { if (_hasItemDetails == BooleanOption.NotSet) { // Calculate how many visible fields are shown in list view. int visibleFieldsInListView; int[] tableFieldIndices = Control.TableFieldIndices; if (ShouldRenderAsTable() && tableFieldIndices.Length != 0) { visibleFieldsInListView = VisibleTableFieldsCount; Debug.Assert(visibleFieldsInListView >= 0, "visibleFieldsInListView is negative"); } else { visibleFieldsInListView = Control.AllFields[Control.LabelFieldIndex].Visible ? 1 : 0; } // Calculate the number of visible fields. _hasItemDetails = BooleanOption.False; int visibleFieldCount = 0; foreach (ObjectListField field in Control.AllFields) { if (field.Visible) { visibleFieldCount++; if (visibleFieldCount > visibleFieldsInListView) { _hasItemDetails = BooleanOption.True; break; } } } } return(_hasItemDetails == BooleanOption.True); }
/// <include file='doc\HtmlObjectListAdapter.uex' path='docs/doc[@for="HtmlObjectListAdapter.OnlyHasDefaultCommand"]/*' /> protected bool OnlyHasDefaultCommand() { if (_onlyHasDefaultCommand == BooleanOption.NotSet) { String defaultCommand = Control.DefaultCommand; if (defaultCommand.Length > 0) { int commandCount = Control.Commands.Count; if (commandCount == 0 || (commandCount == 1 && String.Compare(defaultCommand, Control.Commands[0].Name, StringComparison.OrdinalIgnoreCase) == 0)) { _onlyHasDefaultCommand = BooleanOption.True; } else { _onlyHasDefaultCommand = BooleanOption.False; } } else { _onlyHasDefaultCommand = BooleanOption.False; } } return _onlyHasDefaultCommand == BooleanOption.True; }
public void ConverterToBoolWithDefault(BooleanOption source, bool defaultValue, bool expected, string message) { bool result = source.ToBool(defaultValue); result.Should().Be(expected, message); }
private BooleanOption GetNegatedBooleanOption(BooleanOption oldValue) { switch (oldValue) { case -1: return 1; case 0: return 1; case 1: return 0; } return -1; }
public void ConverterToEnum(string source, BooleanOption expected, string message) { BooleanOption result = source.ToEnum <BooleanOption>(); result.Should().Be(expected, message); }
public void ConverterToBool(BooleanOption source, bool expected, string message) { bool result = source.ToBool(); result.Should().Be(expected, message); }
internal ConnectionOptions () { odbc = new BooleanOption (); host = new ListOption (); uid = new StringOption (); pwd = new StringOption (); database = new StringOption (); charset = new StringOption (); encrypt = new StringOption (); persistSecurityInfo = new BooleanOption (); connectionTimeout = new IntegerOption (); connectionLifetime = new IntegerOption (); minPoolSize = new IntegerOption (); maxPoolSize = new IntegerOption (); pooling = new BooleanOption (); enlist = new BooleanOption (); roundrobin = new BooleanOption (); Reset (); options = CollectionsUtil.CreateCaseInsensitiveHashtable (23); options.Add (ODBC, odbc); options.Add (HOST, host); options.Add (DATASOURCE, host); options.Add (SERVER, host); options.Add (ADDRESS, host); options.Add (NETWORKADDRESS, host); options.Add (UID, uid); options.Add (USER_ID, uid); options.Add (USERID, uid); options.Add (PWD, pwd); options.Add (PASSWORD, pwd); options.Add (DATABASE, database); options.Add (INITIALCATALOG, database); options.Add (CHARSET, charset); options.Add (ENCRYPT, encrypt); options.Add (PERSISTSECURITYINFO, persistSecurityInfo); options.Add (PERSIST_SECURITY_INFO, persistSecurityInfo); options.Add (CONNECTTIMEOUT, connectionTimeout); options.Add (CONNECT_TIMEOUT, connectionTimeout); options.Add (CONNECTIONTIMEOUT, connectionTimeout); options.Add (CONNECTION_TIMEOUT, connectionTimeout); options.Add (CONNECTIONLIFETIME, connectionLifetime); options.Add (CONNECTION_LIFETIME, connectionLifetime); options.Add (MINPOOLSIZE, minPoolSize); options.Add (MIN_POOL_SIZE, minPoolSize); options.Add (MAXPOOLSIZE, maxPoolSize); options.Add (MAX_POOL_SIZE, maxPoolSize); options.Add (POOLING, pooling); options.Add (ENLIST, enlist); options.Add (ROUNDROBIN, roundrobin); options.Add (ROUND_ROBIN, roundrobin); }
public void ConverterToEnum(string source, BooleanOption expected, string message) { BooleanOption result = source.ToEnum<BooleanOption>(); result.Should().Be(expected, message); }
/// <include file='doc\WmlObjectListAdapter.uex' path='docs/doc[@for="WmlObjectListAdapter.HasItemDetails"]/*' /> protected bool HasItemDetails() { if(Control.Items.Count == 0) { return false; } if (_hasItemDetails == BooleanOption.NotSet) { // Calculate how many visible fields are shown in list view. int visibleFieldsInListView; int[] tableFieldIndices; if (ShouldRenderAsTable() && (tableFieldIndices = Control.TableFieldIndices).Length != 0) { visibleFieldsInListView = 0; for (int i = 0; i < tableFieldIndices.Length; i++) { if (Control.AllFields[tableFieldIndices[i]].Visible) { visibleFieldsInListView++; } } } else { visibleFieldsInListView = Control.AllFields[Control.LabelFieldIndex].Visible ? 1 : 0; } // Calculate the number of visible fields. _hasItemDetails = BooleanOption.False; int visibleFieldCount = 0; foreach (ObjectListField field in Control.AllFields) { if (field.Visible) { visibleFieldCount++; if (visibleFieldCount > visibleFieldsInListView) { _hasItemDetails = BooleanOption.True; break; } } } } return _hasItemDetails == BooleanOption.True; }
private void RenderItemDetailsWithTableTags(HtmlMobileTextWriter writer, ObjectListItem item) { Style style = this.Style; Style labelStyle = Control.LabelStyle; Style subCommandStyle = Control.CommandStyle; Color foreColor = (Color)style[Style.ForeColorKey, true]; writer.Write("<table border=0 width=\"100%\">\r\n<tr><td colspan=2>"); writer.BeginStyleContext(); writer.EnterStyle(labelStyle); writer.WriteText(item[Control.LabelFieldIndex], true); writer.ExitStyle(labelStyle); writer.EndStyleContext(); writer.Write("</td></tr>\r\n<tr>"); RenderRule(writer, foreColor, 2); IObjectListFieldCollection fields = Control.AllFields; int fieldIndex = 0; foreach (ObjectListField field in fields) { if (field.Visible) { writer.Write("<tr><td>"); writer.BeginStyleContext(); writer.EnterStyle(Style); writer.WriteText(field.Title, true); writer.ExitStyle(Style); writer.EndStyleContext(); writer.Write("</td><td>"); writer.BeginStyleContext(); writer.EnterStyle(style); writer.WriteText(item[fieldIndex], true); writer.ExitStyle(style); writer.EndStyleContext(); writer.Write("</td></tr>\r\n"); } fieldIndex++; } RenderRule(writer, foreColor, 2); writer.Write("<tr><td colspan=2>"); writer.BeginStyleContext(); BooleanOption cachedItalic = subCommandStyle.Font.Italic; subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterStyle(subCommandStyle); writer.Write("[ "); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; writer.EnterStyle(subCommandStyle); ObjectListCommandCollection commands = Control.Commands; foreach (ObjectListCommand command in commands) { RenderPostBackEventAsAnchor(writer, command.Name, command.Text, subCommandStyle); writer.Write(" | "); } String backCommandText = Control.BackCommandText.Length == 0 ? GetDefaultLabel(BackLabel) : Control.BackCommandText; RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, subCommandStyle); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterStyle(subCommandStyle); writer.Write(" ]"); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; writer.EndStyleContext(); writer.Write("</td></tr></table>"); }
/// <summary> /// Apply the currently selected style to the preview label. /// This function should only be called after making sure that there is no /// cycle that starts with _tvDefinedStyles.SelectedItem /// </summary> private void ApplyStyle() { StyleNode currentStyleItem = (StyleNode)SelectedStyle; Style currentStyle = currentStyleItem.RuntimeStyle; Color foreColor = currentStyle.ForeColor; Color backColor = currentStyle.BackColor; BooleanOption fontBold = currentStyle.Font.Bold; BooleanOption fontItalic = currentStyle.Font.Italic; FontSize fontSize = currentStyle.Font.Size; String fontName = currentStyle.Font.Name; String reference = currentStyle.StyleReference; bool found = true; while ((reference != null && reference.Length > 0) && found) { found = false; foreach (StyleNode styleNode in _tvDefinedStyles.Nodes) { Style style = styleNode.RuntimeStyle; if (0 == String.Compare(style.Name, reference, true, CultureInfo.InvariantCulture)) { if (foreColor == Color.Empty) { foreColor = style.ForeColor; } if (backColor == Color.Empty) { backColor = style.BackColor; } if (fontBold == BooleanOption.NotSet) { fontBold = style.Font.Bold; } if (fontItalic == BooleanOption.NotSet) { fontItalic = style.Font.Italic; } if (fontSize == FontSize.NotSet) { fontSize = style.Font.Size; } if (fontName == String.Empty) { fontName = style.Font.Name; } reference = style.StyleReference; found = true; break; } } // If not found, check default styles if (!found) { if (null != StyleSheet.Default[reference]) { Style style = StyleSheet.Default[reference]; if (foreColor == Color.Empty) { foreColor = style.ForeColor; } if (backColor == Color.Empty) { backColor = style.BackColor; } if (fontBold == BooleanOption.NotSet) { fontBold = style.Font.Bold; } if (fontItalic == BooleanOption.NotSet) { fontItalic = style.Font.Italic; } if (fontSize == FontSize.NotSet) { fontSize = style.Font.Size; } if (fontName == String.Empty) { fontName = style.Font.Name; } reference = null; found = true; break; } } } _previewStyle.ForeColor = foreColor; _previewStyle.BackColor = backColor; _previewStyle.Font.Name = fontName; _previewStyle.Font.Size = fontSize; _previewStyle.Font.Bold = fontBold; _previewStyle.Font.Italic = fontItalic; }
private string GetGoldenGoalOptionId(BooleanOption i_Option) { int index = (int)i_Option; return(GetGoldenGoalOptionIdByIndex(index)); }
private string GetRefereeOptionId(BooleanOption i_Option) { int index = (int)i_Option; return(GetRefereeOptionIdByIndex(index)); }
private Naps2ScanJob AddBooleanOption(string key, bool enabled = true) { var option = new BooleanOption(key); return(AddOption(option, enabled)); }
/// <include file='doc\XhtmlBasicObjectListAdapter.uex' path='docs/doc[@for="XhtmlObjectListAdapter.HasItemDetails"]/*' /> protected virtual bool HasItemDetails() { if (_hasItemDetails == BooleanOption.NotSet) { // Calculate how many visible fields are shown in list view. int visibleFieldsInListView; int[] tableFieldIndices = Control.TableFieldIndices; if (tableFieldIndices.Length != 0) { visibleFieldsInListView = VisibleTableFieldsCount; } else { visibleFieldsInListView = Control.AllFields[Control.LabelFieldIndex].Visible ? 1 : 0; } // Calculate the number of visible fields. _hasItemDetails = BooleanOption.False; int visibleFieldCount = 0; foreach (ObjectListField field in Control.AllFields) { if (field.Visible) { visibleFieldCount++; if (visibleFieldCount > visibleFieldsInListView) { _hasItemDetails = BooleanOption.True; break; } } } } return _hasItemDetails == BooleanOption.True; }
public PluginBooleanOptionViewModel(BooleanOption valueOption, ILocalizationProvider localizationProvider) : base(valueOption.Value, valueOption.NameTextId) { _pluginOptionViewModelImplementation = new PluginOptionViewModelImplementation <bool>(valueOption, localizationProvider, this); }
internal static BooleanOption GetNegatedBooleanOption(BooleanOption oldValue) { switch (oldValue) { case -1: return 1; case 0: return 1; case 1: return 0; } return -1; }
private void RenderItemsListWithoutTableTags(HtmlMobileTextWriter writer) { int startIndex = Control.FirstVisibleItemIndex; int pageSize = Control.VisibleItemCount; ObjectListItemCollection items = Control.Items; IObjectListFieldCollection allFields = Control.AllFields; int count = allFields.Count; int nextStartIndex = startIndex + pageSize; int labelFieldIndex = Control.LabelFieldIndex; Style style = this.Style; Style labelStyle = Control.LabelStyle; writer.EnterStyle(labelStyle); writer.WriteText(Control.AllFields[labelFieldIndex].Title, true); writer.ExitStyle(labelStyle, true); bool hasDefaultCommand = HasDefaultCommand(); bool onlyHasDefaultCommand = OnlyHasDefaultCommand(); bool requiresDetailsScreen = !onlyHasDefaultCommand && HasCommands(); // if there is > 1 visible field, need a details screen for (int visibleFields = 0, i = 0; !requiresDetailsScreen && i < count; i++) { visibleFields += allFields[i].Visible ? 1 : 0; requiresDetailsScreen = requiresDetailsScreen || visibleFields > 1; } bool itemRequiresHyperlink = requiresDetailsScreen || hasDefaultCommand; bool itemRequiresMoreButton = requiresDetailsScreen && hasDefaultCommand; Style subCommandStyle = Control.CommandStyle; subCommandStyle.Alignment = style.Alignment; subCommandStyle.Wrapping = style.Wrapping; writer.EnterStyle(style); for (int i = startIndex; i < nextStartIndex; i++) { ObjectListItem item = items[i]; if (itemRequiresHyperlink) { RenderPostBackEventAsAnchor(writer, hasDefaultCommand ? item.Index.ToString(CultureInfo.InvariantCulture) : String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index), item[labelFieldIndex]); } else { writer.WriteText(item[labelFieldIndex], true); } if (itemRequiresMoreButton) { BooleanOption cachedItalic = subCommandStyle.Font.Italic; subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterFormat(subCommandStyle); writer.Write(" ["); writer.ExitFormat(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; writer.EnterFormat(subCommandStyle); String moreText = Control.MoreText.Length == 0 ? GetDefaultLabel(MoreLabel) : Control.MoreText; writer.WriteBeginTag("a"); RenderPostBackEventAsAttribute(writer, "href", String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index)); writer.Write(">"); writer.WriteText(moreText, true); writer.WriteEndTag("a"); writer.ExitFormat(subCommandStyle); subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterFormat(subCommandStyle); writer.Write("]"); writer.ExitFormat(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; } if (i < (nextStartIndex - 1)) { writer.WriteBreak(); } } writer.ExitStyle(style, Control.BreakAfter); }
private void RenderItemsListWithoutTableTags(XhtmlMobileTextWriter writer) { if (Control.VisibleItemCount == 0) { return; } ConditionalRenderOpeningDivElement(writer); int startIndex = Control.FirstVisibleItemIndex; int pageSize = Control.VisibleItemCount; ObjectListItemCollection items = Control.Items; IObjectListFieldCollection allFields = Control.AllFields; int count = allFields.Count; int nextStartIndex = startIndex + pageSize; int labelFieldIndex = Control.LabelFieldIndex; Style style = this.Style; Style labelStyle = Control.LabelStyle; String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute); String labelClass = GetCustomAttributeValue(XhtmlConstants.CssLabelClassCustomAttribute); if (labelClass == null || labelClass.Length == 0) { labelClass = cssClass; } ConditionalEnterStyle(writer, labelStyle); bool requiresLabelClassSpan = CssLocation == StyleSheetLocation.PhysicalFile && labelClass != null && labelClass.Length > 0; if (requiresLabelClassSpan) { writer.WriteBeginTag("span"); writer.WriteAttribute("class", labelClass, true); writer.Write(">"); } writer.Write(Control.AllFields[labelFieldIndex].Title); writer.SetPendingBreak(); if (requiresLabelClassSpan) { writer.WriteEndTag("span"); } ConditionalExitStyle(writer, labelStyle); writer.WritePendingBreak(); bool hasDefaultCommand = HasDefaultCommand(); bool onlyHasDefaultCommand = OnlyHasDefaultCommand(); bool requiresDetailsScreen = !onlyHasDefaultCommand && HasCommands(); // if there is > 1 visible field, need a details screen for (int visibleFields = 0, i = 0; !requiresDetailsScreen && i < count; i++) { visibleFields += allFields[i].Visible ? 1 : 0; requiresDetailsScreen = requiresDetailsScreen || visibleFields > 1; } bool itemRequiresHyperlink = requiresDetailsScreen || hasDefaultCommand; bool itemRequiresMoreButton = requiresDetailsScreen && hasDefaultCommand; Style subCommandStyle = Control.CommandStyle; subCommandStyle.Alignment = style.Alignment; subCommandStyle.Wrapping = style.Wrapping; ConditionalEnterStyle(writer, style); for (int i = startIndex; i < nextStartIndex; i++) { ObjectListItem item = items[i]; String accessKey = GetCustomAttributeValue(item, XhtmlConstants.AccessKeyCustomAttribute); String itemClass = GetCustomAttributeValue(item, XhtmlConstants.CssClassCustomAttribute); if (itemRequiresHyperlink) { RenderPostBackEventAsAnchor(writer, hasDefaultCommand ? item.Index.ToString(CultureInfo.InvariantCulture) : String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index), item[labelFieldIndex], accessKey, Style, cssClass); } else { bool requiresItemClassSpan = CssLocation == StyleSheetLocation.PhysicalFile && itemClass != null && itemClass.Length > 0; if (requiresItemClassSpan) { writer.WriteBeginTag("span"); writer.WriteAttribute("class", itemClass, true); writer.Write(">"); } writer.Write(item[labelFieldIndex]); if (requiresItemClassSpan) { writer.WriteEndTag("span"); } } if (itemRequiresMoreButton) { String commandClass = GetCustomAttributeValue(XhtmlConstants.CssCommandClassCustomAttribute); BooleanOption cachedItalic = subCommandStyle.Font.Italic; subCommandStyle.Font.Italic = BooleanOption.False; ConditionalEnterFormat(writer, subCommandStyle); if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true") { writer.Write(" ["); } ConditionalExitFormat(writer, subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; ConditionalEnterFormat(writer, subCommandStyle); String controlMT = Control.MoreText; String moreText = (controlMT == null || controlMT.Length == 0) ? GetDefaultLabel(MoreLabel) : controlMT; RenderPostBackEventAsAnchor(writer, String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index), moreText, null /*accessKey*/, subCommandStyle, commandClass); ConditionalExitFormat(writer, subCommandStyle); subCommandStyle.Font.Italic = BooleanOption.False; ConditionalEnterFormat(writer, subCommandStyle); if ((String)Device[XhtmlConstants.BreaksOnInlineElements] != "true") { writer.Write("]"); } ConditionalExitFormat(writer, subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; } if (i < (nextStartIndex - 1)) { writer.WriteBreak(); } else { writer.SetPendingBreak(); } } ConditionalExitStyle(writer, style); ConditionalRenderClosingDivElement(writer); }
private void RenderItemDetailsWithoutTableTags(HtmlMobileTextWriter writer, ObjectListItem item) { Style style = this.Style; Style labelStyle = Control.LabelStyle; Style subCommandStyle = Control.CommandStyle; writer.EnterStyle(labelStyle); writer.WriteText(item[Control.LabelFieldIndex], true); writer.ExitStyle(labelStyle, true); IObjectListFieldCollection fields = Control.AllFields; int fieldIndex = 0; bool boldInStyle = (style.Font.Bold == BooleanOption.True) ? true : false; writer.EnterStyle(style); foreach (ObjectListField field in fields) { if (field.Visible) { if (!boldInStyle) { writer.Write("<b>"); } writer.WriteText(field.Title + ":", true); if (!boldInStyle) { writer.Write("</b>"); } writer.Write(" "); writer.WriteText(item[fieldIndex], true); writer.WriteBreak(); } fieldIndex++; } writer.ExitStyle(style); BooleanOption cachedItalic = subCommandStyle.Font.Italic; subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterStyle(subCommandStyle); writer.Write("[ "); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = cachedItalic; writer.EnterStyle(subCommandStyle); ObjectListCommandCollection commands = Control.Commands; foreach (ObjectListCommand command in commands) { RenderPostBackEventAsAnchor(writer, command.Name, command.Text, subCommandStyle); writer.Write(" | "); } String backCommandText = Control.BackCommandText.Length == 0 ? GetDefaultLabel(BackLabel) : Control.BackCommandText; RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, subCommandStyle); writer.ExitStyle(subCommandStyle); subCommandStyle.Font.Italic = BooleanOption.False; writer.EnterStyle(subCommandStyle); writer.Write(" ]"); writer.ExitStyle(subCommandStyle, Control.BreakAfter); subCommandStyle.Font.Italic = cachedItalic; }
private void RenderItemDetailsWithoutTableTags(HtmlMobileTextWriter writer, ObjectListItem item) { Style style1 = base.Style; Style style2 = Control.LabelStyle; Style style3 = Control.CommandStyle; writer.EnterStyle(style2); writer.WriteText(item[Control.LabelFieldIndex], true); writer.ExitStyle(style2, true); IObjectListFieldCollection iObjectListFieldCollection = Control.AllFields; int i = 0; bool flag = style1.Font.Bold == BooleanOption.True; writer.EnterStyle(style1); IEnumerator iEnumerator = iObjectListFieldCollection.GetEnumerator(); while (iEnumerator.MoveNext()) { ObjectListField objectListField = (ObjectListField)iEnumerator.Current; if (objectListField.Visible) { if (!flag) { writer.Write("<b>"); } writer.WriteText(String.Concat(objectListField.Title, ":"), true); if (!flag) { writer.Write("</b>"); } writer.Write(" "); if (objectListField.Name == "CALL") { writer.WriteText(HtmlcheckPhonenumber(item[i]), true); } else if (objectListField.Name == "MAIL") { writer.WriteText(HtmlMail(item[i]), true); } else { writer.WriteText(item[i], true); } writer.WriteBreak(); } i++; } writer.ExitStyle(style1); BooleanOption booleanOption = style3.Font.Italic; style3.Font.Italic = BooleanOption.False; writer.EnterStyle(style3); writer.Write("[ "); writer.ExitStyle(style3); style3.Font.Italic = booleanOption; writer.EnterStyle(style3); iEnumerator = Control.Commands.GetEnumerator(); while (iEnumerator.MoveNext()) { ObjectListCommand objectListCommand = (ObjectListCommand)iEnumerator.Current; RenderPostBackEventAsAnchor(writer, objectListCommand.Name, objectListCommand.Text, style3); writer.Write(" | "); } string str = (Control.BackCommandText != String.Empty) ? Control.BackCommandText : base.GetDefaultLabel(ControlAdapter.BackLabel); RenderPostBackEventAsAnchor(writer, BackToList, str, style3); writer.ExitStyle(style3); style3.Font.Italic = BooleanOption.False; writer.EnterStyle(style3); writer.Write(" ]"); writer.ExitStyle(style3, Control.BreakAfter); style3.Font.Italic = booleanOption; }
/// <summary> /// Erzeugt ein neues CheckBoxItem-Objekt und initialisiert dieses mit dem zugehörigen IGameScreen-Objekt. /// Zudem sind Angaben zur Zeichenreihenfolge und der Auswahloption Pflicht. /// </summary> public CheckBoxItem(IScreen screen, DisplayLayer drawOrder, string text, BooleanOption option) : base(screen, drawOrder, text) { this.option = option; currentValue = option.Value; }
private void RenderItemDetailsWithTableTags(HtmlMobileTextWriter writer, ObjectListItem item) { Style style1 = base.Style; Style style2 = Control.LabelStyle; Style style3 = Control.CommandStyle; Color color = (Color)style1[Style.ForeColorKey, true]; writer.Write("<table border=0 width=\"100%\">\r\n<tr><td colspan=2>"); writer.BeginStyleContext(); writer.EnterStyle(style2); writer.WriteText(item[Control.LabelFieldIndex], true); writer.ExitStyle(style2); writer.EndStyleContext(); writer.Write("</td></tr>\r\n<tr>"); RenderRule(writer, color, 2); IObjectListFieldCollection iObjectListFieldCollection = Control.AllFields; int i = 0; IEnumerator iEnumerator = iObjectListFieldCollection.GetEnumerator(); while (iEnumerator.MoveNext()) { ObjectListField objectListField = (ObjectListField)iEnumerator.Current; if (objectListField.Visible) { writer.Write("<tr><td>"); writer.BeginStyleContext(); writer.EnterStyle(base.Style); writer.WriteText(objectListField.Title, true); writer.ExitStyle(base.Style); writer.EndStyleContext(); writer.Write("</td><td>"); writer.BeginStyleContext(); writer.EnterStyle(style1); if (objectListField.Name == "CALL") { writer.WriteText(HtmlcheckPhonenumber(item[i]), false); } else if (objectListField.Name == "MAIL") { writer.WriteText(HtmlMail(item[i]), false); } else { writer.WriteText(item[i], false); } writer.ExitStyle(style1); writer.EndStyleContext(); writer.Write("</td></tr>\r\n"); } i++; } RenderRule(writer, color, 2); writer.Write("<tr><td colspan=2>"); writer.BeginStyleContext(); BooleanOption booleanOption = style3.Font.Italic; style3.Font.Italic = BooleanOption.False; writer.EnterStyle(style3); writer.Write("[ "); writer.ExitStyle(style3); style3.Font.Italic = booleanOption; writer.EnterStyle(style3); iEnumerator = Control.Commands.GetEnumerator(); while (iEnumerator.MoveNext()) { ObjectListCommand objectListCommand = (ObjectListCommand)iEnumerator.Current; RenderPostBackEventAsAnchor(writer, objectListCommand.Name, objectListCommand.Text, style3); writer.Write(" | "); } string str = (Control.BackCommandText != String.Empty) ? Control.BackCommandText : base.GetDefaultLabel(ControlAdapter.BackLabel); RenderPostBackEventAsAnchor(writer, BackToList, str, style3); writer.ExitStyle(style3); style3.Font.Italic = BooleanOption.False; writer.EnterStyle(style3); writer.Write(" ]"); writer.ExitStyle(style3); style3.Font.Italic = booleanOption; writer.EndStyleContext(); writer.Write("</td></tr></table>"); }