Skip to content

Commit

Permalink
Merge branch 'avalonia'
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzzerd committed Sep 11, 2023
2 parents 5a535f0 + f440f1e commit 89ca240
Show file tree
Hide file tree
Showing 35 changed files with 738 additions and 938 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish-Release-To-Artifacts

on:
release:
types: [published]

jobs:
release:
name: Release
strategy:
matrix:
kind: ['linux', 'windows', 'macOS']
include:
- kind: linux
os: ubuntu-latest
target: linux-x64
- kind: windows
os: windows-latest
target: win-x64
- kind: macOS
os: macos-latest
target: osx-x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Setup dotnet
uses: actions/[email protected]

- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
release_name="SharpFM.App-$tag-${{ matrix.target }}"
# Build everything
dotnet publish SharpFM.App/SharpFM.App.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name"
# Pack files
if [ "${{ matrix.target }}" == "win-x64" ]; then
# Pack to zip for Windows
7z a -tzip "${release_name}.zip" "./${release_name}/*"
else
tar czvf "${release_name}.tar.gz" "$release_name"
fi
# Delete output directory
rm -r "$release_name"
- name: Publish
uses: softprops/action-gh-release@v1
with:
files: "SharpFM.App*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"configurations": [
{
"name": "C#: SharpFM.App",
"type": "dotnet",
"request": "launch",
"projectPath": "${workspaceFolder}\\SharpFM.App\\SharpFM.App.csproj",
"launchConfigurationId": "TargetFramework=;SharpFM.App"
}
]
}
33 changes: 33 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#fa1b49",
"activityBar.background": "#fa1b49",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#155e02",
"activityBarBadge.foreground": "#e7e7e7",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#fa1b49",
"statusBar.background": "#dd0531",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#fa1b49",
"statusBarItem.remoteBackground": "#dd0531",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#dd0531",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#dd053199",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#dd0531",
"cSpell.words": [
"Avalonia",
"filemaker",
"fmxmlsnippet",
"Mvvm",
"xdoc",
"XMFD",
"XMSC",
"XMSS",
"XMTB"
]
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/SharpFM.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/SharpFM.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/SharpFM.sln"
],
"problemMatcher": "$msCompile"
}
]
}
11 changes: 11 additions & 0 deletions SharpFM.App/App.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="SharpFM.App.App"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->

<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />
</Application.Styles>
</Application>
27 changes: 27 additions & 0 deletions SharpFM.App/App.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using SharpFM.App.ViewModels;

namespace SharpFM.App;

public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}

public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow
{
DataContext = new MainWindowViewModel()
};
}

base.OnFrameworkInitializationCompleted();
}
}
7 changes: 0 additions & 7 deletions SharpFM.App/App.xaml

This file was deleted.

90 changes: 0 additions & 90 deletions SharpFM.App/App.xaml.cs

This file was deleted.

Binary file removed SharpFM.App/Assets/LockScreenLogo.scale-200.png
Binary file not shown.
Binary file removed SharpFM.App/Assets/SplashScreen.scale-200.png
Binary file not shown.
Binary file removed SharpFM.App/Assets/Square150x150Logo.scale-200.png
Binary file not shown.
Binary file removed SharpFM.App/Assets/Square44x44Logo.scale-200.png
Binary file not shown.
Binary file not shown.
Binary file removed SharpFM.App/Assets/StoreLogo.png
Binary file not shown.
Binary file removed SharpFM.App/Assets/Wide310x150Logo.scale-200.png
Binary file not shown.
64 changes: 64 additions & 0 deletions SharpFM.App/DocumentTextBindingBehavior.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System;
using Avalonia;
using Avalonia.Xaml.Interactivity;
using AvaloniaEdit;
using AvaloniaEdit.Utils;

namespace SharpFM.App.Behaviors;

public class DocumentTextBindingBehavior : Behavior<TextEditor>
{
private TextEditor _textEditor = null!;

public static readonly StyledProperty<string> TextProperty =
AvaloniaProperty.Register<DocumentTextBindingBehavior, string>(nameof(Text));

public string Text
{
get => GetValue(TextProperty);
set => SetValue(TextProperty, value);
}

protected override void OnAttached()
{
base.OnAttached();

if (AssociatedObject is TextEditor textEditor)
{
_textEditor = textEditor;
_textEditor.TextChanged += TextChanged;
this.GetObservable(TextProperty).Subscribe(TextPropertyChanged);
}
}

protected override void OnDetaching()
{
base.OnDetaching();

if (_textEditor != null)
{
_textEditor.TextChanged -= TextChanged;
}
}

private void TextChanged(object? sender, EventArgs eventArgs)
{
if (_textEditor != null && _textEditor.Document != null)
{
Text = _textEditor.Document.Text;
}
}

private void TextPropertyChanged(string text)
{
if (_textEditor != null && _textEditor.Document != null && text != null)
{
var caretOffset = _textEditor.CaretOffset;
_textEditor.Document.Text = text;
if (caretOffset <= text.Length)
{
_textEditor.CaretOffset = caretOffset;
}
}
}
}
18 changes: 0 additions & 18 deletions SharpFM.App/LayoutClipPicker.xaml

This file was deleted.

Loading

0 comments on commit 89ca240

Please sign in to comment.