本文整理汇总了C#中IProcess类的典型用法代码示例。如果您正苦于以下问题:C# IProcess类的具体用法?C# IProcess怎么用?C# IProcess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IProcess类属于命名空间,在下文中一共展示了IProcess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StopProcessAsync
public static Task StopProcessAsync(IProcess process)
{
if (process == null)
return Task.FromResult<object>(null);
return Task.Run(() => process.Kill());
}
示例2: ArgumentNullException
void IProcessMonitor.Output(IProcess process, string line)
{
if (line == null)
throw new ArgumentNullException(nameof(line));
_Events.Add(new ProcessStandardOutputEvent(process.ExecutionDuration, DateTime.Now, line));
}
示例3: Init
public void Init()
{
_createPositionMock = new Mock<IProcess<CreatePositionParams, PositionDisplayViewModel>>();
_createPositionMock.Setup(x => x.Execute(It.IsAny<CreatePositionParams>())).Returns(new PositionDisplayViewModel());
_verifyTokenMock = new Mock<IProcess<VerifyUserLinkedInAccessTokenParams, UserAccessTokenResultViewModel>>();
_verifyTokenMock.Setup(x => x.Execute(It.IsAny<VerifyUserLinkedInAccessTokenParams>())).Returns(new UserAccessTokenResultViewModel { AccessTokenValid = true });
_createCompanyCmdMock = CommandTestUtils.GenerateCreateCompanyCommandMock();
_createCompanyCmdMock.Setup(x => x.Execute()).Returns(new Company { Id = NEW_COMPANY_ID });
_companyQueryMock = QueryTestUtils.GenerateCompanyByIdQueryMock();
_process = new LinkedInPositionSearchProcesses(_context, _verifyTokenMock.Object, _createCompanyCmdMock.Object, _createPositionMock.Object, _companyQueryMock.Object);
// Initialize user with test (but valid) access token data
_user = new User { LastVisitedJobSearch = new JobSearch() };
var oauth = new OAuthData
{
Token = "bfcf3fe4-b4d4-4f37-9d32-292ae9d45347",
Secret = "f66673b2-5877-4fbf-80e0-3826ca9f7eed",
TokenProvider = TokenProvider.LinkedIn,
TokenType = TokenType.AccessToken,
};
oauth.LinkedInUsers.Add(_user);
_user.LinkedInOAuthData = oauth;
_context.Users.Add(_user);
_context.OAuthData.Add(oauth);
_context.SaveChanges();
}
示例4: PowerShellConsole
public PowerShellConsole(IPackage package, IProcess process, IFileSystem fileSystem, IPackageFile packageFile)
{
this.fileSystem = fileSystem;
this.package = package;
this.process = process;
this.packageFile = packageFile;
}
示例5: CommunicationViewModel
public CommunicationViewModel(
IProcess process, PacketListViewModel packetList, PacketDetailsViewModel packetDetails, IBus bus)
: base(bus)
{
Contract.Requires<ArgumentNullException>(process != null);
Contract.Requires<ArgumentNullException>(packetList != null);
Contract.Requires<ArgumentNullException>(packetDetails != null);
Contract.Requires<ArgumentNullException>(bus != null);
this.process = process;
this.packetList = packetList;
this.packetDetails = packetDetails;
Func<string> getTitle =
() =>
"Communication: " + (this.process.Player != null ? this.process.Player.Name : this.process.DisplayName);
this.Title = getTitle();
PropertyChangedEventManager.AddHandler(
this.process, (sender, args) => this.Title = getTitle(), string.Empty);
PropertyChangedEventManager.AddHandler(
this.packetList,
(sender, args) => this.packetDetails.Packet = this.packetList.SelectedPacket,
"SelectedPacket");
this.Bus.Subscribe(this.packetList);
}
示例6: Init
public void Init()
{
_verifyTokenMock = new Mock<IProcess<VerifyUserLinkedInAccessTokenParams,UserAccessTokenResultViewModel>>();
_verifyTokenMock.Setup(x => x.Execute(It.IsAny<VerifyUserLinkedInAccessTokenParams>())).Returns(new UserAccessTokenResultViewModel { AccessTokenValid = true });
_createPositionMock = new Mock<IProcess<CreatePositionParams, PositionDisplayViewModel>>();
var createCompanyCmd = new CreateCompanyCommand(_serviceFactory.Object);
_process = new LinkedInPositionSearchProcesses(_context, _verifyTokenMock.Object, createCompanyCmd, _createPositionMock.Object, null);
// Initialize user with test (but valid) access token data
_user = new User();
var oauth = new OAuthData
{
Token = "bfcf3fe4-b4d4-4f37-9d32-292ae9d45347",
Secret = "f66673b2-5877-4fbf-80e0-3826ca9f7eed",
TokenProvider = TokenProvider.LinkedIn,
TokenType = TokenType.AccessToken,
};
oauth.LinkedInUsers.Add(_user);
_user.LinkedInOAuthData = oauth;
_context.Users.Add(_user);
_context.OAuthData.Add(oauth);
_context.SaveChanges();
}
示例7: Restart
public static Unit Restart()
{
ObservableRouter.Restart();
ActorConfig config = ActorConfig.Default;
if (system != null)
{
system.Shutdown();
}
Store = Map(Tuple("", (IProcess)new NullProcess()));
// Root
root = new Actor<Unit, object>(new ProcessId(), config.RootProcessName, Process.pub);
// Top tier
system = new Actor<Unit, object>(root.Id, config.SystemProcessName, Process.pub);
self = user = new Actor<Unit, object>(root.Id, config.UserProcessName, Process.pub);
// Second tier
deadLetters = new Actor<Unit, object>(system.Id, config.DeadLettersProcessName, Process.pub);
noSender = new Actor<Unit, object>(system.Id, config.NoSenderProcessName, Process.pub);
registered = new Actor<Unit, object>(system.Id, config.RegisteredProcessName, Process.pub);
return unit;
}
示例8: TestController
public TestController(IProcess _Process)
: base(_Process)
{
ui = new UserInterface();
reference = 2.5;
ui.textBox1.Text = reference.ToString();
}
示例9: SpawnTrinket
public void SpawnTrinket(IProcess targetProcess, TrinketSpawnConfiguration trinketSpawnConfiguration)
{
var components = new List<TrinketComponent>();
if (trinketSpawnConfiguration.IsDebugEnabled) {
components.Add(new DebugComponent());
}
if (trinketSpawnConfiguration.IsFileSystemHookingEnabled) {
components.Add(new FilesystemComponent(trinketSpawnConfiguration.IsFileSystemOverridingEnabled));
}
if (trinketSpawnConfiguration.Name != null) {
components.Add(new NameComponent(trinketSpawnConfiguration.Name));
}
if (trinketSpawnConfiguration.IsLoggingEnabled) {
components.Add(new VerboseLoggerComponent());
}
if (trinketSpawnConfiguration.IsCommandingEnabled) {
components.Add(new CommandListComponent(trinketSpawnConfiguration.CommandList));
}
if (trinketSpawnConfiguration.IsProcessSuspensionEnabled) {
components.Add(new ProcessSuspensionComponent(trinketSpawnConfiguration.SuspendedProcessNames));
}
var targetProcessId = targetProcess.Id;
var startupConfiguration = new TrinketStartupConfigurationImpl(targetProcessId, components);
using (var ms = streamFactory.CreateMemoryStream()) {
pofSerializer.Serialize(ms.Writer, startupConfiguration);
exeggutorService.SpawnHatchling(
kTrinketEggName,
new SpawnConfiguration {
Arguments = ms.ToArray(),
InstanceName = kTrinketEggName + "_" + targetProcessId,
StartFlags = HatchlingStartFlags.StartAsynchronously
});
}
}
示例10: DoNothing
public override IEnumerable<TAVerb> DoNothing()
{
IProcess[] actions = new IProcess[_host.NumWords];
for (int i = 0; i < _host.NumWords; i++)
actions[i] = _host.Ops[i].Stick(StdLogicVector.DCs(_host.WordWidth));
yield return Verb(ETVMode.Locked, actions);
}
示例11: StopProcess
public async Task StopProcess(IProcess process)
{
string exePath = process.ExePath;
try
{
if (!await StopGracefully(process))
{
Trace.TraceInformation(
"Process has not exited gracefully or is not listening to the stop event, let's try to close the main window");
if (!await Close(process))
{
Trace.TraceInformation("The host process would not close, attempting to kill");
await process.Kill();
Trace.TraceInformation("The host process was killed");
}
else
{
Trace.TraceInformation("Process exited with CloseMainWindow");
}
}
else
{
Trace.TraceInformation("Process exited gracefully");
}
await process.ReleaseResources();
await Task.Delay(ReleaseResourcesDelayMilliseconds); // allowing the os some time to release resources
}
catch (Exception ex)
{
// there is nothing more we can do; we'll swallow the exception and log an error
Trace.TraceError("{0} host process could not be killed. Exception was: {1}", exePath, ex);
}
}
示例12: DashboardController
public DashboardController(IServiceFactory factory,
IProcess<OrgMemberDocVisibilityByOrgAdminParams, GeneralSuccessResultViewModel> orgDocVisibilityProcess)
{
_serviceFactory = factory;
_unitOfWork = factory.GetService<IUnitOfWork>();
_orgDocVisibilityProcess = orgDocVisibilityProcess;
}
示例13: CreateContext
public IActionExecutionContext CreateContext(IProcess remoteProcess)
{
Contract.Requires<ArgumentNullException>(remoteProcess != null);
Contract.Ensures(Contract.Result<IActionExecutionContext>() != null);
throw new NotImplementedException();
}
示例14: BackupGitRepositoriesCommandProvider
public BackupGitRepositoriesCommandProvider(IBackupGitRepositoriesConfigurationProvider backupGitRepositoriesConfigurationProvider, IGitRepositoryBackupFolderProvider gitRepositoryBackupFolderProvider, IProcess process, ILog logger)
{
_backupGitRepositoriesConfigurationProvider = backupGitRepositoriesConfigurationProvider;
_gitRepositoryBackupFolderProvider = gitRepositoryBackupFolderProvider;
_process = process;
_logger = logger;
}
示例15: RemoveProcess
public static void RemoveProcess(IProcess Proc)
{
lock (SyncObject)
{
ActiveProcesses.Remove(Proc);
}
}