示例#1
0
        private async void btn_attach_Click(Object sender, EventArgs e)
        {
            string     m_path = null;
            HHI_HandIn hi     = GetCurrentHandIn();

            if (hi.IsSubItemFolder)
            {
                m_path = stLib_CS.HastyFoo.Dialog.GetFolderPath();
            }
            else
            {
                m_path = stLib_CS.HastyFoo.Dialog.GetFileName();
            }
            if (m_path == null)
            {
                return;
            }
            string name = m_path.Substring(m_path.LastIndexOf('\\') + 1);
            string index;

            if (!HHI_Module.IndexExist(name, GetCurrentHandInsPrefix(), out index))
            {
                return;
            }

            if (hi.IsSubItemFolder)
            {
                await SendFiles(m_path);
            }
            else
            {
                await SendFile(m_path);
            }
        }
        public void FetchInfos()
        {
            var xmls = mDataFeeder.GetCompleteXmlFromNet();

            HHI_Module.listHandInData.Clear();
            HHI_Module.listPrefixes.Clear();
            HHI_Module.listServerInfos.Clear();

            HHI_Module.LoadHandIns(xmls[HHI_Module.HHIRootNodeName]);
            HHI_Module.LoadPrefixs(xmls[HHI_Module.PrefixRootNodeName]);
            HHI_Module.LoadConfig(xmls[HHI_Module.ServerInfoRootNodeName]);
            HHI_Module.LoadAppInfo(xmls[HHI_Module.AppInfoNodeName]);
        }
示例#3
0
        private void btn_attach_Click(object sender, EventArgs e)
        {
            HHI_HandIn hi     = GetCurrentHandIn();
            HHI_Prefix prefix = GetCurrentHandInsPrefix();
            string     name;
            string     studentIndex;
            string     srcPath;

            if (hi.IsSubItemFolder)
            {
                folderBrowserDialog1.ShowDialog();
                srcPath = folderBrowserDialog1.SelectedPath;
                name    = folderBrowserDialog1.SelectedPath.Substring(folderBrowserDialog1.SelectedPath.LastIndexOf('\\') + 1);
            }
            else
            {
                openFileDialog1.ShowDialog();
                srcPath = openFileDialog1.FileName;
                name    = openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf('\\') + 1);
            }
            if (srcPath == "")
            {
                return;
            }
            if (!HHI_Module.IndexExist(name, prefix, out studentIndex))
            {
                return;
            }

            if (!ListHelper.IsIn(HHI_Module.GetUnAttachedWorkIndexs(hi, prefix), Convert.ToInt32(studentIndex)))
            {
                if (MessageBox.Show("学号: " + studentIndex + " 已经提交,是否要覆盖?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    // Yes
                    CopyHelper.Copy(srcPath, hi.Path, hi.IsSubItemFolder);
                }
                else
                {
                    // No
                    return;
                }
            }
            else
            {
                CopyHelper.Copy(srcPath, hi.Path, hi.IsSubItemFolder);
            }
            ReloadList();
            m_output += "\n" + "[" + System.DateTime.Now.ToString() + "]" + "学号为: " + studentIndex + " 的同学,已提交作业!\n";
            MessageBox.Show(m_output);
            m_log += m_output;
        }
示例#4
0
 private void Form_Main_Load(Object sender, EventArgs e)
 {
     HHI_Module.LoadPrefixs();
     HHI_Module.LoadHandIns();
     static_handIn.Text                = cn_strs.str_select_handin;
     fileToolStripMenuItem.Text        = "文件";
     newHandInToolStripMenuItem.Text   = "创建新方案";
     exitToolStripMenuItem.Text        = "退出";
     prefixToolStripMenuItem.Text      = "预设";
     saveToolStripMenuItem.Text        = "保存...";
     saveHHIToolStripMenuItem.Text     = "保存所有新方案";
     savePrefixsToolStripMenuItem.Text = "保存所有预设";
     saveAllToolStripMenuItem.Text     = "保存所有";
     btn_check.Text = "检查";
     comboBox_handIns.DataSource    = HHI_Module.listHandInData;
     comboBox_handIns.ValueMember   = "id";
     comboBox_handIns.DisplayMember = "name";
     ReloadList();
 }
示例#5
0
        private async void btn_ConToServer_Click(Object sender, EventArgs e)
        {
            if (m_Client == null)
            {
                goto CON;
            }
            if (m_Client.Connected() && GetCurrentServerInfo().IP == m_Client.IPAddress)
            {
                MessageBox.Show("服务器已连接");
                return;
            }
            else if (m_Client.Connected() && GetCurrentServerInfo().IP == m_Client.IPAddress)
            {
                m_Client.Disconnect();
            }
CON:
//if( !CurrentPingStatus() ) {
//    return;
//}
            m_Client = new Client(GetCurrentServerInfo().IP, GetCurrentServerInfo().Port);
            if (1 == await m_Client.Connect())
            {
                MessageBox.Show("连接失败");
                return;
            }
            await m_Client.fileTrans.DownloadFiles(HHI_Module.m_dataPath);

            Sleep();

            HHI_Module.LoadPrefixs();
            HHI_Module.LoadHandIns();
            comboBox_handIns.DataSource    = HHI_Module.listHandInData;
            comboBox_handIns.ValueMember   = "id";
            comboBox_handIns.DisplayMember = "name";
            btn_attach.Enabled             = true;
            btn_pull_info.Enabled          = true;
            comboBox_handIns.Enabled       = true;
            RefreshText();
        }
示例#6
0
        private void ProcessCheck()
        {
            HHI_Prefix tprefix = GetCurrentHandInsPrefix();
            HHI_HandIn hi      = GetCurrentHandIn();

            if (!Directory.Exists(hi.Path))
            {
                MessageBox.Show("错误:作业路径不存在\n" + "当前该方案的路径为" + hi.Path + "\n请检查错误");
                return;
            }

            if (tprefix == null)
            {
                m_output += "错误:无该预设\n";
            }

            List <int> digit = HHI_Module.GetUnAttachedWorkIndexs(hi, tprefix);

            m_output += "\n" + "[" + System.DateTime.Now.ToString() + "]" + "\n" + "作业名: " + hi.Name + "\n\n";
            // !process file
            if (digit.Count == 0)
            {
                m_output += "已全部收齐!";
            }
            else
            {
                m_output += "以下编号尚未交作业:" + "\n";
                foreach (var d in digit)
                {
                    m_output += d.ToString() + "   ";
                }
                m_output += "\n" + "共" + digit.Count.ToString() + "人";
            }

            MessageBox.Show(m_output);
            return;
        }
示例#7
0
 private void saveLogToolStripMenuItem_Click(Object sender, EventArgs e)
 {
     HHI_Module.SaveLog(m_log);
 }
示例#8
0
 private void saveAllToolStripMenuItem_Click(Object sender, EventArgs e)
 {
     HHI_Module.SavePrefixs();
     HHI_Module.SaveHandInDatum();
 }
示例#9
0
 private void savePrefixsToolStripMenuItem_Click(Object sender, EventArgs e)
 {
     HHI_Module.SavePrefixs();
 }