Пример #1
0
        //【停止】
        private void Stop_MenuItem_Click(object sender, EventArgs e)
        {
            if (listStrategy.SelectedItems.Count <= 0)
            {
                return;
            }
            ListViewItem    lvi          = listStrategy.SelectedItems[0];
            ProjectStrategy projectStrag = null;

            foreach (ProjectStrategy ps in listProjects)
            {
                if (lvi.Text == ps.username)
                {
                    projectStrag = ps;
                }
            }
            if (projectStrag == null)
            {
                return;
            }
            if (projectStrag.runFlag == EnumRunState.停止 || projectStrag.runFlag == EnumRunState.未运行)
            {
                return;
            }

            projectStrag.showMessage.Print("策略已经停止运行");
            projectStrag.CutOff();
            projectStrag.Free();
            projectStrag.Exit();
            projectStrag.showMessage.Close();
            projectStrag.runFlag = EnumRunState.停止;
            lvi.SubItems[2].Text = EnumRunState.停止.ToString();
            lvi.SubItems[5].Text = "已停止";
        }
Пример #2
0
        //主窗体退出程序
        public void ExitOnClose()
        {
            ProjectStrategy projectStrag = null;

            foreach (ProjectStrategy ps in listProjects)
            {
                projectStrag = ps;
                if (projectStrag.runFlag == EnumRunState.停止 || projectStrag.runFlag == EnumRunState.未运行)
                {
                    continue;
                }
                projectStrag.CutOff();
                projectStrag.Free();
                projectStrag.Exit();
                projectStrag.showMessage.Close();
                projectStrag.runFlag     = EnumRunState.停止;
                projectStrag.runStrategy = null;
            }
        }