Ejemplo n.º 1
0
 private void btnTest_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         DeviceTester <IBilliardsManagerDevice> tester =
             new DeviceTester <IBilliardsManagerDevice>(deviceId,
                                                        delegate(IBilliardsManagerDevice device)
         {
             if (rbTurnOn.Checked)
             {
                 device.LightsOn((int)numTable.Value);
             }
             else
             {
                 device.LightsOff((int)numTable.Value);
             }
         });
         tester.Execute();
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Тестирование устройства
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnTest(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         DeviceTester <ICustomerDisplay> tester = new DeviceTester <ICustomerDisplay>(deviceId,
                                                                                      delegate(ICustomerDisplay device)
         {
             // вывод текста
             for (int i = 0; i < tbDisplayLines.Lines.Length; i++)
             {
                 device[i] = tbDisplayLines.Lines[i];
             }
             // запись в память дисплея
             if (cbSaveLines.Checked)
             {
                 device.SaveToEEPROM();
             }
         });
         tester.Execute();
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 3
0
 private void btnGetWeight_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         DeviceTester <IScaleDevice> tester = new DeviceTester <IScaleDevice>(deviceId,
                                                                              delegate(IScaleDevice device)
         {
             tbWeight.Text = device.Weight.ToString();
         });
         tester.Execute();
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 4
0
 private void btnOpen_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         DeviceTester <ITurnstileDevice> tester =
             new DeviceTester <ITurnstileDevice>(deviceId,
                                                 delegate(ITurnstileDevice device)
         {
             device.Open();
         });
         tester.Execute();
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 5
0
 private void btnRead_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         DeviceTester <ITurnstileDevice> tester =
             new DeviceTester <ITurnstileDevice>(deviceId,
                                                 delegate(ITurnstileDevice device)
         {
             tbData.Text = device.IdentificationData.Trim();
         });
         tester.Execute();
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 6
0
 private void OnSend(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         DeviceTester <ISMSClient> tester = new DeviceTester <ISMSClient>(deviceId,
                                                                          delegate(ISMSClient device)
         {
             // отправка сообщения
             device.Send(tbRecipientNumber.Text, tbMessageText.Text);
             MessageBox.Show(this, "Сообщение отправлено", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
         });
         tester.Execute();
     }
     finally
     {
         this.Cursor = Cursors.Default;
     }
 }
Ejemplo n.º 7
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            try
            {
                DeviceTester <IPrintableDevice> tester = new DeviceTester <IPrintableDevice>(
                    deviceId,
                    delegate(IPrintableDevice device)
                {
                    // проверка наличия бумаги
                    PaperOutStatus paperStatus = device.PrinterStatus.PaperOut;
                    if (!device.ErrorCode.Succeeded)
                    {
                        MessageBox.Show(this, device.ErrorCode.FullDescription,
                                        Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    if (paperStatus == PaperOutStatus.OutActive ||
                        paperStatus == PaperOutStatus.OutPassive)
                    {
                        MessageBox.Show(this,
                                        "Отсутствует бумага в печатающем устройстве", Text,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    // печать
                    device.Print(GetXmlDocument());
                    if (!device.ErrorCode.Succeeded)
                    {
                        MessageBox.Show(this, device.ErrorCode.FullDescription,
                                        Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                });
                tester.Execute();
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }