Beispiel #1
0
        private void LoadAllModuleConfig()
        {
            MultiTaskingRunner_up runner = new MultiTaskingRunner_up();

            ModuleConfigs = new Dictionary <string, UDMsOfSchool>();
            foreach (ConnectionHelper conn in Connections)
            {
                string name = SchoolPanel.GlobalSchoolCache[conn.UID].Title;
                runner.AddTask(string.Format("{0}({1})", name, conn.UID), (x) =>
                {
                    LoadModuleConfig(x as ConnectionHelper);
                }, conn, new System.Threading.CancellationTokenSource());
            }
            runner.ExecuteTasks();
        }
Beispiel #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (dgvModules.SelectedRows.Count <= 0)
            {
                return;
            }

            DialogResult dr = MessageBox.Show("確定要更新選擇的模組?", "ischool", MessageBoxButtons.YesNo);

            if (dr == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            MultiTaskingRunner_up runner = new MultiTaskingRunner_up();
            ModuleRow             mr     = dgvModules.SelectedRows[0].DataBoundItem as ModuleRow;
            string udmName = mr.Name;

            RunnerDic = new Dictionary <string, BitTask>();
            foreach (ConnectionHelper conn in Connections)
            {
                TestAddTask(runner, conn, udmName);
            }
            runner.ExecuteTasks();


            for (int x = 0; x < 1; x--)
            {
                if (RunnerDic.Count > 0)
                {
                    bool Succeed = ReNewTask();
                    if (Succeed)
                    {
                        break;
                    }
                }
            }
            //try
            //{
            //    InitConnections();
            //    LoadAllModuleConfig();
            //    GroupByToDataGrid();
            //}
            //catch { Close(); } //爆了就關吧。
        }
Beispiel #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            MultiTaskingRunner_up runner = new MultiTaskingRunner_up();

            UDMSelect selectUDM = new UDMSelect();

            if (selectUDM.ShowDialog() == System.Windows.Forms.DialogResult.Yes)
            {
                if (!string.IsNullOrEmpty(selectUDM.Add_Url))
                {
                    string modUrl = selectUDM.Add_Url;
                    foreach (ConnectionHelper conn in Connections)
                    {
                        string name = SchoolPanel.GlobalSchoolCache[conn.UID].Title;
                        runner.AddTask(string.Format("{0}({1})", name, conn.UID), (x) =>
                        {
                            object[] obj       = x as object[];
                            ConnectionHelper c = obj[0] as ConnectionHelper;
                            string xurl        = (string)obj[1];
                            AddUDM(c, xurl);
                        }, new object[] { conn, modUrl }, new System.Threading.CancellationTokenSource());
                    }
                    runner.ExecuteTasks();

                    try
                    {
                        InitConnections();
                        LoadAllModuleConfig();
                        GroupByToDataGrid();
                    }
                    catch { Close(); } //爆了就關吧。
                }
                else
                {
                    MsgBox.Show("未選擇UDM!!");
                }
            }
            else
            {
                MsgBox.Show("已取消!!");
            }
        }
Beispiel #4
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dgvModules.SelectedRows.Count <= 0)
            {
                return;
            }

            DialogResult dr = MessageBox.Show("確定要刪除選擇的模組?", "ischool", MessageBoxButtons.YesNo);

            if (dr == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            MultiTaskingRunner_up runner = new MultiTaskingRunner_up();
            ModuleRow             mr     = dgvModules.SelectedRows[0].DataBoundItem as ModuleRow;
            string udmName = mr.Name;

            foreach (ConnectionHelper conn in Connections)
            {
                string name = SchoolPanel.GlobalSchoolCache[conn.UID].Title;
                runner.AddTask(string.Format("{0}({1})", name, conn.UID), (x) =>
                {
                    object[] obj       = x as object[];
                    ConnectionHelper c = obj[0] as ConnectionHelper;
                    string xurl        = (string)obj[1];
                    RemoveUDM(c, xurl);
                }, new object[] { conn, udmName }, new System.Threading.CancellationTokenSource());
            }
            runner.ExecuteTasks();

            //try
            //{
            //    InitConnections();
            //    LoadAllModuleConfig();
            //    GroupByToDataGrid();
            //}
            //catch { Close(); } //爆了就關吧。
        }
Beispiel #5
0
        //執行更新作業
        private void TestAddTask(MultiTaskingRunner_up runner, ConnectionHelper conn, string udmName)
        {
            string name = SchoolPanel.GlobalSchoolCache[conn.UID].Title;

            BitTask bt = new BitTask();

            bt.conn    = conn;
            bt.udmName = udmName;

            runner.AddTask(string.Format("{0}({1})", name, conn.UID), (x) =>
            {
                object[] obj       = x as object[];
                ConnectionHelper c = obj[0] as ConnectionHelper;
                string xurl        = (string)obj[1];
                Envelope el        = UpdateUDM(c, xurl);
                bt.envelope        = el;

                if (!RunnerDic.ContainsKey(c.TargetDSNS))
                {
                    RunnerDic.Add(c.TargetDSNS, bt);
                }
            }, new object[] { conn, udmName }, new System.Threading.CancellationTokenSource());
        }