Главный модуль программы (часть 14) - SwitchToOBEX

Рубрика: Исходники
Среда, 21 апреля 2010 г.
Просмотров: 347
последняя версия: 3.0.9 build 961 beta
от 07 декабря 2007 г.
procedure TForm1.SwitchToOBEX;
var
  ob: boolean;
begin
Screen.Cursor:= crHourGlass;
//Form1.Enabled:= false;
Application.ProcessMessages;
try

  ob:= false;
  //***frmObexFM.ClearElements;
  IsOBEXConnected:= false;
  if IsP2KConnected then
    begin
      //Form1.Enabled:= false;
      Screen.Cursor:= crHourGlass;
      Application.ProcessMessages;
      try
        Logger('P2K режим активен. Выключаю его...');
        p2k.Close;
        //Form1.AdvOfficeStatusBar1.Panels[2].Text:= '';
        lblModel.Caption:= '';
        //Form1.AdvOfficeStatusBar1.Panels[0].Text:= 'Отключен';
        SetStatusConnected(false, '');
        Application.ProcessMessages;
        Logger('Жду ' + IntToStr(SwitchModeTimeOut) + 'мс...');
        sleep(SwitchModeTimeOut);
        IsP2KConnected:= false;
        Logger('P2K режим отключен');
        ob:= true;
        //Form1.AdvOfficeStatusBar1.Panels[0].Text:= 'Подключен';
        //Application.ProcessMessages;
        //frmOBEXFM.PrepareOBex;
      except
        IsP2KConnected:= true;
        Logger('*** P2K режим не отключился');
      end;
      //Form1.Enabled:= true;
      Screen.Cursor:= crDefault;      
    end
  else
    if IsATConnected then
      begin
         Logger('АТ режим активен. Выключаю его...');
        ob:= true;
        DisconnectingAT;
      end
    else
      if IsFlashConnected then
        begin
          try
            IsFlashConnected:= not P2K.FlashReset;
            sleep(SwitchModeTimeOut);
            ob:= true;
          except
            ob:= false;
          end;
        end
      else
        begin
          sleep(1);
          //
          //
          //Application.ProcessMessages;
          //
          ob:= true;
        end;
  if ob then
    begin
          Form1.Visible:= true;
          Application.ProcessMessages;
      //frmOBEXFM.PrepareOBex;
      Logger('Переключаю в OBEX...');
      IsOBEXConnected:= frmOBEXFM.OBEX_OpenPort;
      if not IsOBEXConnected then exit;
      IsOBEXConnected:= frmOBEXFM.OBEX_Connect;
      if not IsOBEXConnected then exit;
      if IsOBEXConnected then
        begin
          //Form1.AdvOfficeStatusBar1.Panels[0].Text:= 'Подключен';
          SetStatusConnected(IsOBEXConnected, '');
          if bOBEXAutoUpdateFileList = 1 then btnOBEX_Refresh.OnClick(nil);
        end;
    end;
finally
Screen.Cursor:= crDefault;
//Form1.Enabled:= true;
end;
end;
Rambler's Top100