当前位置: 首页>>代码示例>>C#>>正文


C# ShutdownReason类代码示例

本文整理汇总了C#中ShutdownReason的典型用法代码示例。如果您正苦于以下问题:C# ShutdownReason类的具体用法?C# ShutdownReason怎么用?C# ShutdownReason使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ShutdownReason类属于命名空间,在下文中一共展示了ShutdownReason类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Shutdown

		public static void Shutdown(ShutdownReason reasonFlag)
		{
			int			Result;
			bool		BooleanResult;
			TokenPrivileges	tp	= new TokenPrivileges ();
			long			LocallyUniqueIdentifier;

			IntPtr hproc	= (IntPtr)ApiNativeMethods.GetCurrentProcess();
			int		htok	= 0;

			BooleanResult	= ApiNativeMethods.OpenProcessToken( (int)hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok );
			if( BooleanResult == false)
				throw new NolmeGenericException (string.Format (CultureInfo.InvariantCulture, "OpenProcessToken Failed"));

			tp.Count					= 1;
			tp.LocallyUniqueIdentifier	= 0;
			tp.Attributes				= SE_PRIVILEGE_ENABLED;
			LocallyUniqueIdentifier		= 0;
			BooleanResult				= ApiNativeMethods.LookupPrivilegeValue( null, SE_SHUTDOWN_NAME, ref LocallyUniqueIdentifier);
			if( BooleanResult == false)
				throw new NolmeGenericException (string.Format (CultureInfo.InvariantCulture, "LookupPrivilegeValue Failed"));

			tp.LocallyUniqueIdentifier	= LocallyUniqueIdentifier;
			BooleanResult	= ApiNativeMethods.AdjustTokenPrivileges( htok, false, ref tp, 0, 0, 0);
			if( BooleanResult == false)
				throw new NolmeGenericException (string.Format (CultureInfo.InvariantCulture, "AdjustTokenPrivileges Failed"));

			Result = User32ApiNativeMethods.ExitWindowsEx(ExitWindows.PowerOff | ExitWindows.Shutdown, reasonFlag);
			if( Result == 0)
				throw new NolmeGenericException (string.Format (CultureInfo.InvariantCulture, "Shutdown Failed"));
		}
开发者ID:tdhieu,项目名称:openvss,代码行数:31,代码来源:Win32ApiUtility.cs

示例2: ExitWindows

 public static bool ExitWindows(ExitWindows exitWindows, ShutdownReason reason, bool ajustToken)
 {
     if (ajustToken && !TokenAdjuster.EnablePrivilege("SeShutdownPrivilege", true)) {
         return false;
     }
     return ExitWindowsEx(exitWindows, reason) != 0;
 }
开发者ID:ErikWitkowski,项目名称:Support,代码行数:7,代码来源:PowerUtilities.cs

