mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2025-12-06 10:10:48 +01:00
refactor: use HyperlinkButton
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
using Avalonia.Platform;
|
using Avalonia.Platform;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using Needlework.Net.Models;
|
using Needlework.Net.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -23,13 +21,4 @@ public partial class HomeViewModel : PageBase
|
|||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void OpenUrl(string? value)
|
|
||||||
{
|
|
||||||
if (value == null) return;
|
|
||||||
var process = new Process() { StartInfo = new ProcessStartInfo(value) { UseShellExecute = true } };
|
|
||||||
process.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using Needlework.Net.Models;
|
using Needlework.Net.Models;
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace Needlework.Net.ViewModels.Pages.Home
|
namespace Needlework.Net.ViewModels.Pages.Home
|
||||||
{
|
{
|
||||||
@@ -13,12 +11,5 @@ namespace Needlework.Net.ViewModels.Pages.Home
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Library Library { get; }
|
public Library Library { get; }
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void OpenUrl()
|
|
||||||
{
|
|
||||||
var process = new Process() { StartInfo = new ProcessStartInfo(Library.Link) { UseShellExecute = true } };
|
|
||||||
process.Start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,29 +48,24 @@
|
|||||||
<StackPanel>
|
<StackPanel>
|
||||||
<controls:Card Margin="12" Width="300">
|
<controls:Card Margin="12" Width="300">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel.Styles>
|
|
||||||
<Style Selector="Button">
|
|
||||||
<Setter Property="Command" Value="{Binding OpenUrlCommand}"/>
|
|
||||||
</Style>
|
|
||||||
</StackPanel.Styles>
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Theme="{StaticResource SubtitleTextBlockStyle}"
|
Theme="{StaticResource SubtitleTextBlockStyle}"
|
||||||
Margin="0 0 0 8">Resources</TextBlock>
|
Margin="0 0 0 8">Resources</TextBlock>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<Button CommandParameter="https://hextechdocs.dev/tag/lcu/" Margin="4">
|
<HyperlinkButton NavigateUri="https://hextechdocs.dev/tag/lcu/" Margin="4">
|
||||||
Hextech Docs
|
Hextech Docs
|
||||||
</Button>
|
</HyperlinkButton>
|
||||||
<Button CommandParameter="https://hextechdocs.dev/getting-started-with-the-lcu-api/" Margin="4">
|
<HyperlinkButton NavigateUri="https://hextechdocs.dev/getting-started-with-the-lcu-api/" Margin="4">
|
||||||
Getting Started
|
Getting Started
|
||||||
</Button>
|
</HyperlinkButton>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<Button CommandParameter="https://discord.com/channels/187652476080488449/516802588805431296" Margin="4">
|
<HyperlinkButton NavigateUri="https://discord.com/channels/187652476080488449/516802588805431296" Margin="4">
|
||||||
#lcu-api
|
#lcu-api
|
||||||
</Button>
|
</HyperlinkButton>
|
||||||
<Button CommandParameter="https://discord.com/channels/187652476080488449/543112946402721832" Margin="4">
|
<HyperlinkButton NavigateUri="https://discord.com/channels/187652476080488449/543112946402721832" Margin="4">
|
||||||
#ingame-api
|
#ingame-api
|
||||||
</Button>
|
</HyperlinkButton>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</controls:Card>
|
</controls:Card>
|
||||||
|
|||||||
@@ -19,9 +19,7 @@
|
|||||||
TextAlignment="Left"
|
TextAlignment="Left"
|
||||||
TextWrapping="WrapWithOverflow"
|
TextWrapping="WrapWithOverflow"
|
||||||
Width="350"/>
|
Width="350"/>
|
||||||
<Button Command="{Binding OpenUrlCommand}"
|
<HyperlinkButton Content="{Binding Library.Link}" NavigateUri="{Binding Library.Link}"
|
||||||
Margin="0 4 0 0">
|
Margin="0 4 0 0"/>
|
||||||
<TextBlock Text="{Binding Library.Link}"/>
|
|
||||||
</Button>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
Reference in New Issue
Block a user