Exemplo n.º 1
0
        private Input GetInput()
        {
            var put = new Input();
            switch (tabControl1.SelectedIndex)
            {
                case 0:
                    put.Type = Type.Blog;
                    put.Text = tbUser.Text.Trim();
                    break;
                case 1:
                    put.Type = Type.Url;
                    put.Text = tbUrl.Text.Trim();
                    break;
                case 2:
                    put.Type = Type.Column;
                    put.Text = tbColumn.Text.Trim();
                    break;
            }

            if (put.Text == string.Empty)
            {
                string msg = string.Empty;
                if (put.Type == Type.Blog) msg = "请输入博客用户名";
                else if (put.Type == Type.Url) msg = "请输入要导出的博客URL";
                else if (put.Type == Type.Column) msg = "请输入专栏别名";
                MessageBox.Show(msg);
                return put;
            }
            if (chk1_chm.Checked) put.Format |= Format.CHM;
            if (chk1_pdf.Checked) put.Format |= Format.PDF;
            if (chk1_htm.Checked) put.Format |= Format.HTML;
            if (chk1_txt.Checked) put.Format |= Format.TXT;
            if (chk1_epub.Checked) put.Format |= Format.EPUB;

            if ((int)put.Format == 0)
            {
                MessageBox.Show("请选择要导出的格式");
                return put;
            }

            FolderDialog fDialog = new FolderDialog();
            var re = fDialog.DisplayDialog();
            if (re != DialogResult.OK)
            {
                return put;
            }
            App.BaseDirectory = fDialog.Path + "\\";

            put.Status = true;

            return put;
        }
Exemplo n.º 2
0
        private Input GetInput()
        {
            var put = new Input();

            switch (tabControl1.SelectedIndex)
            {
            case 0:
                put.Type = Type.Blog;
                put.Text = tbUser.Text.Trim();
                break;

            case 1:
                put.Type = Type.Url;
                put.Text = tbUrl.Text.Trim();
                break;

            case 2:
                put.Type = Type.Column;
                put.Text = tbColumn.Text.Trim();
                break;
            }

            if (put.Text == string.Empty)
            {
                string msg = string.Empty;
                if (put.Type == Type.Blog)
                {
                    msg = "请输入博客用户名";
                }
                else if (put.Type == Type.Url)
                {
                    msg = "请输入要导出的博客URL";
                }
                else if (put.Type == Type.Column)
                {
                    msg = "请输入专栏别名";
                }
                MessageBox.Show(msg);
                return(put);
            }
            if (chk1_chm.Checked)
            {
                put.Format |= Format.CHM;
            }
            if (chk1_pdf.Checked)
            {
                put.Format |= Format.PDF;
            }
            if (chk1_htm.Checked)
            {
                put.Format |= Format.HTML;
            }
            if (chk1_txt.Checked)
            {
                put.Format |= Format.TXT;
            }
            if (chk1_epub.Checked)
            {
                put.Format |= Format.EPUB;
            }

            if ((int)put.Format == 0)
            {
                MessageBox.Show("请选择要导出的格式");
                return(put);
            }

            FolderDialog fDialog = new FolderDialog();
            var          re      = fDialog.DisplayDialog();

            if (re != DialogResult.OK)
            {
                return(put);
            }
            App.BaseDirectory = fDialog.Path + "\\";

            put.Status = true;

            return(put);
        }