mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-18 23:46:37 +08:00
项目结构调整
This commit is contained in:
92
Others/Dragablz/DragablzDemo/BoundExampleModel.cs
Normal file
92
Others/Dragablz/DragablzDemo/BoundExampleModel.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Security.RightsManagement;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Dragablz;
|
||||
using Dragablz.Dockablz;
|
||||
using DragablzDemo.Annotations;
|
||||
|
||||
namespace DragablzDemo
|
||||
{
|
||||
public class BoundExampleModel
|
||||
{
|
||||
private readonly IInterTabClient _interTabClient = new BoundExampleInterTabClient();
|
||||
private readonly ObservableCollection<HeaderedItemViewModel> _items;
|
||||
private readonly ObservableCollection<HeaderedItemViewModel> _toolItems = new ObservableCollection<HeaderedItemViewModel>();
|
||||
|
||||
public BoundExampleModel()
|
||||
{
|
||||
_items = new ObservableCollection<HeaderedItemViewModel>();
|
||||
}
|
||||
|
||||
public BoundExampleModel(params HeaderedItemViewModel[] items)
|
||||
{
|
||||
_items = new ObservableCollection<HeaderedItemViewModel>(items);
|
||||
}
|
||||
|
||||
public ObservableCollection<HeaderedItemViewModel> Items
|
||||
{
|
||||
get { return _items; }
|
||||
}
|
||||
|
||||
public static Guid TabPartition
|
||||
{
|
||||
get { return new Guid("2AE89D18-F236-4D20-9605-6C03319038E6"); }
|
||||
}
|
||||
|
||||
public IInterTabClient InterTabClient
|
||||
{
|
||||
get { return _interTabClient; }
|
||||
}
|
||||
|
||||
public ObservableCollection<HeaderedItemViewModel> ToolItems
|
||||
{
|
||||
get { return _toolItems; }
|
||||
}
|
||||
|
||||
public ItemActionCallback ClosingTabItemHandler
|
||||
{
|
||||
get { return ClosingTabItemHandlerImpl; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback to handle tab closing.
|
||||
/// </summary>
|
||||
private static void ClosingTabItemHandlerImpl(ItemActionCallbackArgs<TabablzControl> args)
|
||||
{
|
||||
//in here you can dispose stuff or cancel the close
|
||||
|
||||
//here's your view model:
|
||||
var viewModel = args.DragablzItem.DataContext as HeaderedItemViewModel;
|
||||
Debug.Assert(viewModel != null);
|
||||
|
||||
//here's how you can cancel stuff:
|
||||
//args.Cancel();
|
||||
}
|
||||
|
||||
public ClosingFloatingItemCallback ClosingFloatingItemHandler
|
||||
{
|
||||
get { return ClosingFloatingItemHandlerImpl; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback to handle floating toolbar/MDI window closing.
|
||||
/// </summary>
|
||||
private static void ClosingFloatingItemHandlerImpl(ItemActionCallbackArgs<Layout> args)
|
||||
{
|
||||
//in here you can dispose stuff or cancel the close
|
||||
|
||||
//here's your view model:
|
||||
var disposable = args.DragablzItem.DataContext as IDisposable;
|
||||
if (disposable != null)
|
||||
disposable.Dispose();
|
||||
|
||||
//here's how you can cancel stuff:
|
||||
//args.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user