Add UIUtils, link links on the sidebar

This commit is contained in:
Timothy Baldridge 2022-01-21 15:20:47 -07:00
parent a5b94af48e
commit 872cb5e34c
2 changed files with 54 additions and 4 deletions

View File

@ -1,12 +1,17 @@
@namespace Wabbajack.App.Blazor.Components @code {
private void OpenPatreonPage() => UIUtils.OpenWebsite(new Uri("https://www.patreon.com/user?u=11907933"));
private void OpenGithubPage() => UIUtils.OpenWebsite(new Uri("https://github.com/wabbajack-tools/wabbajack"));
private void OpenDiscord() => UIUtils.OpenWebsite(new Uri("https://discord.gg/wabbajack"));
}
@namespace Wabbajack.App.Blazor.Components
<div id="side-bar"> <div id="side-bar">
@* TODO: [Low] Replace logo with SVG? *@ @* TODO: [Low] Replace logo with SVG? *@
<img class="logo" src="images/Logo_Dark_Transparent.png" alt="Wabbajack Logo"> <img class="logo" src="images/Logo_Dark_Transparent.png" alt="Wabbajack Logo">
<div class="socials"> <div class="socials">
@* TODO: wrap social icons in a button and make it clickable *@ @* TODO: wrap social icons in a button and make it clickable *@
<img src="images/icons/patreon.svg" alt=""> <img src="images/icons/patreon.svg" alt="" onclick="@OpenPatreonPage">
<img src="images/icons/github.svg" alt=""> <img src="images/icons/github.svg" alt="" onclick="@OpenGithubPage">
<img src="images/icons/discord.svg" alt=""> <img src="images/icons/discord.svg" alt="" onclick="@OpenDiscord">
</div> </div>
</div> </div>

View File

@ -0,0 +1,45 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Media.Imaging;
using Wabbajack.Hashing.xxHash64;
using Wabbajack.Paths;
using Wabbajack.Paths.IO;
namespace Wabbajack
{
public static class UIUtils
{
public static void OpenWebsite(Uri url)
{
Process.Start(new ProcessStartInfo("cmd.exe", $"/c start {url}")
{
CreateNoWindow = true,
});
}
public static void OpenFolder(AbsolutePath path)
{
Process.Start(new ProcessStartInfo(KnownFolders.Windows.Combine("explorer.exe").ToString(), path.ToString())
{
CreateNoWindow = true,
});
}
public static AbsolutePath OpenFileDialog(string filter, string initialDirectory = null)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = filter;
ofd.InitialDirectory = initialDirectory;
if (ofd.ShowDialog() == DialogResult.OK)
return (AbsolutePath)ofd.FileName;
return default;
}
}
}