105040 Update 增加窗口开启逻辑,不允许同时开启多个窗口
This commit is contained in:
parent
8e7e3a4cba
commit
7c26e343a6
|
@ -1,6 +1,7 @@
|
|||
using EPLAN.Harness.API;
|
||||
using EPLAN.Harness.API.Plugins.Core;
|
||||
using EPLAN.Harness.AppCore;
|
||||
using Sinvo.EplanHpD.Plugin.Service;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Extension;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
|
||||
|
@ -8,6 +9,7 @@ using System;
|
|||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting;
|
||||
using System.Windows.Forms.Integration;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin
|
||||
|
@ -51,15 +53,32 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
|
||||
public string ToolbarTooltip => "伺服电机线缆抓取";
|
||||
|
||||
LectotypeWindow window;
|
||||
|
||||
public void Execute(HpdApi api)
|
||||
{
|
||||
new DBHelper().CodeFirst();
|
||||
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
var window = new LectotypeWindow(doc.ID);
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
var mainApp = BaseApp.ActiveApplication;
|
||||
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
||||
helper.Owner = mainApp.Handle;
|
||||
window.Show();
|
||||
if(window == null)
|
||||
{
|
||||
window = new LectotypeWindow(doc.ID);
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
var mainApp = BaseApp.ActiveApplication;
|
||||
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
||||
helper.Owner = mainApp.Handle;
|
||||
window.Closed += delegate
|
||||
{
|
||||
window = null;
|
||||
};
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
window.Activate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
|
|
|
@ -116,10 +116,11 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
catch (Exception)
|
||||
{
|
||||
window = new MainWindow(flexReport);
|
||||
// 解决WPF窗体在WinForm中无法输入的问题
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
window.Show();
|
||||
}
|
||||
// 解决WPF窗体在WinForm中无法输入的问题
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,16 +50,28 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
public HpDModule Module => HpDModule.WorkSpace;
|
||||
|
||||
public string ToolbarTooltip => "扫描器";
|
||||
|
||||
ScannerWindow window;
|
||||
public void Execute(HpdApi api)
|
||||
{
|
||||
//var doc = api.CurrentProject.GetActiveDocument();
|
||||
var window = new ScannerWindow();
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
var mainApp = BaseApp.ActiveApplication;
|
||||
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
||||
helper.Owner = mainApp.Handle;
|
||||
window.Show();
|
||||
if (window == null)
|
||||
{
|
||||
window = new ScannerWindow();
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
var mainApp = BaseApp.ActiveApplication;
|
||||
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
||||
helper.Owner = mainApp.Handle;
|
||||
window.Closed += delegate
|
||||
{
|
||||
window = null;
|
||||
};
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
window.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
|
|
|
@ -70,27 +70,34 @@
|
|||
<ItemGroup>
|
||||
<Reference Include="EPLAN.Harness.API">
|
||||
<HintPath>RefDLL\EPLAN.Harness.API.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="EPLAN.Harness.API.Plugins">
|
||||
<HintPath>RefDLL\EPLAN.Harness.API.Plugins.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="EPLAN.Harness.API.Plugins.Core">
|
||||
<HintPath>RefDLL\EPLAN.Harness.API.Plugins.Core.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="EPLAN.Harness.AppCore, Version=2.9.2.903, Culture=neutral, PublicKeyToken=57aaa27e22f7b107, processorArchitecture=AMD64">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>RefDLL\EPLAN.Harness.AppCore.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="EPLAN.Harness.Common">
|
||||
<HintPath>RefDLL\EPLAN.Harness.Common.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="EPLAN.Harness.Core, Version=2.9.2.903, Culture=neutral, PublicKeyToken=57aaa27e22f7b107, processorArchitecture=AMD64">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>RefDLL\EPLAN.Harness.Core.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="EPLAN.Harness.ProjectCore, Version=2.9.2.903, Culture=neutral, PublicKeyToken=57aaa27e22f7b107, processorArchitecture=AMD64">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>RefDLL\EPLAN.Harness.ProjectCore.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="HandyControl, Version=3.5.1.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\HandyControl.3.5.1\lib\net481\HandyControl.dll</HintPath>
|
||||
|
@ -129,6 +136,10 @@
|
|||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Sinvo.EplanHpD.Plugin.Service\Sinvo.EplanHpD.Plugin.Service.csproj">
|
||||
<Project>{AD1AA2BC-9289-46AE-BDC0-30AE13F51B3F}</Project>
|
||||
<Name>Sinvo.EplanHpD.Plugin.Service</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Sinvo.EplanHpD.Plugin.WPFUI\Sinvo.EplanHpD.Plugin.WPFUI.csproj">
|
||||
<Project>{2DBCD22A-650D-4797-9908-9C4D5D6665FE}</Project>
|
||||
<Name>Sinvo.EplanHpD.Plugin.WPFUI</Name>
|
||||
|
|
Loading…
Reference in New Issue