Commit 7718819d by liulongfei

插件添加页打开接口

parent cd36a27d
...@@ -52,5 +52,11 @@ namespace VIZ.Package.Domain ...@@ -52,5 +52,11 @@ namespace VIZ.Package.Domain
/// </summary> /// </summary>
/// <param name="conn">连接</param> /// <param name="conn">连接</param>
void PreviewOut(ConnModel conn); 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -164,6 +165,21 @@ namespace VIZ.Package.Module ...@@ -164,6 +165,21 @@ namespace VIZ.Package.Module
// 将当前值上至预览 // 将当前值上至预览
this.vizCommandControlObjectService.SetControlObject(ApplicationDomainEx.PreviewConn, this.ControlObject); 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: () => }, final: () =>
{ {
WPFHelper.BeginInvoke(() => WPFHelper.BeginInvoke(() =>
......
...@@ -34,6 +34,14 @@ namespace VIZ.Package.Module ...@@ -34,6 +34,14 @@ namespace VIZ.Package.Module
List<IPluginView> GetPluginViews(); List<IPluginView> GetPluginViews();
/// <summary> /// <summary>
/// 根据页模型获取插件视图
/// </summary>
/// <param name="page">页模型</param>
/// <returns>插件视图</returns>
IPluginView GetPluginView(PageModel page);
/// <summary>
/// 获取插件视图 /// 获取插件视图
/// </summary> /// </summary>
/// <typeparam name="T">插件视图类型</typeparam> /// <typeparam name="T">插件视图类型</typeparam>
......
...@@ -7,6 +7,7 @@ using System.Collections.ObjectModel; ...@@ -7,6 +7,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Documents;
using VIZ.Framework.Common; using VIZ.Framework.Common;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Package.Domain; using VIZ.Package.Domain;
...@@ -305,6 +306,29 @@ namespace VIZ.Package.Module ...@@ -305,6 +306,29 @@ namespace VIZ.Package.Module
} }
/// <summary> /// <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> /// </summary>
/// <typeparam name="T">插件视图类型</typeparam> /// <typeparam name="T">插件视图类型</typeparam>
......
...@@ -119,5 +119,14 @@ namespace VIZ.Package.TestPlugin ...@@ -119,5 +119,14 @@ namespace VIZ.Package.TestPlugin
/// </summary> /// </summary>
public void Dispose() 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