Skip to content

Commit 89ca240

Browse files
committed
Merge branch 'avalonia'
2 parents 5a535f0 + f440f1e commit 89ca240

35 files changed

+738
-938
lines changed
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish-Release-To-Artifacts
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release:
9+
name: Release
10+
strategy:
11+
matrix:
12+
kind: ['linux', 'windows', 'macOS']
13+
include:
14+
- kind: linux
15+
os: ubuntu-latest
16+
target: linux-x64
17+
- kind: windows
18+
os: windows-latest
19+
target: win-x64
20+
- kind: macOS
21+
os: macos-latest
22+
target: osx-x64
23+
runs-on: ${{ matrix.os }}
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v1
27+
28+
- name: Setup dotnet
29+
uses: actions/[email protected]
30+
31+
- name: Build
32+
shell: bash
33+
run: |
34+
tag=$(git describe --tags --abbrev=0)
35+
release_name="SharpFM.App-$tag-${{ matrix.target }}"
36+
37+
# Build everything
38+
dotnet publish SharpFM.App/SharpFM.App.csproj --runtime "${{ matrix.target }}" -c Release -o "$release_name"
39+
40+
# Pack files
41+
if [ "${{ matrix.target }}" == "win-x64" ]; then
42+
# Pack to zip for Windows
43+
7z a -tzip "${release_name}.zip" "./${release_name}/*"
44+
else
45+
tar czvf "${release_name}.tar.gz" "$release_name"
46+
fi
47+
48+
# Delete output directory
49+
rm -r "$release_name"
50+
51+
- name: Publish
52+
uses: softprops/action-gh-release@v1
53+
with:
54+
files: "SharpFM.App*"
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.vscode/launch.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "C#: SharpFM.App",
5+
"type": "dotnet",
6+
"request": "launch",
7+
"projectPath": "${workspaceFolder}\\SharpFM.App\\SharpFM.App.csproj",
8+
"launchConfigurationId": "TargetFramework=;SharpFM.App"
9+
}
10+
]
11+
}

.vscode/settings.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"workbench.colorCustomizations": {
3+
"activityBar.activeBackground": "#fa1b49",
4+
"activityBar.background": "#fa1b49",
5+
"activityBar.foreground": "#e7e7e7",
6+
"activityBar.inactiveForeground": "#e7e7e799",
7+
"activityBarBadge.background": "#155e02",
8+
"activityBarBadge.foreground": "#e7e7e7",
9+
"commandCenter.border": "#e7e7e799",
10+
"sash.hoverBorder": "#fa1b49",
11+
"statusBar.background": "#dd0531",
12+
"statusBar.foreground": "#e7e7e7",
13+
"statusBarItem.hoverBackground": "#fa1b49",
14+
"statusBarItem.remoteBackground": "#dd0531",
15+
"statusBarItem.remoteForeground": "#e7e7e7",
16+
"titleBar.activeBackground": "#dd0531",
17+
"titleBar.activeForeground": "#e7e7e7",
18+
"titleBar.inactiveBackground": "#dd053199",
19+
"titleBar.inactiveForeground": "#e7e7e799"
20+
},
21+
"peacock.color": "#dd0531",
22+
"cSpell.words": [
23+
"Avalonia",
24+
"filemaker",
25+
"fmxmlsnippet",
26+
"Mvvm",
27+
"xdoc",
28+
"XMFD",
29+
"XMSC",
30+
"XMSS",
31+
"XMTB"
32+
]
33+
}

.vscode/tasks.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/SharpFM.sln",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/SharpFM.sln",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"--project",
36+
"${workspaceFolder}/SharpFM.sln"
37+
],
38+
"problemMatcher": "$msCompile"
39+
}
40+
]
41+
}

SharpFM.App/App.axaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Application xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
x:Class="SharpFM.App.App"
4+
RequestedThemeVariant="Default">
5+
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
6+
7+
<Application.Styles>
8+
<FluentTheme />
9+
<StyleInclude Source="avares://AvaloniaEdit/Themes/Fluent/AvaloniaEdit.xaml" />
10+
</Application.Styles>
11+
</Application>

SharpFM.App/App.axaml.cs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Avalonia;
2+
using Avalonia.Controls.ApplicationLifetimes;
3+
using Avalonia.Markup.Xaml;
4+
using SharpFM.App.ViewModels;
5+
6+
namespace SharpFM.App;
7+
8+
public partial class App : Application
9+
{
10+
public override void Initialize()
11+
{
12+
AvaloniaXamlLoader.Load(this);
13+
}
14+
15+
public override void OnFrameworkInitializationCompleted()
16+
{
17+
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
18+
{
19+
desktop.MainWindow = new MainWindow
20+
{
21+
DataContext = new MainWindowViewModel()
22+
};
23+
}
24+
25+
base.OnFrameworkInitializationCompleted();
26+
}
27+
}

SharpFM.App/App.xaml

-7
This file was deleted.

SharpFM.App/App.xaml.cs

-90
This file was deleted.
-1.4 KB
Binary file not shown.
-7.52 KB
Binary file not shown.
Binary file not shown.
-1.61 KB
Binary file not shown.
Binary file not shown.

SharpFM.App/Assets/StoreLogo.png

-1.42 KB
Binary file not shown.
-3.13 KB
Binary file not shown.
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using System;
2+
using Avalonia;
3+
using Avalonia.Xaml.Interactivity;
4+
using AvaloniaEdit;
5+
using AvaloniaEdit.Utils;
6+
7+
namespace SharpFM.App.Behaviors;
8+
9+
public class DocumentTextBindingBehavior : Behavior<TextEditor>
10+
{
11+
private TextEditor _textEditor = null!;
12+
13+
public static readonly StyledProperty<string> TextProperty =
14+
AvaloniaProperty.Register<DocumentTextBindingBehavior, string>(nameof(Text));
15+
16+
public string Text
17+
{
18+
get => GetValue(TextProperty);
19+
set => SetValue(TextProperty, value);
20+
}
21+
22+
protected override void OnAttached()
23+
{
24+
base.OnAttached();
25+
26+
if (AssociatedObject is TextEditor textEditor)
27+
{
28+
_textEditor = textEditor;
29+
_textEditor.TextChanged += TextChanged;
30+
this.GetObservable(TextProperty).Subscribe(TextPropertyChanged);
31+
}
32+
}
33+
34+
protected override void OnDetaching()
35+
{
36+
base.OnDetaching();
37+
38+
if (_textEditor != null)
39+
{
40+
_textEditor.TextChanged -= TextChanged;
41+
}
42+
}
43+
44+
private void TextChanged(object? sender, EventArgs eventArgs)
45+
{
46+
if (_textEditor != null && _textEditor.Document != null)
47+
{
48+
Text = _textEditor.Document.Text;
49+
}
50+
}
51+
52+
private void TextPropertyChanged(string text)
53+
{
54+
if (_textEditor != null && _textEditor.Document != null && text != null)
55+
{
56+
var caretOffset = _textEditor.CaretOffset;
57+
_textEditor.Document.Text = text;
58+
if (caretOffset <= text.Length)
59+
{
60+
_textEditor.CaretOffset = caretOffset;
61+
}
62+
}
63+
}
64+
}

SharpFM.App/LayoutClipPicker.xaml

-18
This file was deleted.

0 commit comments

Comments
 (0)