mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-16 22:26:36 +08:00
项目结构调整
This commit is contained in:
34
Others/Dragablz/Dragablz/DefaultInterTabClient.cs
Normal file
34
Others/Dragablz/Dragablz/DefaultInterTabClient.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Dragablz.Core;
|
||||
|
||||
namespace Dragablz
|
||||
{
|
||||
public class DefaultInterTabClient : IInterTabClient
|
||||
{
|
||||
public virtual INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source)
|
||||
{
|
||||
if (source == null) throw new ArgumentNullException("source");
|
||||
var sourceWindow = Window.GetWindow(source);
|
||||
if (sourceWindow == null) throw new ApplicationException("Unable to ascertain source window.");
|
||||
var newWindow = (Window)Activator.CreateInstance(sourceWindow.GetType());
|
||||
|
||||
newWindow.Dispatcher.Invoke(new Action(() => { }), DispatcherPriority.DataBind);
|
||||
|
||||
var newTabablzControl = newWindow.LogicalTreeDepthFirstTraversal().OfType<TabablzControl>().FirstOrDefault();
|
||||
if (newTabablzControl == null) throw new ApplicationException("Unable to ascertain tab control.");
|
||||
|
||||
if (newTabablzControl.ItemsSource == null)
|
||||
newTabablzControl.Items.Clear();
|
||||
|
||||
return new NewTabHost<Window>(newWindow, newTabablzControl);
|
||||
}
|
||||
|
||||
public virtual TabEmptiedResponse TabEmptiedHandler(TabablzControl tabControl, Window window)
|
||||
{
|
||||
return TabEmptiedResponse.CloseWindowOrLayoutBranch;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user