// Decompiled with JetBrains decompiler
// Type: HPG_68D.MSCommWriteForm
// Assembly: HPG-68D, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 530C99A8-8EEF-42C8-8A74-66FDE7B322C3
// Assembly location: C:\Program Files (x86)\HONGKAIDE\HPG-68D\HPG-68D.exe

using HPG_68D.My;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;


namespace HPG_68D
{
  [DesignerGenerated]
  public class MSCommWriteForm : Form
  {
    private static ArrayList __ENCList = new ArrayList();
    private IContainer components;
    [AccessedThroughProperty("Label1")]
    private Label _Label1;
    [AccessedThroughProperty("Button取消")]
    private Button _Button取消;
    [AccessedThroughProperty("Button写频")]
    private Button _Button写频;
    [AccessedThroughProperty("ProgressBar1")]
    private ProgressBar _ProgressBar1;
    [AccessedThroughProperty("Timer1")]
    private Timer _Timer1;

    [DebuggerNonUserCode]
    static MSCommWriteForm()
    {
    }

    [DebuggerNonUserCode]
    public MSCommWriteForm()
    {
      Load += MSCommWriteForm_Load;
      __ENCList.Add(new WeakReference(this));
      InitializeComponent();
    }

    [DebuggerNonUserCode]
    protected override void Dispose(bool disposing)
    {
      if (disposing && components != null)
        components.Dispose();
      base.Dispose(disposing);
    }

    [DebuggerStepThrough]
    private void InitializeComponent()
    {
      components = new Container();
      var componentResourceManager = new ComponentResourceManager(typeof (MSCommWriteForm));
      Label1 = new Label();
      Button取消 = new Button();
      Button写频 = new Button();
      ProgressBar1 = new ProgressBar();
      Timer1 = new Timer(components);
      SuspendLayout();
      Label1.AccessibleDescription = null;
      Label1.AccessibleName = null;
      componentResourceManager.ApplyResources(Label1, "Label1");
      Label1.BackColor = SystemColors.Control;
      Label1.Font = null;
      Label1.ForeColor = Color.Red;
      Label1.Name = "Label1";
      Button取消.AccessibleDescription = null;
      Button取消.AccessibleName = null;
      componentResourceManager.ApplyResources(Button取消, "Button取消");
      Button取消.BackgroundImage = null;
      Button取消.Font = null;
      Button取消.Name = "Button取消";
      Button取消.UseVisualStyleBackColor = true;
      Button写频.AccessibleDescription = null;
      Button写频.AccessibleName = null;
      componentResourceManager.ApplyResources(Button写频, "Button写频");
      Button写频.BackgroundImage = null;
      Button写频.Font = null;
      Button写频.Name = "Button写频";
      Button写频.UseVisualStyleBackColor = true;
      ProgressBar1.AccessibleDescription = null;
      ProgressBar1.AccessibleName = null;
      componentResourceManager.ApplyResources(ProgressBar1, "ProgressBar1");
      ProgressBar1.BackgroundImage = null;
      ProgressBar1.Font = null;
      ProgressBar1.Name = "ProgressBar1";
      AccessibleDescription = null;
      AccessibleName = null;
      componentResourceManager.ApplyResources(this, "$this");
      AutoScaleMode = AutoScaleMode.Font;
      BackgroundImage = null;
      Controls.Add(Label1);
      Controls.Add(Button取消);
      Controls.Add(Button写频);
      Controls.Add(ProgressBar1);
      Font = null;
      FormBorderStyle = FormBorderStyle.FixedDialog;
      MaximizeBox = false;
      MinimizeBox = false;
      Name = nameof (MSCommWriteForm);
      ResumeLayout(false);
      PerformLayout();
    }

    internal virtual Label Label1
    {
      [DebuggerNonUserCode] get => _Label1;
      [DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set => _Label1 = value;
    }

    internal virtual Button Button取消
    {
      [DebuggerNonUserCode] get => _Button取消;
      [DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set
      {
        if (_Button取消 != null)
          _Button取消.Click -= Button取消_Click;
        _Button取消 = value;
        if (_Button取消 == null)
          return;
        _Button取消.Click += Button取消_Click;
      }
    }

    internal virtual Button Button写频
    {
      [DebuggerNonUserCode] get => _Button写频;
      [DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set
      {
        if (_Button写频 != null)
          _Button写频.Click -= Button写频_Click;
        _Button写频 = value;
        if (_Button写频 == null)
          return;
        _Button写频.Click += Button写频_Click;
      }
    }

    internal virtual ProgressBar ProgressBar1
    {
      [DebuggerNonUserCode] get => _ProgressBar1;
      [DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set
      {
        _ProgressBar1 = value;
      }
    }

    internal virtual Timer Timer1
    {
      [DebuggerNonUserCode] get => _Timer1;
      [DebuggerNonUserCode, MethodImpl(MethodImplOptions.Synchronized)] set
      {
        if (_Timer1 != null)
          _Timer1.Tick -= Timer1_Tick;
        _Timer1 = value;
        if (_Timer1 == null)
          return;
        _Timer1.Tick += Timer1_Tick;
      }
    }

    private void MSCommWriteForm_Load(object sender, EventArgs e)
    {
    }

    private void Timer1_Tick(object sender, EventArgs e)
    {
      var num = checked ((uint) unchecked (checked (publicva.Rw_EEPROM_Add_Length_ListIndex * 100L) / publicva.Rw_EEPROM_Add_Length_ListSum));
      if (num > 100U)
        num = 100U;
      ProgressBar1.Value = checked ((int) num);
      Label1.Text = Conversions.ToString(num) + "%";
      if (!publicva.F_MSCommStop)
        return;
      Timer1.Enabled = false;
      Button取消_Click(RuntimeHelpers.GetObjectValue(sender), e);
    }

    private void Button写频_Click(object sender, EventArgs e)
    {
      MyProject.Forms.MDIParent1.AllForm_SaveData(RuntimeHelpers.GetObjectValue(sender), e);
      if (MyProject.Forms.MDIParent1.MSCcomm_StartInit("Write", publicva.W_EEPROM_Add_Lendgth_List))
      {
        Timer1.Enabled = true;
        Button写频.Enabled = false;
        ProgressBar1.Value = 0;
        Label1.Text = "%";
      }
      else
        Close();
    }

    private void Button取消_Click(object sender, EventArgs e)
    {
      MyProject.Forms.MDIParent1.MSComm_Stop();
      Timer1.Enabled = false;
      Button写频.Enabled = true;
      ProgressBar1.Value = 0;
      Label1.Text = "%";
      Close();
    }
  }
}
