11using System . Windows ;
2+ using System . Xml ;
23using Bloxstrap . Models . RobloxApi ;
3- using Windows . UI . Notifications ;
4- using Windows . Data . Xml . Dom ;
54
65namespace Bloxstrap . Integrations
76{
@@ -105,33 +104,8 @@ public void ShowFriendOnlineNotification(string username)
105104
106105 _notifiedUsers . Add ( username ) ;
107106
108- // Buat XML untuk toast notification
109- string toastXml = $@ "
110- <toast>
111- <visual>
112- <binding template='ToastText02'>
113- <text id='1'>👋 { System . Net . WebUtility . HtmlEncode ( username ) } ada online!</text>
114- <text id='2'>Apa mau main bareng?</text>
115- </binding>
116- </visual>
117- <audio src='ms-winsoundevent:Notification.Default'/>
118- </toast>" ;
119-
120- var xmlDoc = new XmlDocument ( ) ;
121- xmlDoc . LoadXml ( toastXml ) ;
122-
123- var toast = new ToastNotification ( xmlDoc ) ;
124- toast . ExpirationTime = DateTime . Now . AddSeconds ( 30 ) ;
125-
126- try
127- {
128- ToastNotificationManager . CreateToastNotifier ( APP_ID ) . Show ( toast ) ;
129- }
130- catch
131- {
132- // Fallback jika toast notifier tidak tersedia
133- ShowGeneralNotification ( $ "{ username } ada online!", "Apa mau main bareng?" ) ;
134- }
107+ // Fallback to MessageBox since Windows Runtime APIs are not available
108+ ShowGeneralNotification ( $ "{ username } ada online!", "Apa mau main bareng?" ) ;
135109
136110 App . Logger . WriteLine ( LOG_IDENT , $ "Menampilkan notifikasi untuk teman online: { username } ") ;
137111 OnFriendOnline ? . Invoke ( this , new FriendNotificationEventArgs { Username = username } ) ;
@@ -146,33 +120,8 @@ public void ShowGeneralNotification(string title, string message)
146120 {
147121 try
148122 {
149- // Buat XML untuk toast notification umum
150- string toastXml = $@ "
151- <toast>
152- <visual>
153- <binding template='ToastText02'>
154- <text id='1'>{ System . Net . WebUtility . HtmlEncode ( title ) } </text>
155- <text id='2'>{ System . Net . WebUtility . HtmlEncode ( message ) } </text>
156- </binding>
157- </visual>
158- <audio src='ms-winsoundevent:Notification.Default'/>
159- </toast>" ;
160-
161- var xmlDoc = new XmlDocument ( ) ;
162- xmlDoc . LoadXml ( toastXml ) ;
163-
164- var toast = new ToastNotification ( xmlDoc ) ;
165- toast . ExpirationTime = DateTime . Now . AddSeconds ( 15 ) ;
166-
167- try
168- {
169- ToastNotificationManager . CreateToastNotifier ( APP_ID ) . Show ( toast ) ;
170- }
171- catch
172- {
173- // Fallback jika toast notifier tidak tersedia
174- MessageBox . Show ( message , title , MessageBoxButton . OK , MessageBoxImage . Information ) ;
175- }
123+ // Use MessageBox as the primary notification method
124+ MessageBox . Show ( message , title , MessageBoxButton . OK , MessageBoxImage . Information ) ;
176125
177126 App . Logger . WriteLine ( LOG_IDENT , $ "Menampilkan notifikasi: { title } ") ;
178127 OnNotification ? . Invoke ( this , new NotificationEventArgs { Title = title , Message = message } ) ;
0 commit comments