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


C# AggregatedOperationMonitor.AddOperation方法代码示例

本文整理汇总了C#中MonoDevelop.Core.ProgressMonitoring.AggregatedOperationMonitor.AddOperation方法的典型用法代码示例。如果您正苦于以下问题:C# AggregatedOperationMonitor.AddOperation方法的具体用法?C# AggregatedOperationMonitor.AddOperation怎么用?C# AggregatedOperationMonitor.AddOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MonoDevelop.Core.ProgressMonitoring.AggregatedOperationMonitor的用法示例。


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

示例1: 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 ();
            }
        }
开发者ID:IodineLang,项目名称:IodineBindings,代码行数:30,代码来源:IodineProject.cs

示例2: ExecuteProject

        internal static void ExecuteProject(DubProject prj,IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            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("run");
            Instance.BuildCommonArgAppendix(sr, prj, configuration);

            try
            {
                var cmd = new NativeExecutionCommand(Instance.DubExecutable, sr.ToString(), prj.BaseDirectory.ToString());
                if (!context.ExecutionHandler.CanExecute(cmd))
                {
                    monitor.ReportError("Cannot execute \""  + "\". The selected execution mode is not supported for Dub projects.", null);
                    return;
                }

                var op = context.ExecutionHandler.Execute(cmd, console);

                operationMonitor.AddOperation(op);
                op.WaitForCompleted();

                monitor.Log.WriteLine(Instance.DubExecutable+" exited with code: {0}", op.ExitCode);

            }
            catch (Exception ex)
            {
                monitor.ReportError("Cannot execute \"" + sr.ToString() + "\"", ex);
            }
            finally
            {
                operationMonitor.Dispose();
                console.Dispose();
            }
        }
开发者ID:simendsjo,项目名称:Mono-D,代码行数:41,代码来源:DubBuilder.cs

示例3: DoExecute

        protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            var config = GetConfiguration (configuration) as DotNetProjectConfiguration;
            monitor.Log.WriteLine (GettextCatalog.GetString ("Running {0} ...", Name));

            IConsole console = CreateConsole (config, context);
            var aggregatedOperationMonitor = new AggregatedOperationMonitor (monitor);

            try {
                try {
                    ExecutionCommand executionCommand = CreateExecutionCommand (configuration, config);
                    if (context.ExecutionTarget != null)
                        executionCommand.Target = context.ExecutionTarget;

                    IProcessAsyncOperation asyncOp = new DnxExecutionHandler ().Execute (executionCommand, console);
                    aggregatedOperationMonitor.AddOperation (asyncOp);
                    asyncOp.WaitForCompleted ();

                    monitor.Log.WriteLine (GettextCatalog.GetString ("The application exited with code: {0}", asyncOp.ExitCode));
                } finally {
                    console.Dispose ();
                    aggregatedOperationMonitor.Dispose ();
                }
            } catch (Exception ex) {
                LoggingService.LogError (string.Format ("Cannot execute \"{0}\"", Name), ex);
                monitor.ReportError (GettextCatalog.GetString ("Cannot execute \"{0}\"", Name), ex);
            }
        }
开发者ID:lordfinal,项目名称:monodevelop-dnx-addin,代码行数:28,代码来源:DnxProject.cs

示例4: DoExecute

        protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            if (!CheckCanExecute (configuration))
                return;

            var config = (PythonConfiguration) GetConfiguration (configuration);
            IConsole console = config.ExternalConsole ?
                context.ExternalConsoleFactory.CreateConsole (!config.PauseConsoleOutput) :
                context.ConsoleFactory.CreateConsole (!config.PauseConsoleOutput);

            var aggregatedMonitor = new AggregatedOperationMonitor (monitor);

            try {
                var executionCommand = CreateExecutionCommand (configuration, config);
                if (!context.ExecutionHandler.CanExecute (executionCommand)) {
                    monitor.ReportError (GettextCatalog.GetString ("Cannot execute application. The selected execution mode " +
                        "is not supported for IronPython projects"), null);
                    return;
                }

                var asyncOp = context.ExecutionHandler.Execute (executionCommand, console);
                aggregatedMonitor.AddOperation (asyncOp);
                asyncOp.WaitForCompleted ();

                monitor.Log.WriteLine ("The application exited with code: " + asyncOp.ExitCode);

            } catch (Exception exc) {
                monitor.ReportError (GettextCatalog.GetString ("Cannot execute \"{0}\"", config.MainModule), exc);
            } finally {
                console.Dispose ();
                aggregatedMonitor.Dispose ();
            }
        }
