Example #1
0
            /// <summary>
            /// Launch the given WindowsProcess
            /// </summary>
            /// <param name="name">ActiveProcess name</param>
            public static void Launch(string name, string commandLine)
            {
                if (string.IsNullOrEmpty(name))
                {
                    throw new ArgumentNullException("name", "A valid ActiveProcess name must be provided.");
                }
                if (!manager.activeProcesses.ContainsKey(name))
                {
                    throw new InvalidOperationException("An ActiveProcess must first be created.");
                }

                qf4net.QF.Instance.Publish(new ProcessEvent(QFSignal.ProcessLaunch, name, commandLine));
                ActiveProcess aProcess = manager.activeProcesses[name];

                while ((!aProcess.IsInState(aProcess.m_StateFaulted)) && (!aProcess.IsInState(aProcess.m_StateLaunched)))
                {
                    System.Threading.Thread.Sleep(1);
                }
            }
Example #2
0
            private static void Create(IProcess process)
            {
                if (process == null)
                {
                    throw new ArgumentNullException("process", "A valid process must be provided.");
                }
                if ((string.IsNullOrEmpty(process.Name) || manager.activeProcesses.ContainsKey(process.Name)))
                {
                    throw new ArgumentNullException("process.Name", "An ActiveProcess must have a valid, unique name.");
                }

                manager.activeProcesses.Add(process.Name, new ActiveProcess(process));
                manager.activeProcesses[process.Name].Start(manager.priority++);

                ActiveProcess aProcess = manager.activeProcesses[process.Name];

                while ((!aProcess.IsInState(aProcess.m_StateFaulted)) && (!aProcess.IsInState(aProcess.m_StateCreated)))
                {
                    System.Threading.Thread.Sleep(1);
                }
            }