Ejemplo n.º 1
0
 // 发生了自动创建project xml文件的事件
 void dlg_CreateProjectXmlFile(object sender, AutoCreateProjectXmlFileEventArgs e)
 {
     m_bNeedReload = true;
 }
Ejemplo n.º 2
0
        private void ProjectManageDlg_Load(object sender, System.EventArgs e)
        {
            Debug.Assert(string.IsNullOrEmpty(this.HostName) == false, "");

            if (AppInfo != null)
            {
                AppInfo.LoadFormStates(this,
                    "projectman");
            }
            /*
            if (applicationInfo != null) 
            {

                this.Width = applicationInfo.GetInt(
                    "projectman", "width", 640);
                this.Height = applicationInfo.GetInt(
                    "projectman", "height", 500);

                this.Location = new Point(
                    applicationInfo.GetInt("projectman", "x", 0),
                    applicationInfo.GetInt("projectman", "y", 0));

                this.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), applicationInfo.GetString(
                    "projectman", "window_state", "Normal"));
            }
            */


            treeView1.ImageList = imageList_projectNodeType;
            treeView1.PathSeparator = "/";

            if (scriptManager != null)
            {
                bool bDone = false;
            REDO:
                try
                {
                    scriptManager.FillTree(this.treeView1);
                }
                catch (System.IO.FileNotFoundException ex)
                {
                    /*
                    MessageBox.Show("装载" + scriptManager.CfgFilePath + "文件失败,原因:"
                        + ex.Message);
                    */
                    // MessageBox.Show(ex.Message);
                    //return;
                    if (bDone == false)
                    {
                        MessageBox.Show(this, "自动创建新文件 " + scriptManager.CfgFilePath);

                        // 触发事件
                        if (this.CreateProjectXmlFile != null)
                        {
                            AutoCreateProjectXmlFileEventArgs e1 = new AutoCreateProjectXmlFileEventArgs();
                            e1.Filename = scriptManager.CfgFilePath;
                            this.CreateProjectXmlFile(this, e1);
                        }

                        ScriptManager.CreateDefaultProjectsXmlFile(scriptManager.CfgFilePath,
                            "clientcfgs");
                        bDone = true;
                        goto REDO;
                    }
                    else
                    {
                        MessageBox.Show(this, ExceptionUtil.GetAutoText(ex));
                        return;
                    }
                }
                catch (System.Xml.XmlException ex)
                {
                    MessageBox.Show(this,
                        "装载 " + scriptManager.CfgFilePath + " 文件失败,原因:"
                        + ex.Message);
                    return;
                }
            }
            treeView1_AfterSelect(null, null);

            TreeViewUtil.SelectTreeNode(treeView1,
                AppInfo.GetString(
                "projectman",
                "lastUsedProject",
                ""),
                '/');

        }