Skip to content

Commit c1254a0

Browse files
committed
(Fix_) 1
1 parent 659348c commit c1254a0

3 files changed

Lines changed: 8 additions & 58 deletions

File tree

Bloxstrap/Integrations/FpsMonitorService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Windows;
12
using Bloxstrap.UI.Elements;
23

34
namespace Bloxstrap.Integrations

Bloxstrap/Integrations/RobloxNotification.cs

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Windows;
2+
using System.Xml;
23
using Bloxstrap.Models.RobloxApi;
3-
using Windows.UI.Notifications;
4-
using Windows.Data.Xml.Dom;
54

65
namespace 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 });

Bloxstrap/UI/Elements/FpsMonitorOverlay.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
MouseUp="Window_MouseUp"
1616
MouseEnter="Window_MouseEnter"
1717
MouseLeave="Window_MouseLeave">
18-
<Grid Background="#1F1F1F" Opacity="0.85" CornerRadius="10" Margin="5">
18+
<Border Background="#1F1F1F" Opacity="0.85" CornerRadius="10" Margin="5" Padding="10">
1919
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
2020
<TextBlock
2121
Text="FPS Monitor"
@@ -51,5 +51,5 @@
5151
FontSize="9"
5252
HorizontalAlignment="Center"/>
5353
</StackPanel>
54-
</Grid>
54+
</Border>
5555
</Window>

0 commit comments

Comments
 (0)