示例3: ShutdownParams

 /// <summary> Creates a ShutdownParams object with given parameters.
 /// <param name="customReason"/> and <param name="initiatedBy"/> may be null. </summary>
 public ShutdownParams(ShutdownReason reason, TimeSpan delay,
                       bool restart, [CanBeNull] string customReason,
                       [CanBeNull] Player initiatedBy)
     : this(reason, delay, restart) {
     customReasonString = customReason;
     InitiatedBy = initiatedBy;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:9,代码来源:ShutdownParams.cs

示例4: Shutdown

 void Shutdown( ShutdownReason reason, bool quit ) {
     if( shutdownPending ) return;
     shutdownPending = true;
     uriDisplay.Enabled = false;
     console.Enabled = false;
     console.Text = "Shutting down...";
     Server.Shutdown( new ShutdownParams( reason, TimeSpan.Zero, quit, false ), false );
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:8,代码来源:MainForm.cs

示例5: LogOff

		public static void LogOff(ShutdownReason reasonFlag) 
		{
			int Result;
			Result = User32ApiNativeMethods.ExitWindowsEx(ExitWindows.LogOff, reasonFlag);
			if( Result == 0)
			{
				throw new NolmeGenericException (string.Format (CultureInfo.InvariantCulture, "LogOff Failed"));
			}
		}
开发者ID:tdhieu,项目名称:openvss,代码行数:9,代码来源:Win32ApiUtility.cs

示例6: Shutdown

        void Shutdown( ShutdownReason reason, bool quit ) {
            if( shutdownPending ) return;

            //Log( "Shutting down...", LogType.ConsoleOutput ); // write to console only

            shutdownPending = true;
            urlDisplay.Enabled = false;
            console.Enabled = false;
            Server.Shutdown( new ShutdownParams( reason, 0, quit, false ), false );
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:10,代码来源:MainForm.cs

示例7: ReportFailure

 static void ReportFailure( ShutdownReason reason ) {
     Console.Title = String.Format( "fCraft {0} {1}", Updater.CurrentRelease.VersionString, reason );
     if( useColor ) Console.ForegroundColor = ConsoleColor.Red;
     Console.Error.WriteLine( "** {0} **", reason );
     if( useColor ) Console.ResetColor();
     Server.Shutdown( new ShutdownParams( reason, TimeSpan.Zero, false, false ), true );
     if( !Server.HasArg( ArgKey.ExitOnCrash ) ) {
         Console.ReadLine();
     }
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:10,代码来源:Program.cs

示例8: Shutdown

 public NestResult Shutdown(ShutdownReason reason)
 {
     // host shutdown is called by UI thread.
      application.Dispatcher.Invoke(() => { application.Shutdown(); });
      return NestResult.Success;
 }
开发者ID:iboshkov,项目名称:the-dargon-project,代码行数:6,代码来源:DargonClientEgg.cs

示例9: ShutdownParams

 public ShutdownParams( ShutdownReason reason, TimeSpan delay, bool killProcess, bool restart )
 {
     Reason = reason;
     Delay = delay;
     KillProcess = killProcess;
     Restart = restart;
 }
开发者ID:tboxx,项目名称:800craft-1,代码行数:7,代码来源:Server.cs

示例10: DefaultShutdownInput

 public DefaultShutdownInput(ShutdownReason reason, Checkpointer checkpointer)
 {
     _reason = reason;
     _checkpointer = checkpointer;
 }
开发者ID:abide,项目名称:amazon-kinesis-client-net,代码行数:5,代码来源:DefaultShutdownInput.cs

示例11: ChannelOnDisconnected

 private void ChannelOnDisconnected(IChannel channel, ShutdownReason reason)
 {
     ChangeTimerState(false);
     _sentBatch = false;
     FailedQueuedLetters();
     ChannelDisconnected(this, reason);
 }
开发者ID:huoxudong125,项目名称:Hyperletter,代码行数:7,代码来源:BatchChannel.cs

示例12: ChannelDisconnected

        private void ChannelDisconnected(IChannel channel, ShutdownReason reason)
        {
            Binding binding = channel.Binding;

            _routeChannels.Remove(channel.RemoteNodeId);

            if(channel.Direction == Direction.Inbound || reason == ShutdownReason.Requested) {
                _channels.Remove(binding);
                UnhookChannel(channel);
            }

            Action<IHyperSocket, IDisconnectedEventArgs> evnt = Disconnected;
            if(evnt != null) evnt(this, new DisconnectedEventArgs {Binding = binding, Reason = reason, Socket = this, RemoteNodeId = channel.RemoteNodeId});
        }
开发者ID:riax,项目名称:Clr,代码行数:14,代码来源:HyperSocket.cs

示例13: ShutdownEventArgs

 public ShutdownEventArgs(Exception exception) {
     Reason = ShutdownReason.Exception;
     Exception = exception;
 }
开发者ID:jmkelly,项目名称:Foundatio,代码行数:4,代码来源:ShutdownEventCatcher.cs

示例14: Kernel32_ProcessShuttingDown

 static bool Kernel32_ProcessShuttingDown(ShutdownReason sig) {
     ShutdownEventArgs args = new ShutdownEventArgs(sig);
     RaiseShutdownEvent(args);
     return false;
 }
开发者ID:jmkelly,项目名称:Foundatio,代码行数:5,代码来源:ShutdownEventCatcher.cs

示例15: ChannelDisconnecting

 private void ChannelDisconnecting(IChannel channel, ShutdownReason shutdownReason)
 {
     _letterDispatcher.DequeueChannel(channel);
     Action<IHyperSocket, IDisconnectingEventArgs> evnt = Disconnecting;
     if(evnt != null)
         evnt(this, new DisconnectingEventArgs {Binding = channel.Binding, Reason = shutdownReason, RemoteNodeId = channel.RemoteNodeId, Socket = this});
 }
开发者ID:riax,项目名称:Clr,代码行数:7,代码来源:HyperSocket.cs


注:本文中的ShutdownReason类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。