50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Xceed.Wpf.AvalonDock.Layout;
|
|
using UAF.Application.Models;
|
|
using Monolith.Models;
|
|
|
|
namespace Monolith
|
|
{
|
|
public class MonolithLayoutInitializer : ILayoutUpdateStrategy
|
|
{
|
|
public void AfterInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableShown)
|
|
{
|
|
|
|
}
|
|
|
|
public void AfterInsertDocument(LayoutRoot layout, LayoutDocument anchorableShown)
|
|
{
|
|
|
|
}
|
|
|
|
public bool BeforeInsertAnchorable(LayoutRoot layout, LayoutAnchorable anchorableToShow, ILayoutContainer destinationContainer)
|
|
{
|
|
if (destinationContainer != null &&
|
|
destinationContainer.FindParent<LayoutFloatingWindow>() != null)
|
|
return false;
|
|
|
|
if (anchorableToShow.Content is LogToolModel)
|
|
return true; // Disabled.
|
|
|
|
if (anchorableToShow.Content is HostedProcessModel)
|
|
{
|
|
var documentsPane = layout.Descendents().OfType<LayoutDocumentPane>().FirstOrDefault();
|
|
if (documentsPane != null)
|
|
{
|
|
documentsPane.Children.Add(anchorableToShow);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public bool BeforeInsertDocument(LayoutRoot layout, LayoutDocument anchorableToShow, ILayoutContainer destinationContainer)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|