本文整理汇总了C#中MonoDevelop.Projects.ExecutionContext类的典型用法代码示例。如果您正苦于以下问题:C# ExecutionContext类的具体用法?C# ExecutionContext怎么用?C# ExecutionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExecutionContext类属于MonoDevelop.Projects命名空间,在下文中一共展示了ExecutionContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanExecute
/// <summary>
/// Flags Unity projects for debugging with this addin
/// </summary>
protected override bool CanExecute (SolutionEntityItem item, ExecutionContext context, ConfigurationSelector configuration)
{
if (CanExecuteProject (item as Project, context)) {
return context.ExecutionHandler.CanExecute (new UnityExecutionCommand (item.BaseDirectory.FullPath));
}
return base.CanExecute (item, context, configuration);
}
示例2: DoExecute
protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
{
IodineConfiguration config = (IodineConfiguration)GetConfiguration (configuration);
IConsole console = config.ExternalConsole ?
context.ExternalConsoleFactory.CreateConsole (!config.PauseConsoleOutput) :
context.ConsoleFactory.CreateConsole (!config.PauseConsoleOutput);
AggregatedOperationMonitor aggregatedMonitor = new AggregatedOperationMonitor (monitor);
try {
string param = string.Format ("\"{0}\" {1}", config.MainFile, config.CommandLineParameters);
IProcessAsyncOperation op = Runtime.ProcessService.StartConsoleProcess ("iodine",
param, BaseDirectory,
config.EnvironmentVariables, console, null);
monitor.CancelRequested += delegate {
op.Cancel ();
};
aggregatedMonitor.AddOperation (op);
op.WaitForCompleted ();
monitor.Log.WriteLine ("Iodine exited with code: " + op.ExitCode);
} catch (Exception e) {
monitor.ReportError (GettextCatalog.GetString ("Cannot execute \"{0}\"", config.MainFile), e);
} finally {
console.Dispose ();
aggregatedMonitor.Dispose ();
}
}
示例3: OnExecute
protected override Task OnExecute(ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
{
if (base.OnGetCanExecute(context, configuration))
{
return base.OnExecute(monitor, context, configuration);
}
try
{
var project = Project as DotNetProject;
if (project != null && IsSupportedProject)
{
const string SoftDebuggerName = RhinoSoftDebuggerEngine.DebuggerName;
var config = project.GetConfiguration(configuration) as DotNetProjectConfiguration;
var cmd = new RhinoCommonExecutionCommand(project.GetOutputFileName(configuration), project);
cmd.Arguments = config.CommandLineParameters;
cmd.WorkingDirectory = Path.GetDirectoryName(config.CompiledOutputName);
cmd.EnvironmentVariables = config.GetParsedEnvironmentVariables();
cmd.TargetRuntime = project.TargetRuntime;
cmd.UserAssemblyPaths = project.GetUserAssemblyPaths(configuration);
var executionModes = Runtime.ProcessService.GetExecutionModes();
var executionMode = executionModes.SelectMany(r => r.ExecutionModes).FirstOrDefault(r => r.Id == SoftDebuggerName);
var console = context.ConsoleFactory.CreateConsole(new OperationConsoleFactory.CreateConsoleOptions(true));
var operation = executionMode.ExecutionHandler.Execute(cmd, console);
monitor.CancellationToken.Register(() => operation.Cancel());
return operation.Task;
}
}
catch (Exception ex)
{
monitor.ReportError($"An error occurred starting Rhino.\n{ex}", ex);
}
return null;
}
示例4: Execute
internal protected virtual Task Execute (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration, SolutionRunConfiguration runConfiguration)
{
context.RunConfiguration = runConfiguration;
#pragma warning disable 618 // Type or member is obsolete
return Execute (monitor, context, configuration);
#pragma warning restore 618 // Type or member is obsolete
}
示例5: TestContext
internal TestContext (ITestProgressMonitor monitor, TestResultsPad resultsPad, MonoDevelop.Projects.ExecutionContext executionContext, DateTime testDate)
{
this.monitor = monitor;
if (executionContext == null)
executionContext = new ExecutionContext (Runtime.ProcessService.DefaultExecutionHandler, IdeApp.Workbench.ProgressMonitors.ConsoleFactory, null);
this.executionContext = executionContext;
// Round to seconds
this.testDate = new DateTime ((testDate.Ticks / TimeSpan.TicksPerSecond) * TimeSpan.TicksPerSecond);
}
示例6: CanRun
public static bool CanRun(OpenFLProject project, OpenFLProjectConfiguration configuration, ExecutionContext context)
{
ExecutionCommand cmd = (NativeExecutionCommand)CreateExecutionCommand (project, configuration);
if (cmd == null)
{
return false;
}
return context.ExecutionHandler.CanExecute (cmd);
}
示例7: CanExecute
public override bool CanExecute (IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
{
var retval = false;
if(item is DotNetProject)
{
var p = item as DotNetProject;
retval = p.References.Any(y=>y.Reference.Contains("manos"));
}
return retval || base.CanExecute(item,context, configuration);
}
示例8: Debug
public static IAsyncOperation Debug (this ProjectOperations opers, IBuildTarget entry)
{
if (opers.CurrentRunOperation != null && !opers.CurrentRunOperation.IsCompleted)
return opers.CurrentRunOperation;
ExecutionContext context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors, IdeApp.Workspace.ActiveExecutionTarget);
IAsyncOperation op = opers.Execute (entry, context);
return op;
}
示例9: OnGetCanExecute
protected override bool OnGetCanExecute(ExecutionContext context, ConfigurationSelector configuration)
{
if(IdeApp.Workspace.GetAllSolutions().Any((s) => s.StartupItem == this))
{
return context.ExecutionTarget is MicroFrameworkExecutionTarget && base.OnGetCanExecute(context, configuration);
}
else
{
return base.OnGetCanExecute(context, configuration);
}
}
示例10: Execute
/// <summary>
/// Launch Unity project
/// </summary>
public override void Execute (MonoDevelop.Core.IProgressMonitor monitor, IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
{
if (CanExecuteProject (item as Project, context)) {
DispatchService.GuiDispatch (delegate {
IdeApp.Workbench.CurrentLayout = "Debug";
IdeApp.ProjectOperations.CurrentRunOperation = context.ExecutionHandler.Execute (new UnityExecutionCommand (item.BaseDirectory.FullPath), context.ConsoleFactory.CreateConsole (true));
});
} else {
base.Execute (monitor, item, context, configuration);
}
}
示例11: ProfileFile
public static IAsyncOperation ProfileFile (IProfiler profiler, string fileName)
{
if (IdeApp.ProjectOperations.CurrentRunOperation != null
&& !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
return IdeApp.ProjectOperations.CurrentRunOperation;
SwitchWorkbenchContext (ProfileWorkbenchContext);
ExecutionContext context = new ExecutionContext (profiler.GetDefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);
return IdeApp.ProjectOperations.ExecuteFile (fileName, context);
}
示例12: CanExecute
public override bool CanExecute (IBuildTarget item, ExecutionContext context, ConfigurationSelector configuration)
{
// We check for DefaultExecutionHandlerFactory because the tests can't run using any other execution mode
bool res = base.CanExecute (item, context, configuration);
if (!res && (item is IWorkspaceObject)) {
UnitTest test = NUnitService.Instance.FindRootTest ((IWorkspaceObject)item);
return (test != null) && test.CanRun (context.ExecutionHandler);
} else
return res;
}
示例13: ProfileApplication
public static IAsyncOperation ProfileApplication (IProfiler profiler, string executable, string workingDirectory, string args)
{
if (IdeApp.ProjectOperations.CurrentRunOperation != null
&& !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
return IdeApp.ProjectOperations.CurrentRunOperation;
SwitchWorkbenchContext (ProfileWorkbenchContext);
ExecutionContext context = new ExecutionContext (profiler.GetDefaultExecutionHandlerFactory (), IdeApp.Workbench.ProgressMonitors);
//TODO:
return NullAsyncOperation.Failure;
}
示例14: ExecuteProject
public static void ExecuteProject(DubProject prj,IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration, string dubVerb = "run")
{
bool isDebug = context.ExecutionHandler.GetType ().Name.StartsWith ("Debug");
var conf = prj.GetConfiguration(configuration) as DubProjectConfiguration;
IConsole console;
if (conf.ExternalConsole)
console = context.ExternalConsoleFactory.CreateConsole(!conf.PauseConsoleOutput);
else
console = context.ConsoleFactory.CreateConsole(true);
var operationMonitor = new AggregatedOperationMonitor(monitor);
var sr = new StringBuilder();
if (!isDebug) {
sr.Append (dubVerb);
BuildCommonArgAppendix (sr, prj, configuration);
}
try
{
var cmd = isDebug ? prj.CreateExecutionCommand(configuration) : new NativeExecutionCommand(DubSettings.Instance.DubCommand, sr.ToString(), prj.BaseDirectory.ToString());
if (!context.ExecutionHandler.CanExecute(cmd))
{
monitor.ReportError("Cannot execute \"" + cmd.Command + " " + cmd.Arguments + "\". The selected execution mode is not supported for Dub projects.", null);
return;
}
var op = context.ExecutionHandler.Execute(cmd, console);
operationMonitor.AddOperation(op);
op.WaitForCompleted();
if(op.ExitCode != 0)
monitor.ReportError(cmd.Command+" exited with code: "+op.ExitCode.ToString(), null);
else
monitor.Log.WriteLine(cmd.Command+" exited with code: {0}", op.ExitCode);
}
catch (Exception ex)
{
monitor.ReportError("Cannot execute \"" + sr.ToString() + "\"", ex);
}
finally
{
operationMonitor.Dispose();
console.Dispose();
}
}
示例15: Execute
protected override void Execute (IProgressMonitor monitor, SolutionEntityItem entry, ExecutionContext context, ConfigurationSelector configuration)
{
SolutionItemConfiguration conf = entry.GetConfiguration (configuration) as SolutionItemConfiguration;
if (conf != null) {
ExecutionContext localContext = new ExecutionContext (Runtime.ProcessService.DefaultExecutionHandler, context.ConsoleFactory);
conf.CustomCommands.ExecuteCommand (monitor, entry, CustomCommandType.BeforeExecute, localContext, configuration);
if (monitor.IsCancelRequested)
return;
}
base.Execute (monitor, entry, context, configuration);
if (conf != null && !monitor.IsCancelRequested) {
ExecutionContext localContext = new ExecutionContext (Runtime.ProcessService.DefaultExecutionHandler, context.ConsoleFactory);
conf.CustomCommands.ExecuteCommand (monitor, entry, CustomCommandType.AfterExecute, localContext, configuration);
}
}