Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CVRMelonAssistant/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<!-- Load Styles needed for the Theme engine to work. -->
<ResourceDictionary x:Name="Button_Style" Source="Styles/Button.xaml" />
<ResourceDictionary x:Name="ContextMenu_Style" Source="Styles/ContextMenu.xaml" />
<ResourceDictionary x:Name="Label_Style" Source="Styles/Label.xaml" />
<ResourceDictionary x:Name="TextBlock_Style" Source="Styles/TextBlock.xaml" />
<ResourceDictionary x:Name="GridViewColumnHeader_Style" Source="Styles/GridViewColumnHeader.xaml" />
Expand Down
14 changes: 14 additions & 0 deletions CVRMelonAssistant/CVRMelonAssistant.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,19 @@
<Compile Include="Classes\Updater.cs" />
<Compile Include="Libs\semver\SemVersion.cs" />
<Compile Include="Libs\semver\IntExtensions.cs" />
<Compile Include="Localisation\en.xaml.cs">
<DependentUpon>en.xaml</DependentUpon>
</Compile>
<Compile Include="ModInfoWindow.xaml.cs">
<DependentUpon>ModInfoWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Intro.xaml.cs">
<DependentUpon>Intro.xaml</DependentUpon>
</Compile>
<Compile Include="Classes\Mod.cs" />
<Compile Include="Resources\ContextMenusDictionary.xaml.cs">
<DependentUpon>ContextMenusDictionary.xaml</DependentUpon>
</Compile>
<Page Include="Localisation\en-DEBUG.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -182,6 +188,10 @@
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resources\AppResources.xaml" />
<Page Include="Resources\ContextMenusDictionary.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resources\Icons.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -202,6 +212,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\ContextMenu.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Styles\GridViewColumnHeader.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
18 changes: 18 additions & 0 deletions CVRMelonAssistant/Classes/HyperlinkExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Input;
using CVRMelonAssistant.Resources;

namespace CVRMelonAssistant
{
Expand Down Expand Up @@ -45,5 +48,20 @@ public static void NoAwait(this Task task)
}
});
}

public static Hyperlink Create(string uri)
{
var link = new Hyperlink(new Run(uri)) { NavigateUri = new Uri(uri) };
link.RequestNavigate += Hyperlink_RequestNavigate;
link.MouseRightButtonUp += Hyperlink_RightClick;
return link;
}

public static void Hyperlink_RightClick(object sender, MouseButtonEventArgs e)
{
var cm = ContextMenusDictionary.Instance.HyperlinkContextMenu;
cm.DataContext = sender;
cm.IsOpen = true;
}
}
}
5 changes: 3 additions & 2 deletions CVRMelonAssistant/Localisation/en.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<ResourceDictionary
x:Class="CVRMelonAssistant.Localisation.en"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CVRMelonAssistant"
Expand Down Expand Up @@ -72,7 +73,7 @@
</Span>
<Span x:Key="Intro:WikiGuide">
Feel free to join the
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://discord.gg/xE7AwSrn">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://discord.gg/xE7AwSrn" MouseRightButtonUp="Hyperlink_RightClick">
ChilloutVR Modding Group discord
</Hyperlink> for more info, help, and support.
</Span>
Expand Down Expand Up @@ -120,7 +121,7 @@
<sys:String x:Key="About:List:Header">ChilloutVR Melon Assistant is a fork of Assistant's Mod Assistant for Beat Saber.</sys:String>
<Span x:Key="About:SupportAssistant">
Visit
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://github.com/Assistant/ModAssistant">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://github.com/Assistant/ModAssistant" MouseRightButtonUp="Hyperlink_RightClick">
Mod Assistant GitHub repo
</Hyperlink>
to appreciate their hard work and/or throw some money at them!
Expand Down
14 changes: 14 additions & 0 deletions CVRMelonAssistant/Localisation/en.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace CVRMelonAssistant.Localisation {
public partial class en {
private void Hyperlink_RightClick(object sender, MouseButtonEventArgs e) {
HyperlinkExtensions.Hyperlink_RightClick(sender, e);
}
}
}
11 changes: 2 additions & 9 deletions CVRMelonAssistant/ModInfoWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,20 @@ public void SetMod(Mod mod)
DownloadLink.Text = (string) FindResource("ModInfoWindow:DownloadLink");
DownloadLink.Inlines.Add(new Run(" "));
if (dlLink?.StartsWith("http") == true)
DownloadLink.Inlines.Add(CreateHyperlink(dlLink));
DownloadLink.Inlines.Add(HyperlinkExtensions.Create(dlLink));
else
DownloadLink.Inlines.Add(new Run(dlLink));

