⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainunit.pas

📁 Gestione Cellulari Nokia
💻 PAS
📖 第 1 页 / 共 4 页
字号:
end;

procedure TfrmMain.btnSendVIASMSClick(Sender: TObject);
var
  sInput:string;
begin
 if (FileListBox1.FileName <> '') and (IsRingTone(FileListBox1.Filename))  then
  begin
   sInput:=InputBox('Destination', 'Please enter the destination phone number','');
     if Trim(sInput) <>'' then
       begin
         FBUS1.RingTone.ReadFile(FileListBox1.Filename);
         FBUS1.RingTone.SendAsSMS(sInput);
       end;
    end;
end;

procedure TfrmMain.btnRingToneUploadClick(Sender: TObject);
var
  iUploadPos : integer;
begin
   if (FileListBox1.FileName <> '') and (IsRingTone(FileListBox1.Filename)) then
    begin
      if fBus1.PhoneInfo.Sup_ringtones then
        begin
          if fBus1.PhoneInfo.Total_Ringtones > 1 then
            begin
              application.createForm(TfrmUploadringtone,frmUploadringtone);
              iUploadPos:=frmUploadringtone.ShowForm;
              if (iUploadPos <> -1) and (FBUS1.RingTone.ReadFile(FileListBox1.Filename)) then
                FBUS1.RingTone.Upload(True,iUploadPos);
              frmUploadringtone.free;  
            end
          else
            FBUS1.RingTone.Upload(True);
        end
      else
        Messagedlg('Sorry. Your phone does not support uploading of Ringtones',mtInformation,[mbOk],0);
    end;
end;

procedure TfrmMain.btnRingToneWriteClick(Sender: TObject);
begin
 if (FileListBox1.FileName <> '') and (IsRingTone(FileListBox1.Filename)) then
   FBUS1.RingTone.WriteFile(FileListBox1.FileName);
end;

procedure TfrmMain.rgrpDTMFTypeClick(Sender: TObject);
begin
  if rgrpDTMFType.itemindex=1 then
    begin
      btnCall.enabled:=true;
      btnhangup.enabled:=true;
      txtVoiceCall.Visible:=true;
    end
  else
    begin
      btnCall.enabled:=False;
      btnhangup.enabled:=False;
      txtVoiceCall.Visible:=False;
    end;

end;

procedure TfrmMain.ProcessDTMF(sender : TObject);
var
  sTagIndex:string;
begin
 if FBus1.Connected then
 With Sender as TButton do
   begin
     sTagIndex:=IntToStr(TButton(Sender).tag);
     if sTagIndex = '99' then sTagIndex:='+';
     if sTagIndex = '88' then sTagIndex:='#';

     if txtVoiceCall.Visible then
       txtVoiceCall.text:=txtVoiceCall.text+sTagIndex
     else
       FBUS1.SendDTMF(sTagIndex);
   end;
end;
procedure TfrmMain.btnCallClick(Sender: TObject);
begin

  if FBus1.Connected then
    begin
      FBUS1.CallInProgressNumber:=txtVoiceCall.text;
      FBUS1.MakeVoiceCall(txtVoiceCall.text);
    end;
end;



procedure TfrmMain.btnHangupClick(Sender: TObject);
begin
  if FBus1.Connected then
    begin
      FBUS1.CallInProgressNumber:='';
      FBUS1.HangupPhone;
    end;
end;

procedure TfrmMain.UpDown1Click(Sender: TObject; Button: TUDBtnType);
  function FilterHash10(sData:string):string;
  var
    iPos:integer;
    sNewString:String;
  begin
    sNewString:='';

    for ipos:=0 to length(sData)-1 do
      if sData[ipos+1] = #10 then
        sNewString:=sNewString+#13#10
      else
        sNewString:=sNewString+sData[ipos+1];

     result:=sNewString;
  end;
begin
   moNetMonitor.lines.clear;
   moNetMonitor.lines.add(FilterHash10(FBus1.NetMon(edit1.text)));
end;

procedure TfrmMain.Button7Click(Sender: TObject);
begin
  edit1.text:='0';
  moNetMonitor.lines.clear;
  FBus1.NetMon('devel');
end;

procedure TfrmMain.Button8Click(Sender: TObject);
begin
  edit1.text:='0';
  moNetMonitor.lines.clear;
  FBus1.NetMon('field');
