本文整理汇总了C#中SelectMode类的典型用法代码示例。如果您正苦于以下问题:C# SelectMode类的具体用法?C# SelectMode怎么用?C# SelectMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectMode类属于命名空间,在下文中一共展示了SelectMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Poll
protected bool Poll(int microSeconds, SelectMode mode)
{
fd_set readFDs = null;
fd_set writeFDs = null;
if (mode == SelectMode.SelectRead)
{
readFDs = new fd_set();
readFDs.FD_ZERO();
readFDs.FD_SET(mSocket);
}
if (mode == SelectMode.SelectWrite)
{
writeFDs = new fd_set();
writeFDs.FD_ZERO();
writeFDs.FD_SET(mSocket);
}
Int32 ret = select(0, readFDs, null, null, null);
//Console.WriteLine("select returned: {0}", ret);
if (readFDs.FD_ISSET(mSocket))
{
return true;
}
return false;
}
示例2: Poll
internal override bool Poll(int microseconds, SelectMode mode)
{
if (this.acceptedSock == null)
{
throw new IOException("Not accepted yet");
}
return this.acceptedSock.Poll(microseconds, mode);
}
示例3: AddCallback
public void AddCallback(SelectMode mode, Socket socket, Action<Socket> callback)
{
_selectable.AddCallback(mode, socket, callback);
// If we have changed the selectable sockets interup the select to wait on the new sockets.
if (socket != _reader)
InterruptSelect();
}
示例4: PreferencesGUI
public static void PreferencesGUI () {
// Load the preferences
if (!prefsLoaded) {
LoadPrefs();
prefsLoaded = true;
OnWindowResize();
}
settingsScroll = EditorGUILayout.BeginScrollView(settingsScroll, GUILayout.MaxHeight(136));
// Geometry Settings
GUILayout.Label("Geometry Editing Settings", EditorStyles.boldLabel);
_selectMode = (SelectMode)EditorGUILayout.EnumPopup("Default Selection Mode", _selectMode);
_faceColor = EditorGUILayout.ColorField("Selected Face Color", _faceColor);
_defaultMaterial = (Material) EditorGUILayout.ObjectField("Default Material", _defaultMaterial, typeof(Material), false);
defaultOpenInDockableWindow = EditorGUILayout.Toggle("Open in Dockable Window", defaultOpenInDockableWindow);
GUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Default Collider");
defaultColliderType = (int)((ProBuilder.ColliderType)EditorGUILayout.EnumPopup( (ProBuilder.ColliderType)defaultColliderType ));
GUILayout.EndHorizontal();
if((ProBuilder.ColliderType)defaultColliderType == ProBuilder.ColliderType.MeshCollider)
_forceConvex = EditorGUILayout.Toggle("Force Convex Mesh Collider", _forceConvex);
_showNotifications = EditorGUILayout.Toggle("Show Editor Notifications", _showNotifications);
pbDragCheckLimit = EditorGUILayout.Toggle(new GUIContent("Limit Drag Check to Selection", "If true, when drag selecting faces, only currently selected pb-Objects will be tested for matching faces. If false, all pb_Objects in the scene will be checked. The latter may be slower in large scenes."), pbDragCheckLimit);
pbForceGridPivot = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Grid", "If true, newly instantiated pb_Objects will have their pivot points set to the first available vertex, ensuring that the object's vertices are placed on-grid."), pbForceGridPivot);
GUILayout.Space(4);
GUILayout.Label("Texture Editing Settings", EditorStyles.boldLabel);
defaultHideFaceMask = EditorGUILayout.Toggle("Hide face mask", defaultHideFaceMask);
EditorGUILayout.EndScrollView();
GUILayout.Space(4);
GUILayout.Label("Shortcut Settings", EditorStyles.boldLabel);
if(GUI.Button(resetRect, "Use defaults"))
ResetToDefaults();
ShortcutSelectPanel();
ShortcutEditPanel();
// Save the preferences
if (GUI.changed)
SetPrefs();
}
示例5: BeginPoll
public IAsyncResult BeginPoll(int microSeconds,
SelectMode mode,
AsyncCallback callback)
{
AsyncPollCaller caller = new AsyncPollCaller(Poll);
//AsyncCallback cb = new AsyncCallback(AsyncPollCallback);
IAsyncResult result = caller.BeginInvoke(microSeconds, mode, callback, caller);
return result;
}
示例6: PalPanel
public PalPanel()
{
this.SetStyle(ControlStyles.DoubleBuffer|ControlStyles.UserPaint|ControlStyles.AllPaintingInWmPaint,true);
myPal = null;
this.MouseDown+=new MouseEventHandler(mouseDown);
//Width=(width+2*space)*NumAcross;
//Height=(height+2*space)*NumAcross;
clickX=-100;
clickY=-100;
selIdx=-1;
mode = SelectMode.Single;
}
示例7: ColorSelectDialog
public ColorSelectDialog(Control parentCtrl, SelectMode mode)
{
InitializeComponent();
if (mode == SelectMode.Color)
{
stampBButton.Visible = false;
stampSButton.Visible = false;
this.Width -= 206;
}
this.Top = parentCtrl.Top + parentCtrl.Height;
this.Left = parentCtrl.Left;
}
示例8: Poll
public static void Poll(this Socket socket, SelectMode mode, CancellationToken cancellationToken)
{
if (!cancellationToken.CanBeCanceled)
return;
if (socket != null)
{
do
{
cancellationToken.ThrowIfCancellationRequested();
} while (!socket.Poll(1000, mode));
}
else
cancellationToken.ThrowIfCancellationRequested();
}
示例9: SetMaterial
static void SetMaterial(SelectMode sm)
{
switch(sm)
{
case SelectMode.Face:
selectionMaterial = new Material(Shader.Find("Hidden/ProBuilder/UnlitColor"));
break;
case SelectMode.Vertex:
vertexHandleSize = pb_Preferences_Internal.GetFloat(pb_Constant.pbVertexHandleSize);
selectionMaterial = new Material(Shader.Find("Hidden/ProBuilder/VertexBillboard"));
selectionMaterial.SetTexture("_MainTex", (Texture2D)Resources.Load("Textures/VertOff", typeof(Texture2D)));
break;
}
selectionMaterial.SetColor("_Color", faceSelectionColor); // todo - remove this and use vertex colors
}
示例10: SelectCards
public SelectCards(Player player, IEnumerable<CardInstance> candidates, SelectMode mode, string message)
: base(player.Game)
{
if (player == null)
{
throw new ArgumentNullException("player");
}
else if (candidates == null)
{
throw new ArgumentNullException("candidates");
}
Player = player;
Candidates = candidates.Where(card => !card.Behaviors.Has<Behaviors.IUnselectable>()).ToList().ToIndexable();
Message = message ?? String.Empty;
Mode = mode;
}
示例11: LoadPrefs
public static void LoadPrefs()
{
_faceColor = pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultFaceColor );
pbDefaultSelectedVertexColor = pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultSelectedVertexColor );
pbDefaultVertexColor = pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultVertexColor );
if(!EditorPrefs.HasKey( pb_Constant.pbDefaultOpenInDockableWindow))
EditorPrefs.SetBool(pb_Constant.pbDefaultOpenInDockableWindow, true);
defaultHideFaceMask = (EditorPrefs.HasKey(pb_Constant.pbDefaultHideFaceMask)) ? EditorPrefs.GetBool(pb_Constant.pbDefaultHideFaceMask) : false;
defaultOpenInDockableWindow = EditorPrefs.GetBool(pb_Constant.pbDefaultOpenInDockableWindow);
pbDefaultSelectionMode = pb_Preferences_Internal.GetEnum<SelectMode>(pb_Constant.pbDefaultSelectionMode);
defaultColliderType = (int)pb_Preferences_Internal.GetEnum<ColliderType>(pb_Constant.pbDefaultCollider);
pbDragCheckLimit = pb_Preferences_Internal.GetBool(pb_Constant.pbDragCheckLimit);
pbForceConvex = pb_Preferences_Internal.GetBool(pb_Constant.pbForceConvex);
pbForceGridPivot = pb_Preferences_Internal.GetBool(pb_Constant.pbForceGridPivot);
pbForceVertexPivot = pb_Preferences_Internal.GetBool(pb_Constant.pbForceVertexPivot);
pbPerimeterEdgeExtrusionOnly = pb_Preferences_Internal.GetBool(pb_Constant.pbPerimeterEdgeExtrusionOnly);
pbPerimeterEdgeBridgeOnly = pb_Preferences_Internal.GetBool(pb_Constant.pbPerimeterEdgeBridgeOnly);
pbPBOSelectionOnly = pb_Preferences_Internal.GetBool(pb_Constant.pbPBOSelectionOnly);
pbVertexHandleSize = pb_Preferences_Internal.GetFloat(pb_Constant.pbVertexHandleSize);
if(EditorPrefs.HasKey(pb_Constant.pbDefaultMaterial))
{
_defaultMaterial = (Material) AssetDatabase.LoadAssetAtPath(pb_Constant.pbDefaultMaterial, typeof(Material));
if(_defaultMaterial == null)
_defaultMaterial = pb_Constant.DefaultMaterial;
}
defaultShortcuts = EditorPrefs.HasKey(pb_Constant.pbDefaultShortcuts) ?
pb_Shortcut.ParseShortcuts(EditorPrefs.GetString(pb_Constant.pbDefaultShortcuts)) :
pb_Shortcut.DefaultShortcuts();
_showNotifications = EditorPrefs.HasKey(pb_Constant.pbShowEditorNotifications) ?
EditorPrefs.GetBool(pb_Constant.pbShowEditorNotifications) : true;
}
示例12: RemoveCallback
public void RemoveCallback(SelectMode mode, Socket socket)
{
lock (_gate)
{
switch (mode)
{
case SelectMode.SelectRead:
_readCallbacks.Remove(socket);
break;
case SelectMode.SelectWrite:
var callbackQueue = _writeCallbacks[socket];
callbackQueue.Dequeue();
if (callbackQueue.Count == 0)
_writeCallbacks.Remove(socket);
break;
case SelectMode.SelectError:
_errorCallbacks.Remove(socket);
break;
default:
throw new ArgumentOutOfRangeException("mode");
}
}
}
示例13: AddCallback
public void AddCallback(SelectMode mode, Socket socket, Action<Socket> callback)
{
lock (_gate)
{
switch (mode)
{
case SelectMode.SelectRead:
_readCallbacks.Add(socket, callback);
break;
case SelectMode.SelectWrite:
Queue<Action<Socket>> callbackQueue;
if (!_writeCallbacks.TryGetValue(socket, out callbackQueue))
_writeCallbacks.Add(socket, callbackQueue = new Queue<Action<Socket>>());
callbackQueue.Enqueue(callback);
break;
case SelectMode.SelectError:
_errorCallbacks.Add(socket, callback);
break;
default:
throw new ArgumentOutOfRangeException("mode");
}
}
}
示例14: Poll
public static unsafe SocketError Poll(SafeCloseSocket handle, int microseconds, SelectMode mode, out bool status)
{
uint* fdSet = stackalloc uint[Interop.Sys.FD_SETSIZE_UINTS];
Interop.Sys.FD_ZERO(fdSet);
Interop.Sys.FD_SET(handle.FileDescriptor, fdSet);
int fdCount = 0;
uint* readFds = null;
uint* writeFds = null;
uint* errorFds = null;
switch (mode)
{
case SelectMode.SelectRead:
readFds = fdSet;
fdCount = handle.FileDescriptor + 1;
break;
case SelectMode.SelectWrite:
writeFds = fdSet;
fdCount = handle.FileDescriptor + 1;
break;
case SelectMode.SelectError:
errorFds = fdSet;
fdCount = handle.FileDescriptor + 1;
break;
}
int socketCount = 0;
Interop.Error err = Interop.Sys.Select(fdCount, readFds, writeFds, errorFds, microseconds, &socketCount);
if (err != Interop.Error.SUCCESS)
{
status = false;
return GetSocketErrorForErrorCode(err);
}
status = Interop.Sys.FD_ISSET(handle.FileDescriptor, fdSet);
return SocketError.Success;
}
示例15: Poll
/// <summary>
/// Determines the status of the VirtualSocket.
/// </summary>
/// <param name="microSeconds">The time to wait for a response, in microseconds.</param>
/// <param name="mode">One of the <see cref="SelectMode"/> values.</param>
/// <returns>See the Socket documentation for the return values.</returns>
/// <remarks>This property is not supported for SSL/TLS sockets. It can only be used if the SecureProtocol is set to None. Asynchronous behavior in SSL or TLS mode can be achieved by calling the asynchronous methods.</remarks>
/// <exception cref="NotSupportedException">The mode parameter is not one of the SelectMode values -or- the socket is in SSL or TLS mode.</exception>
/// <exception cref="SocketException">An operating system error occurs while accessing the VirtualSocket.</exception>
/// <exception cref="ObjectDisposedException">The VirtualSocket has been closed.</exception>
/// <remarks>Set microSeconds parameter to a negative integer if you would like to wait indefinitely for a response.</remarks>
public override bool Poll(int microSeconds, SelectMode mode) {
if (SecureProtocol != SecureProtocol.None)
throw new NotSupportedException("The Poll method is not supported in SSL or TLS mode. Use the asynchronous methods and the Available property instead.");
return base.Poll(microSeconds, mode);
}