Skip to content

Commit 65036c3

Browse files
committed
change perms
1 parent 1d648f9 commit 65036c3

13 files changed

Lines changed: 336 additions & 233 deletions

Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesDocumentDock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace MinoriEditorShell.Platforms.Avalonia.Controls
1010
{
11-
internal class MesDocumentDock : MesDockBase, IDocumentDock
11+
public class MesDocumentDock : MesDockBase, IDocumentDock
1212
{
1313
private Boolean _canCreateDocument;
1414

Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesProportionalDock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace MinoriEditorShell.Platforms.Avalonia.Controls
1212
/// Proportional dock.
1313
/// </summary>
1414
[DataContract(IsReference = true)]
15-
internal class MesProportionalDock : MesDockBase, IProportionalDock
15+
public class MesProportionalDock : MesDockBase, IProportionalDock
1616
{
1717
private Orientation _orientation;
1818

Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesRootDock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace MinoriEditorShell.Platforms.Avalonia.Controls
1313
/// <summary>
1414
/// Main root dock
1515
/// </summary>
16-
internal class MesRootDock : MesDockBase, IRootDock
16+
public class MesRootDock : MesDockBase, IRootDock
1717
{
1818
private Boolean _isFocusableRoot = true;
1919
private IDockWindow _window;

Modules/MinoriEditorShell.Platforms.Avalonia/Controls/MesToolDock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace MinoriEditorShell.Platforms.Avalonia.Controls
1010
{
11-
internal class MesToolDock : MesDockBase, IToolDock
11+
public class MesToolDock : MesDockBase, IToolDock
1212
{
1313
private Alignment _alignment = Alignment.Unset;
1414
private Boolean _isExpanded;

Modules/MinoriEditorShell.Platforms.Avalonia/MinoriEditorShell.Platforms.Avalonia.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,14 @@
3232
</ItemGroup>
3333

3434
<ItemGroup>
35+
<ProjectReference Include="..\..\..\..\MvvmCross\MvvmCross.Plugins\Messenger\MvvmCross.Plugin.Messenger.csproj" />
36+
<ProjectReference Include="..\..\..\..\MvvmCross\MvvmCross\MvvmCross.csproj" />
3537
<ProjectReference Include="..\MinoriEditorShell\MinoriEditorShell.csproj" />
3638

3739
<PackageReference Include="Avalonia" Version="0.10.10" />
3840
<PackageReference Include="Avalonia.Desktop" Version="0.10.10" />
3941
<PackageReference Include="Dock.Avalonia" Version="0.10.8" />
4042
<PackageReference Include="Dock.Model" Version="0.10.8" />
41-
<PackageReference Include="MvvmCross" Version="8.0.2" />
42-
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="8.0.2" />
43-
<PackageReference Include="MvvmCross.Plugin.ResxLocalization" Version="8.0.2" />
4443
<PackageReference Include="System.ComponentModel.Composition" Version="5.0.0" />
4544
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" />
4645
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />

Modules/MinoriEditorShell.Platforms.Avalonia/Presenters/MesAvnViewPresenter.cs

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Avalonia.Controls;
22
using Dock.Model.Controls;
3+
using Dock.Model.Core;
34
using Microsoft.Extensions.Logging;
45
using MinoriEditorShell.Platforms.Avalonia.Presenters.Attributes;
56
using MinoriEditorShell.Platforms.Avalonia.ViewModels;
@@ -199,35 +200,59 @@ protected virtual Task<bool> CloseWindow(IMvxViewModel toClose)
199200
/// Depending on what the type is, will define where the class goes.
200201
/// Either to MesDocumentManager or main view if not a IMesDocument or IMesTool
201202
/// </summary>
202-
/// <param name="element"></param>
203+
/// <param name="view"></param>
203204
/// <param name="attribute"></param>
204205
/// <param name="request"></param>
205206
/// <returns></returns>
206-
protected async Task<Boolean> ShowContentView(
207-
IMvxView element, MesContentPresentationAttribute attribute, MvxViewModelRequest request)
207+
protected async Task<Boolean> ShowContentView(IMvxView view, MesContentPresentationAttribute attribute, MvxViewModelRequest request)
208208
{
209209
try
210210
{
211211
// Everything that passes here should be a view
212-
IMvxView view = element as IMvxView;
213212
MesDocumentManagerViewModel manager = (MesDocumentManagerViewModel)Mvx.IoCProvider.Resolve<IMesDocumentManager>();
214213

215214
// from which we can now get the view model.
216215
switch (view.ViewModel)
217216
{
218217
case IMesDocument document:
218+
{
219+
// Try to set view, this is needed for DocumentManager
220+
IMesDocument docViewModel = (IMesDocument)view.ViewModel;
221+
docViewModel.View = view; // Needed for Binding with AvalonDock
219222

220-
// Try to set view, this is needed for DocumentManager
221-
IMesDocument docViewModel = (IMesDocument)view.ViewModel;
222-
docViewModel.View = view; // Needed for Binding with AvalonDock
223+
MesDocumentWrapper documentWrapper = new(docViewModel);
223224

224-
MesDocumentWrapper documentWrapper = new(docViewModel);
225+
// Add to manager model
226+
IDocumentDock docdock = manager.DocumentDock;
227+
IRootDock layout = manager.Layout;
225228

226-
// Add to manager model
227-
//manager.Documents.Add(docViewModel);
228-
manager.AddDockable(manager.GetDockable<IDocumentDock>("Files"), documentWrapper);
229-
_log.LogTrace($"Add {document} to IMesDocumentManager.Documents");
230-
return true;
229+
if (layout is { } && docdock is { })
230+
{
231+
manager.DocumentDock.VisibleDockables.Add(documentWrapper);
232+
manager.AddDockable(docdock, documentWrapper);
233+
manager.SetActiveDockable(documentWrapper);
234+
manager.SetFocusedDockable(layout, documentWrapper);
235+
236+
_log.LogTrace($"Add {document} to IMesDocumentManager.Documents");
237+
}
238+
else
239+
{
240+
_log.LogTrace("There was an error attaching to layout");
241+
}
242+
243+
// ---------- remove after test
244+
ContentControl contentControl = FrameworkElementsDictionary.Keys.FirstOrDefault(w => (w as MesWindow)?.Identifier == attribute.WindowIdentifier)
245+
?? FrameworkElementsDictionary.Keys.Last();
246+
247+
if (!attribute.StackNavigation && FrameworkElementsDictionary[contentControl].Any())
248+
FrameworkElementsDictionary[contentControl].Pop(); // Close previous view
249+
250+
FrameworkElementsDictionary[contentControl].Push((Control)view);
251+
contentControl.Content = documentWrapper;
252+
_log.LogTrace($"Passing to parent {view.ViewModel}");
253+
254+
return true;
255+
}
231256

232257
case IMesTool tool:
233258
// Try to set view, this is needed for DocumentManager
@@ -240,16 +265,18 @@ protected async Task<Boolean> ShowContentView(
240265
return true;
241266

242267
default:
243-
_log.LogTrace($"Passing to parent {view.ViewModel}");
244-
ContentControl contentControl = FrameworkElementsDictionary.Keys.FirstOrDefault(w => (w as MesWindow)?.Identifier == attribute.WindowIdentifier)
245-
?? FrameworkElementsDictionary.Keys.Last();
246-
247-
if (!attribute.StackNavigation && FrameworkElementsDictionary[contentControl].Any())
248-
FrameworkElementsDictionary[contentControl].Pop(); // Close previous view
249-
250-
FrameworkElementsDictionary[contentControl].Push((Control)element);
251-
contentControl.Content = element;
252-
return true;
268+
{
269+
_log.LogTrace($"Passing to parent {view.ViewModel}");
270+
ContentControl contentControl = FrameworkElementsDictionary.Keys.FirstOrDefault(w => (w as MesWindow)?.Identifier == attribute.WindowIdentifier)
271+
?? FrameworkElementsDictionary.Keys.Last();
272+
273+
if (!attribute.StackNavigation && FrameworkElementsDictionary[contentControl].Any())
274+
FrameworkElementsDictionary[contentControl].Pop(); // Close previous view
275+
276+
FrameworkElementsDictionary[contentControl].Push((Control)view);
277+
contentControl.Content = view;
278+
return true;
279+
}
253280
}
254281
}
255282
catch (Exception exception)

0 commit comments

Comments
 (0)