var srcLink = mod.versions[0].sourceLink;
SourceCodeLink.Text = (string) FindResource("ModInfoWindow:SourceCodeLink");
SourceCodeLink.Inlines.Add(new Run(" "));
if (srcLink?.StartsWith("http") == true)
SourceCodeLink.Inlines.Add(CreateHyperlink(srcLink));
SourceCodeLink.Inlines.Add(HyperlinkExtensions.Create(srcLink));
else
SourceCodeLink.Inlines.Add(new Run(srcLink));

InternalIds.Text = string.Format((string) FindResource("ModInfoWindow:InternalIds"), mod._id, mod.versions[0]._version);
}

private static Hyperlink CreateHyperlink(string uri)
{
var link = new Hyperlink(new Run(uri)) {NavigateUri = new Uri(uri)};
link.RequestNavigate += HyperlinkExtensions.Hyperlink_RequestNavigate;
return link;
}
}
}

24 changes: 12 additions & 12 deletions CVRMelonAssistant/Pages/About.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
VerticalAlignment="Center"
FontSize="20"
FontWeight="Bold">
<Hyperlink NavigateUri="https://github.com/Assistant/" RequestNavigate="Hyperlink_RequestNavigate">
<Hyperlink NavigateUri="https://github.com/Assistant/" RequestNavigate="Hyperlink_RequestNavigate" MouseRightButtonUp="Hyperlink_RightClick">
Assistant
</Hyperlink>
</TextBlock>
Expand All @@ -88,7 +88,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://ko-fi.com/N4N8JX7B">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://ko-fi.com/N4N8JX7B" MouseRightButtonUp="Hyperlink_RightClick">
<Run Text="{DynamicResource About:Donate}" />
</Hyperlink>
</TextBlock>
Expand All @@ -100,7 +100,7 @@
VerticalAlignment="Center"
FontSize="20"
FontWeight="Bold">
<Hyperlink NavigateUri="https://umbranox.carrd.co/" RequestNavigate="Hyperlink_RequestNavigate">
<Hyperlink NavigateUri="https://umbranox.carrd.co/" RequestNavigate="Hyperlink_RequestNavigate" MouseRightButtonUp="Hyperlink_RightClick">
Umbranox
</Hyperlink>
</TextBlock>
Expand All @@ -120,7 +120,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/scoresaber">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.patreon.com/scoresaber" MouseRightButtonUp="Hyperlink_RightClick">
<Run Text="{DynamicResource About:Donate}" />
</Hyperlink>
</TextBlock>
Expand All @@ -132,7 +132,7 @@
VerticalAlignment="Center"
FontSize="20"
FontWeight="Bold">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.jackbaron.com/">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.jackbaron.com/" MouseRightButtonUp="Hyperlink_RightClick">
lolPants
</Hyperlink>
</TextBlock>
Expand All @@ -158,7 +158,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16">
<Hyperlink NavigateUri="https://www.paypal.me/jackbarondev" RequestNavigate="Hyperlink_RequestNavigate">
<Hyperlink NavigateUri="https://www.paypal.me/jackbarondev" RequestNavigate="Hyperlink_RequestNavigate" MouseRightButtonUp="Hyperlink_RightClick">
<Run Text="{DynamicResource About:Donate}" />
</Hyperlink>
</TextBlock>
Expand All @@ -170,7 +170,7 @@
VerticalAlignment="Center"
FontSize="20"
FontWeight="Bold">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.github.com/Caeden117">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://www.github.com/Caeden117" MouseRightButtonUp="Hyperlink_RightClick">
Caeden117
</Hyperlink>
</TextBlock>
Expand All @@ -184,7 +184,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16">
<Hyperlink NavigateUri="https://ko-fi.com/Caeden117" RequestNavigate="Hyperlink_RequestNavigate">
<Hyperlink NavigateUri="https://ko-fi.com/Caeden117" RequestNavigate="Hyperlink_RequestNavigate" MouseRightButtonUp="Hyperlink_RightClick">
<Run Text="{DynamicResource About:Donate}" />
</Hyperlink>
</TextBlock>
Expand All @@ -196,7 +196,7 @@
VerticalAlignment="Center"
FontSize="20"
FontWeight="Bold">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://twitter.com/moarinterz">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://twitter.com/moarinterz" MouseRightButtonUp="Hyperlink_RightClick">
Interz
</Hyperlink>
</TextBlock>
Expand All @@ -210,7 +210,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16">
<Hyperlink NavigateUri="https://streamlabs.com/lnterz/tip" RequestNavigate="Hyperlink_RequestNavigate">
<Hyperlink NavigateUri="https://streamlabs.com/lnterz/tip" RequestNavigate="Hyperlink_RequestNavigate" MouseRightButtonUp="Hyperlink_RightClick">
<Run Text="{DynamicResource About:Donate}" />
</Hyperlink>
</TextBlock>
Expand All @@ -222,7 +222,7 @@
VerticalAlignment="Center"
FontSize="20"
FontWeight="Bold">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://github.com/megalon">
<Hyperlink local:HyperlinkExtensions.IsExternal="True" NavigateUri="https://github.com/megalon" MouseRightButtonUp="Hyperlink_RightClick">
Megalon2D
</Hyperlink>
</TextBlock>
Expand All @@ -242,7 +242,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16">
<Hyperlink NavigateUri="https://ko-fi.com/megalon" RequestNavigate="Hyperlink_RequestNavigate">
<Hyperlink NavigateUri="https://ko-fi.com/megalon" RequestNavigate="Hyperlink_RequestNavigate" MouseRightButtonUp="Hyperlink_RightClick">
<Run Text="{DynamicResource About:Donate}" />
</Hyperlink>
</TextBlock>
Expand Down
5 changes: 5 additions & 0 deletions CVRMelonAssistant/Pages/About.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Navigation;
using static CVRMelonAssistant.Http;