开发者ID:carlosalberto,项目名称:IronPythonBinding,代码行数:33,代码来源:PythonProject.cs

示例5: Run

        public static void Run(HaxeProject project, HaxeProjectConfiguration configuration, IProgressMonitor monitor, ExecutionContext context)
        {
            ExecutionCommand cmd = CreateExecutionCommand (project, configuration);

            if (cmd is NativeExecutionCommand)
            {
                IConsole console;
                if (configuration.ExternalConsole)
                    console = context.ExternalConsoleFactory.CreateConsole (false);
                else
                    console = context.ConsoleFactory.CreateConsole (false);

                AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);

                try
                {
                    if (!context.ExecutionHandler.CanExecute (cmd))
                    {
                        monitor.ReportError (String.Format ("Cannot execute '{0}'.", cmd.CommandString), null);
                        return;
                    }

                    IProcessAsyncOperation operation = context.ExecutionHandler.Execute (cmd, console);

                    operationMonitor.AddOperation (operation);
                    operation.WaitForCompleted ();

                    monitor.Log.WriteLine ("Player exited with code {0}.", operation.ExitCode);
                }
                catch (Exception)
                {
                    monitor.ReportError (String.Format ("Error while executing '{0}'.", cmd.CommandString), null);
                }
                finally
                {
                    operationMonitor.Dispose ();
                    console.Dispose ();
                }
            }
            else
            {
                Process.Start (cmd.CommandString);
            }
        }
开发者ID:aaulia,项目名称:md-haxebinding,代码行数:44,代码来源:HaxeCompilerManager.cs

示例6: ExecuteCommand

        /// <summary>
        /// Executes a file and reports events related to the execution to the 'monitor' passed in the parameters.
        /// </summary>
        static int ExecuteCommand(
            string command,
            string args,
            string baseDirectory,

            IProgressMonitor monitor,
            out string errorOutput,
            out string programOutput)
        {
            errorOutput = string.Empty;
            int exitCode = -1;

            var swError = new StringWriter ();
            var swOutput = new StringWriter ();

            var chainedError = new LogTextWriter ();
            chainedError.ChainWriter (monitor.Log);
            chainedError.ChainWriter (swError);

            var chainedOutput = new LogTextWriter ();
            chainedOutput.ChainWriter (monitor.Log);
            chainedOutput.ChainWriter (swOutput);

            monitor.Log.WriteLine ("{0} {1}", command, args);

            var operationMonitor = new AggregatedOperationMonitor (monitor);
            var p = Runtime.ProcessService.StartProcess (command, args, baseDirectory, chainedOutput, chainedError, null);
            operationMonitor.AddOperation (p); //handles cancellation

            p.WaitForOutput ();
            errorOutput = swError.ToString ();
            programOutput = swOutput.ToString ();
            exitCode = p.ExitCode;
            p.Dispose ();

            if (monitor.IsCancelRequested) {
                monitor.Log.WriteLine (GettextCatalog.GetString ("Build cancelled"));
                monitor.ReportError (GettextCatalog.GetString ("Build cancelled"), null);
                if (exitCode == 0)
                    exitCode = -1;
            }
            {
                chainedError.Close ();
                swError.Close ();
                operationMonitor.Dispose ();
            }

            return exitCode;
        }
开发者ID:rikkimax,项目名称:Mono-D,代码行数:52,代码来源:ProjectBuilder.cs

