unit MainForm;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation,
FMX.StdCtrls, System.Notification;
type
TForm1 = class(TForm)
ButtonShowNotification: TButton;
NotificationCenter1: TNotificationCenter;
procedure ButtonShowNotificationClick(Sender: TObject);
private
{ Private declarations }
procedure ShowNotification(const ATitle, AMessage: string);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.ButtonShowNotificationClick(Sender: TObject);
begin
ShowNotification('通知标题', '这是一个系统通知示例');
end;
procedure TForm1.ShowNotification(const ATitle, AMessage: string);
var
Notification: TNotification;
begin
Notification := NotificationCenter1.CreateNotification;
try
Notification.Name := 'MyNotification';
Notification.Title := ATitle;
Notification.AlertBody := AMessage;
NotificationCenter1.PresentNotification(Notification);
finally
Notification.Free;
end;
end;
end.
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.10496807098389 seconds