예제 #1
0
        private void ExportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (sm.Empty())
            {
                MessageBox.Show("亲,还没数据哦!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string        pwd = null;
            bool          need_encrypt;
            GetEncryptPwd gp = new GetEncryptPwd();
            DialogResult  dr = gp.ShowDialog();

            if (dr == DialogResult.OK)
            {
                pwd          = gp.pwd;
                need_encrypt = true;
            }
            else
            {
                need_encrypt = false;
            }
            gp.Close();

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
            dr         = sfd.ShowDialog();
            if (dr == DialogResult.OK && sfd.CheckPathExists)
            {
                string path = sfd.FileName;

                sm.SaveToFile(sfd.FileName, need_encrypt, pwd);
                //MessageBox.Show("导出完毕!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                toolStripStatusLabel1.Text = "导出完毕!";
            }
        }
예제 #2
0
        private void ExportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if ( sm.Empty() )
            {
                MessageBox.Show("亲,还没数据哦!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string pwd = null;
            bool need_encrypt;
            GetEncryptPwd gp = new GetEncryptPwd();
            DialogResult dr = gp.ShowDialog();
            if (dr == DialogResult.OK)
            {
                pwd = gp.pwd;
                need_encrypt = true;
            }
            else
                need_encrypt = false;
            gp.Close();

            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
            dr = sfd.ShowDialog();
            if (dr == DialogResult.OK && sfd.CheckPathExists)
            {
                string path = sfd.FileName;

                sm.SaveToFile(sfd.FileName, need_encrypt, pwd);
                //MessageBox.Show("导出完毕!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                toolStripStatusLabel1.Text = "导出完毕!";
            }
        }