Expand All @@ -26,6 +27,10 @@ private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e
e.Handled = true;
}

public void Hyperlink_RightClick(object sender, MouseButtonEventArgs e) {
HyperlinkExtensions.Hyperlink_RightClick(sender, e);
}

private async void HeadpatsButton_Click(object sender, RoutedEventArgs e)
{
PatButton.IsEnabled = false;
Expand Down
2 changes: 1 addition & 1 deletion CVRMelonAssistant/Pages/Mods.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="{Binding PromotionMargin}" Visibility="{Binding PromotionVisibility}">
<Hyperlink NavigateUri="{Binding PromotionLink, TargetNullValue=about:blank}" RequestNavigate="Hyperlink_RequestNavigate">
<Hyperlink NavigateUri="{Binding PromotionLink, TargetNullValue=about:blank}" RequestNavigate="Hyperlink_RequestNavigate" MouseRightButtonUp="Hyperlink_RightClick">
<Run Text="{Binding PromotionText}" />
</Hyperlink>
</TextBlock>
Expand Down
4 changes: 4 additions & 0 deletions CVRMelonAssistant/Pages/Mods.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@ private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e
e.Handled = true;
}

public void Hyperlink_RightClick(object sender, MouseButtonEventArgs e) {
HyperlinkExtensions.Hyperlink_RightClick(sender, e);
}

private void Page_Loaded(object sender, RoutedEventArgs e)
{
RefreshColumns();
Expand Down
8 changes: 8 additions & 0 deletions CVRMelonAssistant/Resources/ContextMenusDictionary.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<ResourceDictionary x:Class="CVRMelonAssistant.Resources.ContextMenusDictionary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ContextMenu x:Key="cmHyperlink">
<MenuItem Header="Open" Click="HyperLinkContextMenu_Open"/>
<MenuItem Header="Copy" Click="HyperLinkContextMenu_Copy"/>
</ContextMenu>
</ResourceDictionary>
41 changes: 41 additions & 0 deletions CVRMelonAssistant/Resources/ContextMenusDictionary.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;

namespace CVRMelonAssistant.Resources {
public partial class ContextMenusDictionary {
static ContextMenusDictionary _instance = null;
ContextMenu _hyperlinkContextMenu;

public ContextMenu HyperlinkContextMenu => _hyperlinkContextMenu;

public static ContextMenusDictionary Instance {
get {
if(_instance is null)
_instance = new ContextMenusDictionary();
return _instance;
}
}

public ContextMenusDictionary() {
InitializeComponent();
_hyperlinkContextMenu = this["cmHyperlink"] as ContextMenu;
}
private void HyperLinkContextMenu_Open(object sender, RoutedEventArgs e) {
var menuItem = sender as MenuItem;
var link = menuItem.DataContext as Hyperlink;
link.DoClick();
}

private void HyperLinkContextMenu_Copy(object sender, RoutedEventArgs e) {
var menuItem = sender as MenuItem;
var link = menuItem.DataContext as Hyperlink;
Clipboard.SetText(link.NavigateUri.ToString());
}
}
}
19 changes: 19 additions & 0 deletions CVRMelonAssistant/Styles/ContextMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type ContextMenu}">
<Setter Property="Background" Value="{DynamicResource ButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ComboBoxOutline}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource ButtonBackground}" />
<Setter Property="Padding" Value="4,1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContextMenu}">
<Border x:Name="Border" Background="{DynamicResource ButtonBackground}" BorderThickness="1">
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
2 changes: 1 addition & 1 deletion CVRMelonAssistant/Styles/MenuItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ControlTemplate TargetType="{x:Type MenuItem}">
<Border
x:Name="templateRoot"
BorderBrush="{DynamicResource ButtonOutline}"
BorderBrush="Transparent"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="4"
Background="{TemplateBinding Background}"
Expand Down