示例7: Update

		public static void Update (ProjectFile file, bool force)
		{
			ISingleFileCustomTool tool;
			ProjectFile genFile;
			if (!ShouldRunGenerator (file, force, out tool, out genFile)) {
				return;
			}
			
			TaskService.Errors.ClearByOwner (file);
			
			//if this file is already being run, cancel it
			lock (runningTasks) {
				IAsyncOperation runningTask;
				if (runningTasks.TryGetValue (file.FilePath, out runningTask)) {
					runningTask.Cancel ();
					runningTasks.Remove (file.FilePath);
				}
			}
			
			var monitor = IdeApp.Workbench.ProgressMonitors.GetToolOutputProgressMonitor (false);
			var result = new SingleFileCustomToolResult ();
			var aggOp = new AggregatedOperationMonitor (monitor);
			try {
				monitor.BeginTask (GettextCatalog.GetString ("Running generator '{0}' on file '{1}'...", file.Generator, file.Name), 1);
				IAsyncOperation op = tool.Generate (monitor, file, result);
				runningTasks.Add (file.FilePath, op);
				aggOp.AddOperation (op);
				op.Completed += delegate {
					lock (runningTasks) {
						IAsyncOperation runningTask;
						if (runningTasks.TryGetValue (file.FilePath, out runningTask) && runningTask == op) {
							runningTasks.Remove (file.FilePath);
							UpdateCompleted (monitor, aggOp, file, genFile, result, false);
						} else {
							//it was cancelled because another was run for the same file, so just clean up
							aggOp.Dispose ();
							monitor.EndTask ();
							monitor.ReportWarning (GettextCatalog.GetString ("Cancelled because generator ran again for the same file"));
							monitor.Dispose ();
						}
					}
				};
			} catch (Exception ex) {
				result.UnhandledException = ex;
				UpdateCompleted (monitor, aggOp, file, genFile, result, false);
			}
		}
开发者ID:riverans,项目名称:monodevelop,代码行数:47,代码来源:CustomToolService.cs

示例8: OnExecute

		protected override void OnExecute (IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configSel)
		{
			var conf = (MonoDroidProjectConfiguration) GetConfiguration (configSel);
			
			if (NeedsBuilding (configSel)) {
				monitor.ReportError (
					GettextCatalog.GetString ("MonoDroid projects must be built before uploading"), null);
				return;
			}
			
			var manifestFile = conf.ObjDir.Combine ("android", "AndroidManifest.xml");
			if (!File.Exists (manifestFile)) {
				monitor.ReportError ("Intermediate manifest file is missing", null);
				return;
			}
			
			var manifest = AndroidAppManifest.Load (manifestFile);
			var activity = manifest.GetLaunchableActivityName ();
			if (string.IsNullOrEmpty (activity)) {
				monitor.ReportError ("Application does not contain a launchable activity", null);
				return;
			}
			activity = manifest.PackageName + "/" + activity;
			
			IConsole console = null;
			var opMon = new AggregatedOperationMonitor (monitor);
			try {
				var handler = context.ExecutionHandler as MonoDroidExecutionHandler;
				bool useHandlerDevice = handler != null && handler.DeviceTarget != null;
				
				AndroidDevice device = null;
				
				if (useHandlerDevice) {
					device = handler.DeviceTarget;
				} else {
					var deviceId = GetDeviceTarget (conf);
					if (deviceId != null)
						device = MonoDroidFramework.DeviceManager.GetDevice (deviceId);
					if (device == null)
						SetDeviceTarget (conf, null);
				}
				
				var uploadOp = MonoDroidUtility.SignAndUpload (monitor, this, configSel, false, ref device);
				
				//user cancelled device selection
				if (device == null)
					return;
				
				opMon.AddOperation (uploadOp);
				uploadOp.WaitForCompleted ();
				
				if (!uploadOp.Success || monitor.IsCancelRequested)
					return;
				
				//successful, persist the device choice
				if (!useHandlerDevice)
					SetDeviceTarget (conf, device.ID);
				
				var command = (MonoDroidExecutionCommand) CreateExecutionCommand (configSel, conf);
				command.Device = device;
				command.Activity = activity;
				
				//FIXME: would be nice to skip this if it's a debug handler, which will set another value later
				var propOp = MonoDroidFramework.Toolbox.SetProperty (device, "debug.mono.extra", string.Empty);
				opMon.AddOperation (propOp);
				propOp.WaitForCompleted ();
				if (!propOp.Success) {
					monitor.ReportError (GettextCatalog.GetString ("Count not clear debug settings on device"),
						propOp.Error);
					return;
				}
				
				console = context.ConsoleFactory.CreateConsole (false);
				var executeOp = context.ExecutionHandler.Execute (command, console);
				opMon.AddOperation (executeOp);
				executeOp.WaitForCompleted ();
				
			} finally {
				opMon.Dispose ();
				if (console != null)
					console.Dispose ();
			}
		}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:83,代码来源:MonoDroidProject.cs

