private void btnSubmit_Click(object sender, EventArgs e)
        {
            err.Clear();

            if (string.IsNullOrWhiteSpace(txtProjectName.Text))
            {
                err.SetError(txtProjectName, "專案名稱不可空白");
            }
            else if (!ProjectHandler.ValidName(txtProjectName.Text))
            {
                err.SetError(txtProjectName, "專案名稱必須為英文或數字組成");
            }

            if (MainForm.Projects.Contains(txtProjectName.Text))
            {
                err.SetError(txtProjectName, "專案名稱已被使用");
            }

            if (!chkUseDefault.Checked)
            {
                if (string.IsNullOrWhiteSpace(txtAP.Text))
                {
                    err.SetError(txtAP, "開發站不可空白");
                }

                if (string.IsNullOrWhiteSpace(txtUser.Text) && cboContract.Text != "_dev")
                {
                    err.SetError(txtUser, "帳號不可空白");
                }

                if (string.IsNullOrWhiteSpace(txtPwd.Text) && cboContract.Text != "_dev")
                {
                    err.SetError(txtPwd, "密碼不可空白");
                }
            }

            if (string.IsNullOrWhiteSpace(txtProjectPath.Text))
            {
                err.SetError(txtProjectPath, "專案本機檔案路徑不可空白");
            }
            else if (!Directory.Exists(txtProjectPath.Text))
            {
                err.SetError(txtProjectPath, "指定的本機檔案路徑不存在");
            }

            foreach (Control ctrl in this.Controls)
            {
                if (string.IsNullOrEmpty(err.GetError(ctrl)))
                {
                    continue;
                }
                return;
            }

            try
            {
                if (chkUseDefault.Checked)
                {
                    MainForm.DefaultDevSite.TryConnect();
                }
                else
                {
                    Connection connection = new Connection();
                    connection.Connect(txtAP.Text, cboContract.Text, txtUser.Text, txtPwd.Text);
                }
            }
            catch (Exception ex)
            {
                if (chkUseDefault.Checked)
                {
                    err.SetError(chkUseDefault, "登入失敗 : " + ex.Message);
                }
                else
                {
                    err.SetError(txtAP, "登入失敗 : " + ex.Message);
                }
                return;
            }

            DevSiteLoginInfo info = new DevSiteLoginInfo();

            if (chkUseDefault.Checked)
            {
                info = MainForm.DefaultDevSite;
            }
            else
            {
                info.AccessPoint  = txtAP.Text;
                info.ContractName = cboContract.Text;
                info.User         = txtUser.Text;
                info.Password     = txtPwd.Text;
            }
            MainForm.Projects.AddProject(txtProjectName.Text, info, txtProjectPath.Text);

            this.Close();
        }
        public void Reload()
        {
            this.ProjectName = MainForm.CurrentProject.Name;

            try
            {
                if (!ModuleHandler.Exists(ProjectName))
                {
                    ModuleHandler = ModuleHandler.CreateNew(ProjectName, string.Empty, this.Node);
                }
                else
                {
                    ModuleHandler = new ModuleHandler(this.Node, MainForm.CurrentProject.Name);
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                string err = "檔案管理服務無法使用({0})";
                if (!ProjectHandler.ValidName(ProjectName))
                {
                    this.Node.Text = string.Format(err, "專案名稱含有不合法字元");
                }
                else
                {
                    Regex reg = new Regex("ischool.dsa.exception.DSAServiceException: (.*)\n");
                    Match m   = reg.Match(msg);
                    if (m.Success)
                    {
                        this.Node.Text = string.Format(err, m.Groups[1].Value);
                    }
                    else
                    {
                        this.Node.Text = string.Format(err, "檔案管理服務初始化失敗");
                    }
                    this.Node.ToolTipText = ex.Message;
                }

                this.Editors = new List <IEditable>();
                return;
            }

            //ModuleHandler.StatusChanged += new EventHandler<ModuleStatusEventArgs>(ModuleHandler_StatusChanged);
            if (this.Editors == null)
            {
                this.Editors = new List <IEditable>();
                FileEditable edit = new FileEditable(this);

                Editors.Add(edit);
                this.CurrentEditor = edit;
            }
            else
            {
                FileEditable fe = CurrentEditor as FileEditable;
                FileUIEditor ui = fe.Editor as FileUIEditor;
                ui.Reload();
            }

            if (Directory.Exists(ModuleHandler.LocalPath))
            {
                this.Node.Text = "檔案管理 ( 本機路徑 : " + ModuleHandler.LocalPath + " )";
            }
            else
            {
                this.Node.Text = "檔案管理 ( 本機路徑不存在 : " + ModuleHandler.LocalPath + " )";
            }

            ModuleHandler.CheckItemStatus();
        }