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


C# ProcessPriorityClass类代码示例

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


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

示例1: CheckForNeedButton

 private bool CheckForNeedButton(ProcessPriorityClass priority)
 {
     if (priority == ProcessPriorityClass.Normal)
     {
         radioButton1.Checked = true;
         return true;
     }
     else if (priority == ProcessPriorityClass.AboveNormal)
     {
         radioButton2.Checked = true;
         return true;
     }
     else if (priority == ProcessPriorityClass.BelowNormal)
     {
         radioButton3.Checked = true;
         return true;
     }
     else if (priority == ProcessPriorityClass.High)
     {
         radioButton4.Checked = true;
         return true;
     }
     else if (priority == ProcessPriorityClass.Idle)
     {
         radioButton5.Checked = true;
         return true;
     }
     else if (priority == ProcessPriorityClass.RealTime)
     {
         radioButton6.Checked = true;
         return true;
     }
     return false;
 }
开发者ID:AndreiMisiukevich,项目名称:Task-manager,代码行数:34,代码来源:ChangePriority.cs

示例2: ConsoleProcess

 public ConsoleProcess()
 {
     BufferSizeStdout = 4096;
     BufferSizeStderr = 4096;
     ModeStderr = CommunicationMode.Line;
     ModeStdout = CommunicationMode.Line;
     PriorityClass = ProcessPriorityClass.Normal;
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:8,代码来源:ConsoleProcess.cs

示例3: SetPriority

        public virtual void SetPriority(int processId, ProcessPriorityClass priority)
        {
            var process = Process.GetProcessById(processId);

            Logger.Info("Updating [{0}] process priority from {1} to {2}",
                        process.ProcessName,
                        process.PriorityClass,
                        priority);

            process.PriorityClass = priority;
        }
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:11,代码来源:ProcessProvider.cs

示例4: Initialize

        public void Initialize()
        {
            this.CachedProcessPriorityClass = Process.GetCurrentProcess().PriorityClass;
            this.CachedThreadPriority = Thread.CurrentThread.Priority;
            
            Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
            Thread.CurrentThread.Priority = ThreadPriority.Highest;

            this.IsCachedStatus = true;

            this.Time(1, () => { });
        }
开发者ID:nokia6102,项目名称:jasily.cologler,代码行数:12,代码来源:CodeTimer.cs

示例5: ChangePriority

        private void ChangePriority(ProcessPriorityClass priority)
        {
            cbxPriority.SelectedValue = priority;

            for (var i = 0; i < tsmiPriority.DropDownItems.Count; i++)
            {
                var item = (ToolStripMenuItem)tsmiPriority.DropDownItems[i];
                item.Checked = (int)item.Tag == (int)priority;
            }

            processor.Priority = priority;
        }
开发者ID:vitalyobukhov,项目名称:Flac2Alac,代码行数:12,代码来源:Progress.cs

示例6: HighPerformance

#pragma warning disable 0618
		/// <summary>
		/// Initializes a new instance of the <see cref="HighPerformance"/> class.
		/// </summary>
		internal HighPerformance() {
			////if (!WaitForQuietCpu()) {
			////    Assert.Inconclusive("Timed out waiting for a quiet CPU in which to perform perf tests.");
			////}

			this.originalLoggerThreshold = LogManager.GetLoggerRepository().Threshold;
			LogManager.GetLoggerRepository().Threshold = LogManager.GetLoggerRepository().LevelMap["OFF"];
			this.powerSetting = new PowerManagment.PowerSetting(PowerManagment.PowerProfiles.HighPerformance);
			this.originalProcessPriority = Process.GetCurrentProcess().PriorityClass;
			Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
			Thread.CurrentThread.Priority = ThreadPriority.Highest;
			SpinCpu();
		}
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:17,代码来源:HighPerformance.cs

示例7: ProcessInfo

 /// <summary>
 /// Initializes a new instance of the <see cref="ProcessInfo"/> class.
 /// </summary>
 /// <param name="filename">The filename.</param>
 /// <param name="arguments">The arguments.</param>
 /// <param name="workingDirectory">The working directory.</param>
 /// <param name="priority">The priority.</param>
 /// <param name="successExitCodes">The success exit codes.</param>
 public ProcessInfo(string filename, SecureArguments arguments, string workingDirectory, ProcessPriorityClass priority, int[] successExitCodes)
 {
     this.arguments = arguments;
     this.priority = priority;
     startInfo.FileName = filename.StripQuotes();
     startInfo.Arguments = arguments == null ? null : arguments.ToString(SecureDataMode.Private);
     startInfo.WorkingDirectory = workingDirectory.StripQuotes();
     startInfo.UseShellExecute = false;
     startInfo.CreateNoWindow = true;
     startInfo.RedirectStandardOutput = true;
     startInfo.RedirectStandardError = true;
     startInfo.RedirectStandardInput = false;
     this.successExitCodes = successExitCodes ?? new[] { 0 };
 }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:22,代码来源:ProcessInfo.cs

示例8: TryExecute_Impersonated

 /// <summary>
 /// Executes the <paramref name="executable"/> and waits a maximum time of <paramref name="maxWaitMs"/> for completion. If the process doesn't end in 
 /// this time, it gets aborted. This method tries to impersonate the interactive user and run the process under its identity.
 /// </summary>
 /// <param name="executable">Program to execute</param>
 /// <param name="arguments">Program arguments</param>
 /// <param name="priorityClass">Process priority</param>
 /// <param name="maxWaitMs">Maximum time to wait for completion</param>
 /// <returns><c>true</c> if process was executed and finished correctly</returns>
 public static bool TryExecute_Impersonated(string executable, string arguments, ProcessPriorityClass priorityClass = ProcessPriorityClass.Normal, int maxWaitMs = INFINITE)
 {
   IntPtr userToken;
   if (!ImpersonationHelper.GetTokenByProcess(out userToken, true))
     return false;
   try
   {
     string unused;
     return TryExecute_Impersonated(executable, arguments, userToken, false, out unused, priorityClass, maxWaitMs);
   }
   finally
   {
     ImpersonationHelper.SafeCloseHandle(userToken);
   }
 }
开发者ID:jgauffin,项目名称:MediaPortal-2,代码行数:24,代码来源:ProcessUtils.cs

示例9: TryExecuteReadString

 /// <summary>
 /// Executes the <paramref name="executable"/> and waits a maximum time of <paramref name="maxWaitMs"/> for completion and returns the contents of
 /// <see cref="Process.StandardOutput"/>. If the process doesn't end in this time, it gets aborted.
 /// </summary>
 /// <param name="executable">Program to execute</param>
 /// <param name="arguments">Program arguments</param>
 /// <param name="result">Returns the contents of standard output</param>
 /// <param name="priorityClass">Process priority</param>
 /// <param name="maxWaitMs">Maximum time to wait for completion</param>
 /// <returns></returns>
 public static bool TryExecuteReadString(string executable, string arguments, out string result, ProcessPriorityClass priorityClass = ProcessPriorityClass.Normal, int maxWaitMs = 1000)
 {
   using (System.Diagnostics.Process process = new System.Diagnostics.Process { StartInfo = new ProcessStartInfo(executable, arguments) { UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true } })
   {
     process.Start();
     process.PriorityClass = priorityClass;
     using (process.StandardOutput)
     {
       result = process.StandardOutput.ReadToEnd();
       if (process.WaitForExit(maxWaitMs))
         return process.ExitCode == 0;
     }
     if (!process.HasExited)
       process.Kill();
   }
   return false;
 }
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:27,代码来源:ProcessUtils.cs

示例10: ClientConnection

        public ClientConnection(string hostName, string ipAddress, int instance, ProcessPriorityClass priority, int bitSize)
        {
            IsOnline = true;
            Jobs = new List<Job>();
            PriorityJobs = new List<Job>();
            CurrentJob = "";
            ActiveHours = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY";
            Id = (_nextClientId++);
            HostName = hostName;
            IPAddress = ipAddress;
            Instance = instance;
            Priority = priority;
            BitSize = bitSize;
            _lastCall.Reset();
            _lastCall.Start();

            RestoreSettings();
        }
开发者ID:SteveMoody73,项目名称:Amleto,代码行数:18,代码来源:ClientConnection.cs

示例11: Run

        public void Run(ProcessEx process, ProcessPriorityClass priority)
        {
            if (this.Status.InUse)
            throw new InvalidOperationException("Current core is running another process");

              if (process == null)
            throw new ArgumentNullException("Process can not be null");

              this.Process = process;
              this.Process.ExecutingCore = this;

              //bind event
              this.Process.Exited += Process_Exited;

              this.Process.Start();
              this.Process.Status = ProcessExecutionStatus.Running;
              this.Process.PriorityClass = priority;
              this.Status.InUse = true;

              //TODO set affinity
              this.Process.ProcessorAffinity = (IntPtr) (int) Math.Pow(2, this.Status.Index);
        }
开发者ID:Liano,项目名称:intelife,代码行数:22,代码来源:Core.cs

示例12: RegistSchedule

        public void RegistSchedule(string serviceName,ProcessPriorityClass Priority,string FilePath,string args)
        {
            using (TaskService task= new TaskService())
            {
                string SchedulerName= "GISHitpanDBManager"+Guid.NewGuid().ToString();
                using(TaskDefinition def = task.NewTask())
                {
                    //일반
                    def.Principal.DisplayName = serviceName;
                    def.Principal.UserId=string.Format("{0}\\{1}",Environment.UserDomainName,Environment.UserName);
                    def.Principal.LogonType=TaskLogonType.InteractiveToken;
                    def.Principal.RunLevel=TaskRunLevel.Highest;
                    def.Triggers.Add( new LogonTrigger());
                    //조건
                    def.Settings.MultipleInstances=TaskInstancesPolicy.IgnoreNew;
                    def.Settings.DisallowStartIfOnBatteries=false;
                    def.Settings.StopIfGoingOnBatteries=false;
                    def.Settings.AllowHardTerminate=false;
                    def.Settings.StartWhenAvailable=true;
                    def.Settings.RunOnlyIfNetworkAvailable=false;
                    def.Settings.IdleSettings.StopOnIdleEnd=false;
                    def.Settings.IdleSettings.RestartOnIdle=false;
                    //설정
                    def.Settings.AllowDemandStart=false;
                    def.Settings.Enabled=true;
                    def.Settings.Hidden=false;
                    def.Settings.RunOnlyIfIdle=false;
                    def.Settings.ExecutionTimeLimit=TimeSpan.Zero;
                    def.Settings.Priority = Priority;
                    //동작
                    def.Actions.Add(FilePath, args);
                    //등록
                    task.RootFolder.RegisterTaskDefinition(SchedulerName,def);
                }

            }
        }
开发者ID:hesed7,项目名称:hitpan,代码行数:37,代码来源:AutoBackupService.cs

示例13: QueueProcess

 /// <summary>
 /// Queues the process.
 /// </summary>
 /// <param name="process">The process to enqueue.</param>
 /// <param name="prc">process priority.</param>
 public void QueueProcess(ProcessEx process, ProcessPriorityClass prc)
 {
     lock (_queueLock)
       {
     this._processQueue.Enqueue(new KeyValuePair<ProcessEx, ProcessPriorityClass>(process, prc));
     process.Status = ProcessExecutionStatus.Queued;
       }
 }
开发者ID:Liano,项目名称:intelife,代码行数:13,代码来源:ProcessManager.cs

示例14: ProcessInfo

 /// <summary>
 /// Initializes a new instance of the <see cref="ProcessInfo" /> class.	
 /// </summary>
 /// <param name="filename">The filename.</param>
 /// <param name="arguments">The arguments.</param>
 /// <param name="workingDirectory">The working directory.</param>
 /// <param name="priority">The priority.</param>
 /// <remarks></remarks>
 public ProcessInfo(string filename, PrivateArguments arguments, string workingDirectory, ProcessPriorityClass priority) :
     this(filename, arguments, workingDirectory, priority, null){}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:10,代码来源:ProcessInfo.cs

示例15: SetProcessPriority

 private void SetProcessPriority(ProcessPriorityClass priority)
 {
     try
     {
         using (var phandle = new ProcessHandle(processSelectedPid, ProcessAccess.SetInformation))
             phandle.SetPriorityClass(priority);
     }
     catch (Exception ex)
     {
         PhUtils.ShowException("Unable to set process priority", ex);
     }
 }
开发者ID:andyvand,项目名称:ProcessHacker,代码行数:12,代码来源:HackerWindow.cs


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