示例9: OnExecute

        protected override void OnExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configSel)
        {
            var conf = (MonoBrickProjectConfiguration)GetConfiguration(configSel);
            var cmd = (MonoBrickExecutionCommand)CreateExecutionCommand(configSel, conf);

            bool debugExecution = !(context.ExecutionHandler is MonoBrickExecutionHandler);

            var runtime = conf.TargetRuntime;

            if (runtime.RuntimeId != "Mono" && debugExecution)
            {
                monitor.ReportError("You must use the Mono runtime for debugging!", null);
                return;
            }

            using (var opMon = new AggregatedOperationMonitor(monitor))
            {
                IConsole console = null;

                try
                {
                    console = conf.ExternalConsole
                        ? context.ExternalConsoleFactory.CreateConsole(!conf.PauseConsoleOutput)
                        : context.ConsoleFactory.CreateConsole(!conf.PauseConsoleOutput);

                    cmd.Console = console;

                    if (!MonoBrickUtility.GetEV3Configuration(console))
                    {
                        string configError = "Invalid EV3 configuration. Check Preferences->MonoBrick for correct settings!";

                        console.Log.WriteLine(configError);
                        monitor.ReportError(configError, null);
                        return;
                    }

                    console.Log.WriteLine("Upload to brick...");

                    string EV3IPAddress = UserSettings.Instance.IPAddress;

                    var uploadOp = MonoBrickUtility.Upload(EV3IPAddress, cmd);
                    opMon.AddOperation(uploadOp);

                    uploadOp.WaitForCompleted();

                    if (!uploadOp.Success)
                    {
                        console.Log.WriteLine(uploadOp.ErrorMessage);
                        monitor.ReportError(uploadOp.ErrorMessage, null);
                        return;
                    }

                    console.Log.WriteLine("Running on brick...");

                    var ex = context.ExecutionHandler.Execute(cmd, console);
                    opMon.AddOperation(ex);
                    ex.WaitForCompleted();

                    console.Log.WriteLine("");
                    console.Log.WriteLine("Finished!");
                }
                finally
                {
                    if (console != null)
                        console.Dispose();
                }
            }
        }
开发者ID:RoninWest,项目名称:monoev3,代码行数:68,代码来源:MonoBrickAddinProjects.cs

示例10: Run

        public static void Run(NMEProject project, NMEProjectConfiguration configuration, IProgressMonitor monitor, ExecutionContext context)
        {
            string exe = "haxelib";
            string args = "run nme run " + project.TargetNMMLFile + " " + configuration.Platform.ToLower ();

            if (configuration.DebugMode)
            {
                args += " -debug";
            }

            if (project.AdditionalArguments != "")
            {
                args += " " + project.AdditionalArguments;
            }

            if (configuration.AdditionalArguments != "")
            {
                args += " " + configuration.AdditionalArguments;
            }

            IConsole console;
            if (configuration.ExternalConsole)
                console = context.ExternalConsoleFactory.CreateConsole (false);
            else
                console = context.ConsoleFactory.CreateConsole (false);

            AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);

            try
            {
                NativeExecutionCommand cmd = new NativeExecutionCommand (exe);
                cmd.Arguments = args;
                cmd.WorkingDirectory = project.BaseDirectory.FullPath;

                if (!context.ExecutionHandler.CanExecute (cmd))
                {
                    monitor.ReportError (String.Format ("Cannot execute '{0} {1}'.", exe, args), null);
                    return;
                }

                IProcessAsyncOperation operation = context.ExecutionHandler.Execute (cmd, console);

                operationMonitor.AddOperation (operation);
                operation.WaitForCompleted ();

                monitor.Log.WriteLine ("Player exited with code {0}.", operation.ExitCode);
            }
            catch (Exception)
            {
                monitor.ReportError (String.Format ("Error while executing '{0} {1}'.", exe, args), null);
            }
            finally
            {
                operationMonitor.Dispose ();
                console.Dispose ();
            }
        }
开发者ID:tjhei,项目名称:md-haxebinding,代码行数:57,代码来源:NMECommandLineToolsManager.cs

