Exemplo n.º 1
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(); });
        }
Exemplo n.º 2
0
 private void FrmBatch_Load(object sender, EventArgs e)
 {
     ThreadPool.QueueUserWorkItem(x => {
         frmLoading = new FrmLoading();
         frmLoading.ShowDialog();
     });
     labelX3.Text = _node.Parent.Text;
     labelX4.Text = _node.Text;
     LoadTableList();
     loadTemplates();
     Properties.Settings.Default.Reload();
     this.Invoke((Action) delegate { frmLoading.Close(); });
 }
Exemplo n.º 3
0
        async void LoadDataInfo(Node node)
        {
            ThreadPool.QueueUserWorkItem(new WaitCallback(a =>
            {
                frmLoading = new FrmLoading();
                frmLoading.ShowDialog();
            }));
            var res = await Task.Run(() =>
            {
                if (node.Level == 1)
                {
                    if (node.Nodes.Count >= 1)
                    {
                        return(0);
                    }
                    node.Nodes.Clear();
                    var list  = G.GetDatabases(node.DataKey, node.TagString);
                    var nodes = list.Select(a => new Node(a)
                    {
                        Image       = Properties.Resources._base,
                        DataKey     = node.DataKey,
                        ContextMenu = buttonItem22
                    }).ToArray();
                    node.Nodes.AddRange(nodes);
                }
                else if (node.Level == 2)
                {
                    node.Nodes.Clear();
                    Task.Delay(1000);
                    var list  = G.GetTablesByDatabase(node.DataKey, node.Text);
                    var nodes = list.Select(a => new Node(a.Name)
                    {
                        Image = Properties.Resources.application,
                        // CheckBoxVisible = true,
                        // CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.CheckBox,
                        // CheckState = CheckState.Unchecked,
                        Tag         = a,
                        DataKey     = node.DataKey,
                        ContextMenu = buttonItem23
                    }).ToArray();
                    node.Nodes.AddRange(nodes);
                }
                return(0);
            });

            node.Expanded = true;
            this.Invoke((Action) delegate() { frmLoading.Close(); });
        }