end;

procedure TfrmMain.Button6Click(Sender: TObject);
begin
  edit1.text:='0';
  moNetMonitor.lines.clear;
  FBus1.NetMon('off')
end;

procedure TfrmMain.btnClearClick(Sender: TObject);
begin
  FBUSLogoMgr1.ClearLogo;
end;

procedure TfrmMain.btnLoadfromfileClick(Sender: TObject);
begin
  if dlgOpenImageFile.execute then
    begin
      FBUSLogoMgr1.ClearLogo;
      cmboLogoTypeclick(self);
      screen.cursor:=crHourglass;
      application.processmessages;
      dlgOpenImageFile.InitialDir:=sApplicationPath;
      FBUSLogoMgr1.LoadLogoFromFile(dlgOpenImageFile.Filename);
      end;
   screen.cursor:=crDefault;
end;

procedure TfrmMain.btnDownloadClick(Sender: TObject);
var
   iPicMsgIndex : integer;
   frm : TfrmPicindex;
begin
  iPicMsgIndex:=-1;
  screen.cursor:=crHourGlass;

  if (cmboLogoType.itemindex=4) then
    begin
      if (fBus1.PhoneInfo.Sup_pictures) then
        begin
          //frm:=TfrmPicindex.create(self);
          //iPicMsgIndex:=frm.displayForm-1;
          //if iPicMsgIndex >=0 then
          //  FBUSLogoMgr1.Download(cmboLogoType.itemIndex,iPicMsgIndex);
          //frm.free;
          application.createform(TfrmLogoBrowse,frmLogoBrowse);
          frmLogoBrowse.displayform;
          frmLogoBrowse.free;
        end
      else
        Messagedlg('Sorry your phone does not support Picture Messages',mtInformation,[mbOk],0);
    end
  else
    case cmboLogoType.itemIndex of
    1: begin
         if Not fBus1.PhoneInfo.Sup_Startup_logo then
          Messagedlg('Sorry your phone does not support Startup Logos',mtInformation,[mbOk],0)
        else
          FBUSLogoMgr1.Download(cmboLogoType.itemIndex);
       end;
    2: begin
        if Not fBus1.PhoneInfo.Sup_operator_logo then
          Messagedlg('Sorry your phone does not support Operator Logos',mtInformation,[mbOk],0)
        else
          FBUSLogoMgr1.Download(cmboLogoType.itemIndex);
       end;

    3: begin
        if Not fBus1.PhoneInfo.Sup_caller_group_logo then
          Messagedlg('Sorry your phone does not support Caller Group Logos',mtInformation,[mbOk],0)
        else
          FBUSLogoMgr1.Download(cmboLogoType.itemIndex);
       end;
    end;


  screen.cursor:=crdefault;

end;

procedure TfrmMain.Notebook1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
begin
  MFBUSStatusBar1.Panels[1].text:='';
end;

procedure TfrmMain.SendThruSMSClick(Sender: TObject);
var
  sDestination:String;
begin

  if FBUSLogoMgr1.NetCode='' then
     FBUSLogoMgr1.SetNewNetCode(Fbus1.NetworkInfo.DefaultNetCode);//This will set the Netcode to the default netcode of the provider, IF it is blank

  if cmboLogoType.itemindex=4 then
    begin
      FBUSLogoMgr1.MessageText := txtPictureMessage.Text;
      FBUSLogoMgr1.SendPictueSMS(txtDestination.text,cbUniCode.checked);
    end
  else
  if (cmboLogoType.itemindex = 1) and ( FBUS1.PhoneInfo.Model <> 'Nokia 3310') and ( FBUS1.PhoneInfo.Model <> 'Nokia 3210') and ( FBUS1.PhoneInfo.Model <> 'Nokia 6110') then
    messageDlg('Sorry. Your phone cannot send a "Startup Logo" as this logo type is not supportd by your phone',mtInformation,[mbOk],0)
  else
    begin
      sDestination:=Inputbox('destination number','Please Enter the destination number','');
      if length(sDestination) >0 then
        begin
          screen.cursor:=crHourGlass;
          FBUSLogoMgr1.SendLogoViaSMS(sDestination);
          screen.cursor:=crDefault;
        end;
    end;
end;

procedure TfrmMain.btnSaveLogoClick(Sender: TObject);
begin
  FBUSLogoMgr1.SaveLogoToFile('c:\test.nol');
