示例#1
0
        private void readConfig_Click(object sender, EventArgs e)
        {
            if (result == null || result.IsCompleted)
            {
                ResetDevice();
                listBox.Items.Clear();

                if (status.Algorithm == UsedAlgorithm.Cucliced)
                {
                    Invoke(initer, 0, 31);
                    maker = new Maker(MakeCuclic);
                }
                else
                {
                    Invoke(initer, 0, 1);
                    maker = new Maker(MakeBroadcast);
                }

                status.Working = true;
                result         = maker.BeginInvoke(null, null);
            }
        }
示例#2
0
 private void SaveForm_Shown(object sender, EventArgs e)
 {
     Invoke(initer, 0, 64);
     maker = new Maker(WriteCFG);
     async = maker.BeginInvoke(null, null);
 }
示例#3
0
 private void SaveForm_Shown(object sender, EventArgs e)
 {
     Invoke(initer, 0, 64);
     maker = new Maker(WriteCFG);
     async = maker.BeginInvoke(null, null);
 }
示例#4
0
 /// <summary>
 /// старт загрузки!!!
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LoadeForm_Shown(object sender, EventArgs e)
 {
     Invoke(initer, 0, 48);
     maker = new Maker(ReadCFG);
     async = maker.BeginInvoke(null, null);
 }
示例#5
0
 /// <summary>
 /// старт загрузки!!!
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LoadeForm_Shown(object sender, EventArgs e)
 {
     Invoke(initer, 0, 48);
     maker = new Maker(ReadCFG);
     async = maker.BeginInvoke(null, null);
 }
示例#6
0
        private void buttonWriteToDevice_Click(object sender, EventArgs e)
        {
            lock (workHandle)
            {
                if (workHandle.operation == Operation.Default)
                {
                    workHandle.operation = Operation.Write;
                    rInfo = new ReadInfo();

                    rInfo.Device = device;
                    rInfo.DeviceNumber = (int)numericUpDownDeviceNumber.Value;
                    rInfo.TimeoutForAnswer = (int)numericUpDownDeviceAnswerTimeout.Value;
                    rInfo.TimeoutBetweenRead = (int)numericUpDownTimeoutForAnswer.Value;
                    rInfo.AttemptsToRead = (int)numericUpDownCountDo.Value;
                    rInfo.NumberOfDataChecks = (int)numericUpDown5.Value;
                    rInfo.UseBroadcast = checkBoxUseBroadcast.Checked;

                    if (rInfo.UseBroadcast)
                    {
                        rInfo.Device = Device.D3F;
                        rInfo.DeviceNumber = 63;
                    }

                    if (comboBoxAlgorithmWrite.SelectedIndex == 0)
                    {
                        rInfo.UsingAnAlgorithmWithDataProtection = false;
                    }
                    else
                        rInfo.UsingAnAlgorithmWithDataProtection = true;

                    if (checkBoxAllPages.Checked)
                    {
                        for (int i = 0; i < rInfo.Pages.Length; i++)
                        {
                            rInfo.Pages[i] = (i + 1);
                        }
                        rInfo.countCommands = 112;
                    }
                    else
                    {
                        if (checkBoxPage1.Checked) { rInfo.Pages[0] = 1; rInfo.countCommands += 16; }
                        if (checkBoxPage2.Checked) { rInfo.Pages[1] = 2; rInfo.countCommands += 16; }
                        if (checkBoxPage3.Checked) { rInfo.Pages[2] = 3; rInfo.countCommands += 16; }
                        if (checkBoxPage4.Checked) { rInfo.Pages[3] = 4; rInfo.countCommands += 16; }
                        if (checkBoxPage5.Checked) { rInfo.Pages[4] = 5; rInfo.countCommands += 16; }
                        if (checkBoxPage6.Checked) { rInfo.Pages[5] = 6; rInfo.countCommands += 16; }
                        if (checkBoxPage7.Checked) { rInfo.Pages[6] = 7; rInfo.countCommands += 16; }
                    }

                    try
                    {
                        workHandle.need = NeedTolk.Yes;
                        workHandle.commonTimeout = rInfo.TimeoutForAnswer;
                        workHandle.defTimeout = rInfo.TimeoutBetweenRead;
                        workHandle.deviceNumber = rInfo.DeviceNumber;
                        workHandle.countDo = rInfo.AttemptsToRead;

                        Maker maker = new Maker(Do);
                        maker.BeginInvoke(null, null);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Не удалось прочитать конфигурацию устройства!" + Constants.vbCrLf +
                            "Причина: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
示例#7
0
        private void button3_Click(object sender, EventArgs e)
        {
            lock (workHandle)
            {
                if (workHandle.operation == Operation.Default)
                {
                    workHandle.operation = Operation.SelectedWrite;
                    workHandle.selected = new DataGridViewCell[GetActivedPage().SelectedCells.Count];

                    GetActivedPage().SelectedCells.CopyTo(workHandle.selected, 0);
                    Array.Sort(workHandle.selected, new Comparer());

                    if (comboBoxAlgorithmWrite.SelectedIndex == 1)
                    {
                        workHandle.needSafe = true;
                    }

                    workHandle.need = NeedTolk.Yes;
                    workHandle.commonTimeout = (int)numericUpDownDeviceAnswerTimeout.Value;
                    workHandle.defTimeout = (int)numericUpDownTimeoutForAnswer.Value;

                    if (checkBoxUseBroadcast.Checked)
                    {
                        workHandle.deviceNumber = 63;
                        device = Device.D3F;
                    }
                    else
                        workHandle.deviceNumber = (int)numericUpDownDeviceNumber.Value;

                    workHandle.countDo = (int)numericUpDownCountDo.Value;

                    Maker maker = new Maker(Do);
                    maker.BeginInvoke(null, null);
                }
            }
        }