• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ShutdownReason类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: HandleDispatcherClosed

        /// <summary>
        ///   Handles the event of the dispatcher closing (and disposing)
        ///   because of a disconnect or a user request.
        /// </summary>
        /// <param name="reason"> The reason why the dispatcher closed. </param>
        internal void HandleDispatcherClosed(ShutdownReason reason)
        {
            this.ShutdownReason = reason;
            this.dispatcher = null;

#if DEBUG
            this.runningLock.Set();
#endif

            this.OnDisconnected(new DisconnectedEventArgs(reason));
        }
开发者ID:st4l,项目名称:BEsharp,代码行数:16,代码来源:RConClient.cs


示例17: Shutdown

 void Shutdown( ShutdownReason reason, bool quit )
 {
     if( shutdownPending ) return;
     shutdownPending = true;
     SetURIDisplayEnabled(false);
     SetConsoleEnabled(false);
     SetConsoleText("Shutting down...");
     Server.Shutdown( new ShutdownParams( reason, TimeSpan.Zero, quit, false ), false );
 }
开发者ID:Desertive,项目名称:800craft,代码行数:9,代码来源:MainForm.cs


示例18: DispatchAction

        private void DispatchAction(Action a)
        {
            var initAction = a as InitializeAction;
            if (initAction != null)
            {
                ShardId = initAction.ShardId;
                _stateMachine.Fire(Trigger.BeginInitialize);
                return;
            }

            var processRecordAction = a as ProcessRecordsAction;
            if (processRecordAction != null)
            {
                Records = processRecordAction.Records;
                _stateMachine.Fire(Trigger.BeginProcessRecords);
                return;
            }

            var shutdownAction = a as ShutdownAction;
            if (shutdownAction != null)
            {
                ShutdownReason = (ShutdownReason)Enum.Parse(typeof(ShutdownReason), shutdownAction.Reason);
                _stateMachine.Fire(Trigger.BeginShutdown);
                return;
            }

            var checkpointAction = a as CheckpointAction;
            if (checkpointAction != null)
            {
                CheckpointError = checkpointAction.Error;
                CheckpointSeqNo = checkpointAction.SequenceNumber;
                _stateMachine.Fire(Trigger.FinishCheckpoint);
                return;
            }

            throw new MalformedActionException("Received an action which couldn't be understood: " + a.Type);
        }
开发者ID:hmmdeif,项目名称:amazon-kinesis-client-net,代码行数:37,代码来源:ClientLibrary.cs


示例19: ExitWindowsEx

 private static extern bool ExitWindowsEx(EXIT_WINDOWS uFlags, ShutdownReason dwReason);
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:1,代码来源:WindowsAPI.cs


示例20:

		internal static extern int		ExitWindowsEx			(ExitWindows exitFlags, ShutdownReason shutDownReason);
开发者ID:tdhieu,项目名称:openvss,代码行数:1,代码来源:ApiNativeMethods.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SiblingType类代码示例发布时间:2022-05-24
下一篇:
C# ShutdownEventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap