public static ContentVisibilities SanitizeValue(ContentVisibilities vis) { if ((vis & ContentVisibilities.NgDontCare) == ContentVisibilities.None) { vis |= ContentVisibilities.NgDontCare; } if ((vis & ContentVisibilities.FavDontCare) == ContentVisibilities.None) { vis |= ContentVisibilities.FavDontCare; } if ((vis & ContentVisibilities.NewDontCare) == ContentVisibilities.None) { vis |= ContentVisibilities.NewDontCare; } return vis; }
public static string ConvertToFlagsString(ContentVisibilities vis) { char[] flags = new char[3]; switch (vis & ContentVisibilities.NgDontCare) { case ContentVisibilities.NgTrue: flags[0] = 'T'; break; case ContentVisibilities.NgFalse: flags[0] = 'F'; break; case ContentVisibilities.NgDontCare: flags[0] = '*'; break; default: throw new ArgumentOutOfRangeException(); } switch (vis & ContentVisibilities.FavDontCare) { case ContentVisibilities.FavTrue: flags[1] = 'T'; break; case ContentVisibilities.FavFalse: flags[1] = 'F'; break; case ContentVisibilities.FavDontCare: flags[1] = '*'; break; default: throw new ArgumentOutOfRangeException(); } switch (vis & ContentVisibilities.NewDontCare) { case ContentVisibilities.NewTrue: flags[2] = 'T'; break; case ContentVisibilities.NewFalse: flags[2] = 'F'; break; case ContentVisibilities.NewDontCare: flags[2] = '*'; break; default: throw new ArgumentOutOfRangeException(); } return new string(flags); }
private void RadioButton_CheckedChanged(object sender, EventArgs e) { if (this.updating) return; RadioButton sender2 = sender as RadioButton; ContentVisibilities vis; if (this.dicPresetRV.TryGetValue(sender2, out vis)) { this.ContentVisibilities = vis; } else if (this.dicCustomRV.TryGetValue(sender2, out vis)) { ContentVisibilities oldVis = this.ContentVisibilities; if ((vis & ContentVisibilities.NgDontCare) != ContentVisibilities.None) { vis |= oldVis & ~ContentVisibilities.NgDontCare; } else if ((vis & ContentVisibilities.FavDontCare) != ContentVisibilities.None) { vis |= oldVis & ~ContentVisibilities.FavDontCare; } else if ((vis & ContentVisibilities.NewDontCare) != ContentVisibilities.None) { vis |= oldVis & ~ContentVisibilities.NewDontCare; } else { throw new InvalidOperationException(); } this.ContentVisibilities = vis; } else { throw new InvalidOperationException(); } }