Exemplo n.º 1
0
 public void Add(UIStepControl stp)
 {
     HelperUI.ModifyMethod(this, () =>
     {
         uiStepContainer1.Add(stp);
     });
 }
Exemplo n.º 2
0
        private async void BttExecute_Click(object sender, EventArgs e)
        {
            this.Refresh(EStatus.Running);
            //StepObserver.RegisterSteps

            await Task.Run(() =>
            {
#if NETCOREAPP3_0
                var result = Executor?.Run();
                this.Refresh(EStatus.Finishing);
                if (result == null)
                {
                    return;
                }

                HelperUI.ModifyMethod(cmbType, () => {
                    if (result.ComputeResult().IsOk())
                    {
                        pictureBox1.BackColor = Color.Green;
                    }
                    else if (result.ComputeResult().IsWarning())
                    {
                        pictureBox1.BackColor = Color.Orange;
                    }
                    else if (result.ComputeResult().IsError())
                    {
                        pictureBox1.BackColor = Color.Red;
                    }
                });
#endif
            });
        }
Exemplo n.º 3
0
        public void SetValueFinish(string item, bool isOk, bool isWarning, string message)
        {
            Process currentProcess         = System.Diagnostics.Process.GetCurrentProcess();
            long    totalBytesOfMemoryUsed = currentProcess.WorkingSet64;

#if NETCOREAPP3_0
            HelperUI.ModifyMethod(this, () =>
            {
                if (isOk)
                {
                    //picture.Image = this.imageList1.Images[(int)EIcons.END_OK];
                    this.after.Text = item;
                    PBack.BackColor = System.Drawing.Color.Green;
                }
                else if (isWarning)
                {
                    //this.picture.Image = this.imageList1.Images[(int)EIcons.END_WARNINGS];
                    this.after.Text = item;
                    PBack.BackColor = System.Drawing.Color.Orange;
                }
                else
                {
                    //this.picture.Image = this.imageList1.Images[(int)EIcons.END_ERRORS];
                    this.after.Text = message;
                    PBack.BackColor = System.Drawing.Color.Red;
                }
                this.lblFinish.Text = "Finished: " + DateTime.Now.ToString("hh.mm.ss.ffffff") + " MEM " + totalBytesOfMemoryUsed;
            });
#endif
        }
Exemplo n.º 4
0
 public UIStepContainer()
 {
     HelperUI.ModifyMethod(this, () =>
     {
         InitializeComponent();
     });
 }
Exemplo n.º 5
0
 public void SetValueInitial(string desc)
 {
     HelperUI.ModifyMethod(this, () =>
     {
         this.lblDesc.Text = (desc);
     });
 }
Exemplo n.º 6
0
 public void Add(UIStepControl stp)
 {
     HelperUI.ModifyMethod(this, () =>
     {
         panel.Controls.Add(stp);
     });
 }
Exemplo n.º 7
0
 public void ResizeToJustIcon()
 {
     HelperUI.ModifyMethod(this, () =>
     {
         isMin = EDisplayMode.JUST_ICON;
         RefreshMode();
     });
 }
Exemplo n.º 8
0
 public StepControlObserver(UIStepGenerator form)
 {
     HelperUI.ModifyMethod(form, () =>
     {
         Container = new UIStepControl();
         form.Add(Container);
     });
 }
Exemplo n.º 9
0
        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
            });
        }
Exemplo n.º 10
0
        public void Add(UIStepControl stp)
        {
#if NETCOREAPP3_0
            HelperUI.ModifyMethod(this, () =>
            {
                uiStepContainer1.Add(stp);
            });
#endif
        }
Exemplo n.º 11
0
        public UIStepContainer()
        {
#if NETCOREAPP3_0
            HelperUI.ModifyMethod(this, () =>
            {
                InitializeComponent();
            });
#endif
        }
Exemplo n.º 12
0
        public void SetValueInitial(string desc)
        {
#if NETCOREAPP3_0
            HelperUI.ModifyMethod(this, () =>
            {
                this.lblDesc.Text = (desc);
            });
#endif
        }
Exemplo n.º 13
0
        public void ResizeToJustIcon()
        {
#if NETCOREAPP3_0
            HelperUI.ModifyMethod(this, () =>
            {
                isMin = EDisplayMode.JUST_ICON;
                RefreshMode();
            });
#endif
        }
Exemplo n.º 14
0
 public void SetValueException(string item, string desc)
 {
     HelperUI.ModifyMethod(this, () =>
     {
         //this.picture.Image = this.imageList1.Images[(int)EIcons.END_ERRORS];
         PBack.BackColor     = System.Drawing.Color.Red;
         this.after.Text     = item;
         this.lblFinish.Text = "Finished with Exceptions: " + DateTime.Now;
     });
 }
Exemplo n.º 15
0
 public UIStepControl()
 {
     HelperUI.ModifyMethod(this, () =>
     {
         InitializeComponent();
         RefreshMode();
         //picture.Image = this.imageList1.Images[(int)EIcons.INITIAL];
         PBack.BackColor = System.Drawing.Color.LightGray;
     });
 }
Exemplo n.º 16
0
 public StepContainerObserver(FrmMain form, FrmMainObserver obs)
 {
     HelperUI.ModifyMethod(form, () =>
     {
         FrmMainObserver        = obs;
         Container              = new UIStepGenerator();
         Container.StepObserver = this;
         form.panelSteps.Controls.Add(Container);
     });
 }
Exemplo n.º 17
0
        public void SetValueStart(string item)
        {
            Process currentProcess         = System.Diagnostics.Process.GetCurrentProcess();
            long    totalBytesOfMemoryUsed = currentProcess.WorkingSet64;

            HelperUI.ModifyMethod(this, () =>
            {
                //this.picture.Image = this.imageList1.Images[(int)EIcons.START];
                PBack.BackColor    = System.Drawing.Color.Gray;
                this.before.Text   = item;
                this.lblStart.Text = "Started: " + DateTime.Now.ToString("hh.mm.ss.ffffff") + " MEM " + totalBytesOfMemoryUsed;
            });
        }
Exemplo n.º 18
0
 public void Refresh(EStatus param1)
 {
     CurrentStatus = param1;
     HelperUI.ModifyMethod(bttGenerate, () =>
     {
         this.bttGenerate.Enabled = CurrentStatus == EStatus.Initial ||
                                    CurrentStatus == EStatus.Generating;
         this.bttExecute.Enabled = CurrentStatus == EStatus.Generating && Executor != null;
         this.bttDelete.Enabled  = CurrentStatus == EStatus.Initial ||
                                   CurrentStatus == EStatus.Generating ||
                                   CurrentStatus == EStatus.Finishing;
         this.cmbType.Enabled = (CurrentStatus == EStatus.Initial ||
                                 CurrentStatus == EStatus.Generating);
     });
 }
Exemplo n.º 19
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);
            }
        }