Пример #1
0
        private async void superTabControl1_SelectedTabChanging(object sender, SuperTabStripSelectedTabChangingEventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxX1.Text))
            {
                e.Cancel = true;
                MessageBoxEx.Show("命名空间不能为空");
                return;
            }

            if (e.NewValue.Text == "生成代码")
            {
                var codeGenerate = new CodeGenerate();
                var taskBuild    = new TaskBuild()
                {
                    Fsql            = G.GetFreeSql(_node.DataKey),
                    DbName          = _node.Parent.Text,
                    NamespaceName   = textBoxX1.Text,
                    RemoveStr       = textBoxX2.Text,
                    OptionsEntity01 = checkBoxX1.Checked,
                    OptionsEntity02 = checkBoxX2.Checked,
                    OptionsEntity03 = checkBoxX3.Checked,
                    OptionsEntity04 = checkBoxX4.Checked
                };

                editorCode.Text = await codeGenerate.Setup(taskBuild, editorTemplates.Text, dbTableInfos, dbTableInfo);
            }
        }
Пример #2
0
 public RazorModel(IFreeSql fsql, TaskBuild task, List <DbTableInfo> tables, DbTableInfo table)
 {
     this.fsql   = fsql;
     this.task   = task;
     this.tables = tables;
     this.table  = table;
 }
Пример #3
0
 public RazorModel(TaskBuild task, List <DbTableInfo> tables, DbTableInfo table)
 {
     this.fsql   = task.Fsql;
     this.task   = task;
     this.tables = tables;
     this.table  = table;
 }
Пример #4
0
        private async void command_export_Executed(object sender, EventArgs e)
        {
            Properties.Settings.Default.Save();
            if (listBoxAdv2.Items.Count == 0)
            {
                MessageBoxEx.Show("请选择表");
                return;
            }
            if (string.IsNullOrEmpty(textBoxX1.Text))
            {
                MessageBoxEx.Show("命名空间不能为空");
                return;
            }
            if (string.IsNullOrEmpty(textBoxX4.Text))
            {
                MessageBoxEx.Show("请选择导出路径");
                return;
            }
            if (listBoxAdv3.CheckedItems.Count == 0)
            {
                MessageBoxEx.Show("请选择生成模板");
                return;
            }
            var templates = listBoxAdv3.CheckedItems.Cast <ListBoxItem>().Select(a => a.Text).ToArray();
            var taskBuild = new TaskBuild()
            {
                Fsql            = G.GetFreeSql(_node.DataKey),
                DbName          = _node.Text,
                FileName        = textBoxX3.Text,
                GeneratePath    = textBoxX4.Text,
                NamespaceName   = textBoxX1.Text,
                RemoveStr       = textBoxX2.Text,
                OptionsEntity01 = checkBoxX1.Checked,
                OptionsEntity02 = checkBoxX2.Checked,
                OptionsEntity03 = checkBoxX3.Checked,
                OptionsEntity04 = checkBoxX4.Checked,
                Templates       = templates
            };
            var        tables     = listBoxAdv2.Items.Cast <string>().ToArray();
            var        tableInfos = dbTableInfos.Where(a => tables.Contains(a.Name)).ToList();
            FrmLoading frmLoading = null;

            ThreadPool.QueueUserWorkItem(new WaitCallback(a =>
            {
                this.Invoke((Action) delegate()
                {
                    frmLoading = new FrmLoading("正在生成中,请稍后.....");
                    frmLoading.ShowDialog();
                });
            }));
            await new CodeGenerate().Setup(taskBuild, tableInfos);
            this.Invoke((Action) delegate() { frmLoading?.Close(); });
        }