avalonia:forgot what i did

This commit is contained in:
Royce551 2021-04-25 22:39:03 -05:00
parent a5fb6f5ef5
commit 2a1ba9c384
13 changed files with 79 additions and 40 deletions

View file

@ -1,7 +1,7 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:FRESHMusicPlayer_Avalonia"
x:Class="FRESHMusicPlayer_Avalonia.App">
xmlns:local="using:FRESHMusicPlayer"
x:Class="FRESHMusicPlayer.App">
<Application.DataTemplates>
<local:ViewLocator/>
</Application.DataTemplates>

View file

@ -1,10 +1,10 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using FRESHMusicPlayer_Avalonia.ViewModels;
using FRESHMusicPlayer_Avalonia.Views;
using FRESHMusicPlayer.ViewModels;
using FRESHMusicPlayer.Views;
namespace FRESHMusicPlayer_Avalonia
namespace FRESHMusicPlayer
{
public class App : Application
{

View file

@ -4,7 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
<ApplicationIcon>icon.ico</ApplicationIcon>
<RootNamespace>FRESHMusicPlayer_Avalonia</RootNamespace>
<RootNamespace>FRESHMusicPlayer</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\" />

View file

@ -1,6 +1,7 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.ReactiveUI;
using FRESHMusicPlayer;
using System;
namespace FRESHMusicPlayer_Avalonia

View file

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace FRESHMusicPlayer.Utilities
{
public class InterfaceUtils
{
public static void OpenURL(string url)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Process.Start(new ProcessStartInfo
{
FileName = url,
UseShellExecute = true
});
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Process.Start("xdg-open", url);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Process.Start("open", url);
}
}
}
}

View file

@ -1,9 +1,9 @@
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using FRESHMusicPlayer_Avalonia.ViewModels;
using FRESHMusicPlayer.ViewModels;
using System;
namespace FRESHMusicPlayer_Avalonia
namespace FRESHMusicPlayer
{
public class ViewLocator : IDataTemplate
{

View file

@ -1,25 +1,21 @@
using ATL;
using FRESHMusicPlayer;
using ATL.Playlist;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Media.Imaging;
using FRESHMusicPlayer.Handlers;
using LiteDB;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Text;
using ReactiveUI;
using Avalonia.Media.Imaging;
using System.IO;
using System.Timers;
using LiteDB;
using FRESHMusicPlayer.Handlers;
using FRESHMusicPlayer_Avalonia.Views;
using System.Collections.ObjectModel;
using System.Reactive;
using System.Linq;
using System.Diagnostics;
using Avalonia.Controls;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Avalonia.Controls.ApplicationLifetimes;
using ATL.Playlist;
using System.Timers;
namespace FRESHMusicPlayer_Avalonia.ViewModels
namespace FRESHMusicPlayer.ViewModels
{
public class MainWindowViewModel : ViewModelBase
{

View file

@ -1,12 +1,17 @@
using System;
using FRESHMusicPlayer.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FRESHMusicPlayer_Avalonia.ViewModels
namespace FRESHMusicPlayer.ViewModels
{
public class SettingsViewModel : ViewModelBase
{
public void ReportIssueCommand() => InterfaceUtils.OpenURL(@"https://github.com/Royce551/FRESHMusicPlayer/issues/new");
public void ViewSourceCodeCommand() => InterfaceUtils.OpenURL(@"https://github.com/Royce551/FRESHMusicPlayer");
public void ViewLicenseCommand() => InterfaceUtils.OpenURL(@"https://choosealicense.com/licenses/gpl-3.0/");
public void ViewWebsiteCommand() => InterfaceUtils.OpenURL(@"https://royce551.github.io/FRESHMusicPlayer");
}
}

View file

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Text;
namespace FRESHMusicPlayer_Avalonia.ViewModels
namespace FRESHMusicPlayer.ViewModels
{
public class ViewModelBase : ReactiveObject
{

View file

@ -1,12 +1,12 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:FRESHMusicPlayer_Avalonia.ViewModels"
xmlns:vm="using:FRESHMusicPlayer.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:svg="clr-namespace:Avalonia.Svg.Skia;assembly=Avalonia.Svg.Skia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
Width="800" Height="540"
x:Class="FRESHMusicPlayer_Avalonia.Views.MainWindow"
x:Class="FRESHMusicPlayer.Views.MainWindow"
Icon="/Assets/icon.ico"
Title="{Binding WindowTitle}"
>

View file

@ -1,13 +1,11 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using FRESHMusicPlayer.Handlers;
using FRESHMusicPlayer_Avalonia.ViewModels;
using FRESHMusicPlayer.ViewModels;
namespace FRESHMusicPlayer_Avalonia.Views
namespace FRESHMusicPlayer.Views
{
public class MainWindow : Window
{

View file

@ -1,11 +1,17 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="using:FRESHMusicPlayer.ViewModels"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Width="600" Height="400"
x:Class="FRESHMusicPlayer_Avalonia.Views.Settings"
x:Class="FRESHMusicPlayer.Views.Settings"
Title="FRESHMusicPlayer Settings">
<Window.DataContext>
<vm:SettingsViewModel/>
</Window.DataContext>
<TabControl TabStripPlacement="Left" SelectedIndex="3">
<TabItem Header="General">
<StackPanel Margin="10">
@ -40,18 +46,18 @@
</TabItem>
<TabItem Header="About FMP">
<StackPanel Margin="10">
<Image Source="/Assets/fmplogofull.png" Stretch="UniformToFill" Margin="0,0,0,20"/>
<StackPanel Margin="10" HorizontalAlignment="Stretch">
<Image Source="/Assets/fmplogofull.png" Stretch="UniformToFill" Width="300" HorizontalAlignment="Left" Margin="0,0,0,20"/>
<TextBlock Text="FRESHMusicPlayer (for Mac and Linux) Ver. 69420"/>
<TextBlock Text="by Squid Grill (and open source contributors)"/>
<TextBlock Text="Licensed under the GPL v3 license" Margin="0,0,0,20"/>
<TextBlock Text="Thank you for using FRESHMusicPlayer! ❤" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,0,0,20"/>
<Button Content="Report an issue"/>
<Button Content="View source code"/>
<Button Content="View license"/>
<Button Content="FMP on the interwebs"/>
<Button Content="Report an issue" Command="{Binding ReportIssueCommand}"/>
<Button Content="View source code" Command="{Binding ViewSourceCodeCommand}"/>
<Button Content="View license" Command="{Binding ViewLicenseCommand}"/>
<Button Content="FMP on the interwebs" Command="{Binding ViewWebsiteCommand}"/>
</StackPanel>
</TabItem>
</TabControl>

View file

@ -2,7 +2,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace FRESHMusicPlayer_Avalonia.Views
namespace FRESHMusicPlayer.Views
{
public class Settings : Window
{