diff --git a/.editorconfig b/.editorconfig
index 73cfb445..0d920fb0 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -87,7 +87,7 @@ csharp_style_conditional_delegate_call = true:suggestion
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
# Code-block preferences
-csharp_prefer_braces = true:suggestion
+csharp_prefer_braces = true:none
# Expression-level preferences
csharp_prefer_simple_default_expression = true:suggestion
@@ -144,3 +144,6 @@ csharp_space_between_square_brackets = false
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
+
+# IDE0011: Add braces
+dotnet_diagnostic.IDE0011.severity = none
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f4a98eee..dec4ef97 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -83,9 +83,9 @@ jobs:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} # Needed to get PR information, if any
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
shell: powershell
- run: >
- .\.sonar\scanner\dotnet-sonarscanner
- begin /k:"TorisanKitsune_MinoriEditorShell" /o:"torisankitsune"
+ run: >
+ .\.sonar\scanner\dotnet-sonarscanner
+ begin /k:"TorisanKitsune_MinoriEditorShell" /o:"torisankitsune"
/d:sonar.login="${{secrets.SONAR_TOKEN}}" /d:sonar.host.url="https://sonarcloud.io"
/d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml
/v:${{steps.gitversion.outputs.semVer}}
diff --git a/.sonarlint/MinoriEditorShell.slconfig b/.sonarlint/MinoriEditorShell.slconfig
index edbf02e2..ae55e19b 100644
--- a/.sonarlint/MinoriEditorShell.slconfig
+++ b/.sonarlint/MinoriEditorShell.slconfig
@@ -9,7 +9,7 @@
"Profiles": {
"CSharp": {
"ProfileKey": "AXHDDFLUVHc24qBALL5K",
- "ProfileTimestamp": "2021-05-05T07:40:20Z"
+ "ProfileTimestamp": "2021-10-27T09:08:11Z"
}
}
}
\ No newline at end of file
diff --git a/.sonarlint/torisankitsune_minorieditorshell2/CSharp/SonarLint.xml b/.sonarlint/torisankitsune_minorieditorshell2/CSharp/SonarLint.xml
new file mode 100644
index 00000000..21acd70e
--- /dev/null
+++ b/.sonarlint/torisankitsune_minorieditorshell2/CSharp/SonarLint.xml
@@ -0,0 +1,89 @@
+
+
+
+
+ sonar.cs.analyzeGeneratedCode
+ false
+
+
+ sonar.cs.file.suffixes
+ .cs
+
+
+ sonar.cs.ignoreHeaderComments
+ true
+
+
+ sonar.cs.roslyn.ignoreIssues
+ false
+
+
+
+
+ S107
+
+
+ max
+ 7
+
+
+
+
+ S110
+
+
+ max
+ 5
+
+
+
+
+ S1479
+
+
+ maximum
+ 30
+
+
+
+
+ S2342
+
+
+ flagsAttributeFormat
+ ^([A-Z]{1,3}[a-z0-9]+)*([A-Z]{2})?s$
+
+
+ format
+ ^([A-Z]{1,3}[a-z0-9]+)*([A-Z]{2})?$
+
+
+
+
+ S2436
+
+
+ max
+ 2
+
+
+ maxMethod
+ 3
+
+
+
+
+ S3776
+
+
+ propertyThreshold
+ 3
+
+
+ threshold
+ 15
+
+
+
+
+
\ No newline at end of file
diff --git a/.sonarlint/torisankitsune_minorieditorshellcsharp.ruleset b/.sonarlint/torisankitsune_minorieditorshellcsharp.ruleset
index f9145a58..6bc76dac 100644
--- a/.sonarlint/torisankitsune_minorieditorshellcsharp.ruleset
+++ b/.sonarlint/torisankitsune_minorieditorshellcsharp.ruleset
@@ -169,6 +169,7 @@
+
@@ -194,11 +195,13 @@
+
+
diff --git a/CreateArtifacts.ps1 b/CreateArtifacts.ps1
index 0c7b9f0b..57200697 100644
--- a/CreateArtifacts.ps1
+++ b/CreateArtifacts.ps1
@@ -19,7 +19,7 @@ foreach ($nupkg in $nupkgs) {
#mkdir Artifacts\$basedir\Demos
cp Demos\SimpleDemo\SimpleDemo.WPF\bin\Release\net5.0-windows Artifacts\$basedir\Demos\SimpleDemo.WPF -Recurse
cp Demos\SimpleDemo\SimpleDemo.RibbonWPF\bin\Release\net5.0-windows Artifacts\$basedir\Demos\SimpleDemo.RibbonWPF -Recurse
-cp Demos\MinoriDemo\MinoriDemo.WPF\bin\Release\net5.0-windows Artifacts\$basedir\Demos\MinoriDemo.WPF -Recurse
+cp Demos\SimpleDemo\SimpleDemo.Avalonia\bin\Release\net5.0 Artifacts\$basedir\Demos\SimpleDemo.Avalonia -Recurse
cp Demos\MinoriDemo\MinoriDemo.RibbonWPF\bin\Release\net5.0-windows Artifacts\$basedir\Demos\MinoriDemo.RibbonWPF -Recurse
# Compress folder into 7z file
diff --git a/Demos/MinoriDemo/MinoriDemo.Core/ViewModels/MainViewModel.cs b/Demos/MinoriDemo/MinoriDemo.Core/ViewModels/MainViewModel.cs
index 757e5ac9..f2a2c91e 100644
--- a/Demos/MinoriDemo/MinoriDemo.Core/ViewModels/MainViewModel.cs
+++ b/Demos/MinoriDemo/MinoriDemo.Core/ViewModels/MainViewModel.cs
@@ -1,8 +1,6 @@
-using Microsoft.Extensions.Logging;
using MinoriEditorShell.Services;
using MvvmCross;
using MvvmCross.Commands;
-using MvvmCross.Logging;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using System;
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWpf/App.xaml.cs b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/App.xaml.cs
similarity index 100%
rename from Demos/MinoriDemo/MinoriDemo.RibbonWpf/App.xaml.cs
rename to Demos/MinoriDemo/MinoriDemo.RibbonWPF/App.xaml.cs
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWPF/DataClasses/ThemeItem.cs b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/DataClasses/ThemeItem.cs
new file mode 100644
index 00000000..d33218d2
--- /dev/null
+++ b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/DataClasses/ThemeItem.cs
@@ -0,0 +1,63 @@
+using MinoriDemo.RibbonWPF.Modules.Themes;
+using MvvmCross;
+using MvvmCross.Base;
+using MvvmCross.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Windows.Media;
+
+namespace MinoriDemo.RibbonWPF.DataClasses
+{
+ internal class ThemeItem : MvxNotifyPropertyChanged
+ {
+ private Color _color;
+ private String _key;
+ private Boolean _canEdit = false;
+ private String _modeText = "Edit";
+
+ public ThemeHelper ThemeHelper { get; set; }
+
+ public String ModeText
+ {
+ get => _modeText;
+ set => SetProperty(ref _modeText, value);
+ }
+
+ public Boolean CanEdit
+ {
+ get => _canEdit;
+ set
+ {
+ if (SetProperty(ref _canEdit, value))
+ {
+ ModeText = value ? "Done" : "Edit";
+ }
+ }
+ }
+
+ public String Key
+ {
+ get => _key;
+ set => SetProperty(ref _key, value);
+ }
+
+ public Color Color
+ {
+ get => _color;
+ set
+ {
+ _color = value;
+
+ Mvx.IoCProvider.Resolve()
+ .ExecuteOnMainThreadAsync(() =>
+ {
+ IDictionary brushes = ThemeHelper.GetBrushes();
+ brushes[Key] = new SolidColorBrush(value);
+ ThemeHelper.SetBrushes(brushes);
+ });
+ }
+ }
+
+ public String OriginalKey { get; internal set; }
+ }
+}
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWpf/MainWindow.xaml b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/MainWindow.xaml
similarity index 90%
rename from Demos/MinoriDemo/MinoriDemo.RibbonWpf/MainWindow.xaml
rename to Demos/MinoriDemo/MinoriDemo.RibbonWPF/MainWindow.xaml
index c28a2f14..668aa875 100644
--- a/Demos/MinoriDemo/MinoriDemo.RibbonWpf/MainWindow.xaml
+++ b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/MainWindow.xaml
@@ -1,4 +1,4 @@
-
-
\ No newline at end of file
+
diff --git a/Demos/MinoriDemo/MinoriDemo.WPF/MinoriDemo.Wpf.ruleset b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/MinoriDemo.RibbonWPF.ruleset
similarity index 100%
rename from Demos/MinoriDemo/MinoriDemo.WPF/MinoriDemo.Wpf.ruleset
rename to Demos/MinoriDemo/MinoriDemo.RibbonWPF/MinoriDemo.RibbonWPF.ruleset
diff --git a/Demos/MinoriDemo/MinoriDemo.Wpf/Setup.cs b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Setup.cs
similarity index 93%
rename from Demos/MinoriDemo/MinoriDemo.Wpf/Setup.cs
rename to Demos/MinoriDemo/MinoriDemo.RibbonWPF/Setup.cs
index c013254e..5ef6c2ca 100644
--- a/Demos/MinoriDemo/MinoriDemo.Wpf/Setup.cs
+++ b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Setup.cs
@@ -1,7 +1,7 @@
using Microsoft.Extensions.Logging;
using MinoriEditorShell.Platforms.Wpf;
-namespace MinoriDemo.WpfCore
+namespace MinoriDemo.RibbonWPF
{
internal class Setup : MesWpfSetup
{
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWpf/Views/MainView.xaml b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/MainView.xaml
similarity index 100%
rename from Demos/MinoriDemo/MinoriDemo.RibbonWpf/Views/MainView.xaml
rename to Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/MainView.xaml
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWpf/Views/MainView.xaml.cs b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/MainView.xaml.cs
similarity index 100%
rename from Demos/MinoriDemo/MinoriDemo.RibbonWpf/Views/MainView.xaml.cs
rename to Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/MainView.xaml.cs
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ThemeEditorView.xaml b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ThemeEditorView.xaml
new file mode 100644
index 00000000..c73ea261
--- /dev/null
+++ b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ThemeEditorView.xaml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ThemeEditorView.xaml.cs b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ThemeEditorView.xaml.cs
new file mode 100644
index 00000000..951fe41a
--- /dev/null
+++ b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ThemeEditorView.xaml.cs
@@ -0,0 +1,178 @@
+using Microsoft.Win32;
+using MinoriDemo.RibbonWPF.DataClasses;
+using MinoriDemo.RibbonWPF.Modules.Themes;
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace MinoriDemo.RibbonWPF.Views
+{
+ ///
+ /// Interaction logic for ToolSampleView.xaml
+ ///
+ [MvxContentPresentation]
+ public partial class ThemeEditorView
+ {
+ public ThemeHelper _themeHelper;
+
+ // TODO: I18n
+ private const String _newKey = "Unnamed";
+
+ public ThemeEditorView()
+ {
+ InitializeComponent();
+
+ // Setup selection drop down item.
+ _themeHelper = new ThemeHelper();
+ ThemeSelection.ItemsSource = _themeHelper.GetAppDictionary().MergedDictionaries;
+ ThemeSelection.SelectedItem = ThemeSelection.Items[0];
+ }
+
+ ///
+ /// Add new item to list.
+ ///
+ ///
+ ///
+ private void Add_Click(Object sender, RoutedEventArgs e)
+ {
+ IDictionary brushes = _themeHelper.GetBrushes();
+ if (brushes.Keys.Contains(_newKey))
+ {
+ MessageBox.Show($"{_newKey} already exists, please rename key before adding a new one", "Duplicate key");
+ return;
+ }
+ brushes[_newKey] = new SolidColorBrush();
+ _themeHelper.SetBrushes(brushes);
+
+ UpdateList(brushes);
+ }
+
+ private void Export_Click(Object sender, RoutedEventArgs e)
+ {
+ if (ThemeSelection == null)
+ {
+ MessageBox.Show("Select a theme to export");
+ return;
+ }
+ SaveFileDialog saveFile = new SaveFileDialog
+ {
+ InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
+ Filter = "Resource Dictionary (*.xaml)|*.xaml",
+ AddExtension = true,
+ DefaultExt = ".xaml",
+ };
+ if (saveFile.ShowDialog() == true)
+ {
+ File.WriteAllText(saveFile.FileName, _themeHelper.ExportString());
+ }
+ }
+
+ private void RemoveClick(Object sender, RoutedEventArgs e)
+ {
+ if (sender is Button button && button.DataContext is ThemeItem item)
+ {
+ IDictionary brushes = _themeHelper.GetBrushes();
+ brushes.Remove(item.Key);
+ _themeHelper.SetBrushes(brushes);
+
+ UpdateList(brushes);
+ }
+ }
+
+ private void RenameClick(Object sender, RoutedEventArgs e)
+ {
+ if (sender is Button button && button.DataContext is ThemeItem item)
+ {
+ if (!item.CanEdit)
+ {
+ item.OriginalKey = item.Key;
+ item.CanEdit = true;
+ }
+ else
+ {
+ item.CanEdit = false;
+
+ // Set new name here
+ String newKey = item.Key;
+ // where !old key
+ if (!String.IsNullOrEmpty(newKey) && newKey != item.OriginalKey)
+ {
+ // Get list
+ IDictionary brushes = _themeHelper.GetBrushes();
+
+ // add new key
+ if (brushes.ContainsKey(item.OriginalKey))
+ {
+ brushes[item.Key] = brushes[item.OriginalKey];
+ brushes.Remove(item.OriginalKey);
+ }
+ else
+ {
+ brushes[item.Key] = new SolidColorBrush();
+ }
+ _themeHelper.SetBrushes(brushes);
+
+ // update
+ UpdateList(brushes);
+ }
+ }
+ }
+ }
+
+ private void Search_Click(Object sender, RoutedEventArgs e)
+ {
+ IDictionary brushes = _themeHelper.GetBrushes();
+ if (!String.IsNullOrWhiteSpace(search.Text))
+ {
+ IEnumerable> select = brushes
+ .Where(x => x.Key.ToLower().Contains(search.Text.ToLower()));
+
+ SortedDictionary result = new SortedDictionary();
+ foreach (KeyValuePair item in select) { result[item.Key] = item.Value; }
+
+ UpdateList(result);
+ }
+ else
+ {
+ UpdateList(brushes);
+ }
+ }
+
+ private void search_KeyDown(Object sender, System.Windows.Input.KeyEventArgs e)
+ {
+ if (e.Key == System.Windows.Input.Key.Enter)
+ {
+ e.Handled = true;
+ Search_Click(sender, e);
+ }
+ }
+
+ private void ThemeChanged(Object sender, SelectionChangedEventArgs e)
+ {
+ _themeHelper.CurrentThemeDictionary = ThemeSelection.SelectedItem as ResourceDictionary;
+ if (_themeHelper.CurrentThemeDictionary != null)
+ {
+ UpdateList(_themeHelper.GetBrushes());
+ }
+ }
+
+ ///
+ /// Updates list from
+ ///
+ private void UpdateList(IDictionary brushes)
+ {
+ MainResourceList.ItemsSource =
+ brushes.Select(x => new ThemeItem
+ {
+ ThemeHelper = _themeHelper,
+ Key = x.Key,
+ Color = x.Value.Color,
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ToolSampleView.xaml b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ToolSampleView.xaml
new file mode 100644
index 00000000..475edb72
--- /dev/null
+++ b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ToolSampleView.xaml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ToolSampleView.xaml.cs b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ToolSampleView.xaml.cs
new file mode 100644
index 00000000..6bcc5ea1
--- /dev/null
+++ b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/ToolSampleView.xaml.cs
@@ -0,0 +1,16 @@
+using MvvmCross.Platforms.Wpf.Presenters.Attributes;
+
+namespace MinoriDemo.RibbonWPF.Views
+{
+ ///
+ /// Interaction logic for ToolSampleView.xaml
+ ///
+ [MvxContentPresentation]
+ public partial class ToolSampleView
+ {
+ public ToolSampleView()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/VirtualCanvasView.xaml b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/VirtualCanvasView.xaml
new file mode 100644
index 00000000..8cf55e81
--- /dev/null
+++ b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/VirtualCanvasView.xaml
@@ -0,0 +1,18 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWpf/Views/VirtualCanvasView.xaml.cs b/Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/VirtualCanvasView.xaml.cs
similarity index 100%
rename from Demos/MinoriDemo/MinoriDemo.RibbonWpf/Views/VirtualCanvasView.xaml.cs
rename to Demos/MinoriDemo/MinoriDemo.RibbonWPF/Views/VirtualCanvasView.xaml.cs
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWpf/MainWindow.xaml.cs b/Demos/MinoriDemo/MinoriDemo.RibbonWpf/MainWindow.xaml.cs
index bcf91ef8..8187a5bc 100644
--- a/Demos/MinoriDemo/MinoriDemo.RibbonWpf/MainWindow.xaml.cs
+++ b/Demos/MinoriDemo/MinoriDemo.RibbonWpf/MainWindow.xaml.cs
@@ -1,4 +1,4 @@
-namespace MinoriDemo.RibbonWPF
+namespace MinoriDemo.RibbonWPF
{
///
/// Interaction logic for MainWindow.xaml
@@ -7,4 +7,4 @@ public partial class MainWindow
{
public MainWindow() => InitializeComponent();
}
-}
\ No newline at end of file
+}
diff --git a/Demos/MinoriDemo/MinoriDemo.RibbonWpf/Setup.cs b/Demos/MinoriDemo/MinoriDemo.RibbonWpf/Setup.cs
deleted file mode 100644
index 552f23dc..00000000
--- a/Demos/MinoriDemo/MinoriDemo.RibbonWpf/Setup.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using Microsoft.Extensions.Logging;
-using MinoriEditorShell.Platforms.Wpf;
-using MinoriEditorShell.Services;
-using MvvmCross;
-using MvvmCross.IoC;
-using MvvmCross.ViewModels;
-using System;
-
-namespace MinoriDemo.RibbonWPF
-{
- internal class Setup : MesWpfSetup
- {
- protected override ILoggerFactory CreateLogFactory() =>
- LoggerFactory.Create((builder) =>
- builder
- .SetMinimumLevel(0)
- .AddDebug());
-
- protected override ILoggerProvider CreateLogProvider() => null;
-
- protected override void InitializeLastChance(IMvxIoCProvider iocProvider)
- {
- base.InitializeLastChance(iocProvider);
-
- IMesThemeManager manager = Mvx.IoCProvider.Resolve();
- foreach (IMesTheme theme in manager.Themes)
- {
- theme.Add(new Uri("pack://application:,,,/ColorPickerLib;component/Themes/Generic.xaml"));
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.WPF/App.xaml b/Demos/MinoriDemo/MinoriDemo.WPF/App.xaml
deleted file mode 100644
index 55644a02..00000000
--- a/Demos/MinoriDemo/MinoriDemo.WPF/App.xaml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.WPF/App.xaml.cs b/Demos/MinoriDemo/MinoriDemo.WPF/App.xaml.cs
deleted file mode 100644
index 505a3b5f..00000000
--- a/Demos/MinoriDemo/MinoriDemo.WPF/App.xaml.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using MinoriEditorShell.Platforms.Wpf;
-using MvvmCross.Core;
-using MvvmCross.Platforms.Wpf.Views;
-
-namespace MinoriDemo.WpfCore
-{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : MvxApplication
- {
- protected override void RegisterSetup() => this.RegisterSetupType();
- }
-}
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.WPF/MainWindow.xaml b/Demos/MinoriDemo/MinoriDemo.WPF/MainWindow.xaml
deleted file mode 100644
index 719c4c9d..00000000
--- a/Demos/MinoriDemo/MinoriDemo.WPF/MainWindow.xaml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.WPF/MainWindow.xaml.cs b/Demos/MinoriDemo/MinoriDemo.WPF/MainWindow.xaml.cs
deleted file mode 100644
index b8579e8f..00000000
--- a/Demos/MinoriDemo/MinoriDemo.WPF/MainWindow.xaml.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace MinoriDemo.WpfCore
-{
- ///
- /// Interaction logic for MainWindow.xaml
- ///
- public partial class MainWindow
- {
- public MainWindow()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.WPF/MinoriDemo.WPF.csproj b/Demos/MinoriDemo/MinoriDemo.WPF/MinoriDemo.WPF.csproj
deleted file mode 100644
index 4631748e..00000000
--- a/Demos/MinoriDemo/MinoriDemo.WPF/MinoriDemo.WPF.csproj
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- WinExe
- net5.0-windows
- true
- MinoriDemo.Wpf.ruleset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.WPF/Views/MainView.xaml b/Demos/MinoriDemo/MinoriDemo.WPF/Views/MainView.xaml
deleted file mode 100644
index fa389e12..00000000
--- a/Demos/MinoriDemo/MinoriDemo.WPF/Views/MainView.xaml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.WPF/Views/MainView.xaml.cs b/Demos/MinoriDemo/MinoriDemo.WPF/Views/MainView.xaml.cs
deleted file mode 100644
index 7373b133..00000000
--- a/Demos/MinoriDemo/MinoriDemo.WPF/Views/MainView.xaml.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using MvvmCross.Platforms.Wpf.Presenters.Attributes;
-using MvvmCross.Platforms.Wpf.Views;
-
-namespace MinoriDemo.WpfCore.Views
-{
- ///
- /// Interaction logic for MainView.xaml
- ///
- [MvxContentPresentation]
- public partial class MainView : MvxWpfView
- {
- public MainView() => InitializeComponent();
- }
-}
\ No newline at end of file
diff --git a/Demos/MinoriDemo/MinoriDemo.Wpf/MinoriDemo.Wpf.csproj b/Demos/MinoriDemo/MinoriDemo.Wpf/MinoriDemo.Wpf.csproj
deleted file mode 100644
index 4631748e..00000000
--- a/Demos/MinoriDemo/MinoriDemo.Wpf/MinoriDemo.Wpf.csproj
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- WinExe
- net5.0-windows
- true
- MinoriDemo.Wpf.ruleset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/App.axaml b/Demos/SimpleDemo/SimpleDemo.Avalonia/App.axaml
new file mode 100644
index 00000000..2a721687
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/App.axaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/App.axaml.cs b/Demos/SimpleDemo/SimpleDemo.Avalonia/App.axaml.cs
new file mode 100644
index 00000000..8e398531
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/App.axaml.cs
@@ -0,0 +1,27 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Markup.Xaml;
+using MinoriEditorShell.Platforms.Avalonia;
+using MinoriEditorShell.Platforms.Avalonia.Views;
+using MvvmCross.Core;
+using System.Diagnostics;
+
+namespace SimpleDemo.Avalonia
+{
+ public class App : MesApplication
+ {
+ public override void Initialize() => AvaloniaXamlLoader.Load(this);
+
+ protected override void RegisterSetup() => this.RegisterSetupType();
+
+ public override void OnFrameworkInitializationCompleted()
+ {
+ if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+ {
+ desktop.MainWindow = new MainWindow();
+ }
+
+ base.OnFrameworkInitializationCompleted();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/MainWindow.axaml b/Demos/SimpleDemo/SimpleDemo.Avalonia/MainWindow.axaml
new file mode 100644
index 00000000..eaf189ed
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/MainWindow.axaml
@@ -0,0 +1,11 @@
+
+ Welcome to Avalonia Mes!
+
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/MainWindow.axaml.cs b/Demos/SimpleDemo/SimpleDemo.Avalonia/MainWindow.axaml.cs
new file mode 100644
index 00000000..cc4dc4e6
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/MainWindow.axaml.cs
@@ -0,0 +1,22 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using MinoriEditorShell.Platforms.Avalonia.Presenters.Attributes;
+using MinoriEditorShell.Platforms.Avalonia.Views;
+
+namespace SimpleDemo.Avalonia
+{
+ [MesWindowPresentation]
+ public class MainWindow : MesWindow
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+#if DEBUG
+ this.AttachDevTools();
+#endif
+ }
+
+ private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
+ }
+}
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/Program.cs b/Demos/SimpleDemo/SimpleDemo.Avalonia/Program.cs
new file mode 100644
index 00000000..c1726508
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/Program.cs
@@ -0,0 +1,26 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.ApplicationLifetimes;
+using System;
+
+namespace SimpleDemo.Avalonia
+{
+ ///
+ /// This is autogenerated from the VS Studio tool.
+ ///
+ internal static 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
+ // yet and stuff might break.
+ public static void Main(string[] args)
+ => BuildAvaloniaApp()
+ .StartWithClassicDesktopLifetime(args);
+
+ // Avalonia configuration, don't remove; also used by visual designer.
+ public static AppBuilder BuildAvaloniaApp()
+ => AppBuilder.Configure()
+ .UsePlatformDetect()
+ .LogToTrace();
+ }
+}
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/Setup.cs b/Demos/SimpleDemo/SimpleDemo.Avalonia/Setup.cs
new file mode 100644
index 00000000..adaa3ae5
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/Setup.cs
@@ -0,0 +1,11 @@
+using Microsoft.Extensions.Logging;
+using MinoriEditorShell.Platforms.Avalonia;
+
+namespace SimpleDemo.Avalonia
+{
+ internal class Setup : MesAvnSetup
+ {
+ protected override ILoggerFactory CreateLogFactory() => LoggerFactory.Create(b => b.SetMinimumLevel(0).AddDebug());
+ protected override ILoggerProvider CreateLogProvider() => null;
+ }
+}
\ No newline at end of file
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/SimpleDemo.Avalonia.csproj b/Demos/SimpleDemo/SimpleDemo.Avalonia/SimpleDemo.Avalonia.csproj
new file mode 100644
index 00000000..4688dd4e
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/SimpleDemo.Avalonia.csproj
@@ -0,0 +1,23 @@
+
+
+ WinExe
+ net5.0
+ ..\..\..\.sonarlint\torisankitsune_minorieditorshellcsharp.ruleset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/SimpleDemo.Avalonia.ruleset b/Demos/SimpleDemo/SimpleDemo.Avalonia/SimpleDemo.Avalonia.ruleset
new file mode 100644
index 00000000..913e6bd2
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/SimpleDemo.Avalonia.ruleset
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/MainView.axaml b/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/MainView.axaml
new file mode 100644
index 00000000..a97b38e3
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/MainView.axaml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/MainView.axaml.cs b/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/MainView.axaml.cs
new file mode 100644
index 00000000..ccdf3d83
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/MainView.axaml.cs
@@ -0,0 +1,14 @@
+using Avalonia.Markup.Xaml;
+using MinoriEditorShell.Platforms.Avalonia.Presenters.Attributes;
+using MinoriEditorShell.Platforms.Avalonia.Views;
+
+namespace SimpleDemo.Avalonia.Views
+{
+ [MesContentPresentation]
+ public partial class MainView : MesAvnView
+ {
+ public MainView() => InitializeComponent();
+
+ private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
+ }
+}
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/TipView.axaml b/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/TipView.axaml
new file mode 100644
index 00000000..28bd8b15
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/TipView.axaml
@@ -0,0 +1,10 @@
+
+ Welcome to TipView!
+
diff --git a/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/TipView.axaml.cs b/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/TipView.axaml.cs
new file mode 100644
index 00000000..ae319e1b
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.Avalonia/Views/TipView.axaml.cs
@@ -0,0 +1,16 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using MinoriEditorShell.Platforms.Avalonia.Presenters.Attributes;
+using MinoriEditorShell.Platforms.Avalonia.Views;
+
+namespace SimpleDemo.Avalonia.Views
+{
+ [MesContentPresentation]
+ public partial class TipView : MesAvnView
+ {
+ public TipView() => InitializeComponent();
+
+ private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
+ }
+}
diff --git a/Demos/SimpleDemo/SimpleDemo.RibbonWPF/SimpleDemo.RibbonWPF.ruleset b/Demos/SimpleDemo/SimpleDemo.RibbonWPF/SimpleDemo.RibbonWPF.ruleset
new file mode 100644
index 00000000..45b67821
--- /dev/null
+++ b/Demos/SimpleDemo/SimpleDemo.RibbonWPF/SimpleDemo.RibbonWPF.ruleset
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/Demos/SimpleDemo/SimpleDemo.RibbonWPF/Views/MainView.xaml b/Demos/SimpleDemo/SimpleDemo.RibbonWPF/Views/MainView.xaml
index 8829532f..5c1af20d 100644
--- a/Demos/SimpleDemo/SimpleDemo.RibbonWPF/Views/MainView.xaml
+++ b/Demos/SimpleDemo/SimpleDemo.RibbonWPF/Views/MainView.xaml
@@ -18,7 +18,7 @@
-
+
\ No newline at end of file
diff --git a/Demos/SimpleDemo/SimpleDemo.WPF/SimpleDemo.WPF.csproj b/Demos/SimpleDemo/SimpleDemo.WPF/SimpleDemo.WPF.csproj
index 8548bf1a..5e44e1a2 100644
--- a/Demos/SimpleDemo/SimpleDemo.WPF/SimpleDemo.WPF.csproj
+++ b/Demos/SimpleDemo/SimpleDemo.WPF/SimpleDemo.WPF.csproj
@@ -5,7 +5,6 @@
true
..\..\..\.sonarlint\torisankitsune_minorieditorshellcsharp.ruleset
-
diff --git a/Demos/SimpleDemo/SimpleDemo.WPF/Views/MainView.xaml b/Demos/SimpleDemo/SimpleDemo.WPF/Views/MainView.xaml
index 4a999091..2908f4f9 100644
--- a/Demos/SimpleDemo/SimpleDemo.WPF/Views/MainView.xaml
+++ b/Demos/SimpleDemo/SimpleDemo.WPF/Views/MainView.xaml
@@ -23,7 +23,7 @@
-
+
\ No newline at end of file
diff --git a/Demos/SimpleDemo/SimpleDemo.Wpf/SimpleDemo.Wpf.csproj b/Demos/SimpleDemo/SimpleDemo.Wpf/SimpleDemo.Wpf.csproj
index 8548bf1a..5e44e1a2 100644
--- a/Demos/SimpleDemo/SimpleDemo.Wpf/SimpleDemo.Wpf.csproj
+++ b/Demos/SimpleDemo/SimpleDemo.Wpf/SimpleDemo.Wpf.csproj
@@ -5,7 +5,6 @@
true
..\..\..\.sonarlint\torisankitsune_minorieditorshellcsharp.ruleset
-
diff --git a/MinoriEditorShell-Avalonia.sln b/MinoriEditorShell-Avalonia.sln
new file mode 100644
index 00000000..1cba21c4
--- /dev/null
+++ b/MinoriEditorShell-Avalonia.sln
@@ -0,0 +1,89 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26124.0
+MinimumVisualStudioVersion = 15.0.26124.0
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{D9E73129-B533-484C-AEFC-7DA139610289}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinoriEditorShell", "Modules\MinoriEditorShell\MinoriEditorShell.csproj", "{C7863C93-477E-445B-98A1-F09454583537}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Demos", "Demos", "{3787F54F-76A2-47AE-AA26-79065C6CE52F}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SimpleDemo", "SimpleDemo", "{40760750-D249-419D-B947-BB18B5A7FC4B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleDemo.Core", "Demos\SimpleDemo\SimpleDemo.Core\SimpleDemo.Core.csproj", "{5D755878-EA31-4D57-B5D9-D36EA9275DA9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleDemo.Avalonia", "Demos\SimpleDemo\SimpleDemo.Avalonia\SimpleDemo.Avalonia.csproj", "{4AEE5668-722A-4799-9399-DBF9023D14F5}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinoriEditorShell.Platforms.Avalonia", "Modules\MinoriEditorShell.Platforms.Avalonia\MinoriEditorShell.Platforms.Avalonia.csproj", "{CCFF52CE-0ECB-4135-946D-D249DE58AA6D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C7863C93-477E-445B-98A1-F09454583537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Debug|x64.Build.0 = Debug|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Debug|x86.Build.0 = Debug|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Release|x64.ActiveCfg = Release|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Release|x64.Build.0 = Release|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Release|x86.ActiveCfg = Release|Any CPU
+ {C7863C93-477E-445B-98A1-F09454583537}.Release|x86.Build.0 = Release|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Debug|x64.Build.0 = Debug|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Debug|x86.Build.0 = Debug|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Release|x64.ActiveCfg = Release|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Release|x64.Build.0 = Release|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Release|x86.ActiveCfg = Release|Any CPU
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9}.Release|x86.Build.0 = Release|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Debug|x64.Build.0 = Debug|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Debug|x86.Build.0 = Debug|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Release|x64.ActiveCfg = Release|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Release|x64.Build.0 = Release|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Release|x86.ActiveCfg = Release|Any CPU
+ {4AEE5668-722A-4799-9399-DBF9023D14F5}.Release|x86.Build.0 = Release|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Debug|x64.Build.0 = Debug|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Debug|x86.Build.0 = Debug|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Release|x64.ActiveCfg = Release|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Release|x64.Build.0 = Release|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Release|x86.ActiveCfg = Release|Any CPU
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {C7863C93-477E-445B-98A1-F09454583537} = {D9E73129-B533-484C-AEFC-7DA139610289}
+ {40760750-D249-419D-B947-BB18B5A7FC4B} = {3787F54F-76A2-47AE-AA26-79065C6CE52F}
+ {5D755878-EA31-4D57-B5D9-D36EA9275DA9} = {40760750-D249-419D-B947-BB18B5A7FC4B}
+ {4AEE5668-722A-4799-9399-DBF9023D14F5} = {40760750-D249-419D-B947-BB18B5A7FC4B}
+ {CCFF52CE-0ECB-4135-946D-D249DE58AA6D} = {D9E73129-B533-484C-AEFC-7DA139610289}
+ EndGlobalSection
+EndGlobal
diff --git a/MinoriEditorShell.sln b/MinoriEditorShell.sln
index 04b186a3..b33af6a8 100644
--- a/MinoriEditorShell.sln
+++ b/MinoriEditorShell.sln
@@ -23,10 +23,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SimpleDemo", "SimpleDemo",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDemo.Core", "Demos\SimpleDemo\SimpleDemo.Core\SimpleDemo.Core.csproj", "{1BE23C45-838B-47E7-8437-90493CBEA59A}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDemo.WPF", "Demos\SimpleDemo\SimpleDemo.WPF\SimpleDemo.WPF.csproj", "{1C1AD720-523F-4144-8BA3-1E86461BC019}"
+EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{417CE623-3714-4105-8A2F-4C1A7DB61AA7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriEditorShell", "Modules\MinoriEditorShell\MinoriEditorShell.csproj", "{320B6932-9C96-4A1C-A2FC-F393516AE13F}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDemo.RibbonWPF", "Demos\SimpleDemo\SimpleDemo.RibbonWPF\SimpleDemo.RibbonWPF.csproj", "{4179EC7D-789B-4570-91F9-A5D56251A6EE}"
+EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriEditorShell.Ribbon", "Modules\MinoriEditorShell.Ribbon\MinoriEditorShell.Ribbon.csproj", "{ED2E6A4C-FE20-4CB8-953E-880C1EE31AE6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriEditorShell.VirtualCanvas", "Modules\MinoriEditorShell.VirtualCanvas\MinoriEditorShell.VirtualCanvas.csproj", "{B8BA7A12-25B1-445D-93B8-D0F34226D053}"
@@ -35,6 +39,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MinoriDemo", "MinoriDemo",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriDemo.Core", "Demos\MinoriDemo\MinoriDemo.Core\MinoriDemo.Core.csproj", "{E2733B2F-5C55-4C2E-879F-1495C5E11A4B}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriDemo.RibbonWPF", "Demos\MinoriDemo\MinoriDemo.RibbonWPF\MinoriDemo.RibbonWPF.csproj", "{9D695910-476E-4156-8AEE-4F2DDBE984FD}"
+EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{D96C6D53-E9ED-4E32-9856-B858A63C9D9E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriEditorShell.Platforms.Wpf", "Modules\MinoriEditorShell.Platforms.Wpf\MinoriEditorShell.Platforms.Wpf.csproj", "{79572320-E719-4053-A12A-9D74E111FC5E}"
@@ -52,15 +58,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Images", "Images", "{DE4AEC
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriEditorShell.RibbonTests", "Tests\MinoriEditorShell.RibbonTests\MinoriEditorShell.RibbonTests.csproj", "{7A48AD22-69BF-49A7-8988-E163F779997E}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriEditorShellTests", "Tests\MinoriEditorShellTests\MinoriEditorShellTests.csproj", "{45823E3D-C3E2-4DFF-8952-1C5B52B3F950}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriDemo.RibbonWpf", "Demos\MinoriDemo\MinoriDemo.RibbonWpf\MinoriDemo.RibbonWpf.csproj", "{1E99AC6C-40A7-418B-95E4-CA72D4A257CD}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriDemo.Wpf", "Demos\MinoriDemo\MinoriDemo.Wpf\MinoriDemo.Wpf.csproj", "{0E0460C0-BA5B-44D7-815B-592C42505D7D}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDemo.RibbonWpf", "Demos\SimpleDemo\SimpleDemo.RibbonWpf\SimpleDemo.RibbonWpf.csproj", "{DCC25078-D09F-4B0B-889C-F061BEF42A8D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MinoriEditorShell.Platforms.Avalonia", "Modules\MinoriEditorShell.Platforms.Avalonia\MinoriEditorShell.Platforms.Avalonia.csproj", "{C8944E3A-2D90-41D7-B16A-360CE60235A4}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDemo.Wpf", "Demos\SimpleDemo\SimpleDemo.Wpf\SimpleDemo.Wpf.csproj", "{882BD98A-2FF7-48B0-8D79-1EA52193CAE1}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleDemo.Avalonia", "Demos\SimpleDemo\SimpleDemo.Avalonia\SimpleDemo.Avalonia.csproj", "{AA7C540B-522B-474F-9866-860B6E251739}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -72,10 +72,18 @@ Global
{1BE23C45-838B-47E7-8437-90493CBEA59A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BE23C45-838B-47E7-8437-90493CBEA59A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BE23C45-838B-47E7-8437-90493CBEA59A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1C1AD720-523F-4144-8BA3-1E86461BC019}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1C1AD720-523F-4144-8BA3-1E86461BC019}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1C1AD720-523F-4144-8BA3-1E86461BC019}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1C1AD720-523F-4144-8BA3-1E86461BC019}.Release|Any CPU.Build.0 = Release|Any CPU
{320B6932-9C96-4A1C-A2FC-F393516AE13F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{320B6932-9C96-4A1C-A2FC-F393516AE13F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{320B6932-9C96-4A1C-A2FC-F393516AE13F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{320B6932-9C96-4A1C-A2FC-F393516AE13F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4179EC7D-789B-4570-91F9-A5D56251A6EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4179EC7D-789B-4570-91F9-A5D56251A6EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4179EC7D-789B-4570-91F9-A5D56251A6EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4179EC7D-789B-4570-91F9-A5D56251A6EE}.Release|Any CPU.Build.0 = Release|Any CPU
{ED2E6A4C-FE20-4CB8-953E-880C1EE31AE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED2E6A4C-FE20-4CB8-953E-880C1EE31AE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED2E6A4C-FE20-4CB8-953E-880C1EE31AE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -88,6 +96,10 @@ Global
{E2733B2F-5C55-4C2E-879F-1495C5E11A4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2733B2F-5C55-4C2E-879F-1495C5E11A4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2733B2F-5C55-4C2E-879F-1495C5E11A4B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9D695910-476E-4156-8AEE-4F2DDBE984FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9D695910-476E-4156-8AEE-4F2DDBE984FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9D695910-476E-4156-8AEE-4F2DDBE984FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9D695910-476E-4156-8AEE-4F2DDBE984FD}.Release|Any CPU.Build.0 = Release|Any CPU
{79572320-E719-4053-A12A-9D74E111FC5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79572320-E719-4053-A12A-9D74E111FC5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79572320-E719-4053-A12A-9D74E111FC5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -104,26 +116,14 @@ Global
{7A48AD22-69BF-49A7-8988-E163F779997E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A48AD22-69BF-49A7-8988-E163F779997E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A48AD22-69BF-49A7-8988-E163F779997E}.Release|Any CPU.Build.0 = Release|Any CPU
- {45823E3D-C3E2-4DFF-8952-1C5B52B3F950}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {45823E3D-C3E2-4DFF-8952-1C5B52B3F950}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {45823E3D-C3E2-4DFF-8952-1C5B52B3F950}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {45823E3D-C3E2-4DFF-8952-1C5B52B3F950}.Release|Any CPU.Build.0 = Release|Any CPU
- {1E99AC6C-40A7-418B-95E4-CA72D4A257CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1E99AC6C-40A7-418B-95E4-CA72D4A257CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1E99AC6C-40A7-418B-95E4-CA72D4A257CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1E99AC6C-40A7-418B-95E4-CA72D4A257CD}.Release|Any CPU.Build.0 = Release|Any CPU
- {0E0460C0-BA5B-44D7-815B-592C42505D7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0E0460C0-BA5B-44D7-815B-592C42505D7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0E0460C0-BA5B-44D7-815B-592C42505D7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0E0460C0-BA5B-44D7-815B-592C42505D7D}.Release|Any CPU.Build.0 = Release|Any CPU
- {DCC25078-D09F-4B0B-889C-F061BEF42A8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DCC25078-D09F-4B0B-889C-F061BEF42A8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DCC25078-D09F-4B0B-889C-F061BEF42A8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DCC25078-D09F-4B0B-889C-F061BEF42A8D}.Release|Any CPU.Build.0 = Release|Any CPU
- {882BD98A-2FF7-48B0-8D79-1EA52193CAE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {882BD98A-2FF7-48B0-8D79-1EA52193CAE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {882BD98A-2FF7-48B0-8D79-1EA52193CAE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {882BD98A-2FF7-48B0-8D79-1EA52193CAE1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C8944E3A-2D90-41D7-B16A-360CE60235A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C8944E3A-2D90-41D7-B16A-360CE60235A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C8944E3A-2D90-41D7-B16A-360CE60235A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C8944E3A-2D90-41D7-B16A-360CE60235A4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AA7C540B-522B-474F-9866-860B6E251739}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AA7C540B-522B-474F-9866-860B6E251739}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AA7C540B-522B-474F-9866-860B6E251739}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AA7C540B-522B-474F-9866-860B6E251739}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -131,21 +131,21 @@ Global
GlobalSection(NestedProjects) = preSolution
{F8E17C87-3554-4E81-9FB6-0BC0939EDA6B} = {87C5CCCC-7448-4802-B35F-C0BEA3FF880D}
{1BE23C45-838B-47E7-8437-90493CBEA59A} = {F8E17C87-3554-4E81-9FB6-0BC0939EDA6B}
+ {1C1AD720-523F-4144-8BA3-1E86461BC019} = {F8E17C87-3554-4E81-9FB6-0BC0939EDA6B}
{320B6932-9C96-4A1C-A2FC-F393516AE13F} = {417CE623-3714-4105-8A2F-4C1A7DB61AA7}
+ {4179EC7D-789B-4570-91F9-A5D56251A6EE} = {F8E17C87-3554-4E81-9FB6-0BC0939EDA6B}
{ED2E6A4C-FE20-4CB8-953E-880C1EE31AE6} = {417CE623-3714-4105-8A2F-4C1A7DB61AA7}
{B8BA7A12-25B1-445D-93B8-D0F34226D053} = {417CE623-3714-4105-8A2F-4C1A7DB61AA7}
{0D78D57D-5ED4-4898-A3E5-39C7B5ECEF0C} = {87C5CCCC-7448-4802-B35F-C0BEA3FF880D}
{E2733B2F-5C55-4C2E-879F-1495C5E11A4B} = {0D78D57D-5ED4-4898-A3E5-39C7B5ECEF0C}
+ {9D695910-476E-4156-8AEE-4F2DDBE984FD} = {0D78D57D-5ED4-4898-A3E5-39C7B5ECEF0C}
{79572320-E719-4053-A12A-9D74E111FC5E} = {417CE623-3714-4105-8A2F-4C1A7DB61AA7}
{ACD61563-7365-4287-8FE8-6B0C38C5E8E3} = {417CE623-3714-4105-8A2F-4C1A7DB61AA7}
{F23310EF-CC43-41C1-9C80-82B881764AC5} = {D96C6D53-E9ED-4E32-9856-B858A63C9D9E}
{DE4AECF4-649F-45C0-B260-419F68EB5707} = {748FD7C1-877B-451D-809A-68E032C39B34}
{7A48AD22-69BF-49A7-8988-E163F779997E} = {D96C6D53-E9ED-4E32-9856-B858A63C9D9E}
- {45823E3D-C3E2-4DFF-8952-1C5B52B3F950} = {D96C6D53-E9ED-4E32-9856-B858A63C9D9E}
- {1E99AC6C-40A7-418B-95E4-CA72D4A257CD} = {0D78D57D-5ED4-4898-A3E5-39C7B5ECEF0C}
- {0E0460C0-BA5B-44D7-815B-592C42505D7D} = {0D78D57D-5ED4-4898-A3E5-39C7B5ECEF0C}
- {DCC25078-D09F-4B0B-889C-F061BEF42A8D} = {F8E17C87-3554-4E81-9FB6-0BC0939EDA6B}
- {882BD98A-2FF7-48B0-8D79-1EA52193CAE1} = {F8E17C87-3554-4E81-9FB6-0BC0939EDA6B}
+ {C8944E3A-2D90-41D7-B16A-360CE60235A4} = {417CE623-3714-4105-8A2F-4C1A7DB61AA7}
+ {AA7C540B-522B-474F-9866-860B6E251739} = {F8E17C87-3554-4E81-9FB6-0BC0939EDA6B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C4DE08D7-0160-4FCF-876A-904438A56A8A}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/Bi.n.d.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/Bi.n.d.cs
new file mode 100644
index 00000000..1a7f3ca5
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/Bi.n.d.cs
@@ -0,0 +1,87 @@
+using System.Collections.Generic;
+using System.Windows;
+using MvvmCross.Base;
+using MvvmCross.Exceptions;
+using MvvmCross.Binding;
+using MvvmCross.Binding.Bindings;
+using MvvmCross;
+using Avalonia;
+using System;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ // ReSharper disable InconsistentNaming
+ public static class Bi
+ // ReSharper restore InconsistentNaming
+ {
+ static Bi()
+ {
+ MesDesignTimeChecker.Check();
+ }
+
+ // ReSharper disable InconsistentNaming
+#warning fix ndProperty
+ //public static readonly AvaloniaProperty ndProperty =
+ // // ReSharper restore InconsistentNaming
+ // AvaloniaProperty.RegisterAttached("nd",
+ // typeof(string),
+ // typeof(Bi),
+ // new AvaloniaProperty(null, CallBackWhenndIsChanged));
+
+ public static string Getnd(AvaloniaProperty obj)
+ {
+ //return obj.GetValue(ndProperty) as string;
+ throw new NotImplementedException();
+ }
+
+#warning fix Setnd
+ //public static void Setnd(
+ // StyledProperty obj,
+ // string value)
+ //{
+ // obj.SetValue(ndProperty, value);
+ //}
+
+ private static IMesBindingCreator _bindingCreator;
+
+ private static IMesBindingCreator BindingCreator
+ {
+ get
+ {
+ _bindingCreator = _bindingCreator ?? ResolveBindingCreator();
+ return _bindingCreator;
+ }
+ }
+
+ private static IMesBindingCreator ResolveBindingCreator()
+ {
+ IMesBindingCreator toReturn;
+ if (!Mvx.IoCProvider.TryResolve(out toReturn))
+ {
+ throw new MvxException("Unable to resolve the binding creator - have you initialized Windows Binding");
+ }
+
+ return toReturn;
+ }
+
+ private static void CallBackWhenndIsChanged(
+ object sender,
+ object args)
+ //StyledPropertyChangedEventArgs args)
+ {
+ //var bindingCreator = BindingCreator;
+
+ //bindingCreator?.CreateBindings(sender, args, ParseBindingDescriptions);
+ throw new NotImplementedException();
+ }
+
+ private static IEnumerable ParseBindingDescriptions(string bindingText)
+ {
+ throw new NotImplementedException();
+ //if (MvxSingleton.Instance == null)
+ // return null;
+
+ //return MvxSingleton.Instance.BindingDescriptionParser.Parse(bindingText);
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/IMesBindingCreator.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/IMesBindingCreator.cs
new file mode 100644
index 00000000..a658739c
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/IMesBindingCreator.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using MvvmCross.Binding.Bindings;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ public interface IMesBindingCreator
+ {
+ //void CreateBindings(
+ // object sender,
+ // DependencyPropertyChangedEventArgs args,
+ // Func> parseBindingDescriptions);
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/IMesWindowsAssemblyCache.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/IMesWindowsAssemblyCache.cs
new file mode 100644
index 00000000..e570205f
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/IMesWindowsAssemblyCache.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ public interface IMesWindowsAssemblyCache
+ {
+ IList Assemblies { get; }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/Import.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/Import.cs
new file mode 100644
index 00000000..9f593315
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/Import.cs
@@ -0,0 +1,59 @@
+using System.Reflection;
+using MvvmCross.Base;
+using MvvmCross.Converters;
+using MvvmCross.IoC;
+using MvvmCross.Binding.Combiners;
+using MvvmCross;
+using System;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ public class Import
+ {
+ static Import()
+ {
+ //MesDesignTimeChecker.Check();
+ throw new NotImplementedException();
+ }
+
+ private object _from;
+
+ public object From
+ {
+ get { return _from; }
+ set
+ {
+ if (_from == value)
+ return;
+
+ _from = value;
+ if (_from != null)
+ {
+ RegisterAssembly(_from.GetType().Assembly);
+ }
+ }
+ }
+
+ private static void RegisterAssembly(Assembly assembly)
+ {
+ if (MvxSingleton.Instance == null)
+ {
+ MesWindowsAssemblyCache.EnsureInitialized();
+ MesWindowsAssemblyCache.Instance?.Assemblies.Add(assembly);
+ }
+ else
+ {
+ Mvx.IoCProvider.CallbackWhenRegistered(
+ registry =>
+ {
+ registry.AddOrOverwriteFrom(assembly);
+ });
+ Mvx.IoCProvider.CallbackWhenRegistered(
+ registry =>
+ {
+ registry.AddOrOverwriteFrom(assembly);
+ });
+ }
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/La.n.g.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/La.n.g.cs
new file mode 100644
index 00000000..e8f5423d
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/La.n.g.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Windows;
+using System.Collections.Generic;
+using MvvmCross.Binding.Bindings;
+using MvvmCross.Base;
+using MvvmCross.Binding;
+using MvvmCross.Core;
+using Avalonia;
+using MvvmCross;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ // ReSharper disable InconsistentNaming
+ public static class La
+ // ReSharper restore InconsistentNaming
+ {
+ static La()
+ {
+ MesDesignTimeChecker.Check();
+ }
+
+ // ReSharper disable InconsistentNaming
+#warning fix ngProperty
+ //public static readonly AvaloniaProperty ngProperty =
+ // // ReSharper restore InconsistentNaming
+ // AvaloniaProperty.RegisterAttached("ng",
+ // typeof(string),
+ // typeof(La),
+ // new AvaloniaPropertyMetadata()); //null, CallBackWhenngIsChanged));
+
+ public static string Getng(AvaloniaObject obj)
+ {
+ //return obj.GetValue(ngProperty) as string;
+ throw new NotImplementedException();
+ }
+
+ public static void Setng(
+ AvaloniaObject obj,
+ string value)
+ {
+ //obj.SetValue(ngProperty, value);
+ throw new NotImplementedException();
+ }
+
+ private static IMesBindingCreator _bindingCreator;
+
+ private static IMesBindingCreator BindingCreator
+ {
+ get
+ {
+ _bindingCreator = _bindingCreator ?? Mvx.IoCProvider.Resolve();
+ return _bindingCreator;
+ }
+ }
+
+#warning fix CallBackWhenngIsChanged
+ //private static void CallBackWhenngIsChanged(
+ // object sender,
+ // DependencyPropertyChangedEventArgs args)
+ //{
+ // // bindingCreator may be null in the designer currently
+ // var bindingCreator = BindingCreator;
+ // if (bindingCreator == null)
+ // return;
+
+ // bindingCreator.CreateBindings(sender, args, ParseBindingDescriptions);
+ //}
+
+ private static IEnumerable ParseBindingDescriptions(string languageText)
+ {
+ if (MvxSingleton.Instance == null)
+ return null;
+
+ return MvxSingleton.Instance.BindingDescriptionParser.LanguageParse(languageText);
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/MesMvvmCrossBindingCreator.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/MesMvvmCrossBindingCreator.cs
new file mode 100644
index 00000000..c24530a3
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/MesMvvmCrossBindingCreator.cs
@@ -0,0 +1,130 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Avalonia;
+using MvvmCross.Binding;
+using MvvmCross.Binding.Bindings;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding.MesBinding
+{
+ public class MesMvvmCrossBindingCreator : MesBindingCreator
+ {
+ protected override void ApplyBindings(StyledElement attachedObject,
+ IEnumerable bindingDescriptions)
+ {
+ var binder = MvxBindingSingletonCache.Instance.Binder;
+ var bindingDescriptionList = bindingDescriptions.ToList();
+ var bindings = binder.Bind(attachedObject.DataContext, attachedObject, bindingDescriptionList);
+ RegisterBindingsForUpdates(attachedObject, bindings);
+ }
+
+ private void RegisterBindingsForUpdates(AvaloniaObject attachedObject,
+ IEnumerable bindings)
+ {
+ if (bindings == null)
+ return;
+
+ var bindingsList = GetOrCreateBindingsList(attachedObject);
+ foreach (var binding in bindings)
+ {
+ bindingsList.Add(binding);
+ }
+ }
+
+ private IList GetOrCreateBindingsList(AvaloniaObject attachedObject)
+ {
+ //var existing = attachedObject.GetValue(BindingsListProperty) as IList;
+ //if (existing != null)
+ // return existing;
+
+ //// attach the list
+ //var newList = new List();
+ //attachedObject.SetValue(BindingsListProperty, newList);
+
+ //// create a binding watcher for the list
+ //var binding = new System.Windows.Data.Binding();
+ //bool attached = false;
+ //Action attachAction = () =>
+ //{
+ // if (attached)
+ // return;
+ // BindingOperations.SetBinding(attachedObject, DataContextWatcherProperty, binding);
+ // attached = true;
+ //};
+
+ //Action detachAction = () =>
+ //{
+ // if (!attached)
+ // return;
+
+ // BindingOperations.ClearBinding(attachedObject, DataContextWatcherProperty);
+ // attached = false;
+ //};
+ //attachAction();
+ //attachedObject.Loaded += (o, args) =>
+ //{
+ // attachAction();
+ //};
+ //attachedObject.Unloaded += (o, args) =>
+ //{
+ // detachAction();
+ //};
+
+ //return newList;
+ throw new NotImplementedException();
+ }
+
+#warning fix DataContextWatcherProperty
+ //public static readonly AvaloniaProperty DataContextWatcherProperty = AvaloniaProperty.Register(
+ // "DataContextWatcher",
+ // typeof(object),
+ // typeof(AvaloniaObject),
+ // new AvaloniaPropertyMetadata(null, DataContext_Changed));
+
+ public static object GetDataContextWatcher(AvaloniaProperty d)
+ {
+ //return d.GetValue(DataContextWatcherProperty);
+ throw new NotImplementedException();
+ }
+
+ public static void SetDataContextWatcher(AvaloniaProperty d, string value)
+ {
+ //d.SetValue(DataContextWatcherProperty, value);
+ throw new NotImplementedException();
+ }
+
+#warning fix BindingsListProperty
+ //public static readonly AvaloniaProperty BindingsListProperty = AvaloniaProperty.Register(
+ // "BindingsList",
+ // typeof(IList),
+ // typeof(AvaloniaObject),
+ // new AvaloniaPropertyMetadata(null));
+
+ public static IList GetBindingsList(AvaloniaProperty d)
+ {
+ //return d.GetValue(BindingsListProperty) as IList;
+ throw new NotImplementedException();
+ }
+
+ public static void SetBindingsList(AvaloniaProperty d, string value)
+ {
+ //d.SetValue(BindingsListProperty, value);
+ throw new NotImplementedException();
+ }
+
+#warning fix DataContext_Changed
+ //private static void DataContext_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ //{
+ // var frameworkElement = d as AvaloniaObject;
+
+ // var bindings = frameworkElement?.GetValue(BindingsListProperty) as IList;
+ // if (bindings == null)
+ // return;
+
+ // foreach (var binding in bindings)
+ // {
+ // binding.DataContext = e.NewValue;
+ // }
+ //}
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/MesWindowsTargetBindingFactoryRegistry.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/MesWindowsTargetBindingFactoryRegistry.cs
new file mode 100644
index 00000000..55d59750
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/MesWindowsTargetBindingFactoryRegistry.cs
@@ -0,0 +1,52 @@
+using MinoriEditorShell.Platforms.Avalonia.Binding.MesBinding.Target;
+using MvvmCross.Binding;
+using MvvmCross.Binding.Bindings.Target;
+using MvvmCross.Binding.Bindings.Target.Construction;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding.MesBinding
+{
+ public class MesWindowsTargetBindingFactoryRegistry : MvxTargetBindingFactoryRegistry
+ {
+ protected override bool TryCreateReflectionBasedBinding(object target, string targetName,
+ out IMvxTargetBinding binding)
+ {
+ if (TryCreatePropertyDependencyBasedBinding(target, targetName, out binding))
+ {
+ return true;
+ }
+
+ return base.TryCreateReflectionBasedBinding(target, targetName, out binding);
+ }
+
+ private static bool TryCreatePropertyDependencyBasedBinding(object target, string targetName,
+ out IMvxTargetBinding binding)
+ {
+ if (target == null)
+ {
+ binding = null;
+ return false;
+ }
+
+ if (string.IsNullOrEmpty(targetName))
+ {
+ MvxBindingLog.Error(
+ "Empty binding target passed to MvxWindowsTargetBindingFactoryRegistry");
+ binding = null;
+ return false;
+ }
+
+ var dependencyProperty = target.GetType().FindDependencyProperty(targetName);
+ if (dependencyProperty == null)
+ {
+ binding = null;
+ return false;
+ }
+
+ var actualProperty = target.GetType().FindActualProperty(targetName);
+ var actualPropertyType = actualProperty?.PropertyType ?? typeof(object);
+
+ binding = new MesDependencyPropertyTargetBinding(target, targetName, dependencyProperty, actualPropertyType);
+ return true;
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/Target/MesCollapsedTargetBinding.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/Target/MesCollapsedTargetBinding.cs
new file mode 100644
index 00000000..29aa1241
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/Target/MesCollapsedTargetBinding.cs
@@ -0,0 +1,18 @@
+namespace MinoriEditorShell.Platforms.Avalonia.Binding.MesBinding.Target
+{
+ public class MesCollapsedTargetBinding : MesVisibleTargetBinding
+ {
+ public MesCollapsedTargetBinding(object target)
+ : base(target)
+ {
+ }
+
+ public override void SetValue(object value)
+ {
+ if (value == null)
+ value = false;
+ var boolValue = (bool)value;
+ base.SetValue(!boolValue);
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/Target/MesDependencyPropertyTargetBinding.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/Target/MesDependencyPropertyTargetBinding.cs
new file mode 100644
index 00000000..7e64f493
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/Target/MesDependencyPropertyTargetBinding.cs
@@ -0,0 +1,102 @@
+using System;
+using System.ComponentModel;
+using Avalonia;
+using MvvmCross.Binding;
+using MvvmCross.Binding.Bindings.Target;
+using MvvmCross.Binding.Extensions;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding.MesBinding.Target
+{
+ public class MesDependencyPropertyTargetBinding : MvxConvertingTargetBinding
+ {
+ private readonly string _targetName;
+ private readonly AvaloniaProperty _targetDependencyProperty;
+ private readonly Type _actualPropertyType;
+ private readonly TypeConverter _typeConverter;
+
+ public MesDependencyPropertyTargetBinding(object target, string targetName, AvaloniaProperty targetDependencyProperty, Type actualPropertyType)
+ : base(target)
+ {
+ _targetDependencyProperty = targetDependencyProperty;
+ _actualPropertyType = actualPropertyType;
+ _targetName = targetName;
+ _typeConverter = _actualPropertyType.TypeConverter();
+
+ // if we return TwoWay for ImageSource then we end up in
+ // problems with WP7 not doing the auto-conversion
+ // see some of my angst in http://stackoverflow.com/questions/16752242/how-does-xaml-create-the-string-to-bitmapimage-value-conversion-when-binding-to/16753488#16753488
+ // Note: if we discover other issues here, then we should make a more flexible solution
+
+#warning TODO: fix ImageSource
+ //if (_actualPropertyType == typeof(ImageSource))
+ //{
+ // _defaultBindingMode = MvxBindingMode.OneWay;
+ //}
+ }
+
+ public override void SubscribeToEvents()
+ {
+ //var frameworkElement = Target as FrameworkElement;
+ //if (frameworkElement == null)
+ // return;
+ //var listenerBinding = new System.Windows.Data.Binding(_targetName)
+ //{ Source = frameworkElement };
+
+ //var attachedProperty = DependencyProperty.RegisterAttached(
+ // "ListenAttached" + _targetName + Guid.NewGuid().ToString("N")
+ // , typeof(object)
+ // , typeof(FrameworkElement)
+ // , new PropertyMetadata(null, (s, e) => FireValueChanged(e.NewValue)));
+ //frameworkElement.SetBinding(attachedProperty, listenerBinding);
+ throw new NotImplementedException();
+ }
+
+ public override Type TargetType => _actualPropertyType;
+
+ private MvxBindingMode _defaultBindingMode = MvxBindingMode.TwoWay;
+ public override MvxBindingMode DefaultMode => _defaultBindingMode;
+
+ protected virtual object GetValueByReflection()
+ {
+ throw new NotImplementedException();
+ //var target = Target as FrameworkElement;
+ //if (target == null)
+ //{
+ // MvxBindingLog.Warning("Weak Target is null in {0} - skipping Get", GetType().Name);
+ // return null;
+ //}
+
+ //return target.GetValue(_targetDependencyProperty);
+ }
+
+ protected override void SetValueImpl(object target, object value)
+ {
+ throw new NotImplementedException();
+ //MvxBindingLog.Trace("Receiving setValue to " + (value ?? ""));
+ //var frameworkElement = target as FrameworkElement;
+ //if (frameworkElement == null)
+ //{
+ // MvxBindingLog.Warning("Weak Target is null in {0} - skipping set", GetType().Name);
+ // return;
+ //}
+
+ //frameworkElement.SetValue(_targetDependencyProperty, value);
+ }
+
+ protected override object MakeSafeValue(object value)
+ {
+ if (_actualPropertyType.IsInstanceOfType(value))
+ return value;
+
+ if (_typeConverter == null
+ || value == null)
+ // TODO - is this correct? Do we need to do more here? See #297
+ return _actualPropertyType.MakeSafeValue(value);
+
+ if (!_typeConverter.CanConvertFrom(value.GetType()))
+ return null; // TODO - is this correct? Do we need to do more here? See #297
+
+ return _typeConverter.ConvertFrom(value);
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/Target/MesVisibleTargetBinding.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/Target/MesVisibleTargetBinding.cs
new file mode 100644
index 00000000..49d8f4f4
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBinding/Target/MesVisibleTargetBinding.cs
@@ -0,0 +1,28 @@
+using Avalonia;
+using Avalonia.Controls;
+using MvvmCross.Binding;
+using System;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding.MesBinding.Target
+{
+ public class MesVisibleTargetBinding : MesDependencyPropertyTargetBinding
+ {
+ public MesVisibleTargetBinding(object target)
+ : base(target, "Visibility", Visual.IsVisibleProperty, typeof(StyledProperty))
+ {
+
+ }
+
+ public override MvxBindingMode DefaultMode => MvxBindingMode.OneWay;
+
+ public override Type TargetType => typeof(bool);
+
+ public override void SetValue(object value)
+ {
+ if (value == null)
+ value = false;
+ var boolValue = (bool)value;
+ base.SetValue(boolValue);// ? Visibility.Visible : Visibility.Collapsed);
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBindingCreator.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBindingCreator.cs
new file mode 100644
index 00000000..cfa79c48
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesBindingCreator.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using MvvmCross.Logging;
+using MvvmCross.Binding.Bindings;
+using Avalonia;
+using MvvmCross;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ public abstract class MesBindingCreator : IMesBindingCreator
+ {
+ //public void CreateBindings(object sender, DependencyPropertyChangedEventArgs args,
+ // Func> parseBindingDescriptions)
+ //{
+ // var attachedObject = sender as StyledElement;
+ // if (attachedObject == null)
+ // {
+ // IMvxLog _log = Mvx.IoCProvider.Resolve().GetLogFor();
+ // _log.Warn("Null attached StyledElement seen in Bi.nd binding");
+ // return;
+ // }
+
+ // var text = args.NewValue as string;
+ // if (string.IsNullOrEmpty(text))
+ // return;
+
+ // var bindingDescriptions = parseBindingDescriptions(text);
+ // if (bindingDescriptions == null)
+ // return;
+
+ // ApplyBindings(attachedObject, bindingDescriptions);
+ //}
+
+ protected abstract void ApplyBindings(StyledElement attachedObject,
+ IEnumerable bindingDescriptions);
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesDependencyPropertyExtensions.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesDependencyPropertyExtensions.cs
new file mode 100644
index 00000000..e0cb1d58
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesDependencyPropertyExtensions.cs
@@ -0,0 +1,78 @@
+using Avalonia;
+using System;
+using System.ComponentModel;
+using System.Linq;
+using System.Reflection;
+using System.Windows;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ public static class MesDependencyPropertyExtensions
+ {
+ public static TypeConverter TypeConverter(this Type type)
+ {
+ var typeConverter =
+ type.GetCustomAttributes(typeof(TypeConverterAttribute), true).FirstOrDefault() as
+ TypeConverterAttribute;
+ if (typeConverter == null)
+ return null;
+
+ var converterType = Type.GetType(typeConverter.ConverterTypeName);
+ if (converterType == null)
+ return null;
+ var converter = Activator.CreateInstance(converterType) as TypeConverter;
+
+ return converter;
+ }
+
+ public static PropertyInfo FindActualProperty(this Type type, string name)
+ {
+ if (string.IsNullOrEmpty(name))
+ return null;
+
+ var property = type.GetProperty(name, BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance);
+ return property;
+ }
+
+ public static FieldInfo FindDependencyPropertyInfo(this Type type, string dependencyPropertyName)
+ {
+ if (string.IsNullOrEmpty(dependencyPropertyName))
+ return null;
+
+ if (!EnsureIsDependencyPropertyName(ref dependencyPropertyName))
+ return null;
+
+ var candidateType = type;
+ while (candidateType != null)
+ {
+ var fieldInfo = candidateType.GetField(dependencyPropertyName, BindingFlags.Static | BindingFlags.Public);
+ if (fieldInfo != null)
+ return fieldInfo;
+
+ candidateType = candidateType.BaseType;
+ }
+
+ return null;
+ }
+
+ public static AvaloniaProperty FindDependencyProperty(this Type type, string name)
+ {
+ if (string.IsNullOrEmpty(name))
+ return null;
+
+ var propertyInfo = FindDependencyPropertyInfo(type, name);
+
+ return propertyInfo?.GetValue(null) as AvaloniaProperty;
+ }
+
+ private static bool EnsureIsDependencyPropertyName(ref string dependencyPropertyName)
+ {
+ if (string.IsNullOrEmpty(dependencyPropertyName))
+ return false;
+
+ if (!dependencyPropertyName.EndsWith("Property"))
+ dependencyPropertyName += "Property";
+ return true;
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesDesignTimeChecker.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesDesignTimeChecker.cs
new file mode 100644
index 00000000..ff42270e
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesDesignTimeChecker.cs
@@ -0,0 +1,30 @@
+using MvvmCross;
+using MvvmCross.Binding.Parse.Binding;
+using System;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ public static class MesDesignTimeChecker
+ {
+ private static bool _checked;
+
+ public static void Check()
+ {
+ //if (_checked)
+ // return;
+
+ //_checked = true;
+ //if (!MvxDesignTimeHelper.IsInDesignTime)
+ // return;
+
+ //MvxDesignTimeHelper.Initialize();
+
+ //if (!Mvx.IoCProvider.CanResolve())
+ //{
+ // var builder = new MesWindowsBindingBuilder(MesWindowsBindingBuilder.BindingType.MvvmCross);
+ // builder.DoRegistration();
+ //}
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsAssemblyCache.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsAssemblyCache.cs
new file mode 100644
index 00000000..c1285d14
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsAssemblyCache.cs
@@ -0,0 +1,42 @@
+using System.Collections.Generic;
+using System.Reflection;
+using MvvmCross.Base;
+using MvvmCross.Exceptions;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ ///
+ /// Assembly cache setup
+ ///
+ public class MesWindowsAssemblyCache
+ : MvxSingleton
+ , IMesWindowsAssemblyCache
+ {
+ ///
+ /// Helper to make sure class is init properly
+ ///
+ public static void EnsureInitialized()
+ {
+ if (Instance != null)
+ return;
+
+ MesWindowsAssemblyCache instance = new MesWindowsAssemblyCache();
+
+ if (Instance != instance)
+ throw new MvxException("Error initialising MvxWindowsAssemblyCache");
+ }
+
+ ///
+ /// Setups assbembly cache
+ ///
+ public MesWindowsAssemblyCache()
+ {
+ Assemblies = new List();
+ }
+
+ ///
+ /// Gets assembly cache
+ ///
+ public IList Assemblies { get; }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsBindingBuilder.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsBindingBuilder.cs
new file mode 100644
index 00000000..006fd8b8
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsBindingBuilder.cs
@@ -0,0 +1,133 @@
+using System;
+using MvvmCross.Base;
+using MvvmCross.Converters;
+using MvvmCross.Binding;
+using MvvmCross.Binding.Binders;
+using MvvmCross.Binding.Bindings.Target.Construction;
+using MvvmCross.Binding.Combiners;
+using MvvmCross.IoC;
+using MinoriEditorShell.Platforms.Avalonia.Binding.MesBinding;
+using MvvmCross;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ public class MesWindowsBindingBuilder : MvxBindingBuilder
+ {
+ public enum BindingType
+ {
+ Windows,
+ MvvmCross
+ }
+
+ private readonly BindingType _bindingType;
+
+ public MesWindowsBindingBuilder(
+ BindingType bindingType = BindingType.MvvmCross)
+ {
+ _bindingType = bindingType;
+ }
+
+ public override void DoRegistration(IMvxIoCProvider iocProvider)
+ {
+ base.DoRegistration(iocProvider);
+ InitializeBindingCreator();
+ }
+
+ protected override void RegisterBindingFactories(IMvxIoCProvider iocProvider)
+ {
+ switch (_bindingType)
+ {
+ case BindingType.Windows:
+ // no need for MvvmCross binding factories - so don't create them
+ break;
+
+ case BindingType.MvvmCross:
+ base.RegisterBindingFactories(iocProvider);
+ break;
+
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+
+ protected override IMvxTargetBindingFactoryRegistry CreateTargetBindingRegistry()
+ {
+ switch (_bindingType)
+ {
+ case BindingType.Windows:
+ return base.CreateTargetBindingRegistry();
+
+ case BindingType.MvvmCross:
+ return new MesWindowsTargetBindingFactoryRegistry();
+
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+
+ private void InitializeBindingCreator()
+ {
+ var creator = CreateBindingCreator();
+ Mvx.IoCProvider.RegisterSingleton(creator);
+ }
+
+ protected virtual IMesBindingCreator CreateBindingCreator()
+ {
+ switch (_bindingType)
+ {
+ //case BindingType.Windows:
+ // return new MesWindowsBindingCreator();
+
+ case BindingType.MvvmCross:
+ return new MesMvvmCrossBindingCreator();
+
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+ }
+
+ protected override void FillValueConverters(IMvxValueConverterRegistry registry)
+ {
+ base.FillValueConverters(registry);
+
+ if (MvxSingleton.Instance != null)
+ {
+ foreach (var assembly in MvxSingleton.Instance.Assemblies)
+ {
+ registry.Fill(assembly);
+ }
+ }
+ }
+
+ protected override void FillValueCombiners(IMvxValueCombinerRegistry registry)
+ {
+ base.FillValueCombiners(registry);
+
+ if (MvxSingleton.Instance != null)
+ {
+ foreach (var assembly in MvxSingleton.Instance.Assemblies)
+ {
+ registry.Fill(assembly);
+ }
+ }
+ }
+
+ protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
+ {
+#warning fix FillTargetFactories
+ //registry.RegisterCustomBindingFactory(
+ // MesWindowsPropertyBinding.FrameworkElement_Visible,
+ // view => new MvxVisibleTargetBinding(view));
+
+ //registry.RegisterCustomBindingFactory(
+ // MesWindowsPropertyBinding.FrameworkElement_Collapsed,
+ // view => new MvxCollapsedTargetBinding(view));
+
+ //registry.RegisterCustomBindingFactory(
+ // MesWindowsPropertyBinding.FrameworkElement_Hidden,
+ // view => new MvxCollapsedTargetBinding(view));
+
+ base.FillTargetFactories(registry);
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsPropertyBinding.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsPropertyBinding.cs
new file mode 100644
index 00000000..8da903b2
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsPropertyBinding.cs
@@ -0,0 +1,9 @@
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ internal static class MesWindowsPropertyBinding
+ {
+ public const string FrameworkElement_Visible = "Visible";
+ public const string FrameworkElement_Collapsed = "Collapsed";
+ public const string FrameworkElement_Hidden = "Hidden";
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsPropertyBindingExtensions.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsPropertyBindingExtensions.cs
new file mode 100644
index 00000000..9f94ae3f
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/MesWindowsPropertyBindingExtensions.cs
@@ -0,0 +1,16 @@
+using Avalonia;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding
+{
+ public static class MesWindowsPropertyBindingExtensions
+ {
+ public static string BindVisible(this AvaloniaObject frameworkElement)
+ => MesWindowsPropertyBinding.FrameworkElement_Visible;
+
+ public static string BindCollapsed(this AvaloniaObject frameworkElement)
+ => MesWindowsPropertyBinding.FrameworkElement_Collapsed;
+
+ public static string BindHidden(this AvaloniaObject frameworkElement)
+ => MesWindowsPropertyBinding.FrameworkElement_Hidden;
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/WindowsBinding/AvnWindowsBindingCreator.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/WindowsBinding/AvnWindowsBindingCreator.cs
new file mode 100644
index 00000000..d9f8999d
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Binding/WindowsBinding/AvnWindowsBindingCreator.cs
@@ -0,0 +1,110 @@
+using System;
+using System.Collections.Generic;
+using MvvmCross.Converters;
+using MvvmCross.Logging;
+using MvvmCross.Binding;
+using MvvmCross.Binding.Bindings;
+using MvvmCross.Binding.Bindings.SourceSteps;
+using Avalonia.Data;
+using MinoriEditorShell.Platforms.Avalonia.Binding;
+using Avalonia.Data.Core;
+using Avalonia.Data.Converters;
+using MinoriEditorShell.Platforms.Avalonia.Converters;
+using Avalonia;
+using MvvmCross;
+using Microsoft.Extensions.Logging;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Binding.WindowsBinding
+{
+ public class AvnWindowsBindingCreator : MesBindingCreator
+ {
+ protected virtual void ApplyBinding(MvxBindingDescription bindingDescription, Type actualType,
+ StyledElement attachedObject)
+ {
+ ILogger log = MvxLogHost.GetLog();
+ AvaloniaProperty dependencyProperty = actualType.FindDependencyProperty(bindingDescription.TargetName);
+ if (dependencyProperty == null)
+ {
+ log.LogWarning("Dependency property not found for {0}", bindingDescription.TargetName);
+ return;
+ }
+
+ var property = actualType.FindActualProperty(bindingDescription.TargetName);
+ if (property == null)
+ {
+ log.LogWarning("Property not returned {0} - may cause issues", bindingDescription.TargetName);
+ }
+
+ var sourceStep = bindingDescription.Source as MvxPathSourceStepDescription;
+ if (sourceStep == null)
+ {
+ log.LogWarning("Binding description for {0} is not a simple path - Windows Binding cannot cope with this", bindingDescription.TargetName);
+ return;
+ }
+
+ throw new NotImplementedException();
+ //var newBinding = new
+ //{
+ // Path = new PropertyPath(sourceStep.SourcePropertyPath),
+ // Mode = ConvertMode(bindingDescription.Mode, property?.PropertyType ?? typeof(object)),
+ // Converter = GetConverter(sourceStep.Converter),
+ // ConverterParameter = sourceStep.ConverterParameter,
+ //};
+
+ //BindingOperations.Apply(attachedObject, dependencyProperty, newBinding);
+ }
+
+ protected override void ApplyBindings(StyledElement attachedObject,
+ IEnumerable bindingDescriptions)
+ {
+ var actualType = attachedObject.GetType();
+ foreach (var bindingDescription in bindingDescriptions)
+ {
+ ApplyBinding(bindingDescription, actualType, attachedObject);
+ }
+ }
+
+ protected static IValueConverter GetConverter(IMvxValueConverter converter)
+ {
+ if (converter == null)
+ return null;
+
+ // TODO - consider caching this wrapper - it is a tiny bit wasteful creating a wrapper for each binding
+ return new MvxNativeValueConverter(converter);
+ }
+
+ protected static BindingMode ConvertMode(MvxBindingMode mode, Type propertyType)
+ {
+ switch (mode)
+ {
+ case MvxBindingMode.Default:
+ // if we return TwoWay for ImageSource then we end up in
+ // problems with WP7 not doing the auto-conversion
+ // see some of my angst in http://stackoverflow.com/questions/16752242/how-does-xaml-create-the-string-to-bitmapimage-value-conversion-when-binding-to/16753488#16753488
+ // Note: if we discover other issues here, then we should make a more flexible solution
+#warning fix ImageSource
+ //if (propertyType == typeof(ImageSource))
+ // return BindingMode.OneWay;
+
+ return BindingMode.TwoWay;
+
+ case MvxBindingMode.TwoWay:
+ return BindingMode.TwoWay;
+
+ case MvxBindingMode.OneWay:
+ return BindingMode.OneWay;
+
+ case MvxBindingMode.OneTime:
+ return BindingMode.OneTime;
+
+ case MvxBindingMode.OneWayToSource:
+ ILogger log = MvxLogHost.GetLog();
+ log.LogWarning("WinPhone doesn't support OneWayToSource");
+ return BindingMode.TwoWay;
+
+ default:
+ throw new ArgumentOutOfRangeException(nameof(mode));
+ }
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesClippingHwndHost.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesClippingHwndHost.cs
new file mode 100644
index 00000000..3f4acdda
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesClippingHwndHost.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+using System.Windows;
+// using System.Windows.Interop;
+// using System.Windows.Media;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ // public class MesClippingHwndHost : HwndHost
+ // {
+ // private HwndSource _source;
+
+ // public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
+ // "Content", typeof(Visual), typeof(MesClippingHwndHost),
+ // new PropertyMetadata(OnContentChanged));
+
+ // private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ // {
+ // MesClippingHwndHost hwndHost = (MesClippingHwndHost)d;
+
+ // if (e.OldValue != null)
+ // {
+ // if (hwndHost._source != null)
+ // {
+ // hwndHost._source.RootVisual = null;
+ // }
+
+ // hwndHost.RemoveLogicalChild(e.OldValue);
+ // }
+
+ // if (e.NewValue != null)
+ // {
+ // hwndHost.AddLogicalChild(e.NewValue);
+ // if (hwndHost._source != null)
+ // {
+ // hwndHost._source.RootVisual = (Visual)e.NewValue;
+ // }
+ // }
+ // }
+
+ // public Visual Content
+ // {
+ // get => (Visual)GetValue(ContentProperty);
+ // set => SetValue(ContentProperty, value);
+ // }
+
+ // protected override IEnumerator LogicalChildren
+ // {
+ // get
+ // {
+ // if (Content != null)
+ // {
+ // yield return Content;
+ // }
+ // }
+ // }
+
+ // protected override HandleRef BuildWindowCore(HandleRef hwndParent)
+ // {
+ // HwndSourceParameters param = new HwndSourceParameters("MinoriEditorStudioClippingHwndHost", (Int32)Width, (Int32)Height)
+ // {
+ // ParentWindow = hwndParent.Handle,
+ // WindowStyle = NativeMethods.WS_VISIBLE | NativeMethods.WS_CHILD,
+ // };
+
+ // _source = new HwndSource(param)
+ // {
+ // RootVisual = Content
+ // };
+
+ // return new HandleRef(null, _source.Handle);
+ // }
+
+ // protected override void DestroyWindowCore(HandleRef hwnd)
+ // {
+ // _source.Dispose();
+ // _source = null;
+ // }
+
+ // protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
+ // {
+ // // If we don't do this, HwndHost doesn't seem to pick up on all size changes.
+ // UpdateWindowPos();
+
+ // base.OnRenderSizeChanged(sizeInfo);
+ // }
+ //}
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesCustomToggleButton.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesCustomToggleButton.cs
new file mode 100644
index 00000000..5e8cedfc
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesCustomToggleButton.cs
@@ -0,0 +1,12 @@
+//using System.Windows.Controls.Primitives;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ // public class MesCustomToggleButton : ToggleButton
+ // {
+ // protected override void OnToggle()
+ // {
+ // // Don't update IsChecked - we'll do that with a binding.
+ // }
+ // }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesDockDock.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesDockDock.cs
new file mode 100644
index 00000000..51fbad88
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesDockDock.cs
@@ -0,0 +1,24 @@
+using Dock.Model.Controls;
+using MinoriEditorShell.Platforms.Avalonia.Core;
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ internal class MesDockDock : MesDockBase, IDockDock
+ {
+ private Boolean _lastChildFill = true;
+
+ ///
+ /// if last child
+ ///
+ [DataMember(IsRequired = false, EmitDefaultValue = true)]
+ public Boolean LastChildFill
+ {
+ get => _lastChildFill;
+ set => SetProperty(ref _lastChildFill, value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesDocumentDock.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesDocumentDock.cs
new file mode 100644
index 00000000..f01d561c
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesDocumentDock.cs
@@ -0,0 +1,31 @@
+using Dock.Model.Controls;
+using MinoriEditorShell.Platforms.Avalonia.Core;
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Windows.Input;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ public class MesDocumentDock : MesDockBase, IDocumentDock
+ {
+ private Boolean _canCreateDocument;
+
+ ///
+ /// Determine if we can crate command
+ ///
+ [DataMember(IsRequired = false, EmitDefaultValue = true)]
+ public Boolean CanCreateDocument
+ {
+ get => _canCreateDocument;
+ set => SetProperty(ref _canCreateDocument, value);
+ }
+
+ ///
+ /// Command to create document
+ ///
+ [IgnoreDataMember]
+ public ICommand CreateDocument { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesDynamicStyle.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesDynamicStyle.cs
new file mode 100644
index 00000000..ae6c684f
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesDynamicStyle.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Windows;
+//using System.Windows.Controls;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ // Based on http://stackoverflow.com/questions/9490264/dynamicresource-for-style-basedon
+ // public class MesDynamicStyle
+ // {
+ // public static readonly DependencyProperty BaseStyleProperty = DependencyProperty.RegisterAttached(
+ // "BaseStyle", typeof(Style), typeof(MesDynamicStyle),
+ // new PropertyMetadata(OnStylesChanged));
+
+ // public static Style GetBaseStyle(DependencyObject obj)
+ // {
+ // return (Style)obj.GetValue(BaseStyleProperty);
+ // }
+
+ // public static void SetBaseStyle(DependencyObject obj, Style value)
+ // {
+ // obj.SetValue(BaseStyleProperty, value);
+ // }
+
+ // public static readonly DependencyProperty DerivedStyleProperty = DependencyProperty.RegisterAttached(
+ // "DerivedStyle", typeof(Style), typeof(MesDynamicStyle),
+ // new PropertyMetadata(OnStylesChanged));
+
+ // public static Style GetDerivedStyle(DependencyObject obj)
+ // {
+ // return (Style)obj.GetValue(DerivedStyleProperty);
+ // }
+
+ // public static void SetDerivedStyle(DependencyObject obj, Style value)
+ // {
+ // obj.SetValue(DerivedStyleProperty, value);
+ // }
+
+ // private static void OnStylesChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
+ // {
+ // var mergedStyles = GetMergedStyles(target, GetBaseStyle(target), GetDerivedStyle(target));
+ // var element = (FrameworkElement)target;
+ // element.Style = mergedStyles;
+ // }
+
+ // public static readonly DependencyProperty ItemContainerBaseStyleProperty = DependencyProperty.RegisterAttached(
+ // "ItemContainerBaseStyle", typeof(Style), typeof(MesDynamicStyle),
+ // new PropertyMetadata(OnItemContainerStylesChanged));
+
+ // public static Style GetItemContainerBaseStyle(DependencyObject obj)
+ // {
+ // return (Style)obj.GetValue(ItemContainerBaseStyleProperty);
+ // }
+
+ // public static void SetItemContainerBaseStyle(DependencyObject obj, Style value)
+ // {
+ // obj.SetValue(ItemContainerBaseStyleProperty, value);
+ // }
+
+ // public static readonly DependencyProperty ItemContainerDerivedStyleProperty = DependencyProperty.RegisterAttached(
+ // "ItemContainerDerivedStyle", typeof(Style), typeof(MesDynamicStyle),
+ // new PropertyMetadata(OnItemContainerStylesChanged));
+
+ // public static Style GetItemContainerDerivedStyle(DependencyObject obj)
+ // {
+ // return (Style)obj.GetValue(ItemContainerDerivedStyleProperty);
+ // }
+
+ // public static void SetItemContainerDerivedStyle(DependencyObject obj, Style value)
+ // {
+ // obj.SetValue(ItemContainerDerivedStyleProperty, value);
+ // }
+
+ // private static void OnItemContainerStylesChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
+ // {
+ // var mergedStyles = GetMergedStyles(target,
+ // GetItemContainerBaseStyle(target),
+ // GetItemContainerDerivedStyle(target));
+ // var element = (ItemsControl)target;
+ // element.ItemContainerStyle = mergedStyles;
+ // }
+
+ // public static Style GetMergedStyles(DependencyObject target, Style baseStyle, Style derivedStyle)
+ // where T : DependencyObject
+ // {
+ // if (!(target is T))
+ // throw new InvalidCastException("Target must be " + typeof(T));
+
+ // if (derivedStyle == null) return baseStyle;
+ // if (baseStyle == null) return derivedStyle;
+
+ // var newStyle = new Style { BasedOn = baseStyle, TargetType = derivedStyle.TargetType };
+ // foreach (var setter in derivedStyle.Setters) newStyle.Setters.Add(setter);
+ // foreach (var trigger in derivedStyle.Triggers) newStyle.Triggers.Add(trigger);
+ // return newStyle;
+ // }
+ // }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesExpanderEx.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesExpanderEx.cs
new file mode 100644
index 00000000..f322a180
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesExpanderEx.cs
@@ -0,0 +1,14 @@
+using System.Windows;
+//using System.Windows.Controls;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ // public class MesExpanderEx : Expander
+ // {
+ // static MesExpanderEx()
+ // {
+ // DefaultStyleKeyProperty.OverrideMetadata(typeof(MesExpanderEx),
+ // new FrameworkPropertyMetadata(typeof(MesExpanderEx)));
+ // }
+ // }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesLayoutInitializer.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesLayoutInitializer.cs
new file mode 100644
index 00000000..2786803e
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesLayoutInitializer.cs
@@ -0,0 +1,118 @@
+// using AvalonDock.Layout;
+using MinoriEditorShell.Services;
+using System;
+using System.Linq;
+using System.Windows;
+//using System.Windows.Controls;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ // public class MesLayoutInitializer : ILayoutUpdateStrategy
+ // {
+ // // public Boolean BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
+ // // {
+ // // if (anchorableToShow.Content is IMesTool tool)
+ // // {
+ // // MesPaneLocation preferredLocation = tool.PreferredLocation;
+ // // String paneName = GetPaneName(preferredLocation);
+ // // LayoutAnchorablePane toolsPane = layout.Descendents().OfType().FirstOrDefault(d => d.Name == paneName);
+ // // if (toolsPane == null)
+ // // {
+ // // switch (preferredLocation)
+ // // {
+ // // case MesPaneLocation.Left:
+ // // toolsPane = CreateAnchorablePane(layout, Orientation.Horizontal, paneName, InsertPosition.Start);
+ // // break;
+
+ // // case MesPaneLocation.Right:
+ // // toolsPane = CreateAnchorablePane(layout, Orientation.Horizontal, paneName, InsertPosition.End);
+ // // break;
+
+ // // case MesPaneLocation.Bottom:
+ // // toolsPane = CreateAnchorablePane(layout, Orientation.Vertical, paneName, InsertPosition.End);
+ // // break;
+
+ // // default:
+ // // throw new ArgumentOutOfRangeException();
+ // // }
+ // // }
+ // // toolsPane.Children.Add(anchorableToShow);
+ // // return true;
+ // // }
+
+ // // return false;
+ // // }
+
+ // // private static String GetPaneName(MesPaneLocation location)
+ // // {
+ // // switch (location)
+ // // {
+ // // case MesPaneLocation.Left:
+ // // return "LeftPane";
+
+ // // case MesPaneLocation.Right:
+ // // return "RightPane";
+
+ // // case MesPaneLocation.Bottom:
+ // // return "BottomPane";
+
+ // // default:
+ // // throw new ArgumentOutOfRangeException("location");
+ // // }
+ // // }
+
+ // // private static LayoutAnchorablePane CreateAnchorablePane(LayoutRoot layout, Orientation orientation,
+ // // String paneName, InsertPosition position)
+ // // {
+ // // LayoutPanel parent = layout.Descendents().OfType().First(d => d.Orientation == orientation);
+ // // LayoutAnchorablePane toolsPane = new LayoutAnchorablePane { Name = paneName };
+ // // if (position == InsertPosition.Start)
+ // // {
+ // // parent.InsertChildAt(0, toolsPane);
+ // // }
+ // // else
+ // // {
+ // // parent.Children.Add(toolsPane);
+ // // }
+
+ // // return toolsPane;
+ // // }
+
+ // // private enum InsertPosition
+ // // {
+ // // Start,
+ // // End
+ // // }
+
+ // // public void AfterInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableShown)
+ // // {
+ // // // If this is the first anchorable added to this pane, then use the preferred size.
+ // // if (anchorableShown.Content is IMesTool tool)
+ // // {
+ // // if (anchorableShown.Parent is LayoutAnchorablePane anchorablePane && anchorablePane.ChildrenCount == 1)
+ // // {
+ // // switch (tool.PreferredLocation)
+ // // {
+ // // case MesPaneLocation.Left:
+ // // case MesPaneLocation.Right:
+ // // anchorablePane.DockWidth = new GridLength(tool.PreferredWidth, GridUnitType.Pixel);
+ // // break;
+
+ // // case MesPaneLocation.Bottom:
+ // // anchorablePane.DockHeight = new GridLength(tool.PreferredHeight, GridUnitType.Pixel);
+ // // break;
+
+ // // default:
+ // // throw new ArgumentOutOfRangeException();
+ // // }
+ // // }
+ // // }
+ // // }
+
+ // // public Boolean BeforeInsertDocument(LayoutRoot layout, LayoutDocument anchorableToShow, ILayoutContainer destinationContainer) => false;
+
+ // // public void AfterInsertDocument(LayoutRoot layout, LayoutDocument anchorableShown)
+ // // {
+ // // }
+ // }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesPanesStyleSelector.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesPanesStyleSelector.cs
new file mode 100644
index 00000000..3f7fb354
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesPanesStyleSelector.cs
@@ -0,0 +1,28 @@
+using MinoriEditorShell.Services;
+using System;
+using System.Windows;
+//using System.Windows.Controls;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ // public class MesPanesStyleSelector : StyleSelector
+ // {
+ // public Style ToolStyle { get; set; }
+ // public Style DocumentStyle { get; set; }
+
+ // public override Style SelectStyle(Object item, DependencyObject container)
+ // {
+ // switch (item)
+ // {
+ // case IMesTool _:
+ // return ToolStyle;
+
+ // case IMesDocument _:
+ // return DocumentStyle;
+
+ // default:
+ // return base.SelectStyle(item, container);
+ // }
+ // }
+ // }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesPanesTemplateSelector.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesPanesTemplateSelector.cs
new file mode 100644
index 00000000..f6cacf4c
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesPanesTemplateSelector.cs
@@ -0,0 +1,27 @@
+using MinoriEditorShell.Services;
+using System.Windows;
+//using System.Windows.Controls;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ // public class MesPanesTemplateSelector : DataTemplateSelector
+ // {
+ // public DataTemplate ToolTemplate { get; set; }
+ // public DataTemplate DocumentTemplate { get; set; }
+
+ // public override DataTemplate SelectTemplate(object item, DependencyObject container)
+ // {
+ // switch (item)
+ // {
+ // case IMesTool _:
+ // return ToolTemplate;
+
+ // case IMesDocument _:
+ // return DocumentTemplate;
+
+ // default:
+ // return base.SelectTemplate(item, container);
+ // }
+ // }
+ // }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesProportionalDock.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesProportionalDock.cs
new file mode 100644
index 00000000..f0d3fd3e
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesProportionalDock.cs
@@ -0,0 +1,27 @@
+using Dock.Model.Controls;
+using Dock.Model.Core;
+using MinoriEditorShell.Platforms.Avalonia.Core;
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ ///
+ /// Proportional dock.
+ ///
+ [DataContract(IsReference = true)]
+ public class MesProportionalDock : MesDockBase, IProportionalDock
+ {
+ private Orientation _orientation;
+
+ ///
+ [DataMember(IsRequired = false, EmitDefaultValue = true)]
+ public Orientation Orientation
+ {
+ get => _orientation;
+ set => SetProperty(ref _orientation, value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesProportionalDockSplitter.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesProportionalDockSplitter.cs
new file mode 100644
index 00000000..2184476b
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesProportionalDockSplitter.cs
@@ -0,0 +1,9 @@
+using Dock.Model.Controls;
+using MinoriEditorShell.Platforms.Avalonia.Core;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ public class MesProportionalDockSplitter : MesDockableBase, IProportionalDockSplitter
+ {
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesRootDock.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesRootDock.cs
new file mode 100644
index 00000000..ee97f9e8
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesRootDock.cs
@@ -0,0 +1,73 @@
+using Dock.Model.Controls;
+using Dock.Model.Core;
+using MinoriEditorShell.Platforms.Avalonia.Core;
+using MvvmCross.Commands;
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Windows.Input;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ ///
+ /// Main root dock
+ ///
+ public class MesRootDock : MesDockBase, IRootDock
+ {
+ private Boolean _isFocusableRoot = true;
+ private IDockWindow _window;
+ private IList _windows;
+
+ ///
+ /// is root focusable
+ ///
+ [DataMember(IsRequired = false, EmitDefaultValue = true)]
+ public Boolean IsFocusableRoot
+ {
+ get => _isFocusableRoot;
+ set => SetProperty(ref _isFocusableRoot, value);
+ }
+
+ ///
+ /// Dockable Window
+ ///
+ [DataMember(IsRequired = false, EmitDefaultValue = true)]
+ public IDockWindow Window
+ {
+ get => _window;
+ set => SetProperty(ref _window, value);
+ }
+
+ ///
+ /// List of windows
+ ///
+ [DataMember(IsRequired = false, EmitDefaultValue = true)]
+ public IList Windows
+ {
+ get => _windows;
+ set => SetProperty(ref _windows, value);
+ }
+
+ ///
+ /// Initializes new instance of the class.
+ ///
+ public MesRootDock()
+ {
+ ShowWindows = new MvxCommand(() => _navigateAdapter.ShowWindows());
+ ExitWindows = new MvxCommand(() => _navigateAdapter.ExitWindows());
+ }
+
+ ///
+ /// Show window command
+ ///
+ [IgnoreDataMember]
+ public ICommand ShowWindows { get; }
+
+ ///
+ /// Exit window command
+ ///
+ [IgnoreDataMember]
+ public ICommand ExitWindows { get; }
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesSliderEx.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesSliderEx.cs
new file mode 100644
index 00000000..a8995dfa
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesSliderEx.cs
@@ -0,0 +1,33 @@
+using System.ComponentModel;
+// using System.Windows.Controls;
+// using System.Windows.Controls.Primitives;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ ///
+ /// Slider that exposes the thumb drag started / completed events directly
+ /// to allow Caliburn Micro to attach to the messages.
+ ///
+// public class MesSliderEx : Slider
+// {
+// [Category("Behavior")]
+// public event DragStartedEventHandler ThumbDragStarted;
+
+// [Category("Behavior")]
+// public event DragCompletedEventHandler ThumbDragCompleted;
+
+// protected override void OnThumbDragStarted(DragStartedEventArgs e)
+// {
+// ThumbDragStarted?.Invoke(this, e);
+
+// base.OnThumbDragStarted(e);
+// }
+
+// protected override void OnThumbDragCompleted(DragCompletedEventArgs e)
+// {
+// ThumbDragCompleted?.Invoke(this, e);
+
+// base.OnThumbDragCompleted(e);
+// }
+// }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesToolDock.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesToolDock.cs
new file mode 100644
index 00000000..022432aa
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesToolDock.cs
@@ -0,0 +1,58 @@
+using Dock.Model.Controls;
+using Dock.Model.Core;
+using MinoriEditorShell.Platforms.Avalonia.Core;
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using System.Text;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ public class MesToolDock : MesDockBase, IToolDock
+ {
+ private Alignment _alignment = Alignment.Unset;
+ private Boolean _isExpanded;
+ private Boolean _autoHide = true;
+ private GripMode _gripMode = GripMode.Visible;
+
+ ///
+ /// Current Alignment
+ ///
+ [DataMember(IsRequired = false, EmitDefaultValue = true)]
+ public Alignment Alignment
+ {
+ get => _alignment;
+ set => SetProperty(ref _alignment, value);
+ }
+
+ ///
+ /// Is expandable?
+ ///
+ [DataMember(IsRequired = false, EmitDefaultValue = true)]
+ public Boolean IsExpanded
+ {
+ get => _isExpanded;
+ set => SetProperty(ref _isExpanded, value);
+ }
+
+ ///
+ /// Is Autohide is set?
+ ///
+ [DataMember(IsRequired = false, EmitDefaultValue = true)]
+ public Boolean AutoHide
+ {
+ get => _autoHide;
+ set => SetProperty(ref _autoHide, value);
+ }
+
+ ///
+ /// Type of grip
+ ///
+ [DataMember(IsRequired = false, EmitDefaultValue = true)]
+ public GripMode GripMode
+ {
+ get => _gripMode;
+ set => SetProperty(ref _gripMode, value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesVisualTreeUtility.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesVisualTreeUtility.cs
new file mode 100644
index 00000000..a289b919
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesVisualTreeUtility.cs
@@ -0,0 +1,23 @@
+using System.Windows;
+//using System.Windows.Media;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Controls
+{
+ public static class MesVisualTreeUtility
+ {
+ // public static T FindParent(DependencyObject child)
+ // where T : DependencyObject
+ // {
+ // var parentObject = VisualTreeHelper.GetParent(child);
+
+ // if (parentObject == null)
+ // return null;
+
+ // var parent = parentObject as T;
+ // if (parent != null)
+ // return parent;
+
+ // return FindParent(parentObject);
+ // }
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/BoolToInsertModeConverter.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/BoolToInsertModeConverter.cs
new file mode 100644
index 00000000..d3c98582
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/BoolToInsertModeConverter.cs
@@ -0,0 +1,26 @@
+using Avalonia.Data.Converters;
+using System;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Converters
+{
+ public class BoolToInsertModeConverter : IValueConverter
+ {
+ #region IValueConverter Members
+
+ public Object Convert(Object value, Type targetType, Object parameter, System.Globalization.CultureInfo culture)
+ {
+ Boolean? actValue = value as Boolean?;
+ if (actValue == null)
+ {
+ return null;
+ }
+
+ return actValue == false ? "INS" : "OVR";
+ }
+
+ public Object ConvertBack(Object value, Type targetType, Object parameter,
+ System.Globalization.CultureInfo culture) => throw new NotImplementedException();
+
+ #endregion IValueConverter Members
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/DrawingColorToMediaBrushConverter.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/DrawingColorToMediaBrushConverter.cs
new file mode 100644
index 00000000..65f750db
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/DrawingColorToMediaBrushConverter.cs
@@ -0,0 +1,33 @@
+using Avalonia.Data.Converters;
+using Avalonia.Media;
+using System;
+using System.Globalization;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Converters
+{
+ ///
+ /// Convert between media brush and drawing color
+ ///
+ public class DrawingColorToMediaBrushConverter : IValueConverter
+ {
+ ///
+ /// Convert from Drawing Color to meda brush
+ ///
+ public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
+ {
+ System.Drawing.Color? color = value as System.Drawing.Color?;
+ return color == null ? null :
+ new SolidColorBrush(Color.FromArgb(color.Value.A, color.Value.R, color.Value.G, color.Value.B));
+ }
+
+ ///
+ /// Reverse convert from media brush to drawing color
+ ///
+ public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
+ {
+ Color? color = value as Color?;
+ return color == null ? System.Drawing.Color.Empty :
+ System.Drawing.Color.FromArgb(color.Value.A, color.Value.R, color.Value.G, color.Value.B);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/DrawingColorToMediaColorConverter.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/DrawingColorToMediaColorConverter.cs
new file mode 100644
index 00000000..90ef02a3
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/DrawingColorToMediaColorConverter.cs
@@ -0,0 +1,32 @@
+using Avalonia.Data.Converters;
+using Avalonia.Media;
+using System;
+using System.Globalization;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Converters
+{
+ ///
+ /// Drawing color to media color
+ ///
+ public class DrawingColorToMediaColorConverter : IValueConverter
+ {
+ ///
+ /// Convert from Drawing Color to meda brush
+ ///
+ public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
+ {
+ System.Drawing.Color? color = value as System.Drawing.Color?;
+ return color == null ? null : (Object)Color.FromArgb(color.Value.A, color.Value.R, color.Value.G, color.Value.B);
+ }
+
+ ///
+ /// Back convert to drawing color from media brush
+ ///
+ public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
+ {
+ Color? color = value as Color?;
+ return color == null ? System.Drawing.Color.Empty :
+ System.Drawing.Color.FromArgb(color.Value.A, color.Value.R, color.Value.G, color.Value.B);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/MvxNativeValueConverters.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/MvxNativeValueConverters.cs
new file mode 100644
index 00000000..5d24ba81
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/MvxNativeValueConverters.cs
@@ -0,0 +1,69 @@
+using Avalonia.Data.Converters;
+using Avalonia.Markup.Xaml;
+using MvvmCross.Converters;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Converters
+{
+ public class MvxNativeValueConverter
+ : MarkupExtension, IValueConverter
+ {
+ private readonly IMvxValueConverter _wrapped;
+
+ public MvxNativeValueConverter(IMvxValueConverter wrapped)
+ {
+ _wrapped = wrapped;
+ }
+
+ protected IMvxValueConverter Wrapped => _wrapped;
+
+ public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var toReturn = _wrapped.Convert(value, targetType, parameter, culture);
+ return MapIfSpecialValue(toReturn);
+ }
+
+ public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var toReturn = _wrapped.ConvertBack(value, targetType, parameter, culture);
+ return MapIfSpecialValue(toReturn);
+ }
+
+ private static object MapIfSpecialValue(object toReturn)
+ {
+ if (toReturn == MvxBindingConstant.DoNothing)
+ {
+ throw new NotImplementedException();
+ //return System.Windows.Data.Binding.DoNothing;
+ }
+
+ if (toReturn == MvxBindingConstant.UnsetValue)
+ {
+ throw new NotImplementedException();
+ //return DependencyProperty.UnsetValue;
+ }
+
+ return toReturn;
+ }
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return this;
+ }
+ }
+
+ public class MvxNativeValueConverter
+ : MvxNativeValueConverter
+ where T : IMvxValueConverter, new()
+ {
+ protected new T Wrapped => (T)base.Wrapped;
+
+ public MvxNativeValueConverter()
+ : base(new T())
+ {
+ }
+ }
+}
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/NativeConverters.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/NativeConverters.cs
new file mode 100644
index 00000000..0f066d30
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/NativeConverters.cs
@@ -0,0 +1,8 @@
+// using MvvmCross.Platforms.Wpf.Converters;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Converters
+{
+ // public class CultureInfoNameConverter : MvxNativeValueConverter
+ // {
+ // }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/NullObjectToVisibiltyConverter.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/NullObjectToVisibiltyConverter.cs
new file mode 100644
index 00000000..c429eac3
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/NullObjectToVisibiltyConverter.cs
@@ -0,0 +1,16 @@
+using Avalonia.Data.Converters;
+using System;
+using System.Globalization;
+using System.Windows;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Converters
+{
+ public class NullObjectToVisibiltyConverter : IValueConverter
+ {
+ public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) =>
+ //(value == null) ? Visibility.Collapsed : Visibility.Visible;
+ null;
+
+ public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture) => null;
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/NullableValueConverter.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/NullableValueConverter.cs
new file mode 100644
index 00000000..d10b0c4f
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/NullableValueConverter.cs
@@ -0,0 +1,26 @@
+using Avalonia;
+using Avalonia.Data.Converters;
+using System;
+using System.Globalization;
+using System.Windows;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Converters
+{
+ ///
+ /// Converts from nullss
+ ///
+ public class NullableValueConverter : IValueConverter
+ {
+ ///
+ ///
+ ///
+ public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) =>
+ value ?? AvaloniaProperty.UnsetValue;
+
+ ///
+ /// Do nothing
+ ///
+ public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture) =>
+ throw new NotSupportedException();
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/TreeViewIndentConverter.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/TreeViewIndentConverter.cs
new file mode 100644
index 00000000..0f9500d7
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Converters/TreeViewIndentConverter.cs
@@ -0,0 +1,44 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Data.Converters;
+using System;
+using System.Globalization;
+using System.Windows;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Converters
+{
+ public class TreeViewIndentConverter : IValueConverter
+ {
+ public double Indent { get; set; }
+
+ private static int GetItemDepth(TreeViewItem item)
+ {
+ AvaloniaObject target = item;
+
+ var depth = 0;
+ //do
+ //{
+ // if (target is TreeView)
+ // return depth - 1;
+ // if (target is TreeViewItem)
+ // depth++;
+ //} while ((target = VisualTreeHelper.GetParent(target)) != null);
+
+ //return 0;
+ throw new NotImplementedException();
+ }
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (!(value is TreeViewItem item))
+ return new Thickness(0);
+
+ return new Thickness(Indent * GetItemDepth(item), 0, 0, 0);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Core/IMesAvnSetup.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Core/IMesAvnSetup.cs
new file mode 100644
index 00000000..8d123078
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Core/IMesAvnSetup.cs
@@ -0,0 +1,13 @@
+using Avalonia.Controls;
+using Avalonia.Threading;
+using MinoriEditorShell.Platforms.Avalonia.Presenters;
+using MvvmCross.Core;
+
+namespace MinoriEditorShell.Platforms.Avalonia
+{
+ public interface IMvxAvnSetup : IMvxSetup
+ {
+ void PlatformInitialize(Dispatcher uiThreadDispatcher, IMesAvnViewPresenter presenter);
+ void PlatformInitialize(Dispatcher uiThreadDispatcher, ContentControl root);
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Core/MesAvnSetup.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Core/MesAvnSetup.cs
new file mode 100644
index 00000000..bd49138d
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Core/MesAvnSetup.cs
@@ -0,0 +1,287 @@
+using Avalonia.Controls;
+using MinoriEditorShell.Messages;
+using MinoriEditorShell.Modules.Services;
+using MinoriEditorShell.Platforms.Avalonia.Presenters;
+using MinoriEditorShell.Platforms.Avalonia.Views;
+using MinoriEditorShell.Platforms.Avalonia.Services;
+using MinoriEditorShell.Services;
+using MinoriEditorShell.ViewModels;
+using MvvmCross;
+using MvvmCross.Core;
+using MvvmCross.IoC;
+using MvvmCross.Plugin;
+using MvvmCross.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Threading;
+using MvvmCross.Presenters;
+using MinoriEditorShell.Platforms.Wpf.ViewModels;
+using Avalonia.Threading;
+using System.Reflection;
+using System.Linq;
+using MvvmCross.Views;
+using MvvmCross.Binding;
+using MvvmCross.Converters;
+using MvvmCross.Binding.BindingContext;
+using MvvmCross.Binding.Bindings.Target.Construction;
+using MvvmCross.Binding.Binders;
+using Microsoft.Extensions.Logging;
+using MinoriEditorShell.Platforms.Avalonia.Binding;
+using MinoriEditorShell.Platforms.Avalonia.ViewModels;
+
+// Portions of this was barrowed from MvvmCross.
+namespace MinoriEditorShell.Platforms.Avalonia
+{
+ ///
+ /// This is the main initializer for the kit. Call or over-ride this simualr to any other MvxWpfSetup setup
+ ///
+ public abstract class MesAvnSetup : MvxSetup, IMvxAvnSetup
+ {
+ // To handle messages between classes
+ private MvvmCross.Plugin.Messenger.IMvxMessenger _messenger;
+
+ private IMesAvnViewPresenter _presenter;
+ private ContentControl _root;
+ private Dispatcher _uiThreadDispatcher;
+
+ protected IMesAvnViewPresenter Presenter
+ {
+ get
+ {
+ _presenter = CreateViewPresenter(_root);
+ return _presenter;
+ }
+ }
+
+ protected virtual IEnumerable ValueConverterAssemblies
+ {
+ get
+ {
+ List toReturn = new List();
+ toReturn.AddRange(GetViewModelAssemblies());
+ toReturn.AddRange(GetViewAssemblies());
+ return toReturn;
+ }
+ }
+
+ protected virtual List ValueConverterHolders => new List();
+
+ public override IEnumerable GetViewAssemblies()
+ {
+ return base.GetViewAssemblies().Union(new[] { Assembly.GetEntryAssembly() });
+ }
+
+ ///
+ /// Sets up initial connected types and setup
+ ///
+ public override void InitializePrimary()
+ {
+ base.InitializePrimary();
+
+ // register necessary interfaces
+ Mvx.IoCProvider.LazyConstructAndRegisterSingleton();
+ Mvx.IoCProvider.LazyConstructAndRegisterSingleton();
+ Mvx.IoCProvider.LazyConstructAndRegisterSingleton();
+ Mvx.IoCProvider.RegisterType();
+
+ // Register themes
+ Mvx.IoCProvider.LazyConstructAndRegisterSingleton();
+
+ // try to setup culture info
+ String code = Properties.Settings.Default.LanguageCode;
+
+ if (!String.IsNullOrWhiteSpace(code))
+ {
+ CultureInfo culture = CultureInfo.GetCultureInfo(code);
+ // If code == "en", force to use default resource (Resources.resx)
+ // See PO #243
+#warning fix translator depends
+ //if (!Translator.Cultures.Contains(culture))
+ // culture = CultureInfo.InvariantCulture;
+ //Translator.Culture = culture;
+ Thread.CurrentThread.CurrentUICulture = culture;
+ Thread.CurrentThread.CurrentCulture = culture;
+ }
+ }
+
+ ///
+ /// Load any additional plugins, calling parent
+ ///
+ ///
+ public override void LoadPlugins(IMvxPluginManager pluginManager)
+ {
+ base.LoadPlugins(pluginManager);
+ pluginManager.EnsurePluginLoaded();
+ }
+
+ ///
+ /// Setup class based on presenter
+ ///
+ ///
+ ///
+ public void PlatformInitialize(Dispatcher uiThreadDispatcher, IMesAvnViewPresenter presenter)
+ {
+ _uiThreadDispatcher = uiThreadDispatcher;
+ _presenter = presenter;
+ }
+
+ ///
+ /// Setup presenter based on content
+ ///
+ ///
+ ///
+ public void PlatformInitialize(Dispatcher uiThreadDispatcher, ContentControl root)
+ {
+ _uiThreadDispatcher = uiThreadDispatcher;
+ _root = root;
+ }
+
+ ///
+ /// Creates the app.
+ ///
+ /// An instance of MvxApplication
+ protected override IMvxApplication CreateApp(IMvxIoCProvider iocProvider)
+ {
+ _messenger = iocProvider.Resolve();
+ Properties.Settings.Default.PropertyChanged += (s, e) =>
+ {
+ MesSettingsChangedMessage message = new MesSettingsChangedMessage(
+ s, e.PropertyName,
+ Properties.Settings.Default.PropertyValues[e.PropertyName]);
+ _messenger.Publish(message);
+ };
+
+ throw new NotImplementedException();
+ //return new TApplication();
+ }
+
+ protected virtual IMesAvnViewsContainer CreateAvnViewsContainer()
+ {
+ return new MesAvnViewsContainer();
+ }
+
+ protected virtual MvxBindingBuilder CreateBindingBuilder()
+ {
+ return new MesWindowsBindingBuilder();
+ }
+
+ ///
+ /// Used to ensure plugins are loaded.
+ ///
+ /// returns base manager
+ protected override IMvxPluginManager CreatePluginManager(IMvxIoCProvider iocProvider)
+ {
+ IMvxPluginManager manager = base.CreatePluginManager(iocProvider);
+ manager.EnsurePluginLoaded();
+ return manager;
+ }
+
+ protected override IMvxViewDispatcher CreateViewDispatcher()
+ {
+ return new MesAvnViewDispatcher(_uiThreadDispatcher, Presenter);
+ }
+
+ ///
+ /// Creates the inital view for the setup
+ ///
+ /// Control of the main windows for wpf
+ ///
+ protected virtual IMesAvnViewPresenter CreateViewPresenter(ContentControl root)
+ {
+ return new MesAvnViewPresenter(root);
+ }
+
+ protected override IMvxViewsContainer CreateViewsContainer(IMvxIoCProvider iocProvider)
+ {
+ if (iocProvider is null) throw new ArgumentNullException(nameof(iocProvider));
+
+ IMesAvnViewsContainer toReturn = CreateAvnViewsContainer();
+ iocProvider.RegisterSingleton(toReturn);
+ return toReturn;
+ }
+
+ protected override IMvxNameMapping CreateViewToViewModelNaming()
+ {
+ return new MvxPostfixAwareViewToViewModelNameMapping("View", "Control");
+ }
+
+ protected virtual void FillBindingNames(IMvxBindingNameRegistry registry)
+ {
+ // this base class does nothing
+ }
+
+ protected virtual void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
+ {
+ // this base class does nothing
+ }
+
+ protected virtual void FillValueConverters(IMvxValueConverterRegistry registry)
+ {
+ registry.Fill(ValueConverterAssemblies);
+ registry.Fill(ValueConverterHolders);
+ }
+
+ protected virtual void InitializeBindingBuilder(IMvxIoCProvider iocProvider)
+ {
+ RegisterBindingBuilderCallbacks(iocProvider);
+ var bindingBuilder = CreateBindingBuilder();
+ bindingBuilder.DoRegistration(iocProvider);
+ }
+
+ protected override void InitializeFirstChance(IMvxIoCProvider iocProvider)
+ {
+ RegisterPresenter(iocProvider);
+ base.InitializeFirstChance(iocProvider);
+ }
+
+ protected override void InitializeLastChance(IMvxIoCProvider iocProvider)
+ {
+ InitializeBindingBuilder(iocProvider);
+ base.InitializeLastChance(iocProvider);
+ }
+
+ ///
+ /// Sets up the dictionary that connects the viewmodel to the view.
+ ///
+ ///
+ protected override IDictionary InitializeLookupDictionary(IMvxIoCProvider iocProvider)
+ {
+ IDictionary container = base.InitializeLookupDictionary(iocProvider);
+ container.Add(typeof(MesSettingsManagerViewModel), typeof(MesSettingsView));
+ container.Add(typeof(MesGeneralSettingsViewModel), typeof(MesGeneralSettingsView));
+ return container;
+ }
+
+ protected virtual void RegisterBindingBuilderCallbacks(IMvxIoCProvider iocProvider)
+ {
+ if (iocProvider is null) throw new ArgumentNullException(nameof(iocProvider));
+
+ iocProvider.CallbackWhenRegistered(FillValueConverters);
+ iocProvider.CallbackWhenRegistered(FillTargetFactories);
+ iocProvider.CallbackWhenRegistered(FillBindingNames);
+ }
+
+ protected virtual void RegisterPresenter(IMvxIoCProvider iocProvider)
+ {
+ if (iocProvider is null) throw new ArgumentNullException(nameof(iocProvider));
+
+ var presenter = Presenter;
+ iocProvider.RegisterSingleton(presenter);
+ iocProvider.RegisterSingleton(presenter);
+ }
+ }
+
+ ///
+ /// This is the main initializer for the kit. Call or over-ride this simualr to any other MvxWpfSetup setup
+ ///
+ ///
+ public abstract class MesAvnSetup : MesAvnSetup where TApplication : class, IMvxApplication, new()
+ {
+ public override IEnumerable GetViewModelAssemblies() => new[] { typeof(TApplication).GetTypeInfo().Assembly };
+
+ protected override IMvxApplication CreateApp(IMvxIoCProvider iocProvider) => iocProvider.IoCConstruct();
+
+ protected override IMvxViewsContainer CreateViewsContainer(IMvxIoCProvider iocProvider) => base.CreateViewsContainer(iocProvider);
+ }
+}
\ No newline at end of file
diff --git a/Modules/MinoriEditorShell.Platforms.Avalonia/Core/MesDockBase.cs b/Modules/MinoriEditorShell.Platforms.Avalonia/Core/MesDockBase.cs
new file mode 100644
index 00000000..d10a0a59
--- /dev/null
+++ b/Modules/MinoriEditorShell.Platforms.Avalonia/Core/MesDockBase.cs
@@ -0,0 +1,196 @@
+using Dock.Model.Adapters;
+using Dock.Model.Core;
+using MvvmCross.Commands;
+using System;
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Windows.Input;
+
+namespace MinoriEditorShell.Platforms.Avalonia.Core
+{
+ ///
+ /// Base of dockable interfaces
+ ///
+ public abstract class MesDockBase : MesDockableBase, IDock
+ {
+ internal readonly INavigateAdapter _navigateAdapter;
+ private IList _visibleDockables;
+ private IList _hiddenDockables;
+ private IList _pinnedDockables;
+ private IDockable _activeDockable;
+ private IDockable _defaultDockable;
+ private IDockable _focusedDockable;
+ private Double _proportion = Double.NaN;
+ private DockMode _dock = DockMode.Center;
+ private Boolean _isCollapsable = true;
+ private Boolean _isActive;
+
+ ///
+ /// Initializes new instance of the class.
+ ///
+ protected MesDockBase()
+ {
+ _navigateAdapter = new NavigateAdapter(this);
+ GoBack = new MvxCommand(() => _navigateAdapter.GoBack());
+ GoForward = new MvxCommand(() => _navigateAdapter.GoForward());
+ Navigate = new MvxCommand