end;

procedure TfrmMain.btnSendToPhoneClick(Sender: TObject);
var
  sPicIndex:string;
  bCanSend:Boolean;
begin
  bCanSend:=true;
  screen.cursor:=crHourglass;
  if cmboLogoType.itemindex=4 then
    begin
      if fBus1.PhoneInfo.Sup_pictures then
        begin
          sPicIndex:= inputbox('Picture Message Index','Please enter the index for the picture to be saved to','');
          if sPicIndex <> '' then
            if IsNumber(sPicIndex) then
              FBUSLogoMgr1.setgroupnumber(strtoint(sPicIndex));
        end
      else
        begin
          Messagedlg('Sorry your phone does not support Picture Messages',mtInformation,[mbOk],0);
          bCanSend:=false;
        end;
    end;
       case cmboLogoType.itemIndex of
        1: begin
            if Not fBus1.PhoneInfo.Sup_Startup_logo then
              begin
                Messagedlg('Sorry your phone does not support Startup Logos',mtInformation,[mbOk],0);
                bCanSend:=false;
              end
            else
              bCanSend:=true;
           end;
        2: if Not fBus1.PhoneInfo.Sup_operator_logo then
            begin
              Messagedlg('Sorry your phone does not support Operator Logos',mtInformation,[mbOk],0);
              bCanSend:=false;
            end;

        3: if Not fBus1.PhoneInfo.Sup_caller_group_logo then
            begin
              Messagedlg('Sorry your phone does not support Caller Group Logos',mtInformation,[mbOk],0);
              bCanSend:=false;
            end;
       end;

  if bCanSend then
    FBUSLogoMgr1.SendLogoToPhone;
    
  screen.cursor:=crDefault;
end;

procedure TfrmMain.btnResetClick(Sender: TObject);
begin
 if FBUSLogoMgr1.ResetLogo(cmboLogoType.itemindex) then
   begin
    if MessageDlg('Logo Reset. Clear Logo editor?',mtinformation,[mbYes,mbNo],0) = mryes then
       btnClearClick(Self);
   end
 else
   messageDlg('Error: Logo Not Reset',mtinformation,[mbOk],0);
end;

procedure TfrmMain.FBUS1RingToneSent(Sent: Boolean);
begin
 if Sent then
    messageDlg('The Ringtone has successfully been sent',mtInformation,[mbOk],0)
  else
    messageDlg('The Ringtone was not sent due to an error',mtInformation,[mbOk],0);
end;

procedure TfrmMain.FBUS1IncommingCall(Number: String);
begin
   if Messagedlg(FBUS1.PhoneBook.FindCaller(number) + ' is calling. Answer call ?',mtConfirmation,[mbYes,mbNo],0) = mrYes then
      fBus1.Answer;
end;

procedure TfrmMain.PhoneInfo1Click(Sender: TObject);
begin
  FourthShortcutBar1.PanelIndex:=0;
  NoteBook1.pageindex:=0;
  lblText.caption:='Phone Information';
end;

procedure TfrmMain.PhoneBook1Click(Sender: TObject);
begin
    FourthShortcutBar1.PanelIndex:=1;
    if fBus1.Connected then
      begin
        lblText.caption:='Phone Book';
        application.processmessages;
      end
    else
      Notebook1.PageIndex:=1;
end;

procedure TfrmMain.SMS1Click(Sender: TObject);
begin
  lblText.caption:='SMS Messages';
  FourthShortcutBar1.PanelIndex:=1;
  Notebook1.PageIndex:=2;
  application.processmessages;
  cmboSMSMemType.itemindex:=2;
  lvSMS.LoadSMS(cmboSMSMemType.itemindex+11);
end;

procedure TfrmMain.SpeedDial1Click(Sender: TObject);
begin
  lblText.caption:='Speed Dial';
  FourthShortcutBar1.PanelIndex:=1;
  NoteBook1.pageindex:=3;
end;

procedure TfrmMain.RingTone1Click(Sender: TObject);
begin
  lblText.caption:='Ringtone';
  FourthShortcutBar1.PanelIndex:=1;
  NoteBook1.pageindex:=4;
end;

procedure TfrmMain.Logo1Click(Sender: TObject);
begin
  lblText.caption:='Logo';
  FourthShortcutBar1.PanelIndex:=1;
  NoteBook1.pageindex:=6;
