本文整理匯總了C#中System.ProcessResult類的典型用法代碼示例。如果您正苦於以下問題:C# ProcessResult類的具體用法?C# ProcessResult怎麽用?C# ProcessResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ProcessResult類屬於System命名空間,在下文中一共展示了ProcessResult類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Process
public override ProcessResult Process()
{
ProcessResult res = new ProcessResult();
try
{
Process p = System.Diagnostics.Process.GetProcessById(processID);
if (p != null)
{
p.Kill();
res.ErrorCode = 0;
return res;
}
else
{
res.ErrorCode = 6;
res.ErrorDetails = "Nie ma takiego procesu";
return res;
}
}
catch (Exception exc)
{
res.ErrorCode = 5;
res.ErrorDetails = exc.ToString();
}
return res;
}
示例2: BuscarSolicitudVenta
public ProcessResult<List<SolicitudVentaDomain>> BuscarSolicitudVenta(int numerosolicitud)
{
ProcessResult<List<SolicitudVentaDomain>> list = new ProcessResult<List<SolicitudVentaDomain>>();
List<SolicitudVentaDomain> listResult = new List<SolicitudVentaDomain>();
try
{
List<SolicitudVentaLogic> solicitudVenta = EmpleadoLogicRepository.BuscarSolicitudVenta(numerosolicitud);
foreach (var item in solicitudVenta)
{
SolicitudVentaDomain svd = new SolicitudVentaDomain();
svd.productoId = item.productoId;
svd.descripcionProducto = item.descripcionProducto;
svd.presentacionProducto = item.presentacionProducto;
svd.cantidadProducto = item.cantidadProducto;
svd.descuento = item.descuento;
svd.precioProducto = item.precioProducto;
svd.subtotal = item.subtotal;
listResult.Add(svd);
}
list.Result = listResult;
}
catch (Exception e)
{
list.IsSuccess = true;
list.Exception = new ApplicationLayerException<SolicitudPermisoService>("Ocurrio un problema en el sistema", e);
}
return list;
}
示例3: VerifyProcessRan
static void VerifyProcessRan(this Process command, ProcessResult result)
{
if (!result.Success)
throw new ProcessRunnerException(
string.Format("Failed to execute process \"{0}\". Process status was {1}.",
command.Options.CommandLine, result.Status));
}
示例4: Process
public override ProcessResult Process(string ip, InstructionTask instructionTask)
{
ProcessResult result = new ProcessResult();
result.Done = false;
result.Message = "設置檢測儀IP地址失敗!";
return result;
}
示例5: Process
public override ProcessResult Process(string ip, InstructionTask instructionTask)
{
ProcessResult result = new ProcessResult();
result.Done = true;
result.Message = "設置檢測儀探頭閥值下限成功!";
return result;
}
示例6: Process
public override ProcessResult Process(string ip, InstructionTask instructionTask)
{
ProcessResult result = new ProcessResult();
result.Done = false;
result.Message = string.Empty;
return result;
}
示例7: Process
override public ProcessResult Process(ProcessResult lastSiblingResult, TriggerObject trigObject)
{
trigObject.CurrentNodeExecutionChain.Add(this);
ProcessResult result = UserDefinedFunction.Execute(trigObject);
trigObject.CurrentNodeExecutionChain.Remove(this);
return result;
}
示例8: LogProcessResult
/// <summary>
/// Logs the result of a finished process.
/// </summary>
public static void LogProcessResult(ProcessResult result)
{
var outcome = result.Failed ? "failed" : "succeeded";
Console.WriteLine($"The process \"{result.ExecutablePath} {result.Args}\" {outcome} with code {result.Code}.");
Console.WriteLine($"Standard Out:");
Console.WriteLine(result.StdOut);
Console.WriteLine($"Standard Error:");
Console.WriteLine(result.StdErr);
}
示例9: Process
public override ProcessResult Process(ProcessResult lastSiblingResult, TriggerObject trigObject)
{
if (InfiniteLoopRisk == true)
throw new UberScriptException("Line " + LineNumber + ": " + base.ScriptString + "\nAttempted to execute ForLoop with InfiniteLoop risk! Skipping for loop!");
int maxLoopNumber = 10000;
int loopCount = 0;
// first try to execute the initial statement
if (InitialStatement != null)
{
InitialStatement.Process(ProcessResult.None, trigObject);
}
Object result = ConditionalMathTree.Calculate(trigObject);
while (result is bool && (bool)result)
{
//execute the child code
ProcessResult lastResult = ProcessChildren(trigObject);
if (lastResult == ProcessResult.Break) // exit out of this for loop
return ProcessResult.None;
if (lastResult == ProcessResult.Return || lastResult == ProcessResult.ReturnOverride)
{
return lastResult;
}
// ProcessResult.Continue--just keep going
//execute the next part of the loop (often ints.i++)
try
{
RepeatedStatement.Process(ProcessResult.None, trigObject);
}
catch (Exception e)
{
throw new UberScriptException("Line " + LineNumber + ": " + base.ScriptString + "\nForLoop Repeated Statement execution error: ", e);
}
try
{
// see whether we still meet our condition
result = ConditionalMathTree.Calculate(trigObject);
}
catch (Exception e)
{
throw new UberScriptException("Line " + LineNumber + ": " + base.ScriptString + "\nForLoop Conditional Statement execution error: ", e);
}
loopCount++;
if (loopCount > maxLoopNumber)
{
InfiniteLoopRisk = true;
throw new UberScriptException("Attempted to execute ForLoop with InfiniteLoop risk! Skipping for loop!");
}
}
return ProcessResult.None;
}
示例10: SetUp
public void SetUp()
{
_mocks = new MockRepository(MockBehavior.Strict);
_viewFactoryMock = _mocks.Create<IViewFactory>();
_viewMock = _mocks.Create<IView<ProcessResult>>();
_renderedResult = null;
_viewMock.Setup(it => it.Render(It.IsNotNull<ProcessResult>()))
.Callback<ProcessResult>(
result => { _renderedResult = result; }
);
_viewFactoryMock.Setup(it => it.CreateView<ProcessResult>("text")).Returns(_viewMock.Object);
}
示例11: BeginProcessRequest
public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
{
var apm = new ProcessResult(cb, context, extraData);
context.Response.Write(string.Format("<h1>This handler uses a simple custom implementation of the IAsyncResult interface (Async Programming Model)</h1><br/><br/><hr/><br/><br/>"));
context.Response.Write(string.Format("<br/>Before calling start asynchronously: {0} ThreadPool ID: {1}", DateTime.Now.ToString(), Thread.CurrentThread.ManagedThreadId));
apm.Start();
context.Response.Write(string.Format("<br/>After calling start asynchronously: {0} ThreadPool ID: {1}", DateTime.Now.ToString(), Thread.CurrentThread.ManagedThreadId));
return apm;
}
示例12: BeginProcessRequest
public IAsyncResult BeginProcessRequest(object sender, EventArgs e, AsyncCallback cb, object extraData)
{
HttpContext.Current.Response.Write(string.Format("<br /> Thread ID: {0} From: {1}", Thread.CurrentThread.ManagedThreadId, MethodInfo.GetCurrentMethod().Name));
//Func<TimeSpan, DateTime> operation = this.ExecuteLongTimeConsumingOperation;
//return operation.BeginInvoke(TimeSpan.FromDays(10), cb, extraData);
var f = new ProcessResult(cb, this.Context, extraData);
f.Start();
return f;
}
示例13: ToString
public static string ToString(ProcessResult result)
{
switch (result) {
case ProcessResult.EmptyImage:
return @"Ошибочное изображение";
case ProcessResult.NotDetected:
return @"Не определено лицо";
case ProcessResult.Success:
return @"Удачно";
default:
return @"Ошибка обработки";
}
}
示例14: VerifyExitCode
static void VerifyExitCode(this Process command, ProcessResult result, ResultExpectation resultExpectation, ILogger logger)
{
if (result.ExitCode == SuccessExitCode)
return;
string message = string.Format("Process \"{0}\" failed, exit code {1}. All output: {2}",
command.Options.CommandLine, result.ExitCode, result.AllOutput);
if (resultExpectation == ResultExpectation.MustNotFail)
throw new Exception(message);
logger.LogWarning(message);
}
示例15: Process
public override ProcessResult Process()
{
ProcessResult result = new ProcessResult();
try
{
activeProcesses = System.Diagnostics.Process.GetProcesses();
}
catch (Exception exc)
{
result.ErrorCode = 5;
result.ErrorDetails = exc.ToString();
}
return result;
}