예제 #1
0
        public void RunCommandLine_Task(string typeStr, string app_name, string command_arguments)
        {
            ProcessTask pt = new ProcessTask();

            count++;
            pt.idx       = count;
            pt.desc      = typeStr;
            pt.startTime = DateTime.Now;
            pt.AddTask(typeStr, app_name, command_arguments);
            pt.itemIdx = 0;// listBox_Process.Items.Add(pt.ToDescString());
            m_process_task.Add(pt.idx, pt);

            Program.AddCommandLog(typeStr, app_name, command_arguments);
        }
예제 #2
0
        public int RunCommandLine_MultiTask(process_task[] tasks)
        {
            ProcessTask pt = new ProcessTask();

            count++;
            pt.idx       = count;
            pt.startTime = DateTime.Now;
            foreach (var t in tasks)
            {
                pt.AddTask(t.task_desc, t.app_name, t.app_args);
                string typeStr = "MultiTask-";
                typeStr += t.task_desc;
                Program.AddCommandLog(typeStr, t.app_name, t.app_args);
            }
            pt.itemIdx = 0;// listBox_Process.Items.Add(pt.ToDescString());
            m_process_task.Add(pt.idx, pt);
            return(pt.idx);
        }
예제 #3
0
        public void Run()
        {
            foreach (var p in m_process_task.Keys.ToList())
            {
                ProcessTask pt = m_process_task[p];
                pt.Run();
                m_process_task[p] = pt;
                //listBox_Process.Items[p.Value.itemIdx] = p.Value.ToDescString();
            }
            bool isTaskBusy = false;

            foreach (var p in m_process_task)
            {
                if (!p.Value.isDone)
                {
                    isTaskBusy = true;
                }
            }
            if (!isTaskBusy)
            {
                m_process_task.Clear();
            }


            foreach (var p in m_processList.Keys.ToList())
            {
                process_info pi = m_processList[p];
                if (pi.state > 0)
                {
                    pi.m_process.Refresh();
                    if (pi.m_process.HasExited)
                    {
                        pi.SetState(0);
                    }
                    //p.Value.UpdateStayTime();
                    //listBox_Process.Items[pi.itemIdx] = pi.ToDescString();
                    m_processList[p] = pi;
                }
            }
            bool isIdle = true;

            foreach (var p in m_processList)
            {
                if (p.Value.state != 0)
                {
                    isIdle = false;
                }
            }
            if (isIdle)
            {
                m_processList.Clear();
            }

            //while (processState > 0)
            //{
            //    //Program.AddLog("..Refresh.." + DateTime.Now.ToString());
            //    m_process.Refresh();

            //    //m_process.CancelOutputRead();
            //    //m_process.BeginOutputReadLine();
            //    if (m_process.HasExited)
            //    {
            //        processState = 0;
            //    }
            //}
            //Program.AddLog("Command Line Process has exited.");
        }