end;

procedure TfrmMain.DTMF1Click(Sender: TObject);
begin
  lblText.caption:='DTMF';
  FourthShortcutBar1.PanelIndex:=1;
  NoteBook1.pageindex:=5;
end;

procedure TfrmMain.NetMonitor1Click(Sender: TObject);
begin
  lblText.caption:='Net Monitor';
  FourthShortcutBar1.PanelIndex:=1;
  NoteBook1.pageindex:=7;
end;

procedure TfrmMain.btnChangeProviderClick(Sender: TObject);
begin
 application.createform(TfrmProviders,frmProviders);
 frmProviders.ShowProviders(FBUS1.NetworkInfo.NetworkCode,FBUS1.NetworkInfo.Country);

end;

procedure TfrmMain.btnExportClick(Sender: TObject);
begin
   FBUSLogoMgr1.ExportLogoToFile('C:\ExportedLogo.bmp','BMP');
   FBUSLogoMgr1.ExportLogoToFile('C:\ExportedLogo.gif','GIF');
   FBUSLogoMgr1.ExportLogoToFile('C:\ExportedLogo.jpg','JPG');
   messagedlg('3 logos saved to file. 1 BMP, 1 GIF and 1 JPG. Saved to C:\ExportedLogo.xxx',mtinformation,[mbOk],0);
end;

procedure TfrmMain.FBUS1NewSMSMessage(iIndex: Integer);
var
 fSMSMessage : TSMSMessage;
begin
  messagedlg('You have received a new SMS Message.',mtInformation,[mbOk],0);
  fSMSMessage:=FBUS1.SMS.RetreiveMessageData(fbIncommingMessage,iIndex);
  LoadSMSMessages;
end;

procedure TfrmMain.progressbarPBMouseMove(Sender: TObject;
  Shift: TShiftState; X, Y: Integer);
begin
  progressbarPB.hint:= 'Used Entries: ' + inttostr(FBus1.phonebook.PhoneBookEntriesUsed(TMemType(frmMain.cmbpMemType.itemindex)));
  progressbarPB.hint:= progressbarPB.hint + #13+ 'Max Entries: '+ IntToStr(FBus1.phonebook.PhoneBookSize(TMemType(frmMain.cmbpMemType.itemindex)));
  progressbarPB.showhint:=true;
end;

procedure TfrmMain.ShowPhoneBookUsage;
var
  iMaxPhoneBookSize,iUsedEntries:integer;
begin
  iMaxPhoneBookSize:=frmMain.FBus1.phonebook.PhoneBookSize(TMemType(frmMain.cmbpMemType.itemindex));
  iUsedEntries:=frmMain.FBus1.phonebook.PhoneBookEntriesUsed(TMemType(frmMain.cmbpMemType.itemindex));
  progressbarPB.max:=iMaxPhoneBookSize;
  progressbarPB.position:=iUsedEntries;
end;

procedure TfrmMain.LoadCharSets;
begin
  cmboCharSet.items.add('ANSI_CHARSET');
  cmboCharSet.items.add('DEFAULT_CHARSET');
  cmboCharSet.items.add('SYMBOL_CHARSET');
  cmboCharSet.items.add('SHIFTJIS_CHARSET');
  cmboCharSet.items.add('HANGEUL_CHARSET');
  cmboCharSet.items.add('GB2312_CHARSET');
  cmboCharSet.items.add('CHINESEBIG5_CHARSET');
  cmboCharSet.items.add('OEM_CHARSET');
  cmboCharSet.items.add('JOHAB_CHARSET');
  cmboCharSet.items.add('HEBREW_CHARSET');
  cmboCharSet.items.add('ARABIC_CHARSET');
  cmboCharSet.items.add('GREEK_CHARSET');
  cmboCharSet.items.add('TURKISH_CHARSET');
  cmboCharSet.items.add('VIETNAMESE_CHARSET');
  cmboCharSet.items.add('THAI_CHARSET');
  cmboCharSet.items.add('EASTEUROPE_CHARSET');
  cmboCharSet.items.add('RUSSIAN_CHARSET');
  cmboCharSet.items.add('MAC_CHARSET');
  cmboCharSet.items.add('BALTIC_CHARSET');
  cmboCharSet.itemindex:=1;
end;

procedure TfrmMain.cmboCharSetChange(Sender: TObject);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -