diff --git a/.vscode/launch.json b/.vscode/launch.json
index 164becc8..860d13bc 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -63,6 +63,13 @@
"order": 1
}
+ },
+ {
+ "name": "PostIt",
+ "type": "dotnet",
+ "request": "launch",
+ "projectPath": "${workspaceFolder}/src/PostIt/PostIt.Desktop/PostIt.Desktop.csproj",
+
}
]
}
diff --git a/Directory.Packages.props b/Directory.Packages.props
index d5911bb0..75b895be 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -41,7 +41,6 @@
-
@@ -70,4 +69,4 @@
-
\ No newline at end of file
+
diff --git a/src/PostIt/App.axaml.cs b/src/PostIt/App.axaml.cs
deleted file mode 100644
index b75a7f30..00000000
--- a/src/PostIt/App.axaml.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Avalonia;
-using Avalonia.Controls.ApplicationLifetimes;
-using Avalonia.Markup.Xaml;
-
-namespace PostIt;
-
-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();
- }
-
- base.OnFrameworkInitializationCompleted();
- }
-}
\ No newline at end of file
diff --git a/src/PostIt/Directory.Packages.props b/src/PostIt/Directory.Packages.props
new file mode 100644
index 00000000..0db241e6
--- /dev/null
+++ b/src/PostIt/Directory.Packages.props
@@ -0,0 +1,23 @@
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PostIt/MainWindow.axaml b/src/PostIt/MainWindow.axaml
deleted file mode 100644
index e4c0f9ff..00000000
--- a/src/PostIt/MainWindow.axaml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/PostIt/PostIt.Android/Application.cs b/src/PostIt/PostIt.Android/Application.cs
new file mode 100644
index 00000000..fb6b08d3
--- /dev/null
+++ b/src/PostIt/PostIt.Android/Application.cs
@@ -0,0 +1,21 @@
+using Android.App;
+using Android.Runtime;
+using Avalonia;
+using Avalonia.Android;
+
+namespace PostIt.Android
+{
+ [Application]
+ public class Application : AvaloniaAndroidApplication
+ {
+ protected Application(nint javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
+ {
+ }
+
+ protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
+ {
+ return base.CustomizeAppBuilder(builder)
+ .WithInterFont();
+ }
+ }
+}
diff --git a/src/PostIt/PostIt.Android/Icon.png b/src/PostIt/PostIt.Android/Icon.png
new file mode 100644
index 00000000..3c398459
Binary files /dev/null and b/src/PostIt/PostIt.Android/Icon.png differ
diff --git a/src/PostIt/PostIt.Android/MainActivity.cs b/src/PostIt/PostIt.Android/MainActivity.cs
new file mode 100644
index 00000000..1c70a76b
--- /dev/null
+++ b/src/PostIt/PostIt.Android/MainActivity.cs
@@ -0,0 +1,16 @@
+using Android.App;
+using Android.Content.PM;
+using Avalonia;
+using Avalonia.Android;
+
+namespace PostIt.Android;
+
+[Activity(
+ Label = "PostIt.Android",
+ Theme = "@style/MyTheme.NoActionBar",
+ Icon = "@drawable/icon",
+ MainLauncher = true,
+ ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
+public class MainActivity : AvaloniaMainActivity
+{
+}
diff --git a/src/PostIt/PostIt.Android/PostIt.Android.csproj b/src/PostIt/PostIt.Android/PostIt.Android.csproj
new file mode 100644
index 00000000..b50719ed
--- /dev/null
+++ b/src/PostIt/PostIt.Android/PostIt.Android.csproj
@@ -0,0 +1,25 @@
+
+
+ Exe
+ net10.0-android
+ 23
+ enable
+ com.CompanyName.PostIt
+ 1
+ 1.0
+ apk
+ false
+
+
+
+ Resources\drawable\Icon.png
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml b/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml
new file mode 100644
index 00000000..1fd40cab
--- /dev/null
+++ b/src/PostIt/PostIt.Android/Properties/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/PostIt/PostIt.Android/Resources/AboutResources.txt b/src/PostIt/PostIt.Android/Resources/AboutResources.txt
new file mode 100644
index 00000000..c2bca974
--- /dev/null
+++ b/src/PostIt/PostIt.Android/Resources/AboutResources.txt
@@ -0,0 +1,44 @@
+Images, layout descriptions, binary blobs and string dictionaries can be included
+in your application as resource files. Various Android APIs are designed to
+operate on the resource IDs instead of dealing with images, strings or binary blobs
+directly.
+
+For example, a sample Android app that contains a user interface layout (main.axml),
+an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
+would keep its resources in the "Resources" directory of the application:
+
+Resources/
+ drawable/
+ icon.png
+
+ layout/
+ main.axml
+
+ values/
+ strings.xml
+
+In order to get the build system to recognize Android resources, set the build action to
+"AndroidResource". The native Android APIs do not operate directly with filenames, but
+instead operate on resource IDs. When you compile an Android application that uses resources,
+the build system will package the resources for distribution and generate a class called "R"
+(this is an Android convention) that contains the tokens for each one of the resources
+included. For example, for the above Resources layout, this is what the R class would expose:
+
+public class R {
+ public class drawable {
+ public const int icon = 0x123;
+ }
+
+ public class layout {
+ public const int main = 0x456;
+ }
+
+ public class strings {
+ public const int first_string = 0xabc;
+ public const int second_string = 0xbcd;
+ }
+}
+
+You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
+to reference the layout/main.axml file, or R.strings.first_string to reference the first
+string in the dictionary file values/strings.xml.
\ No newline at end of file
diff --git a/src/PostIt/PostIt.Android/Resources/drawable-night-v31/avalonia_anim.xml b/src/PostIt/PostIt.Android/Resources/drawable-night-v31/avalonia_anim.xml
new file mode 100644
index 00000000..dde4b5a7
--- /dev/null
+++ b/src/PostIt/PostIt.Android/Resources/drawable-night-v31/avalonia_anim.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt.Android/Resources/drawable-v31/avalonia_anim.xml b/src/PostIt/PostIt.Android/Resources/drawable-v31/avalonia_anim.xml
new file mode 100644
index 00000000..94f27d9e
--- /dev/null
+++ b/src/PostIt/PostIt.Android/Resources/drawable-v31/avalonia_anim.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt.Android/Resources/drawable/splash_screen.xml b/src/PostIt/PostIt.Android/Resources/drawable/splash_screen.xml
new file mode 100644
index 00000000..2e920b4b
--- /dev/null
+++ b/src/PostIt/PostIt.Android/Resources/drawable/splash_screen.xml
@@ -0,0 +1,13 @@
+
+
+
+ -
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt.Android/Resources/values-night/colors.xml b/src/PostIt/PostIt.Android/Resources/values-night/colors.xml
new file mode 100644
index 00000000..3d47b6fc
--- /dev/null
+++ b/src/PostIt/PostIt.Android/Resources/values-night/colors.xml
@@ -0,0 +1,4 @@
+
+
+ #212121
+
diff --git a/src/PostIt/PostIt.Android/Resources/values-v31/styles.xml b/src/PostIt/PostIt.Android/Resources/values-v31/styles.xml
new file mode 100644
index 00000000..d5ecec43
--- /dev/null
+++ b/src/PostIt/PostIt.Android/Resources/values-v31/styles.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt.Android/Resources/values/colors.xml b/src/PostIt/PostIt.Android/Resources/values/colors.xml
new file mode 100644
index 00000000..59279d5d
--- /dev/null
+++ b/src/PostIt/PostIt.Android/Resources/values/colors.xml
@@ -0,0 +1,4 @@
+
+
+ #FFFFFF
+
diff --git a/src/PostIt/PostIt.Android/Resources/values/styles.xml b/src/PostIt/PostIt.Android/Resources/values/styles.xml
new file mode 100644
index 00000000..6e534de2
--- /dev/null
+++ b/src/PostIt/PostIt.Android/Resources/values/styles.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt.Browser/PostIt.Browser.csproj b/src/PostIt/PostIt.Browser/PostIt.Browser.csproj
new file mode 100644
index 00000000..c27916f2
--- /dev/null
+++ b/src/PostIt/PostIt.Browser/PostIt.Browser.csproj
@@ -0,0 +1,14 @@
+
+
+ net10.0-browser
+ Exe
+ true
+ enable
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/PostIt/PostIt.Browser/Program.cs b/src/PostIt/PostIt.Browser/Program.cs
new file mode 100644
index 00000000..8700609d
--- /dev/null
+++ b/src/PostIt/PostIt.Browser/Program.cs
@@ -0,0 +1,18 @@
+using System.Runtime.Versioning;
+using System.Threading.Tasks;
+using Avalonia;
+using Avalonia.Browser;
+using PostIt;
+
+internal sealed partial class Program
+{
+ private static Task Main(string[] args) => BuildAvaloniaApp()
+ .WithInterFont()
+#if DEBUG
+ .WithDeveloperTools()
+#endif
+ .StartBrowserAppAsync("out");
+
+ public static AppBuilder BuildAvaloniaApp()
+ => AppBuilder.Configure();
+}
\ No newline at end of file
diff --git a/src/PostIt/PostIt.Browser/Properties/AssemblyInfo.cs b/src/PostIt/PostIt.Browser/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..fb787959
--- /dev/null
+++ b/src/PostIt/PostIt.Browser/Properties/AssemblyInfo.cs
@@ -0,0 +1 @@
+[assembly:System.Runtime.Versioning.SupportedOSPlatform("browser")]
diff --git a/src/PostIt/PostIt.Browser/Properties/launchSettings.json b/src/PostIt/PostIt.Browser/Properties/launchSettings.json
new file mode 100644
index 00000000..2f23f172
--- /dev/null
+++ b/src/PostIt/PostIt.Browser/Properties/launchSettings.json
@@ -0,0 +1,13 @@
+{
+ "profiles": {
+ "PostIt.Browser": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "applicationUrl": "https://localhost:7169;http://localhost:5235",
+ "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
+ }
+ }
+}
diff --git a/src/PostIt/PostIt.Browser/runtimeconfig.template.json b/src/PostIt/PostIt.Browser/runtimeconfig.template.json
new file mode 100644
index 00000000..b96a9432
--- /dev/null
+++ b/src/PostIt/PostIt.Browser/runtimeconfig.template.json
@@ -0,0 +1,10 @@
+{
+ "wasmHostProperties": {
+ "perHostConfig": [
+ {
+ "name": "browser",
+ "host": "browser"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/src/PostIt/PostIt.Browser/wwwroot/app.css b/src/PostIt/PostIt.Browser/wwwroot/app.css
new file mode 100644
index 00000000..1d6f754a
--- /dev/null
+++ b/src/PostIt/PostIt.Browser/wwwroot/app.css
@@ -0,0 +1,58 @@
+/* HTML styles for the splash screen */
+.avalonia-splash {
+ position: absolute;
+ height: 100%;
+ width: 100%;
+ background: white;
+ font-family: 'Outfit', sans-serif;
+ justify-content: center;
+ align-items: center;
+ display: flex;
+ pointer-events: none;
+}
+
+/* Light theme styles */
+@media (prefers-color-scheme: light) {
+ .avalonia-splash {
+ background: white;
+ }
+
+ .avalonia-splash h2 {
+ color: #1b2a4e;
+ }
+
+ .avalonia-splash a {
+ color: #0D6EFD;
+ }
+}
+
+@media (prefers-color-scheme: dark) {
+ .avalonia-splash {
+ background: #1b2a4e;
+ }
+
+ .avalonia-splash h2 {
+ color: white;
+ }
+
+ .avalonia-splash a {
+ color: white;
+ }
+}
+
+.avalonia-splash h2 {
+ font-weight: 400;
+ font-size: 1.5rem;
+}
+
+.avalonia-splash a {
+ text-decoration: none;
+ font-size: 2.5rem;
+ display: block;
+}
+
+.avalonia-splash.splash-close {
+ transition: opacity 200ms, display 200ms;
+ display: none;
+ opacity: 0;
+}
diff --git a/src/PostIt/PostIt.Browser/wwwroot/favicon.ico b/src/PostIt/PostIt.Browser/wwwroot/favicon.ico
new file mode 100644
index 00000000..f7da8bb5
Binary files /dev/null and b/src/PostIt/PostIt.Browser/wwwroot/favicon.ico differ
diff --git a/src/PostIt/PostIt.Browser/wwwroot/index.html b/src/PostIt/PostIt.Browser/wwwroot/index.html
new file mode 100644
index 00000000..13fcef65
--- /dev/null
+++ b/src/PostIt/PostIt.Browser/wwwroot/index.html
@@ -0,0 +1,36 @@
+
+
+
+
+ PostIt.Browser
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt.Browser/wwwroot/main.js b/src/PostIt/PostIt.Browser/wwwroot/main.js
new file mode 100644
index 00000000..bf1555e4
--- /dev/null
+++ b/src/PostIt/PostIt.Browser/wwwroot/main.js
@@ -0,0 +1,13 @@
+import { dotnet } from './_framework/dotnet.js'
+
+const is_browser = typeof window != "undefined";
+if (!is_browser) throw new Error(`Expected to be running in a browser`);
+
+const dotnetRuntime = await dotnet
+ .withDiagnosticTracing(false)
+ .withApplicationArgumentsFromQuery()
+ .create();
+
+const config = dotnetRuntime.getConfig();
+
+await dotnetRuntime.runMain(config.mainAssemblyName, [globalThis.location.href]);
diff --git a/src/PostIt/PostIt.Desktop/PostIt.Desktop.csproj b/src/PostIt/PostIt.Desktop/PostIt.Desktop.csproj
new file mode 100644
index 00000000..2266d6cd
--- /dev/null
+++ b/src/PostIt/PostIt.Desktop/PostIt.Desktop.csproj
@@ -0,0 +1,22 @@
+
+
+ WinExe
+
+ net10.0
+ enable
+
+
+ app.manifest
+
+
+
+
+ None
+ All
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/PostIt/Program.cs b/src/PostIt/PostIt.Desktop/Program.cs
similarity index 88%
rename from src/PostIt/Program.cs
rename to src/PostIt/PostIt.Desktop/Program.cs
index f65042f4..17776559 100644
--- a/src/PostIt/Program.cs
+++ b/src/PostIt/PostIt.Desktop/Program.cs
@@ -1,9 +1,9 @@
-using Avalonia;
-using System;
+using System;
+using Avalonia;
-namespace PostIt;
+namespace PostIt.Desktop;
-class Program
+sealed class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
diff --git a/src/PostIt/app.manifest b/src/PostIt/PostIt.Desktop/app.manifest
similarity index 100%
rename from src/PostIt/app.manifest
rename to src/PostIt/PostIt.Desktop/app.manifest
diff --git a/src/PostIt/PostIt.slnx b/src/PostIt/PostIt.slnx
new file mode 100644
index 00000000..dab49d68
--- /dev/null
+++ b/src/PostIt/PostIt.slnx
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PostIt/App.axaml b/src/PostIt/PostIt/App.axaml
similarity index 64%
rename from src/PostIt/App.axaml
rename to src/PostIt/PostIt/App.axaml
index aac65f24..b947594e 100644
--- a/src/PostIt/App.axaml
+++ b/src/PostIt/PostIt/App.axaml
@@ -1,12 +1,17 @@
+
+
+
+
-
+
\ No newline at end of file
diff --git a/src/PostIt/PostIt/App.axaml.cs b/src/PostIt/PostIt/App.axaml.cs
new file mode 100644
index 00000000..2377bd71
--- /dev/null
+++ b/src/PostIt/PostIt/App.axaml.cs
@@ -0,0 +1,42 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Data.Core;
+using Avalonia.Data.Core.Plugins;
+using System.Linq;
+using Avalonia.Markup.Xaml;
+using PostIt.ViewModels;
+using PostIt.Views;
+
+namespace PostIt;
+
+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 MainViewModel()
+ };
+ }
+ else if (ApplicationLifetime is IActivityApplicationLifetime singleViewFactoryApplicationLifetime)
+ {
+ singleViewFactoryApplicationLifetime.MainViewFactory = () => new MainView { DataContext = new MainViewModel() };
+ }
+ else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
+ {
+ singleViewPlatform.MainView = new MainView
+ {
+ DataContext = new MainViewModel()
+ };
+ }
+
+ base.OnFrameworkInitializationCompleted();
+ }
+}
\ No newline at end of file
diff --git a/src/PostIt/PostIt/Assets/Icon.png b/src/PostIt/PostIt/Assets/Icon.png
new file mode 100644
index 00000000..3c398459
Binary files /dev/null and b/src/PostIt/PostIt/Assets/Icon.png differ
diff --git a/src/PostIt/PostIt/Assets/avalonia-logo.ico b/src/PostIt/PostIt/Assets/avalonia-logo.ico
new file mode 100644
index 00000000..f7da8bb5
Binary files /dev/null and b/src/PostIt/PostIt/Assets/avalonia-logo.ico differ
diff --git a/src/PostIt/PostIt.csproj b/src/PostIt/PostIt/PostIt.csproj
similarity index 73%
rename from src/PostIt/PostIt.csproj
rename to src/PostIt/PostIt/PostIt.csproj
index 11c18962..cbd2a8be 100644
--- a/src/PostIt/PostIt.csproj
+++ b/src/PostIt/PostIt/PostIt.csproj
@@ -1,21 +1,23 @@
- WinExe
net10.0
enable
- app.manifest
+ latest
true
+
+
+
-
-
+
None
All
-
+
+
-
\ No newline at end of file
+
diff --git a/src/PostIt/PostIt/ViewLocator.cs b/src/PostIt/PostIt/ViewLocator.cs
new file mode 100644
index 00000000..7c03656f
--- /dev/null
+++ b/src/PostIt/PostIt/ViewLocator.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+using Avalonia.Controls;
+using Avalonia.Controls.Templates;
+using PostIt.ViewModels;
+
+namespace PostIt;
+
+///
+/// Given a view model, returns the corresponding view if possible.
+///
+[RequiresUnreferencedCode(
+ "Default implementation of ViewLocator involves reflection which may be trimmed away.",
+ Url = "https://docs.avaloniaui.net/docs/concepts/view-locator")]
+public class ViewLocator : IDataTemplate
+{
+ public Control? Build(object? param)
+ {
+ if (param is null)
+ return null;
+
+ var name = param.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal);
+ var type = Type.GetType(name);
+
+ if (type != null)
+ {
+ return (Control)Activator.CreateInstance(type)!;
+ }
+
+ return new TextBlock { Text = "Not Found: " + name };
+ }
+
+ public bool Match(object? data)
+ {
+ return data is ViewModelBase;
+ }
+}
\ No newline at end of file
diff --git a/src/PostIt/PostIt/ViewModels/MainViewModel.cs b/src/PostIt/PostIt/ViewModels/MainViewModel.cs
new file mode 100644
index 00000000..68c58f93
--- /dev/null
+++ b/src/PostIt/PostIt/ViewModels/MainViewModel.cs
@@ -0,0 +1,9 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+
+namespace PostIt.ViewModels;
+
+public partial class MainViewModel : ViewModelBase
+{
+ [ObservableProperty]
+ private string _greeting = "Welcome to Avalonia!";
+}
diff --git a/src/PostIt/PostIt/ViewModels/ViewModelBase.cs b/src/PostIt/PostIt/ViewModels/ViewModelBase.cs
new file mode 100644
index 00000000..9e159fa3
--- /dev/null
+++ b/src/PostIt/PostIt/ViewModels/ViewModelBase.cs
@@ -0,0 +1,7 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+
+namespace PostIt.ViewModels;
+
+public abstract class ViewModelBase : ObservableObject
+{
+}
diff --git a/src/PostIt/PostIt/Views/MainView.axaml b/src/PostIt/PostIt/Views/MainView.axaml
new file mode 100644
index 00000000..35333b01
--- /dev/null
+++ b/src/PostIt/PostIt/Views/MainView.axaml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/PostIt/PostIt/Views/MainView.axaml.cs b/src/PostIt/PostIt/Views/MainView.axaml.cs
new file mode 100644
index 00000000..2407b12d
--- /dev/null
+++ b/src/PostIt/PostIt/Views/MainView.axaml.cs
@@ -0,0 +1,13 @@
+
+using Avalonia;
+using Avalonia.Controls;
+
+namespace PostIt.Views;
+
+public partial class MainView : UserControl
+{
+ public MainView()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/src/PostIt/PostIt/Views/MainWindow.axaml b/src/PostIt/PostIt/Views/MainWindow.axaml
new file mode 100644
index 00000000..821c4da7
--- /dev/null
+++ b/src/PostIt/PostIt/Views/MainWindow.axaml
@@ -0,0 +1,12 @@
+
+
+
diff --git a/src/PostIt/MainWindow.axaml.cs b/src/PostIt/PostIt/Views/MainWindow.axaml.cs
similarity index 69%
rename from src/PostIt/MainWindow.axaml.cs
rename to src/PostIt/PostIt/Views/MainWindow.axaml.cs
index b2d99200..9cb85f55 100644
--- a/src/PostIt/MainWindow.axaml.cs
+++ b/src/PostIt/PostIt/Views/MainWindow.axaml.cs
@@ -1,12 +1,11 @@
using Avalonia.Controls;
-namespace PostIt;
+namespace PostIt.Views;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
- this.Greeting.Content="Hello Joe!";
}
}
\ No newline at end of file
diff --git a/src/PostIt/PostIt/Views/TextEditorBinding.cs b/src/PostIt/PostIt/Views/TextEditorBinding.cs
new file mode 100644
index 00000000..56fda68c
--- /dev/null
+++ b/src/PostIt/PostIt/Views/TextEditorBinding.cs
@@ -0,0 +1,51 @@
+using Avalonia;
+using Avalonia.Data;
+using AvaloniaEdit;
+
+namespace PostIt.Views;
+
+public sealed class TextEditorBinding
+{
+ public static readonly AttachedProperty TextProperty =
+ AvaloniaProperty.RegisterAttached(
+ "Text",
+ defaultBindingMode: BindingMode.TwoWay);
+
+ private static readonly AttachedProperty IsTextChangeSubscribedProperty =
+ AvaloniaProperty.RegisterAttached("IsTextChangeSubscribed");
+
+ static TextEditorBinding()
+ {
+ TextProperty.Changed.AddClassHandler((editor, args) =>
+ {
+ EnsureTextChangeSubscribed(editor);
+
+ var text = args.GetNewValue() ?? string.Empty;
+ if (editor.Text != text)
+ {
+ editor.Text = text;
+ }
+ });
+ }
+
+ public static string? GetText(TextEditor editor) => editor.GetValue(TextProperty);
+
+ public static void SetText(TextEditor editor, string? value) => editor.SetValue(TextProperty, value);
+
+ private static void EnsureTextChangeSubscribed(TextEditor editor)
+ {
+ if (editor.GetValue(IsTextChangeSubscribedProperty))
+ {
+ return;
+ }
+
+ editor.SetValue(IsTextChangeSubscribedProperty, true);
+ editor.TextChanged += (_, _) =>
+ {
+ if (editor.Text != GetText(editor))
+ {
+ SetText(editor, editor.Text);
+ }
+ };
+ }
+}
diff --git a/src/Yavsc.Org/Yavsc.Org.csproj b/src/Yavsc.Org/Yavsc.Org.csproj
index 87e99f72..e54192e0 100644
--- a/src/Yavsc.Org/Yavsc.Org.csproj
+++ b/src/Yavsc.Org/Yavsc.Org.csproj
@@ -51,4 +51,4 @@
-
+
\ No newline at end of file
diff --git a/yavsc.sln b/yavsc.sln
index 280fe44f..92489940 100644
--- a/yavsc.sln
+++ b/yavsc.sln
@@ -23,7 +23,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "yavscTests", "test\yavscTes
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yavsc.Blogs", "src\Yavsc.Blogs\Yavsc.Blogs.csproj", "{5D9E161F-3CB3-4854-9D07-3DF6882EA66C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostIt", "src\PostIt\PostIt.csproj", "{342F9C7A-C72A-47F6-A2A7-442A524D10CE}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PostIt", "PostIt", "{E13D107F-4053-D0DE-6394-453609595BFE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostIt", "src\PostIt\PostIt\PostIt.csproj", "{38B554FD-2AAF-4278-B87B-729FA4DC0111}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostIt.Android", "src\PostIt\PostIt.Android\PostIt.Android.csproj", "{4C092CF8-524A-494D-AAFC-69383DFBA31D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostIt.Browser", "src\PostIt\PostIt.Browser\PostIt.Browser.csproj", "{AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PostIt.Desktop", "src\PostIt\PostIt.Desktop\PostIt.Desktop.csproj", "{EFE24256-9335-44C5-8B77-E180C2DB3C0B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -131,18 +139,54 @@ Global
{5D9E161F-3CB3-4854-9D07-3DF6882EA66C}.Release|x64.Build.0 = Release|Any CPU
{5D9E161F-3CB3-4854-9D07-3DF6882EA66C}.Release|x86.ActiveCfg = Release|Any CPU
{5D9E161F-3CB3-4854-9D07-3DF6882EA66C}.Release|x86.Build.0 = Release|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Debug|x64.ActiveCfg = Debug|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Debug|x64.Build.0 = Debug|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Debug|x86.ActiveCfg = Debug|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Debug|x86.Build.0 = Debug|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Release|Any CPU.Build.0 = Release|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Release|x64.ActiveCfg = Release|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Release|x64.Build.0 = Release|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Release|x86.ActiveCfg = Release|Any CPU
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE}.Release|x86.Build.0 = Release|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Debug|x64.Build.0 = Debug|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Debug|x86.Build.0 = Debug|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Release|Any CPU.Build.0 = Release|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Release|x64.ActiveCfg = Release|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Release|x64.Build.0 = Release|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Release|x86.ActiveCfg = Release|Any CPU
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111}.Release|x86.Build.0 = Release|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Debug|x64.Build.0 = Debug|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Debug|x86.Build.0 = Debug|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Release|x64.ActiveCfg = Release|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Release|x64.Build.0 = Release|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Release|x86.ActiveCfg = Release|Any CPU
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D}.Release|x86.Build.0 = Release|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Debug|x64.Build.0 = Debug|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Debug|x86.Build.0 = Debug|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Release|x64.ActiveCfg = Release|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Release|x64.Build.0 = Release|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Release|x86.ActiveCfg = Release|Any CPU
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0}.Release|x86.Build.0 = Release|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Debug|x64.Build.0 = Debug|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Debug|x86.Build.0 = Debug|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Release|x64.ActiveCfg = Release|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Release|x64.Build.0 = Release|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Release|x86.ActiveCfg = Release|Any CPU
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -156,6 +200,10 @@ Global
{27DA6CEC-4266-4F78-BB32-8388F9A401D0} = {CDB1BDB5-53F9-4B43-864F-60F2E74F44E2}
{CDCF676A-2037-472E-8C8B-67C5E4FDFEA1} = {76A7FBA6-B7EC-4864-85C0-1F470794BA0F}
{5D9E161F-3CB3-4854-9D07-3DF6882EA66C} = {CDB1BDB5-53F9-4B43-864F-60F2E74F44E2}
- {342F9C7A-C72A-47F6-A2A7-442A524D10CE} = {CDB1BDB5-53F9-4B43-864F-60F2E74F44E2}
+ {E13D107F-4053-D0DE-6394-453609595BFE} = {CDB1BDB5-53F9-4B43-864F-60F2E74F44E2}
+ {38B554FD-2AAF-4278-B87B-729FA4DC0111} = {E13D107F-4053-D0DE-6394-453609595BFE}
+ {4C092CF8-524A-494D-AAFC-69383DFBA31D} = {E13D107F-4053-D0DE-6394-453609595BFE}
+ {AF96C1C4-D128-4CD7-A8BB-D194E6D270F0} = {E13D107F-4053-D0DE-6394-453609595BFE}
+ {EFE24256-9335-44C5-8B77-E180C2DB3C0B} = {E13D107F-4053-D0DE-6394-453609595BFE}
EndGlobalSection
EndGlobal