示例11: OnExecute

		protected override void OnExecute (IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configSel)
		{
			var conf = (MonoDroidProjectConfiguration) GetConfiguration (configSel);
			
			if (NeedsBuilding (configSel)) {
				monitor.ReportError (
					GettextCatalog.GetString ("Mono for Android projects must be built before uploading"), null);
				return;
			}
			
			IConsole console = null;
			var opMon = new AggregatedOperationMonitor (monitor);
			try {
				var handler = context.ExecutionHandler as MonoDroidExecutionHandler;
				bool useHandlerDevice = handler != null && handler.DeviceTarget != null;
				
				AndroidDevice device = null;
				
				if (useHandlerDevice) {
					device = handler.DeviceTarget;
				} else {
					var deviceId = GetDeviceTarget (conf);
					if (deviceId != null)
						device = MonoDroidFramework.DeviceManager.GetDevice (deviceId);
					if (device == null)
						SetDeviceTarget (conf, null);
				}
				
				var uploadOp = MonoDroidUtility.SignAndUpload (monitor, this, configSel, false, ref device);
				
				//user cancelled device selection
				if (device == null)
					return;
				
				opMon.AddOperation (uploadOp);
				uploadOp.WaitForCompleted ();
				
				if (!uploadOp.Success || monitor.IsCancelRequested)
					return;
				
				//get the activity name after signing produced the final manifest
				string activity;
				if (!GetActivityNameFromManifest (monitor, conf, out activity))
					return;

				//successful, persist the device choice
				if (!useHandlerDevice)
					SetDeviceTarget (conf, device.ID);
				
				var command = (MonoDroidExecutionCommand) CreateExecutionCommand (configSel, conf);
				command.Device = device;
				command.Activity = activity;
				
				//FIXME: would be nice to skip this if it's a debug handler, which will set another value later
				var propOp = MonoDroidFramework.Toolbox.SetProperty (device, "debug.mono.extra", string.Empty);
				opMon.AddOperation (propOp);
				propOp.WaitForCompleted ();
				if (!propOp.Success) {
					monitor.ReportError (GettextCatalog.GetString ("Count not clear debug settings on device"),
						propOp.Error);
					return;
				}
				
				console = context.ConsoleFactory.CreateConsole (false);
				var executeOp = context.ExecutionHandler.Execute (command, console);
				opMon.AddOperation (executeOp);
				executeOp.WaitForCompleted ();
				
			} finally {
				opMon.Dispose ();
				if (console != null)
					console.Dispose ();
			}
		}
开发者ID:poke,项目名称:monodevelop,代码行数:74,代码来源:MonoDroidProject.cs

示例12: DoExecute

		protected override void DoExecute (IProgressMonitor monitor,
		                                   ExecutionContext context)
		{
			CProjectConfiguration conf = (CProjectConfiguration)ActiveConfiguration;
			string command = conf.Output;
			string args = conf.CommandLineParameters;
			string dir = Path.GetFullPath (conf.OutputDirectory);
			string platform = "Native";
			bool pause = conf.PauseConsoleOutput;
			IConsole console;
			
			if (conf.CompileTarget != CBinding.CompileTarget.Bin) {
				IdeApp.Services.MessageService.ShowMessage ("Compile target is not an executable!");
				return;
			}
			
			monitor.Log.WriteLine ("Running project...");
			
			if (conf.ExternalConsole)
				console = context.ExternalConsoleFactory.CreateConsole (!pause);
			else
				console = context.ConsoleFactory.CreateConsole (!pause);
			
			AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);
			
			try {
				IExecutionHandler handler = context.ExecutionHandlerFactory.CreateExecutionHandler (platform);
				
				if (handler == null) {
					monitor.ReportError ("Cannot execute \"" + command + "\". The selected execution mode is not supported in the " + platform + " platform.", null);
					return;
				}
				
				IProcessAsyncOperation op = handler.Execute (Path.Combine (dir, command), args, dir, console);
				
				operationMonitor.AddOperation (op);
				op.WaitForCompleted ();
				
				monitor.Log.WriteLine ("The operation exited with code: {0}", op.ExitCode);
			} catch (Exception ex) {
				monitor.ReportError ("Cannot execute \"" + command + "\"", ex);
			} finally {			
				operationMonitor.Dispose ();			
				console.Dispose ();
			}
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:46,代码来源:CProject.cs

