本文整理汇总了C#中StateFlags类的典型用法代码示例。如果您正苦于以下问题:C# StateFlags类的具体用法?C# StateFlags怎么用?C# StateFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StateFlags类属于命名空间,在下文中一共展示了StateFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public override void Render(CellContext context, StateFlags state, double cellWidth, double cellHeight)
{
if (BoundObject == null) {
return;
}
if (!(BoundObject is TrackInfo)) {
throw new InvalidCastException ("ColumnCellAlbum can only bind to AlbumInfo objects");
}
TrackInfo track = (TrackInfo)BoundObject;
context.Layout.Width = (int)((cellWidth - 8) * Pango.Scale.PangoScale);
context.Layout.Ellipsize = Pango.EllipsizeMode.End;
context.Layout.FontDescription.Weight = font_weight;
context.Layout.SetMarkup (String.Format ("<b>{0}</b>\n<small><i>{1}</i></small>",
GLib.Markup.EscapeText (track.DisplayTrackTitle),
GLib.Markup.EscapeText (track.DisplayArtistName)));
int text_width;
int text_height;
context.Layout.GetPixelSize (out text_width, out text_height);
context.Context.MoveTo (4, ((int)cellHeight - text_height) / 2);
context.Widget.StyleContext.Save ();
context.Widget.StyleContext.AddClass ("entry");
Cairo.Color color = CairoExtensions.GdkRGBAToCairoColor (context.Widget.StyleContext.GetColor (StateFlags.Selected));
context.Widget.StyleContext.Restore ();
color.A = (!context.Opaque) ? 0.3 : 1.0;
context.Context.SetSourceColor (color);
PangoCairoHelper.ShowLayout (context.Context, context.Layout);
}
示例2: AbstractSocketChannel
protected AbstractSocketChannel(IChannel parent, Socket socket)
: base(parent)
{
Socket = socket;
_state = StateFlags.Open;
try
{
Socket.Blocking = false;
}
catch (SocketException ex)
{
try
{
socket.Close();
}
catch (SocketException ex2)
{
if (Logger.IsWarningEnabled)
{
Logger.Warning("Failed to close a partially initialized socket.", ex2);
}
}
throw new ChannelException("Failed to enter non-blocking mode.", ex);
}
}
示例3: Render
public override void Render(CellContext context, StateFlags state, double cellWidth, double cellHeight)
{
PodcastTrackInfo podcast = PodcastTrackInfo.From (BoundTrack);
if (podcast != null) {
if (podcast.Activity == PodcastItemActivity.DownloadPending) {
context.Opaque = false;
}
}
base.Render (context, state, cellWidth, cellHeight);
}
示例4: ContextAwareResult
internal ContextAwareResult(bool captureIdentity, bool forceCaptureContext, bool threadSafeContextCopy, object myObject, object myState, AsyncCallback myCallBack) : base(myObject, myState, myCallBack)
{
if (forceCaptureContext)
{
this._Flags = StateFlags.CaptureContext;
}
if (captureIdentity)
{
this._Flags |= StateFlags.CaptureIdentity;
}
if (threadSafeContextCopy)
{
this._Flags |= StateFlags.ThreadSafeContextCopy;
}
}
示例5: Deserialize
public override bool Deserialize()
{
var result = base.Deserialize();
_unknown = Data.ReadInt32(); // Not always zero, looks like flags or mask?
ProbeMask = Data.ReadInt32();
IgnoreMask = Data.ReadInt64();
LabelTableOffset = Data.ReadInt16();
// This can't be processed here unless the bytecode is also processed for virtual address space
/*if (LabelTableOffset >= 0)
{
LabelTable = new List<LabelTableEntry>();
var tableReader = new ObjectReader(ByteScript);
tableReader.ReadRawData(LabelTableOffset);
var NameRef = tableReader.ReadNameRef();
var Offset = tableReader.ReadUInt32();
while (Offset != 0x0000FFFF)
{
var entry = new LabelTableEntry();
entry.NameRef = NameRef;
entry.Name = PCC.GetName(NameRef);
entry.Offset = Offset;
LabelTable.Add(entry);
NameRef = tableReader.ReadNameRef();
Offset = tableReader.ReadUInt32();
}
}*/
StateFlags = (StateFlags)Data.ReadInt32();
FunctionMapCount = Data.ReadInt32();
for (int i = 0; i < FunctionMapCount; i++)
{
var funcEntry = new FunctionMapEntry();
funcEntry.NameRef.Index = Data.ReadInt32();
funcEntry.NameRef.ModNumber = Data.ReadInt32();
funcEntry.FunctionObjectIndex = Data.ReadInt32();
_FunctionMap.Add(funcEntry);
}
return result;
}
示例6: IS_CPP
public IS_CPP(byte[] data) {
Size = data[0];
Type = (PacketType)data[1];
ReqI = data[2];
Zero = data[3];
Pos1 = BitConverter.ToInt32(data, 4);
Pos2 = BitConverter.ToInt32(data, 8);
Pos3 = BitConverter.ToInt32(data, 12);
H = BitConverter.ToUInt16(data, 16);
P = BitConverter.ToUInt16(data, 18);
R = BitConverter.ToUInt16(data, 20);
ViewPLID = data[22];
InGameCam = (CameraViews)data[23];
FOV = BitConverter.ToSingle(data, 24);
Time = BitConverter.ToUInt16(data, 28);
Flags = (StateFlags)BitConverter.ToUInt16(data, 30);
}
示例7: RegistryKey
/// <summary>
/// Creates a RegistryKey.
/// This key is bound to hkey, if writable is <b>false</b> then no write operations
/// will be allowed. If systemkey is set then the hkey won't be released
/// when the object is GC'ed.
/// The remoteKey flag when set to true indicates that we are dealing with registry entries
/// on a remote machine and requires the program making these calls to have full trust.
/// </summary>
private RegistryKey(SafeRegistryHandle hkey, bool writable, bool systemkey, bool remoteKey, bool isPerfData, RegistryView view)
{
ValidateKeyView(view);
_hkey = hkey;
_keyName = "";
_remoteKey = remoteKey;
_regView = view;
if (systemkey)
{
_state |= StateFlags.SystemKey;
}
if (writable)
{
_state |= StateFlags.WriteAccess;
}
if (isPerfData)
{
_state |= StateFlags.PerfData;
}
}
示例8: FinishPostingAsyncOp
internal bool FinishPostingAsyncOp(ref CallbackClosure closure)
{
ExecutionContext context;
if ((this._Flags & (StateFlags.PostBlockFinished | StateFlags.PostBlockStarted)) != StateFlags.PostBlockStarted)
{
return false;
}
this._Flags |= StateFlags.PostBlockFinished;
CallbackClosure closure2 = closure;
if (closure2 == null)
{
context = null;
}
else if (!closure2.IsCompatible(base.AsyncCallback))
{
closure = null;
context = null;
}
else
{
base.AsyncCallback = closure2.AsyncCallback;
context = closure2.Context;
}
bool flag = this.CaptureOrComplete(ref context, true);
if (((closure == null) && (base.AsyncCallback != null)) && (context != null))
{
closure = new CallbackClosure(context, base.AsyncCallback);
}
return flag;
}
示例9: IsCLSCompliant
//
// Returns member CLS compliance based on full member hierarchy
//
public bool IsCLSCompliant ()
{
if ((state & StateFlags.CLSCompliant_Undetected) != 0) {
state &= ~StateFlags.CLSCompliant_Undetected;
if (IsNotCLSCompliant ())
return false;
bool compliant;
if (DeclaringType != null) {
compliant = DeclaringType.IsCLSCompliant ();
} else {
// TODO: NEED AssemblySpec
if (MemberDefinition.IsImported) {
var attr = MemberDefinition.Assembly.GetCustomAttributes (typeof (CLSCompliantAttribute), false);
compliant = attr.Length > 0 && ((CLSCompliantAttribute) attr[0]).IsCompliant;
} else {
compliant = CodeGen.Assembly.IsClsCompliant;
}
}
if (compliant)
state |= StateFlags.CLSCompliant;
}
return (state & StateFlags.CLSCompliant) != 0;
}
示例10: Connect
async void Connect(IChannelHandlerContext context)
{
var connectPacket = new ConnectPacket
{
ClientId = this.deviceId,
HasUsername = true,
Username = this.iotHubHostName + "/" + this.deviceId,
HasPassword = true,
Password = this.password,
KeepAliveInSeconds = this.mqttTransportSettings.KeepAliveInSeconds,
CleanSession = this.mqttTransportSettings.CleanSession,
HasWill = this.mqttTransportSettings.HasWill
};
if (connectPacket.HasWill)
{
Message message = this.willMessage.Message;
QualityOfService publishToServerQoS = this.mqttTransportSettings.PublishToServerQoS;
string topicName = string.Format(TelemetryTopicFormat, this.deviceId);
PublishPacket will = await Util.ComposePublishPacketAsync(context, message, publishToServerQoS, topicName);
connectPacket.WillMessage = will.Payload;
connectPacket.WillQualityOfService = this.willMessage.QoS;
connectPacket.WillRetain = false;
connectPacket.WillTopicName = will.TopicName;
}
this.stateFlags = StateFlags.Connecting;
await Util.WriteMessageAsync(context, connectPacket, ShutdownOnWriteErrorHandler);
this.lastChannelActivityTime = DateTime.UtcNow;
this.ScheduleKeepConnectionAlive(context);
this.ScheduleCheckConnectTimeout(context);
}
示例11: IsCLSCompliant
//
// Returns member CLS compliance based on full member hierarchy
//
public bool IsCLSCompliant ()
{
if ((state & StateFlags.CLSCompliant_Undetected) != 0) {
state &= ~StateFlags.CLSCompliant_Undetected;
bool compliant;
if (IsNotCLSCompliant (out compliant))
return false;
if (!compliant) {
if (DeclaringType != null) {
compliant = DeclaringType.IsCLSCompliant ();
} else {
compliant = ((ITypeDefinition) MemberDefinition).DeclaringAssembly.IsCLSCompliant;
}
}
if (compliant)
state |= StateFlags.CLSCompliant;
}
return (state & StateFlags.CLSCompliant) != 0;
}
示例12: SubscribeAsync
async Task SubscribeAsync(IChannelHandlerContext context)
{
if (this.IsInState(StateFlags.Receiving) || this.IsInState(StateFlags.Subscribing))
{
return;
}
this.stateFlags |= StateFlags.Subscribing;
this.subscribeCompletion = new TaskCompletionSource();
string topicFilter = CommandTopicFilterFormat.FormatInvariant(this.deviceId);
var subscribePacket = new SubscribePacket(Util.GetNextPacketId(), new SubscriptionRequest(topicFilter, this.mqttTransportSettings.ReceivingQoS));
await Util.WriteMessageAsync(context, subscribePacket, ShutdownOnWriteErrorHandler);
await this.subscribeCompletion.Task;
}
示例13: ChannelActive
public override void ChannelActive(IChannelHandlerContext context)
{
this.stateFlags = StateFlags.NotConnected;
this.Connect(context);
base.ChannelActive(context);
}
示例14: GetAttributeObsolete
public virtual ObsoleteAttribute GetAttributeObsolete ()
{
if ((state & (StateFlags.Obsolete | StateFlags.Obsolete_Undetected)) == 0)
return null;
state &= ~StateFlags.Obsolete_Undetected;
var oa = definition.GetAttributeObsolete ();
if (oa != null)
state |= StateFlags.Obsolete;
return oa;
}
示例15: IsInState
bool IsInState(StateFlags stateFlagsToCheck)
{
return (this.stateFlags & stateFlagsToCheck) == stateFlagsToCheck;
}