修改全局变量前
This commit is contained in:
parent
7e19e55e39
commit
45ebf1f2b6
61
BOB/App.xaml
61
BOB/App.xaml
@ -25,66 +25,7 @@
|
||||
<!--自定义style-->
|
||||
<ResourceDictionary Source="Resources\Styles\WindowStyle.xaml"></ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="TextBox"
|
||||
BasedOn="{StaticResource MaterialDesignFilledTextBox}">
|
||||
<!-- 禁用自动化属性,避免 null 报错 -->
|
||||
<Setter Property="AutomationProperties.Name"
|
||||
Value="" />
|
||||
|
||||
<!-- 使用底线风格 -->
|
||||
<Setter Property="materialDesign:TextFieldAssist.DecorationVisibility"
|
||||
Value="Hidden" />
|
||||
<Setter Property="materialDesign:TextFieldAssist.UnderlineBrush"
|
||||
Value="{DynamicResource MaterialDesignDivider}" />
|
||||
<Setter Property="BorderThickness"
|
||||
Value="0,0,0,1" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource MaterialDesignDivider}" />
|
||||
|
||||
<!-- 字体靠下 -->
|
||||
<Setter Property="VerticalContentAlignment"
|
||||
Value="Bottom" />
|
||||
<Setter Property="Padding"
|
||||
Value="0,0,0,2" />
|
||||
|
||||
<!-- 其他优化 -->
|
||||
<Setter Property="Background"
|
||||
Value="Transparent" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource MaterialDesignBody}" />
|
||||
<Setter Property="FontSize"
|
||||
Value="14" />
|
||||
</Style>
|
||||
<Style TargetType="ComboBox"
|
||||
BasedOn="{StaticResource MahApps.Styles.ComboBox}">
|
||||
<!-- 禁用自动化属性,避免 null 报错 -->
|
||||
<Setter Property="AutomationProperties.Name"
|
||||
Value="" />
|
||||
|
||||
<!-- 使用底线风格 -->
|
||||
<Setter Property="materialDesign:TextFieldAssist.DecorationVisibility"
|
||||
Value="Hidden" />
|
||||
<Setter Property="materialDesign:TextFieldAssist.UnderlineBrush"
|
||||
Value="{DynamicResource MaterialDesignDivider}" />
|
||||
<Setter Property="BorderThickness"
|
||||
Value="0,0,0,1" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource MaterialDesignDivider}" />
|
||||
|
||||
<!-- 字体靠下 -->
|
||||
<Setter Property="VerticalContentAlignment"
|
||||
Value="Bottom" />
|
||||
<Setter Property="Padding"
|
||||
Value="0,0,0,2" />
|
||||
|
||||
<!-- 其他优化 -->
|
||||
<Setter Property="Background"
|
||||
Value="Transparent" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource MaterialDesignBody}" />
|
||||
<Setter Property="FontSize"
|
||||
Value="14" />
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</prism:PrismApplication>
|
||||
|
||||
@ -9,13 +9,13 @@ namespace BOB
|
||||
{
|
||||
public class GlobalVariables
|
||||
{
|
||||
public ProgramModel Program = new();
|
||||
public bool IsAdmin=true;
|
||||
public String UserName="hsc";
|
||||
public String Title = "主程序";
|
||||
public string CurrentFilePath;
|
||||
public StepModel SelectedStep;
|
||||
public ParameterModel SelectedParameter;
|
||||
public DeviceModel SelectedDevice;
|
||||
public ProgramModel Program { get; set; } = new();
|
||||
public bool IsAdmin { get; set; } = true;
|
||||
public String UserName { get; set; } = "hsc";
|
||||
public String Title { get; set; } = "主程序";
|
||||
public string CurrentFilePath { get; set; }
|
||||
public StepModel SelectedStep { get; set; }
|
||||
public ParameterModel SelectedParameter { get; set; }
|
||||
public DeviceModel SelectedDevice { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ namespace BOB.Models
|
||||
#endregion
|
||||
|
||||
private Guid _id = Guid.NewGuid();
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public Guid ID
|
||||
{
|
||||
get => _id;
|
||||
@ -47,7 +47,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private bool _isUsed = true;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public bool IsUsed
|
||||
{
|
||||
get => _isUsed;
|
||||
@ -55,7 +55,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private int _index;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public int Index
|
||||
{
|
||||
get => _index;
|
||||
@ -63,7 +63,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private string? _name;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public string? Name
|
||||
{
|
||||
get => _name;
|
||||
@ -71,7 +71,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private string? _stepType;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public string? StepType
|
||||
{
|
||||
get => _stepType;
|
||||
@ -79,7 +79,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private MethodModel? _method;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public MethodModel? Method
|
||||
{
|
||||
get => _method;
|
||||
@ -87,7 +87,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private ProgramModel? _subProgram;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public ProgramModel? SubProgram
|
||||
{
|
||||
get => _subProgram;
|
||||
@ -95,15 +95,15 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private int? _loopCount;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public int? LoopCount
|
||||
{
|
||||
get => _loopCount;
|
||||
set => SetProperty(ref _loopCount, value);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
private int? _currentLoopCount;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
[JsonIgnore]
|
||||
public int? CurrentLoopCount
|
||||
{
|
||||
get => _currentLoopCount;
|
||||
@ -111,23 +111,23 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private Guid? _loopStartStepId;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public Guid? LoopStartStepId
|
||||
{
|
||||
get => _loopStartStepId;
|
||||
set => SetProperty(ref _loopStartStepId, value);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
private int _result = -1;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
[JsonIgnore]
|
||||
public int Result
|
||||
{
|
||||
get => _result;
|
||||
set => SetProperty(ref _result, value);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
private int? _runTime;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
[JsonIgnore]
|
||||
public int? RunTime
|
||||
{
|
||||
get => _runTime;
|
||||
@ -135,7 +135,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private string? _okExpression;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public string? OKExpression
|
||||
{
|
||||
get => _okExpression;
|
||||
@ -143,7 +143,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private string _gotoSettingString = "";
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public string GotoSettingString
|
||||
{
|
||||
get => _gotoSettingString;
|
||||
@ -151,7 +151,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private Guid? _okGotoStepID;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public Guid? OKGotoStepID
|
||||
{
|
||||
get => _okGotoStepID;
|
||||
@ -159,7 +159,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private Guid? _ngGotoStepID;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public Guid? NGGotoStepID
|
||||
{
|
||||
get => _ngGotoStepID;
|
||||
@ -167,7 +167,7 @@ namespace BOB.Models
|
||||
}
|
||||
|
||||
private string? _description;
|
||||
[JsonIgnore] // 添加 JsonIgnore
|
||||
|
||||
public string? Description
|
||||
{
|
||||
get => _description;
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
TargetType="Window">
|
||||
<Setter Property="WindowStyle"
|
||||
Value="None" />
|
||||
<Setter Property="Topmost"
|
||||
Value="True" />
|
||||
<Setter Property="ResizeMode"
|
||||
Value="NoResize" />
|
||||
<Setter Property="ShowInTaskbar"
|
||||
|
||||
@ -163,13 +163,13 @@ namespace BOB.ViewModels
|
||||
}
|
||||
catch (Exception xmlEx)
|
||||
{
|
||||
LoggerHelper.warnWithNotify($"加载XML注释失败: {Path.GetFileName(xmlPath)} - {xmlEx.Message}");
|
||||
LoggerHelper.WarnWithNotify($"加载XML注释失败: {Path.GetFileName(xmlPath)} - {xmlEx.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.warnWithNotify($"无法加载程序集 {Path.GetFileName(dllPath)}: {ex.Message}");
|
||||
LoggerHelper.WarnWithNotify($"无法加载程序集 {Path.GetFileName(dllPath)}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -196,7 +196,7 @@ namespace BOB.ViewModels
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.warnWithNotify($"加载子程序错误: {filePath} - {ex.Message}");
|
||||
LoggerHelper.WarnWithNotify($"加载子程序错误: {filePath} - {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,12 +152,28 @@ namespace BOB.ViewModels.Dialogs
|
||||
|
||||
private void Save()
|
||||
{
|
||||
if (Mode == "ADD")
|
||||
{
|
||||
Program.Devices.Add(Device);
|
||||
_globalVariables.SelectedDevice = Device;
|
||||
}
|
||||
else
|
||||
{
|
||||
var index = Program.Devices
|
||||
.Select((x, i) => new { x, i })
|
||||
.FirstOrDefault(p => p.x.ID == _globalVariables.SelectedDevice.ID)?.i;
|
||||
|
||||
if (index.HasValue)
|
||||
{
|
||||
Program.Devices[index.Value] = Device;
|
||||
}
|
||||
}
|
||||
RequestClose.Invoke(ButtonResult.OK);
|
||||
}
|
||||
|
||||
private void Cancel()
|
||||
{
|
||||
RequestClose.Invoke();
|
||||
RequestClose.Invoke(ButtonResult.No);
|
||||
}
|
||||
#region Prism Dialog 规范
|
||||
public bool CanCloseDialog()
|
||||
@ -183,7 +199,7 @@ namespace BOB.ViewModels.Dialogs
|
||||
}
|
||||
else
|
||||
{
|
||||
Device = _globalVariables.SelectedDevice;
|
||||
Device = new DeviceModel(_globalVariables.SelectedDevice);
|
||||
IsAdd = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using BOB.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@ -79,12 +80,29 @@ namespace BOB.ViewModels.Dialogs
|
||||
|
||||
private void Save()
|
||||
{
|
||||
if (Mode == "ADD")
|
||||
{
|
||||
Program.Parameters.Add(Parameter);
|
||||
_globalVariables.SelectedParameter = Parameter;
|
||||
}
|
||||
else
|
||||
{
|
||||
var index = Program.Parameters
|
||||
.Select((x, i) => new { x, i })
|
||||
.FirstOrDefault(p => p.x.ID == _globalVariables.SelectedParameter.ID)?.i;
|
||||
|
||||
if (index.HasValue)
|
||||
{
|
||||
Program.Parameters[index.Value] = Parameter;
|
||||
}
|
||||
}
|
||||
|
||||
RequestClose.Invoke(ButtonResult.OK);
|
||||
}
|
||||
|
||||
private void Cancel()
|
||||
{
|
||||
RequestClose.Invoke();
|
||||
RequestClose.Invoke(ButtonResult.No);
|
||||
}
|
||||
#region Prism Dialog 规范
|
||||
public bool CanCloseDialog()
|
||||
@ -100,8 +118,15 @@ namespace BOB.ViewModels.Dialogs
|
||||
public void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
Program=_globalVariables.Program;
|
||||
Parameter = _globalVariables.SelectedParameter;
|
||||
Mode = parameters.GetValue<string>("Mode");
|
||||
if (Mode == "ADD")
|
||||
{
|
||||
Parameter = new();
|
||||
}
|
||||
else
|
||||
{
|
||||
Parameter = new ParameterModel(_globalVariables.SelectedParameter);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ namespace BOB.ViewModels
|
||||
_dialogService = dialogService;
|
||||
_eventAggregator = eventAggregator;
|
||||
testcommand = new DelegateCommand(test);
|
||||
|
||||
|
||||
}
|
||||
private void test()
|
||||
{
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using BOB.Models;
|
||||
using Common.PubEvent;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -12,7 +13,7 @@ using System.Xml;
|
||||
|
||||
namespace BOB.ViewModels
|
||||
{
|
||||
public class ParametersManagerViewModel:BindableBase,IDialogAware
|
||||
public class ParametersManagerViewModel:BindableBase
|
||||
{
|
||||
#region 属性
|
||||
private ProgramModel _program;
|
||||
@ -25,18 +26,30 @@ namespace BOB.ViewModels
|
||||
public ParameterModel SelectedParameter
|
||||
{
|
||||
get => _SelectedParameter;
|
||||
set => SetProperty(ref _SelectedParameter, value);
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _SelectedParameter, value))
|
||||
{
|
||||
_globalVariables.SelectedParameter = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
private DeviceModel _SelectedDevice;
|
||||
public DeviceModel SelectedDevice
|
||||
{
|
||||
get => _SelectedDevice;
|
||||
set => SetProperty(ref _SelectedDevice, value);
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _SelectedDevice, value))
|
||||
{
|
||||
_globalVariables.SelectedDevice = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public DialogCloseListener RequestClose { get; set; }
|
||||
GlobalVariables _GlobalVariables { get; set; }
|
||||
IDialogService _dialogService { get; set; }
|
||||
private GlobalVariables _globalVariables { get; set; }
|
||||
private IDialogService _dialogService { get; set; }
|
||||
private IEventAggregator _eventAggregator { get; set; }
|
||||
public ICommand ParameterAddCommand { get; set; }
|
||||
public ICommand ParameterEditCommand { get; set; }
|
||||
public ICommand ParameterDeleteCommand { get; set; }
|
||||
@ -46,11 +59,12 @@ namespace BOB.ViewModels
|
||||
|
||||
|
||||
|
||||
public ParametersManagerViewModel(GlobalVariables GlobalVariables,IDialogService dialogService)
|
||||
public ParametersManagerViewModel(GlobalVariables GlobalVariables,IDialogService dialogService,IEventAggregator eventAggregator)
|
||||
{
|
||||
_GlobalVariables = GlobalVariables;
|
||||
_dialogService= dialogService;
|
||||
Program = _GlobalVariables.Program;
|
||||
_globalVariables = GlobalVariables;
|
||||
_eventAggregator= eventAggregator;
|
||||
_dialogService = dialogService;
|
||||
Program = _globalVariables.Program;
|
||||
ParameterAddCommand = new DelegateCommand(ParameterAdd);
|
||||
ParameterEditCommand = new DelegateCommand(ParameterEdit);
|
||||
ParameterDeleteCommand = new DelegateCommand(ParameterDelete);
|
||||
@ -64,16 +78,27 @@ namespace BOB.ViewModels
|
||||
|
||||
private void DeviceDelete()
|
||||
{
|
||||
|
||||
Program.Devices.Remove(SelectedDevice);
|
||||
}
|
||||
|
||||
private void DeviceEdit()
|
||||
{
|
||||
var param = new DialogParameters
|
||||
{
|
||||
{ "Mode", _GlobalVariables.SelectedDevice==null?"ADD":"Edit" }
|
||||
{ "Mode", SelectedDevice==null?"ADD":"Edit" }
|
||||
};
|
||||
_dialogService.ShowDialog("DeviceSetting", param);
|
||||
_dialogService.ShowDialog("DeviceSetting", param, (r) =>
|
||||
{
|
||||
if (r.Result == ButtonResult.OK)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
_eventAggregator.GetEvent<OverlayEvent>().Publish(false);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -83,21 +108,44 @@ namespace BOB.ViewModels
|
||||
{
|
||||
{ "Mode", "ADD" }
|
||||
};
|
||||
_dialogService.ShowDialog("DeviceSetting", param);
|
||||
_eventAggregator.GetEvent<OverlayEvent>().Publish(true);
|
||||
_dialogService.ShowDialog("DeviceSetting", param, (r) =>
|
||||
{
|
||||
if (r.Result == ButtonResult.OK)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
_eventAggregator.GetEvent<OverlayEvent>().Publish(false);
|
||||
});
|
||||
}
|
||||
|
||||
private void ParameterDelete()
|
||||
{
|
||||
|
||||
Program.Parameters.Remove(SelectedParameter);
|
||||
}
|
||||
|
||||
private void ParameterEdit()
|
||||
{
|
||||
var param = new DialogParameters
|
||||
{
|
||||
{ "Mode", _GlobalVariables.SelectedParameter==null?"ADD":"Edit" }
|
||||
{ "Mode",SelectedParameter==null?"ADD":"Edit" }
|
||||
};
|
||||
_dialogService.ShowDialog("ParameterSetting", param);
|
||||
_dialogService.ShowDialog("ParameterSetting", param, (r) =>
|
||||
{
|
||||
if (r.Result == ButtonResult.OK)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
_eventAggregator.GetEvent<OverlayEvent>().Publish(false);
|
||||
});
|
||||
}
|
||||
|
||||
private void ParameterAdd()
|
||||
@ -106,24 +154,20 @@ namespace BOB.ViewModels
|
||||
{
|
||||
{ "Mode", "ADD" }
|
||||
};
|
||||
_dialogService.ShowDialog("ParameterSetting", param);
|
||||
}
|
||||
#endregion
|
||||
#region Prism Dialog 规范
|
||||
public bool CanCloseDialog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnDialogClosed()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
|
||||
_dialogService.ShowDialog("ParameterSetting", param, (r) =>
|
||||
{
|
||||
if (r.Result == ButtonResult.OK)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
_eventAggregator.GetEvent<OverlayEvent>().Publish(false);
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,20 @@
|
||||
using BOB.Views;
|
||||
using BOB.Models;
|
||||
using BOB.Views;
|
||||
using Common.PubEvents;
|
||||
using Logger;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace BOB.ViewModels
|
||||
{
|
||||
@ -34,6 +39,11 @@ namespace BOB.ViewModels
|
||||
public ICommand RunSingleCommand { get; set; }
|
||||
public ICommand ResotrationCommand { get; set; }
|
||||
public ICommand StopCommand { get; set; }
|
||||
public ICommand SaveAsCommand { get; set; }
|
||||
public ICommand SaveCommand { get; set; }
|
||||
public ICommand OpenCommand { get; set; }
|
||||
public ICommand NewCommand { get; set; }
|
||||
public ICommand SetDefaultCommand { get; set; }
|
||||
#endregion
|
||||
|
||||
private IEventAggregator _eventAggregator;
|
||||
@ -46,28 +56,153 @@ namespace BOB.ViewModels
|
||||
MinimizeCommand = new DelegateCommand<Window>(MinimizeWindow);
|
||||
MaximizeCommand = new DelegateCommand<Window>(MaximizeWindow);
|
||||
CloseCommand = new DelegateCommand<Window>(CloseWindow);
|
||||
RunningCommand = new DelegateCommand<Window>(Running);
|
||||
RunSingleCommand = new DelegateCommand<Window>(RunSingle);
|
||||
ResotrationCommand = new DelegateCommand<Window>(Resotration);
|
||||
StopCommand = new DelegateCommand<Window>(Stop);
|
||||
RunningCommand = new DelegateCommand(Running);
|
||||
RunSingleCommand = new DelegateCommand(RunSingle);
|
||||
ResotrationCommand = new DelegateCommand(Resotration);
|
||||
StopCommand = new DelegateCommand(Stop);
|
||||
NewCommand = new DelegateCommand(New);
|
||||
OpenCommand = new DelegateCommand(Open);
|
||||
SaveAsCommand = new DelegateCommand(SaveAs);
|
||||
SaveCommand = new DelegateCommand(Save);
|
||||
SetDefaultCommand = new DelegateCommand(SetDefault);
|
||||
}
|
||||
#region ToolBar命令
|
||||
private void SetDefault()
|
||||
{
|
||||
if(_globalVariables.CurrentFilePath!=null)
|
||||
{
|
||||
SystemConfig.Instance.DefaultSubProgramFilePath = _globalVariables.CurrentFilePath;
|
||||
}
|
||||
}
|
||||
private void New()
|
||||
{
|
||||
_globalVariables.CurrentFilePath = null;
|
||||
_globalVariables.Program = new();
|
||||
}
|
||||
|
||||
private void Stop(Window window)
|
||||
private void Open()
|
||||
{
|
||||
try
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Filter = "BOB程序文件|*.bob|所有文件|*.*",
|
||||
Title = "打开程序",
|
||||
InitialDirectory = @"D:\BOB\子程序"
|
||||
};
|
||||
|
||||
if (openFileDialog.ShowDialog() == true)
|
||||
{
|
||||
string filePath = openFileDialog.FileName;
|
||||
|
||||
// 读取 JSON 文件内容
|
||||
string json = File.ReadAllText(filePath);
|
||||
|
||||
// 反序列化为 ProgramModel
|
||||
var program = JsonConvert.DeserializeObject<ProgramModel>(json);
|
||||
|
||||
if (program != null)
|
||||
{
|
||||
_globalVariables.Program = program;
|
||||
_globalVariables.CurrentFilePath = filePath;
|
||||
|
||||
LoggerHelper.SuccessWithNotify($"成功打开文件: {filePath}");
|
||||
}
|
||||
else
|
||||
{
|
||||
LoggerHelper.WarnWithNotify($"文件内容格式不正确: {filePath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.ErrorWithNotify($"打开文件失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SaveAs()
|
||||
{
|
||||
string defaultPath = @"D:\BOB\子程序";
|
||||
|
||||
// 如果目录不存在,可以自动创建
|
||||
if (!Directory.Exists(defaultPath))
|
||||
Directory.CreateDirectory(defaultPath);
|
||||
|
||||
var saveFileDialog = new SaveFileDialog
|
||||
{
|
||||
Filter = "BOB程序文件|*.bob|所有文件|*.*",
|
||||
Title = "另存为",
|
||||
FileName = "NewProgram.bob",
|
||||
InitialDirectory = defaultPath // ✅ 默认打开这个文件夹
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == true)
|
||||
{
|
||||
_globalVariables.CurrentFilePath = saveFileDialog.FileName;
|
||||
SaveProgramToFile(_globalVariables.CurrentFilePath);
|
||||
}
|
||||
|
||||
// 记录日志
|
||||
LoggerHelper.InfoWithNotify($"{_globalVariables.UserName} 另存为文件成功: {saveFileDialog.FileName}");
|
||||
|
||||
}
|
||||
private void SaveProgramToFile(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var tmp = ClearDeviceParameterValue(_globalVariables.Program);
|
||||
string json = JsonConvert.SerializeObject(tmp, Formatting.Indented);
|
||||
File.WriteAllText(filePath, json);
|
||||
LoggerHelper.SuccessWithNotify($"程序已保存: {filePath}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LoggerHelper.ErrorWithNotify($"保存文件失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
private ProgramModel ClearDeviceParameterValue(ProgramModel program)
|
||||
{
|
||||
var tmp = new ProgramModel(program);
|
||||
foreach (var device in tmp.Devices)
|
||||
{
|
||||
tmp.Parameters.Remove(tmp.Parameters.First(x => x.ID == device.ParameterID));
|
||||
}
|
||||
foreach (var step in tmp.StepCollection)
|
||||
{
|
||||
if (step.SubProgram != null)
|
||||
{
|
||||
step.SubProgram = ClearDeviceParameterValue(step.SubProgram);
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
if(_globalVariables.CurrentFilePath == null)
|
||||
{
|
||||
SaveAs();
|
||||
return;
|
||||
}
|
||||
SaveProgramToFile(_globalVariables.CurrentFilePath);
|
||||
LoggerHelper.InfoWithNotify(_globalVariables.UserName + "保存文件成功");
|
||||
}
|
||||
private void Stop()
|
||||
{
|
||||
LoggerHelper.InfoWithNotify(_globalVariables.UserName+"执行停止命令");
|
||||
}
|
||||
|
||||
private void Resotration(Window window)
|
||||
private void Resotration()
|
||||
{
|
||||
LoggerHelper.InfoWithNotify(_globalVariables.UserName + "执行复位命令");
|
||||
}
|
||||
|
||||
private void RunSingle(Window window)
|
||||
private void RunSingle()
|
||||
{
|
||||
LoggerHelper.InfoWithNotify(_globalVariables.UserName + "执行单步执行命令");
|
||||
}
|
||||
|
||||
private void Running(Window window)
|
||||
private void Running()
|
||||
{
|
||||
LoggerHelper.InfoWithNotify(_globalVariables.UserName + "执行运行命令");
|
||||
}
|
||||
@ -94,5 +229,6 @@ namespace BOB.ViewModels
|
||||
{
|
||||
window?.Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,18 +42,23 @@ namespace BOB.ViewModels
|
||||
|
||||
private void DisposeSelectedStep(Guid id)
|
||||
{
|
||||
if (SelectedStep == null) return;
|
||||
if(id== SelectedStep.ID)
|
||||
SelectedStep = null;
|
||||
}
|
||||
|
||||
private void CancelEdit()
|
||||
{
|
||||
|
||||
SelectedStep = null;
|
||||
}
|
||||
|
||||
private void SaveStep()
|
||||
{
|
||||
|
||||
if (SelectedStep == null || (SelectedStep.Method == null && SelectedStep.SubProgram == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void EditSingleSetp()
|
||||
|
||||
@ -16,25 +16,35 @@ namespace BOB.ViewModels
|
||||
public class StepsManagerViewModel:BindableBase
|
||||
{
|
||||
#region 属性
|
||||
private string _Title;
|
||||
public string Title
|
||||
{
|
||||
get => _globalVariables.Title;
|
||||
set => SetProperty(ref _globalVariables.Title, value);
|
||||
get => _Title;
|
||||
set => SetProperty(ref _Title, value);
|
||||
}
|
||||
private StepModel _SelectedStep;
|
||||
public StepModel SelectedStep
|
||||
{
|
||||
get => _globalVariables.SelectedStep;
|
||||
set => SetProperty(ref _globalVariables.SelectedStep, value);
|
||||
get => _SelectedStep;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _SelectedStep, value))
|
||||
{
|
||||
_globalVariables.SelectedStep = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
private ProgramModel _Program;
|
||||
public ProgramModel Program
|
||||
{
|
||||
get => _globalVariables.Program;
|
||||
set => SetProperty(ref _globalVariables.Program, value);
|
||||
get => _Program;
|
||||
set => SetProperty(ref _Program, value);
|
||||
}
|
||||
private bool _IsAdmin;
|
||||
public bool IsAdmin
|
||||
{
|
||||
get => _globalVariables.IsAdmin;
|
||||
set => SetProperty(ref _globalVariables.IsAdmin, value);
|
||||
get => _IsAdmin;
|
||||
set => SetProperty(ref _IsAdmin, value);
|
||||
}
|
||||
GlobalVariables _globalVariables { get; set; }
|
||||
private List<StepModel> tmpCopyList = new List<StepModel>();
|
||||
@ -49,6 +59,8 @@ namespace BOB.ViewModels
|
||||
{
|
||||
_eventAggregator = eventAggregator;
|
||||
_globalVariables = _GlobalVariables;
|
||||
IsAdmin = _globalVariables.IsAdmin;
|
||||
Program = _globalVariables.Program;
|
||||
EditStepCommand = new DelegateCommand(EditStep);
|
||||
CopyStepCommand = new DelegateCommand(CopyStep);
|
||||
PasteStepCommand = new DelegateCommand(PasteStep);
|
||||
|
||||
@ -18,7 +18,12 @@
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<Grid>
|
||||
<GroupBox Header="指令">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="439*" />
|
||||
<ColumnDefinition Width="361*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<GroupBox Header="指令"
|
||||
Grid.ColumnSpan="2">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@ -34,7 +39,8 @@
|
||||
Height="25"
|
||||
Margin="0,0,5,0"
|
||||
VerticalContentAlignment="Center"
|
||||
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}">
|
||||
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
|
||||
materialDesign:HintAssist.Hint="搜索内容">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="KeyDown">
|
||||
<prism:InvokeCommandAction Command="{Binding SearchEnterCommand}" />
|
||||
@ -45,7 +51,7 @@
|
||||
|
||||
<!-- TreeView -->
|
||||
<TreeView Grid.Row="1"
|
||||
ItemsSource="{Binding InstructionTree}" >
|
||||
ItemsSource="{Binding InstructionTree}">
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type model:InstructionNode}"
|
||||
ItemsSource="{Binding Children}">
|
||||
|
||||
@ -5,9 +5,12 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:converters="clr-namespace:BOB.Converters"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:behavior="clr-namespace:Common.Behaviors;assembly=Common"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
Background="White"
|
||||
Panel.ZIndex="1000"
|
||||
mc:Ignorable="d"
|
||||
Height="290"
|
||||
Width="450">
|
||||
@ -47,6 +50,7 @@
|
||||
Width="85" />
|
||||
<TextBox Text="{Binding Device.Name}"
|
||||
VerticalAlignment="Bottom"
|
||||
materialDesign:HintAssist.Hint="设备名称"
|
||||
Width="120" />
|
||||
</StackPanel>
|
||||
<StackPanel Height="30"
|
||||
@ -59,6 +63,7 @@
|
||||
SelectedItem="{Binding Device.Type,UpdateSourceTrigger=PropertyChanged}"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="120"
|
||||
materialDesign:HintAssist.Hint="通讯协议类型"
|
||||
IsEnabled="{Binding IsAdd}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
@ -75,6 +80,7 @@
|
||||
VerticalAlignment="Bottom" />
|
||||
<TextBox Text="{Binding Device.Description}"
|
||||
VerticalAlignment="Bottom"
|
||||
materialDesign:HintAssist.Hint="设备描述"
|
||||
Width="120" />
|
||||
</StackPanel>
|
||||
<Label Content="连接参数"
|
||||
@ -93,9 +99,11 @@
|
||||
VerticalContentAlignment="Bottom" />
|
||||
<TextBox VerticalAlignment="Bottom"
|
||||
Visibility="{Binding Name, Converter={StaticResource DeviceNameConverter}}"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
Text="{Binding Value}"
|
||||
Width="120" />
|
||||
<ComboBox VerticalAlignment="Bottom"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
Visibility="{Binding Name, Converter={StaticResource DeviceNameConverter}, ConverterParameter=Inverse}"
|
||||
ItemsSource="{Binding Name, Converter={StaticResource DeviceNameConverter}, ConverterParameter=Items}"
|
||||
SelectedItem="{Binding Value}"
|
||||
|
||||
@ -7,7 +7,9 @@
|
||||
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
Background="White"
|
||||
xmlns:behavior="clr-namespace:Common.Behaviors;assembly=Common"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
Width="420"
|
||||
Height="284"
|
||||
@ -38,7 +40,8 @@
|
||||
VerticalAlignment="Bottom"
|
||||
Content="参数名称*" />
|
||||
<TextBox Width="120"
|
||||
Text="{Binding Parameter.Name}" />
|
||||
Text="{Binding Parameter.Name}"
|
||||
materialDesign:HintAssist.Hint="参数名称" />
|
||||
</StackPanel>
|
||||
<StackPanel Height="30"
|
||||
Margin="7"
|
||||
@ -49,6 +52,7 @@
|
||||
<ComboBox Width="120"
|
||||
VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding Types}"
|
||||
materialDesign:HintAssist.Hint="参数类型"
|
||||
SelectedItem="{Binding Parameter.Type}"
|
||||
/>
|
||||
</StackPanel>
|
||||
@ -61,6 +65,7 @@
|
||||
<ComboBox Width="120"
|
||||
VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding Categories}"
|
||||
materialDesign:HintAssist.Hint="参数类别"
|
||||
Text="{Binding Parameter.Category}" />
|
||||
</StackPanel>
|
||||
<StackPanel Height="30"
|
||||
@ -71,7 +76,8 @@
|
||||
Content="参数下限" />
|
||||
<TextBox Width="120"
|
||||
VerticalAlignment="Bottom"
|
||||
Text="{Binding Parameter.LowerLimit}" />
|
||||
Text="{Binding Parameter.LowerLimit}"
|
||||
materialDesign:HintAssist.Hint="参数下限" />
|
||||
</StackPanel>
|
||||
<StackPanel Height="30"
|
||||
Margin="7"
|
||||
@ -81,7 +87,8 @@
|
||||
Content="参数上限" />
|
||||
<TextBox Width="120"
|
||||
VerticalAlignment="Bottom"
|
||||
Text="{Binding Parameter.UpperLimit}" />
|
||||
Text="{Binding Parameter.UpperLimit}"
|
||||
materialDesign:HintAssist.Hint="参数名上限" />
|
||||
</StackPanel>
|
||||
<StackPanel Height="30"
|
||||
Margin="7"
|
||||
@ -94,6 +101,7 @@
|
||||
<TextBox MinWidth="120"
|
||||
VerticalAlignment="Bottom"
|
||||
Text="{Binding Parameter.Value, Converter={StaticResource ParameterValueToStringConverter}}"
|
||||
materialDesign:HintAssist.Hint="参数值"
|
||||
Visibility="{Binding Parameter.Type, Converter={StaticResource IsEnumTypeConverter}, ConverterParameter=Collapse}" />
|
||||
|
||||
<!-- 枚举类型时显示下拉框 -->
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
<RowDefinition Height="1.5*"/>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<vs:CommandTree Grid.Row="0" Margin="5"
|
||||
Grid.Column="0"
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Common.PubEvent;
|
||||
using Prism.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -20,11 +22,11 @@ namespace BOB.Views
|
||||
/// </summary>
|
||||
public partial class MainView : UserControl
|
||||
{
|
||||
public MainView()
|
||||
public MainView(IEventAggregator eventAggregator)
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:converters="clr-namespace:BOB.Converters"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<CollectionViewSource x:Key="VisibleParameters"
|
||||
Source="{Binding Program.Parameters}"
|
||||
@ -16,6 +16,8 @@
|
||||
<sys:String>IsVisible</sys:String>
|
||||
</CollectionViewSource.LiveFilteringProperties>
|
||||
</CollectionViewSource>
|
||||
<converters:ParameterCategoryToStringConverter x:Key="ParameterCategoryToStringConverter" />
|
||||
<converters:ParameterValueToStringConverter x:Key="ParameterValueToStringConverter" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
@ -34,7 +36,7 @@
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="类别"
|
||||
|
||||
Binding="{Binding Category, Converter={StaticResource ParameterCategoryToStringConverter}}"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="参数名"
|
||||
Binding="{Binding Name}"
|
||||
@ -44,7 +46,7 @@
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="值"
|
||||
MinWidth="20"
|
||||
|
||||
Binding="{Binding Value, Converter={StaticResource ParameterValueToStringConverter}}"
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
|
||||
|
||||
@ -86,15 +86,20 @@
|
||||
Foreground="White" />
|
||||
</MenuItem.Icon>
|
||||
<MenuItem Header="新建"
|
||||
Foreground="Black" />
|
||||
Foreground="Black"
|
||||
Command="{Binding NewCommand}" />
|
||||
<MenuItem Header="打开"
|
||||
Foreground="Black" />
|
||||
Foreground="Black"
|
||||
Command="{Binding OpenCommand}" />
|
||||
<MenuItem Header="保存"
|
||||
Command="{Binding SaveCommand}"
|
||||
Foreground="Black" />
|
||||
<MenuItem Header="另存为"
|
||||
Foreground="Black" />
|
||||
Foreground="Black"
|
||||
Command="{Binding SaveAsCommand}" />
|
||||
<MenuItem Header="设置默认程序"
|
||||
Foreground="Black" />
|
||||
Foreground="Black"
|
||||
Command="{Binding SetDefaultCommand}" />
|
||||
</MenuItem>
|
||||
|
||||
<!-- 工具菜单 -->
|
||||
@ -234,6 +239,12 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentControl prism:RegionManager.RegionName="ShellViewManager"
|
||||
Grid.ColumnSpan="3" />
|
||||
<Border x:Name="Overlay"
|
||||
Background="#40000000"
|
||||
Visibility="Collapsed"
|
||||
Panel.ZIndex="10"
|
||||
Grid.RowSpan="2"
|
||||
Grid.ColumnSpan="4" />
|
||||
</Grid>
|
||||
</materialDesign:DialogHost>
|
||||
</Grid>
|
||||
|
||||
@ -34,9 +34,8 @@ namespace BOB.Views
|
||||
|
||||
private void ShowOverlay(bool arg)
|
||||
{
|
||||
DialogHost.IsOpen = arg;
|
||||
Overlay.Visibility = arg ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void ShowWaiting(bool arg)
|
||||
{
|
||||
DialogHost.IsOpen = arg;
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
<Label Width="60"
|
||||
Content="名称" />
|
||||
<TextBox MinWidth="120"
|
||||
|
||||
materialDesign:HintAssist.Hint=""
|
||||
Text="{Binding SelectedStep.Name}" />
|
||||
</StackPanel>
|
||||
|
||||
@ -54,6 +54,7 @@
|
||||
<Label Width="60"
|
||||
Content="合格条件" />
|
||||
<TextBox MinWidth="120"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
Text="{Binding SelectedStep.OKExpression}" />
|
||||
</StackPanel>
|
||||
|
||||
@ -64,7 +65,8 @@
|
||||
<Label Width="60"
|
||||
Content="跳转"
|
||||
ToolTip="格式:OK跳转序号/NG跳转序号(默认为0/0)" />
|
||||
<TextBox MinWidth="120" />
|
||||
<TextBox MinWidth="120"
|
||||
materialDesign:HintAssist.Hint="" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- 备注 -->
|
||||
@ -74,6 +76,7 @@
|
||||
<Label Width="60"
|
||||
Content="备注" />
|
||||
<TextBox MinWidth="120"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
Text="{Binding SelectedStep.Description}" />
|
||||
</StackPanel>
|
||||
|
||||
@ -141,12 +144,14 @@
|
||||
MinWidth="120"
|
||||
VerticalAlignment="Bottom"
|
||||
Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
Visibility="{Binding Type, Converter={StaticResource IsEnumTypeConverter}, ConverterParameter=Collapse}" />
|
||||
|
||||
<!-- 枚举类型 -->
|
||||
<ComboBox Height="22"
|
||||
MinWidth="120"
|
||||
VerticalAlignment="Bottom"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
ItemsSource="{Binding Type, Converter={StaticResource EnumValuesConverter}}"
|
||||
Visibility="{Binding Type, Converter={StaticResource IsEnumTypeConverter}}">
|
||||
<ComboBox.SelectedItem>
|
||||
@ -161,6 +166,7 @@
|
||||
<!-- 变量选择框 -->
|
||||
<ComboBox Height="22"
|
||||
MinWidth="120"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
VerticalAlignment="Bottom"
|
||||
SelectedValue="{Binding VariableName}"
|
||||
SelectedValuePath="Name"
|
||||
@ -197,6 +203,7 @@
|
||||
/>
|
||||
<ComboBox Width="120"
|
||||
Margin="0,0,0,0"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
VerticalAlignment="Bottom"
|
||||
SelectedValue="{Binding VariableName}"
|
||||
SelectedValuePath="Name"
|
||||
@ -270,6 +277,7 @@
|
||||
<!-- 非枚举类型 -->
|
||||
<TextBox Height="22"
|
||||
MinWidth="120"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
VerticalAlignment="Bottom"
|
||||
Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}"
|
||||
Visibility="{Binding Type, Converter={StaticResource IsEnumTypeConverter}, ConverterParameter=Collapse}" />
|
||||
@ -277,6 +285,7 @@
|
||||
<!-- 枚举类型 -->
|
||||
<ComboBox Height="22"
|
||||
MinWidth="120"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding Type, Converter={StaticResource EnumValuesConverter}}"
|
||||
SelectedItem="{Binding Value}"
|
||||
@ -286,6 +295,7 @@
|
||||
<!-- 变量选择框 -->
|
||||
<ComboBox Height="22"
|
||||
MinWidth="120"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext.Program.Parameters}"
|
||||
SelectedValue="{Binding VariableName}"
|
||||
@ -311,6 +321,7 @@
|
||||
Visibility="{Binding Category, Converter={StaticResource ParameterCategoryToVisibilityConverter}, ConverterParameter=Inverse}" />
|
||||
<ComboBox Width="120"
|
||||
Margin="0,0,0,0"
|
||||
materialDesign:HintAssist.Hint=""
|
||||
VerticalAlignment="Bottom"
|
||||
ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.Program.Parameters}"
|
||||
SelectedValue="{Binding VariableName}"
|
||||
|
||||
@ -27,7 +27,7 @@ namespace Logger
|
||||
Logger.Info(message);
|
||||
NotifyUI(message, "lightgreen");
|
||||
}
|
||||
public static void warnWithNotify(string message, string stackTrace = null)
|
||||
public static void WarnWithNotify(string message, string stackTrace = null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(stackTrace))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user