Beispiel #1
0
        /// <summary>
        /// 开始
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void bStart_Click(object sender, EventArgs e)
        {
            Node currentNode = guideTree.SelectedNode;

            if (currentNode != null)
            {
                string guideID = currentNode.Tag as string;
                string guideName = currentNode.Text;
                EditForm editForm = new EditForm(conn, guideID, guideName);
                editForm.ShowDialog();
            }
            else
            {
                MessageBox.Show("请先选择向导!", "开始向导",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 加载向导数据
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void bLoadGuideInfo_Click(object sender, EventArgs e)
        {
            Node currentNode = guideTree.SelectedNode;

            if (currentNode != null)
            {
                string guideName = currentNode.Text;
                string fileName = Path.Combine(Application.StartupPath, string.Format("{0}.GuideInfo", guideName));

                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Title = "加载向导数据";
                openFileDialog.Filter = "向导数据|*.GuideInfo";
                openFileDialog.InitialDirectory = Application.StartupPath;

                if (File.Exists(fileName))
                {
                    openFileDialog.FileName = fileName;

                    if (openFileDialog.ShowDialog() == DialogResult.OK)
                    {
                        fileName = openFileDialog.FileName;
                        string id = currentNode.Tag as string;
                        byte[] buffer = Helper.ReadFile(fileName);

                        if (buffer != null)
                        {
                            List<List<FieldInfo>> guideData = Helper.UnseralizeData(buffer) as List<List<FieldInfo>>;

                            EditForm editForm = new EditForm(conn, id, guideName);
                            editForm.GuideData = guideData;
                            editForm.ShowDialog();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("请先选择要加载数据的向导!", "加载向导数据",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }