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


C# AggregatedOperationMonitor.Dispose方法代码示例

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


在下文中一共展示了AggregatedOperationMonitor.Dispose方法的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: DoExecute

        protected override void DoExecute(IProgressMonitor monitor,
		                                   ExecutionContext context,
		                                   ConfigurationSelector configuration)
        {
            RubyProjectConfiguration conf = (RubyProjectConfiguration)GetConfiguration (configuration);
            bool pause = conf.PauseConsoleOutput;
            IConsole console = (conf.ExternalConsole? context.ExternalConsoleFactory: context.ConsoleFactory).CreateConsole (!pause);
            List<string> loadPaths = new List<string> ();
            loadPaths.Add (BaseDirectory.FullPath);
            foreach (object path in conf.LoadPaths) {
                if (!string.IsNullOrEmpty ((string)path)){ loadPaths.Add ((string)path); }
            }

            ExecutionCommand cmd = new NativeExecutionCommand (RubyLanguageBinding.RubyInterpreter, conf.MainFile, BaseDirectory.FullPath,
                                                               new Dictionary<string,string>(){{"RUBYLIB", string.Join (Path.DirectorySeparatorChar.ToString(), loadPaths.ToArray ()) }});

            monitor.Log.WriteLine ("Running {0} {1}", RubyLanguageBinding.RubyInterpreter, conf.MainFile);

            AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);

            try {
                if (!context.ExecutionHandler.CanExecute (cmd)) {
                    monitor.ReportError (string.Format ("Cannot execute {0}.", conf.MainFile), 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 (string.Format ("Cannot execute {0}.", conf.MainFile), ex);
            } finally {
                operationMonitor.Dispose ();
                console.Dispose ();
            }
        }
开发者ID:nover,项目名称:rubybinding,代码行数:39,代码来源:RubyProject.cs

示例3: 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

示例4: 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

示例5: DoExecute

        protected override void DoExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
        {
            var conf = GetConfiguration (configuration) as DProjectConfiguration;

            if (conf == null)
                return;

            bool pause = conf.PauseConsoleOutput;
            IConsole console;

            if (conf.CompileTarget != DCompileTarget.Executable) {
                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);

            var operationMonitor = new AggregatedOperationMonitor (monitor);

            try {
                var cmd = CreateExecutionCommand (conf);
                if (!context.ExecutionHandler.CanExecute (cmd)) {
                    monitor.ReportError ("Cannot execute \"" + conf.Output + "\". The selected execution mode is not supported for D projects.", null);
                    return;
                }

                var 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 \"" + conf.Output + "\"", ex);
            } finally {
                operationMonitor.Dispose ();
                console.Dispose ();
            }
        }
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:44,代码来源:DProject.cs

示例6: 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

示例7: 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

示例8: Update

		public static void Update (ProjectFile file, bool force)
		{
			var tool = GetGenerator (file);
			if (tool == null)
				return;
			
			ProjectFile genFile = null;
			if (!string.IsNullOrEmpty (file.LastGenOutput))
				genFile = file.Project.Files.GetFile (file.FilePath.ParentDirectory.Combine (file.LastGenOutput));
			
			if (!force && genFile != null && File.Exists (genFile.FilePath) && 
			    File.GetLastWriteTime (file.FilePath) < File.GetLastWriteTime (genFile.FilePath)) {
				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);
				var 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);
						} 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);
			}
		}
开发者ID:jkabus,项目名称:monodevelop,代码行数:54,代码来源:CustomToolService.cs

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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;
			
			var opMon = new AggregatedOperationMonitor (monitor);
			try {				
				AndroidDevice device;
				var uploadOp = MonoDroidUtility.SignAndUpload (monitor, this, configSel, false, out device);
				opMon.AddOperation (uploadOp);
				uploadOp.WaitForCompleted ();
				if (!uploadOp.Success)
					return;
				
				var command = (MonoDroidExecutionCommand) CreateExecutionCommand (configSel, conf);
				command.Device = device;
				command.Activity = activity;
				
				using (var console = context.ConsoleFactory.CreateConsole (false)) {
					var executeOp = context.ExecutionHandler.Execute (command, console);
					opMon.AddOperation (executeOp);
					executeOp.WaitForCompleted ();
				}
			} finally {
				opMon.Dispose ();
			}
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:46,代码来源:MonoDroidProject.cs


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