![]() |
|
ارسال المعلومات من السيرفر وعرضها في Lables في الكلاينت Server/Clinet - نسخة قابلة للطباعة +- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum) +-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3) +--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15) +--- الموضوع : ارسال المعلومات من السيرفر وعرضها في Lables في الكلاينت Server/Clinet (/showthread.php?tid=6318) |
ارسال المعلومات من السيرفر وعرضها في Lables في الكلاينت Server/Clinet - Oman Defender - 13-07-2014 السلام عليكم شباب لدي مشروع VCL clinet يتصب بسيرفرandriod firemonky application لدي استفسار في كيفية ارسال المعلومات من السيرفر وعرضها في Lables في الكلاينت هذه الوحده الأصليه لجلب معلومات النظام وعرضها في Labels كود : unit uMain;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls, FMX.ListBox,
FMX.Layouts;
type
TDeviceInfoForm = class(TForm)
btnGetDeviceInfo: TButton;
ListBox1: TListBox;
lbOSName: TListBoxItem;
lbOSVersion: TListBoxItem;
ToolBar1: TToolBar;
Label1: TLabel;
lbDeviceType: TListBoxItem;
procedure btnGetDeviceInfoClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DeviceInfoForm: TDeviceInfoForm;
implementation
{$IFDEF IOS}
uses
iOSapi.UIKit;
{$ENDIF}
{$IFDEF ANDROID}
uses
androidapi.JNI.JavaTypes,
Androidapi.Helpers,
androidapi.JNI.Os;
{$ENDIF}
{$R *.fmx}
{$IFDEF IOS}
procedure TDeviceInfoForm.btnGetDeviceInfoClick(Sender: TObject);
var
Device : UIDevice;
OSNameStr, OSVersionStr, DeviceTypeStr: string;
begin
Device := TUIDevice.Wrap(TUIDevice.OCClass.currentDevice);
OSNameStr := Device.systemName.UTF8String;
OSVersionStr := Device.systemVersion.UTF8String;
DeviceTypeStr := Device.model.UTF8String;
lbOSName.Text := Format('OS Name: %s', [OSNameStr]);
lbOSVersion.Text := Format('OS Version: %s', [OSVersionStr]);
lbDeviceType.Text := Format('Device Type: %s', [DeviceTypeStr]);
end;
{$ENDIF}
{$IFDEF ANDROID}
function GetCodename(VerString: string): string;
begin
if VerString = '1.0' then
Result := 'BASE'
else if VerString = '1.1' then
Result := 'BASE_1_1'
else if VerString = '1.5' then
Result := 'CUPCAKE'
else if VerString = '1.6' then
Result := 'DONUT'
else if VerString = '2.0' then
Result := 'ECLAIR'
else if VerString = '2.0.1' then
Result := 'ECLAIR_0_1'
else if VerString = '2.1' then
Result := 'ECLAIR_MR1'
else if VerString = '2.2' then
Result := 'FROYO'
else if VerString = '2.3' then
Result := 'GINGERBREAD'
else if VerString = '2.3.3' then
Result := 'GINGERBREAD_MR1'
else if VerString = '3.0' then
Result := 'HONEYCOMB'
else if VerString = '3.1' then
Result := 'HONEYCOMB_MR1'
else if VerString = '3.2' then
Result := 'HONEYCOMB_MR2'
else if VerString = '4.0' then
Result := 'ICE_CREAM_SANDWICH'
else if VerString = '4.0.3' then
Result := 'ICE_CREAM_SANDWICH_MR1'
else if VerString = '4.1' then
Result := 'JELLY_BEAN'
else if VerString = '4.2' then
Result := 'JELLY_BEAN_MR1'
else if VerString = '4.3' then
Result := 'JELLY_BEAN_MR2'
else if Pos('4.4',VerString) = 1 then
Result := 'KITKAT'
else Result := 'UNKNOWN';
end;
procedure TDeviceInfoForm.btnGetDeviceInfoClick(Sender: TObject);
var
codename: string;
begin
codename := 'Unknown';
lbDeviceType.Text := Format('Device Type: %s', [JStringToString(TJBuild.JavaClass.MODEL)]);
lbOSName.Text := Format('OS Name: %s', [GetCodename(JStringToString(TJBuild_VERSION.JavaClass.RELEASE))]);
lbOSVersion.Text := Format('OS Version: %s', [JStringToString(TJBuild_VERSION.JavaClass.RELEASE)]);
end;
{$ENDIF}
end |