示例13: ExecuteWithNode

        void ExecuteWithNode(TypeScriptProject project, TypeScriptProjectConfiguration conf, IProgressMonitor monitor, ExecutionContext context)
        {
            if (console != null)
                console.Dispose ();

            var exe = GetNodePath ();

            bool pause = conf.PauseConsoleOutput;

            monitor.Log.WriteLine ("Running project...");

            if (conf.ExternalConsole)
                console = context.ExternalConsoleFactory.CreateConsole (!pause);
            else
                console = context.ConsoleFactory.CreateConsole (!pause);

            AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);

            try {
                var cmd = CreateExecutionCommand (conf);

                if (!context.ExecutionHandler.CanExecute (cmd)) {
                    monitor.ReportError ("Cannot execute \"" + exe + "\". The selected execution mode is not supported for TypeScript projects.", null);
                    return;
                }

                IProcessAsyncOperation op = context.ExecutionHandler.Execute (cmd, console);

                operationMonitor.AddOperation (op);
                op.WaitForCompleted ();

                monitor.Log.WriteLine ("The operation exited with code: {0}", op.ExitCode);
            } catch (Exception ex) {
                monitor.ReportError ("Cannot execute \"" + exe + "\"", ex);
            } finally {
                operationMonitor.Dispose ();
                console.Dispose ();
            }
        }
开发者ID:atsushieno,项目名称:md-typescript,代码行数:39,代码来源:TypeScriptProject.cs

示例14: DoExecuteWithExe

        void DoExecuteWithExe(IProgressMonitor monitor, ExecutionContext context, string exe, HaxeProjectConfiguration configuration)
        {
            monitor.Log.WriteLine("Running project using '{0}' ...", exe);

            if (string.IsNullOrEmpty(exe)) {
                monitor.ReportError(String.Format("No custom player or browser configured."), null);
                return;
            }

            string[] parts = exe.Split(' ');
            string args = "file://"+Path.GetFullPath(Path.Combine(configuration.OutputDirectory, configuration.OutputFileName));
            if (parts.Length > 1)
                args = string.Join(" ", parts, 1, parts.Length-1) + " " + args;
            exe = parts[0];

            IConsole console;
            if (configuration.ExternalConsole)
                console = context.ExternalConsoleFactory.CreateConsole(false);
            else
                console = context.ConsoleFactory.CreateConsole(false);

            AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor(monitor);

            try {
                NativeExecutionCommand cmd = new NativeExecutionCommand(exe);
                cmd.Arguments = args;
                cmd.WorkingDirectory = Path.GetFullPath(configuration.OutputDirectory);

                if (!context.ExecutionHandler.CanExecute(cmd)) {
                    monitor.ReportError(String.Format("Cannot execute '{0} {1}'.", exe, args), null);
                    return;
                }

                IProcessAsyncOperation operation = context.ExecutionHandler.Execute(cmd, console);

                operationMonitor.AddOperation(operation);
                operation.WaitForCompleted();

                monitor.Log.WriteLine("Player exited with code {0}.", operation.ExitCode);
            }
            catch (Exception) {
                    monitor.ReportError(String.Format("Error while executing '{0} {1}'.", exe, args), null);
            }
            finally {
                operationMonitor.Dispose();
                console.Dispose();
            }
        }
开发者ID:tjhei,项目名称:md-haxebinding,代码行数:48,代码来源:HaxeProject.cs

示例15: DoExecute

		protected override void DoExecute (IProgressMonitor monitor,
		                                   ExecutionContext context,
		                                   ConfigurationSelector configuration)
		{
			PythonConfiguration config;
			IConsole console;
			
			config = (PythonConfiguration) GetConfiguration (configuration);
			
			// Make sure we have a module to execute
			if (config.Runtime == null || String.IsNullOrEmpty (config.Module)) {
				MessageService.ShowMessage ("No target module specified!");
				return;
			}
			
			monitor.Log.WriteLine ("Running project...");
			
			// Create a console, external if needed
			if (config.ExternalConsole) {
				console = context.ExternalConsoleFactory.CreateConsole (!config.PauseConsoleOutput);
			}
			else {
				console = context.ConsoleFactory.CreateConsole (!config.PauseConsoleOutput);
			}
			
			AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);
			
			try {
				PythonExecutionCommand cmd = new PythonExecutionCommand (config);
				
				if (!context.ExecutionHandler.CanExecute (cmd)) {
					monitor.ReportError ("The selected execution mode is not supported for Python projects.", null);
					return;
				}
				
				IProcessAsyncOperation op = context.ExecutionHandler.Execute (cmd, console);
				operationMonitor.AddOperation (op);
				op.WaitForCompleted ();
				
				monitor.Log.WriteLine ("The operation exited with code: {0}", op.ExitCode);
			}
			catch (Exception ex) {
				monitor.ReportError ("Cannot execute \"" + config.Runtime.Path + "\"", ex);
			}
			finally {
				operationMonitor.Dispose ();
				console.Dispose ();
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:49,代码来源:PythonProject.cs


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