105040 Update 复制时增加全局提示;布线助手界面增加插入电缆按钮;

This commit is contained in:
lihanbo 2024-12-23 12:01:16 +08:00
parent 844e10040e
commit d6bfc21127
2 changed files with 84 additions and 3 deletions

View File

@ -98,7 +98,22 @@
<GridViewColumn Header="线型号">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox IsReadOnly="True" Text="{Binding CableModel}" />
<TextBox
MaxWidth="230"
GotFocus="TextBox_GotFocus"
IsReadOnly="True"
Text="{Binding CableModel}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="230" Header="操作">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button
Click="InsertCableBtn_Click"
Content="插入电缆"
Style="{StaticResource ButtonPrimary}"
Tag="{Binding CableModel}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>

View File

@ -1,5 +1,12 @@
using EPLAN.Harness.API;
using EPLAN.Harness.Actuator.Commands.Designer;
using EPLAN.Harness.API;
using EPLAN.Harness.AppCore.Controls;
using EPLAN.Harness.Core;
using EPLAN.Harness.Core.Commands;
using EPLAN.Harness.Core.Common;
using EPLAN.Harness.Core.Controls;
using EPLAN.Harness.Core.UIFactory;
using EPLAN.Harness.Primitives.ActionControls;
using EPLAN.Harness.ProjectCore;
using EPLAN.Harness.ProjectCore.Occurrences.Designer;
using HandyControl.Controls;
@ -40,6 +47,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
{
GetCurrentDoc();
_currentFlexDesigner.SelectSet.SelectionChanged += SelectSet_SelectionChanged;
GetMotorCables();
}
@ -94,8 +102,66 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
if(viewModel != null && viewModel.SelectedLine != null)
{
var text = $"{viewModel.SelectedLine.AxisNo}-{viewModel.SelectedLine.CurrentLine}";
Clipboard.SetDataObject(text);
SetToClipboard(text);
}
}
private void TextBox_GotFocus(object sender, RoutedEventArgs e)
{
if (sender is System.Windows.Controls.TextBox box)
{
SetToClipboard(box.Text);
box.SelectAll();
}
}
private void SetToClipboard(string text)
{
try
{
Clipboard.SetDataObject(text);
Growl.SuccessGlobal("复制成功!");
}
catch (Exception ex)
{
FlexMessageBox.Error(ex.Message);
}
}
protected CmdRunEnv _cmdEnvironment = CmdRunEnv.Designer;
private void InsertCableBtn_Click(object sender, RoutedEventArgs e)
{
if(sender is Button btn)
{
if(!string.IsNullOrEmpty(btn.Tag?.ToString() ?? ""))
{
string cableModelNo = btn.Tag?.ToString();
SetToClipboard(cableModelNo);
var Commander = new CommandInvoker();
//this._organizer as FlexDesigner,
//this._bookmarks.ItemList,
//this.GetConectWireFrm(),
//this.GetForkedCableControl(OccCablesSubpartGraph.SIDE.Left),
//this._cmdEnvironment
var cmdD3DPlaceCableForkedAH = new CmdD3DPlaceCableForkedAH(
_currentFlexDesigner,
new EPLAN.Harness.Core.Common.BookmarkList(),
GetConectWireFrm(),
this.GetForkedCableControl(OccCablesSubpartGraph.SIDE.Left),
_cmdEnvironment);
Commander.ExecuteCommand(cmdD3DPlaceCableForkedAH);
}
}
}
private CmdD3DPlaceCableBase.IfrmConnectWires GetConectWireFrm()
{
return _currentFlexDesigner.CurrentView.UserControlFactory_Create<CmdD3DPlaceCableBase.IfrmConnectWires>(UIObject.frm_Designer_ConnectCableWires, Array.Empty<object>());
}
private CmdD3DPlaceCableForked.IForkedCableControl GetForkedCableControl(OccCablesSubpartGraph.SIDE side)
{
return _currentFlexDesigner.CurrentView.UserControlFactory_Create<CmdD3DPlaceCableForked.IForkedCableControl>(UIObject.ctrl_Designer_ForkedPathPlace, new object[] { side });
}
}
}