private async void BttGenerate_Click(object sender, EventArgs e)
        {
#if NETCOREAPP3_0
            this.Refresh(EStatus.Generating);

            string jsonInTextbox = HelperUI.GetMethod <string>(richTextBox1, () =>
            {
                return(richTextBox1.Text);
            });


            if (Executor != null)
            {
                return;
            }

            object type = HelperUI.GetMethod(cmbType, () =>
            {
                if (cmbType.SelectedItem is EType)
                {
                    return(cmbType.SelectedItem);
                }
                return(null);
            });

            if (string.IsNullOrWhiteSpace(jsonInTextbox) || type == null)
            {
                HelperUI.ModifyMethod(bttGenerate, () =>
                {
                    bttGenerate.Enabled = Executor != null;
                });

                return;
            }
#endif
            await Task.Run(() =>
            {
#if NETCOREAPP3_0
                EType typeEnum = (EType)type;
                if (typeEnum == EType.ConfigSupplyViewModel)
                {
                    GenerateAux <IConfigSupply, ConfigSupplyViewModel>(jsonInTextbox);
                }
                else if (typeEnum == EType.WorkerViewModel)
                {
                    GenerateAux <IWorker, WorkerViewModel>(jsonInTextbox);
                }
                else if (typeEnum == EType.ProductViewModel)
                {
                    GenerateAux <IProduct, ProductViewModel>(jsonInTextbox);
                }
                else if (typeEnum == EType.ProductComplexViewModel)
                {
                    GenerateAux <IProduct, ProductComplexViewModel>(jsonInTextbox);
                }
#endif
            });
        }
Example #2
0
        public void Exception <T>(T pData, IStep <T> pStep, Exception ex)
        {
            try
            {
                if (HelperUI.GetMethod <bool>(Form, () => { return(Form.IsDisposed); }))
                {
                    return;
                }

                GetContainer(pData)?.Exception(pData, pStep, ex);
            }
            catch (Exception ex1)
            {
                //FrmMain.SynchronizationContext.Post((state) =>
                //MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                //, null);
            }
        }