Commit 7718819d by liulongfei

插件添加页打开接口

parent cd36a27d
......@@ -52,5 +52,11 @@ namespace VIZ.Package.Domain
/// </summary>
/// <param name="conn">连接</param>
void PreviewOut(ConnModel conn);
/// <summary>
/// 打开页后触发
/// </summary>
/// <param name="page">页</param>
void PageOpend(PageModel page);
}
}
using DevExpress.Xpf.Grid.TreeList;
using DevExpress.Mvvm.POCO;
using DevExpress.Xpf.Grid.TreeList;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -164,6 +165,21 @@ namespace VIZ.Package.Module
// 将当前值上至预览
this.vizCommandControlObjectService.SetControlObject(ApplicationDomainEx.PreviewConn, this.ControlObject);
// 插件处理
PageModel pageModel = msg.Page as PageModel;
if (pageModel == null || string.IsNullOrWhiteSpace(pageModel.PluginID))
return;
IPluginService service = ApplicationDomainEx.ServiceManager.GetService<IPluginService>(ViewServiceKeys.PLUGIN_SERVICE);
if (service == null)
return;
IPluginView pluginView = service.GetPluginView(pageModel);
if (pluginView == null)
return;
pluginView.PageOpend(pageModel);
}, final: () =>
{
WPFHelper.BeginInvoke(() =>
......
......@@ -34,6 +34,14 @@ namespace VIZ.Package.Module
List<IPluginView> GetPluginViews();
/// <summary>
/// 根据页模型获取插件视图
/// </summary>
/// <param name="page">页模型</param>
/// <returns>插件视图</returns>
IPluginView GetPluginView(PageModel page);
/// <summary>
/// 获取插件视图
/// </summary>
/// <typeparam name="T">插件视图类型</typeparam>
......
......@@ -7,6 +7,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;
using VIZ.Framework.Common;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
......@@ -305,6 +306,29 @@ namespace VIZ.Package.Module
}
/// <summary>
/// 根据页模型获取插件视图
/// </summary>
/// <param name="page">页模型</param>
/// <returns>插件视图</returns>
public IPluginView GetPluginView(PageModel page)
{
foreach (PluginNavigationConfig config in this.ItemsSource)
{
if (config.PageModel != page)
continue;
config.View.TryGetTarget(out object target);
if (target == null)
return null;
return target as IPluginView;
}
return null;
}
/// <summary>
/// 获取插件视图
/// </summary>
/// <typeparam name="T">插件视图类型</typeparam>
......
......@@ -119,5 +119,14 @@ namespace VIZ.Package.TestPlugin
/// </summary>
public void Dispose()
{ }
/// <summary>
/// 打开页后触发
/// </summary>
/// <param name="page">页</param>
public void PageOpend(PageModel page)
{
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment