/// <summary>
 /// Соединие с тераомметром и открытие его окна
 /// </summary>
 /// <param name="form"></param>
 /// <returns></returns>
 public override bool ConnectToDevice(MainForm form)
 {
     if (DeviceForm == null)
     {
         if (connect())
         {
             DeviceForm             = new TeraForm(this, form);
             DeviceForm.MdiParent   = form;
             DeviceForm.FormClosed += new System.Windows.Forms.FormClosedEventHandler(deviceFormClosedEvent);
             //DeviceForm.FormClosing += new System.Windows.Forms.FormClosingEventHandler(deviceFormClosedEvent);
             getCheckSumFromDevice(); //запрос проверочной суммы с прибора
             //loadOrCreateFromDB();
             if (!loadOrCreateFromDB() || (checkSumFromDevice != checkSumFromDB))
             {
                 syncCoeffs(true);
             }
             DeviceForm.InitAndShow();
         }
     }
     else
     {
         DeviceForm.WindowState = System.Windows.Forms.FormWindowState.Normal; //Разворачиваем окно, если оно свёрнуто
         DeviceForm.Activate();                                                //Делаем активным
     }
     return(IsConnected);
 }
 protected override void disconnect()
 {
     base.disconnect();
     this.DeviceForm.Dispose();
     this.DeviceForm = null;
 }