Skip to content

Commit 4c68014

Browse files
committed
Add pointer cursor to some buttons
1 parent 56c42ae commit 4c68014

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

src/UniGetUI/Services/LoginButton_Login.cs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text;
66
using System.Threading.Tasks;
77
using Microsoft.UI;
8+
using Microsoft.UI.Input;
89
using Microsoft.UI.Xaml;
910
using Microsoft.UI.Xaml.Controls;
1011
using Microsoft.UI.Xaml.Controls.Primitives;
@@ -17,6 +18,14 @@
1718

1819
namespace UniGetUI.Services
1920
{
21+
public class PointButton: Button
22+
{
23+
public PointButton()
24+
{
25+
ProtectedCursor = InputSystemCursor.Create(InputSystemCursorShape.Hand);
26+
}
27+
}
28+
2029
public partial class UserAvatar: UserControl
2130
{
2231
public UserAvatar()
@@ -95,7 +104,7 @@ private void SetLoading()
95104
this.Content = new ProgressRing() { IsIndeterminate = true, Width = 24, Height = 24 };
96105
}
97106

98-
private Button GenerateLoginControl()
107+
private PointButton GenerateLoginControl()
99108
{
100109
var personPicture = new PersonPicture
101110
{
@@ -120,7 +129,7 @@ private Button GenerateLoginControl()
120129
FontSize = 12
121130
};
122131

123-
var loginButton = new Button
132+
var loginButton = new PointButton
124133
{
125134
HorizontalAlignment = HorizontalAlignment.Stretch,
126135
Content = CoreTools.Translate("Log in")
@@ -145,7 +154,7 @@ private Button GenerateLoginControl()
145154
Content = stackPanel
146155
};
147156

148-
return new Button
157+
return new PointButton
149158
{
150159
Margin = new Thickness(0),
151160
Padding = new Thickness(4),
@@ -157,7 +166,7 @@ private Button GenerateLoginControl()
157166
};
158167
}
159168

160-
private async Task<Button> GenerateLogoutControl()
169+
private async Task<PointButton> GenerateLogoutControl()
161170
{
162171
var authClient = new GitHubAuthService();
163172
var token = await authClient.GetAccessTokenAsync();
@@ -202,11 +211,11 @@ private async Task<Button> GenerateLogoutControl()
202211
};
203212
hyperlinkButton.Click += (_, _) => MainApp.Instance.MainWindow.NavigationPage.OpenSettingsPage(typeof(Backup));
204213

205-
var loginButton = new Button
214+
var loginButton = new PointButton
206215
{
207216
HorizontalAlignment = HorizontalAlignment.Stretch,
208217
Content = "Log out",
209-
Background = new SolidColorBrush(ActualTheme is ElementTheme.Dark? Colors.DarkRed: Colors.Red),
218+
Background = new SolidColorBrush(ActualTheme is ElementTheme.Dark? Colors.DarkRed: Colors.PaleVioletRed),
210219
BorderThickness = new(0)
211220
};
212221
loginButton.Click += LogoutButton_Click;
@@ -230,7 +239,7 @@ private async Task<Button> GenerateLogoutControl()
230239
Content = stackPanel
231240
};
232241

233-
return new Button
242+
return new PointButton
234243
{
235244
Margin = new Thickness(0),
236245
Padding = new Thickness(4),

0 commit comments

Comments
 (0)