Browse Source

11

样式分支
fyf 2 years ago
parent
commit
7227da7af8
6 changed files with 151 additions and 160 deletions
  1. +13
    -5
      BPASmart.ConfigurationSoftware/Servers/ServiceCenter.cs
  2. +1
    -1
      BPASmart.Model/用户/UserManager.cs
  3. +33
    -0
      BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs
  4. +65
    -57
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml
  5. +25
    -97
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs
  6. +14
    -0
      BeDesignerSCADA/ViewModel/MainViewModelNew.cs

+ 13
- 5
BPASmart.ConfigurationSoftware/Servers/ServiceCenter.cs View File

@@ -178,11 +178,19 @@ namespace BPASmart.ConfigurationSoftware
/// </summary>
private void RegisterOpenFileType()
{
string icoFile = System.Windows.Forms.Application.StartupPath + $"\\Images\\fyf.ico";
string DirectoryPath = $"{Json<ProjectModel>.Data.ProjectPath}\\Images";
Directory.CreateDirectory(DirectoryPath);
File.Copy(icoFile, $"{DirectoryPath}\\fyf.ico");
SystemHelper.GetInstance.RegisterOpenFileType("project", "HBL", System.Windows.Forms.Application.ExecutablePath, $"{DirectoryPath}\\fyf.ico");
try
{
string icoFile = System.Windows.Forms.Application.StartupPath + $"\\Images\\fyf.ico";
string DirectoryPath = $"{Json<ProjectModel>.Data.ProjectPath}\\Images";
Directory.CreateDirectory(DirectoryPath);
File.Copy(icoFile, $"{DirectoryPath}\\fyf.ico");
SystemHelper.GetInstance.RegisterOpenFileType("project", "HBL", System.Windows.Forms.Application.ExecutablePath, $"{DirectoryPath}\\fyf.ico");
}
catch (Exception ex)
{

}
}

/// <summary>


+ 1
- 1
BPASmart.Model/用户/UserManager.cs View File

@@ -1,4 +1,4 @@
using BPASmart.Model.用户;
using BPASmart.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;


+ 33
- 0
BPASmartClient.SCADAControl/CustomerControls/TheButton.xaml.cs View File

@@ -3,6 +3,8 @@ using BPASmartClient.DATABUS;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -74,6 +76,27 @@ namespace BPASmartClient.SCADAControl.CustomerControls
private void MyButton_Click(object sender, RoutedEventArgs e)
{
Config.GetInstance().RunJsScipt(ClickExec);
try
{
if (!string.IsNullOrEmpty(StartPath) && StartPath.Contains(".exe"))
{
string path = $"{System.AppDomain.CurrentDomain.BaseDirectory}{StartPath}";
if (File.Exists(path))
{
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = path;
info.Arguments = "";
//info.WindowStyle = ProcessWindowStyle.Minimized;
Process pro = Process.Start(info);
pro.WaitForExit();
}
}
}
catch (Exception ex)
{

}
}

#region 数据绑定模块
@@ -90,6 +113,16 @@ namespace BPASmartClient.SCADAControl.CustomerControls
private static readonly DependencyProperty DataModelProperty =
DependencyProperty.Register("DataModel", typeof(Dictionary<string, object>), typeof(TheButton), new PropertyMetadata(new Dictionary<string, object>()));
/// <summary>
/// 启动路径
/// </summary>
public string StartPath
{
get { return (string)GetValue(StartPathProperty); }
set { SetValue(StartPathProperty, value); }
}
public static readonly DependencyProperty StartPathProperty =
DependencyProperty.Register("StartPath", typeof(string), typeof(TheButton), new PropertyMetadata(string.Empty));
/// <summary>
/// 运行事件
/// </summary>
public void Register()


+ 65
- 57
BeDesignerSCADA/Controls/MainCanvasPanel.xaml View File

@@ -221,35 +221,34 @@
<mypro:PropertyDefinition DisplayName="标题" Category="基本属性" DisplayOrder="2" Name="Title" Description="标题"/>
<mypro:PropertyDefinition DisplayName="运行状态" Category="基本属性" DisplayOrder="2" Name="Direction" Description="Direction"/>
<mypro:PropertyDefinition DisplayName="Tag" Category="基本属性" DisplayOrder="2" Name="Tag" Description="Tag"/>


<mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="MaxValue" Description="MaxValue"/>
<mypro:PropertyDefinition DisplayName="最小值" Category="基本属性" DisplayOrder="3" Name="MinValue" Description="MinValue"/>
<mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="Maximum" Description="Maximum"/>
<mypro:PropertyDefinition DisplayName="最小值" Category="基本属性" DisplayOrder="3" Name="Minimum" Description="Minimum"/>
<mypro:PropertyDefinition DisplayName="间隔" Category="基本属性" DisplayOrder="3" Name="Interval"/>
<mypro:PropertyDefinition DisplayName="宽度" Category="基本属性" DisplayOrder="3" Name="Width"/>
<mypro:PropertyDefinition DisplayName="高度" Category="基本属性" DisplayOrder="3" Name="Height"/>
<mypro:PropertyDefinition DisplayName="勾选状态" Category="基本属性" DisplayOrder="3" Name="BindingIsChecked"/>
<mypro:PropertyDefinition DisplayName="路径" Category="基本属性" DisplayOrder="3" Name="Source" />
<mypro:PropertyDefinition DisplayName="FontSize" Category="基本属性" DisplayOrder="4" Name="FontSize"/>
<mypro:PropertyDefinition DisplayName="字体" Category="基本属性" DisplayOrder="4" Name="FontFamily"/>
<mypro:PropertyDefinition DisplayName="字体样式" Category="基本属性" DisplayOrder="4" Name="FontWeight"/>
<mypro:PropertyDefinition DisplayName="斜体" Category="基本属性" DisplayOrder="4" Name="FontStyle"/>
<mypro:PropertyDefinition DisplayName="下划线" Category="基本属性" DisplayOrder="4" Name="TextDecorations"/>

<mypro:PropertyDefinition DisplayName="文字环绕样式" Category="基本属性" DisplayOrder="4" Name="TextWrapping"/>
<mypro:PropertyDefinition DisplayName="是否使能" Category="基本属性" DisplayOrder="5" Name="IsEnabled"/>
<mypro:PropertyDefinition DisplayName="是否显示" Category="基本属性" DisplayOrder="5" Name="Visibility"/>
<mypro:PropertyDefinition DisplayName="回车换行" Category="基本属性" DisplayOrder="5" Name="AcceptsReturn"/>
<mypro:PropertyDefinition DisplayName="鼠标样式" Category="基本属性" DisplayOrder="5" Name="Cursor"/>
<mypro:PropertyDefinition DisplayName="键盘触发顺序" Category="基本属性" DisplayOrder="5" Name="TabIndex"/>
<mypro:PropertyDefinition DisplayName="控件透明度" Category="基本属性" DisplayOrder="5" Name="Opacity"/>
<mypro:PropertyDefinition DisplayName="垂直滚动条" Category="基本属性" DisplayOrder="6" Name="VerticalScrollBarVisibility"/>
<mypro:PropertyDefinition DisplayName="水平滚动条" Category="基本属性" DisplayOrder="6" Name="HorizontalScrollBarVisibility"/>
<mypro:PropertyDefinition DisplayName="是否ESC触发" Category="基本属性" DisplayOrder="7" Name="IsCancel"/>
<mypro:PropertyDefinition DisplayName="是否Enter触发" Category="基本属性" DisplayOrder="7" Name="IsDefault"/>

<mypro:PropertyDefinition DisplayName="启动路径" Category="基本属性" DisplayOrder="2" Name="StartPath" Description="StartPath"/>

<mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="MaxValue" Description="MaxValue"/>
<mypro:PropertyDefinition DisplayName="最小值" Category="基本属性" DisplayOrder="3" Name="MinValue" Description="MinValue"/>
<mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="Maximum" Description="Maximum"/>
<mypro:PropertyDefinition DisplayName="最小值" Category="基本属性" DisplayOrder="3" Name="Minimum" Description="Minimum"/>
<mypro:PropertyDefinition DisplayName="间隔" Category="基本属性" DisplayOrder="3" Name="Interval"/>
<mypro:PropertyDefinition DisplayName="宽度" Category="基本属性" DisplayOrder="3" Name="Width"/>
<mypro:PropertyDefinition DisplayName="高度" Category="基本属性" DisplayOrder="3" Name="Height"/>
<mypro:PropertyDefinition DisplayName="勾选状态" Category="基本属性" DisplayOrder="3" Name="BindingIsChecked"/>
<mypro:PropertyDefinition DisplayName="路径" Category="基本属性" DisplayOrder="3" Name="Source" />
<mypro:PropertyDefinition DisplayName="FontSize" Category="基本属性" DisplayOrder="4" Name="FontSize"/>
<mypro:PropertyDefinition DisplayName="字体" Category="基本属性" DisplayOrder="4" Name="FontFamily"/>
<mypro:PropertyDefinition DisplayName="字体样式" Category="基本属性" DisplayOrder="4" Name="FontWeight"/>
<mypro:PropertyDefinition DisplayName="斜体" Category="基本属性" DisplayOrder="4" Name="FontStyle"/>
<mypro:PropertyDefinition DisplayName="下划线" Category="基本属性" DisplayOrder="4" Name="TextDecorations"/>

<mypro:PropertyDefinition DisplayName="文字环绕样式" Category="基本属性" DisplayOrder="4" Name="TextWrapping"/>
<mypro:PropertyDefinition DisplayName="是否使能" Category="基本属性" DisplayOrder="5" Name="IsEnabled"/>
<mypro:PropertyDefinition DisplayName="是否显示" Category="基本属性" DisplayOrder="5" Name="Visibility"/>
<mypro:PropertyDefinition DisplayName="回车换行" Category="基本属性" DisplayOrder="5" Name="AcceptsReturn"/>
<mypro:PropertyDefinition DisplayName="鼠标样式" Category="基本属性" DisplayOrder="5" Name="Cursor"/>
<mypro:PropertyDefinition DisplayName="键盘触发顺序" Category="基本属性" DisplayOrder="5" Name="TabIndex"/>
<mypro:PropertyDefinition DisplayName="控件透明度" Category="基本属性" DisplayOrder="5" Name="Opacity"/>
<mypro:PropertyDefinition DisplayName="垂直滚动条" Category="基本属性" DisplayOrder="6" Name="VerticalScrollBarVisibility"/>
<mypro:PropertyDefinition DisplayName="水平滚动条" Category="基本属性" DisplayOrder="6" Name="HorizontalScrollBarVisibility"/>
<mypro:PropertyDefinition DisplayName="是否ESC触发" Category="基本属性" DisplayOrder="7" Name="IsCancel"/>
<mypro:PropertyDefinition DisplayName="是否Enter触发" Category="基本属性" DisplayOrder="7" Name="IsDefault"/>

<mypro:PropertyDefinition DisplayName="垂直对齐" Category="基本属性" DisplayOrder="8" Name="VerticalContentAlignment"/>
<mypro:PropertyDefinition DisplayName="水平对齐" Category="基本属性" DisplayOrder="8" Name="HorizontalContentAlignment"/>
@@ -257,12 +256,16 @@
<mypro:PropertyDefinition DisplayName="文本提示" Category="基本属性" DisplayOrder="9" Name="ToolTip"/>
<mypro:PropertyDefinition DisplayName="左边距" Category="基本属性" DisplayOrder="9" Name="(Canvas.Left)"/>
<mypro:PropertyDefinition DisplayName="上边距" Category="基本属性" DisplayOrder="9" Name="(Canvas.Top)"/>
<mypro:PropertyDefinition DisplayName="启动测试" Category="基本属性" DisplayOrder="9" Name="TestData"/>
<mypro:PropertyDefinition DisplayName="气缸左执行" Category="基本属性" DisplayOrder="10" Name="LeftTogIsChecked"/>
<mypro:PropertyDefinition DisplayName="气缸右执行" Category="基本属性" DisplayOrder="10" Name="RightTogIsChecked"/>
<mypro:PropertyDefinition DisplayName="背景透明" Category="基本属性" DisplayOrder="10" Name="IsCheckedColor"/>
<mypro:PropertyDefinition DisplayName="启动测试" Category="基本属性" DisplayOrder="9" Name="TestData"/>
<mypro:PropertyDefinition DisplayName="气缸左执行" Category="基本属性" DisplayOrder="10" Name="LeftTogIsChecked"/>
<mypro:PropertyDefinition DisplayName="气缸右执行" Category="基本属性" DisplayOrder="10" Name="RightTogIsChecked"/>
<mypro:PropertyDefinition DisplayName="背景透明" Category="基本属性" DisplayOrder="10" Name="IsCheckedColor"/>
<mypro:PropertyDefinition DisplayName="边框宽度" Category="基本属性" DisplayOrder="10" Name="BKThickness"/>
<mypro:PropertyDefinition DisplayName="虚线绘制" Category="基本属性" DisplayOrder="10" Name="BKStrokeDashArray"/>
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="11" Name="WaveThickness"/>
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="11" Name="StrokeThickness"/>
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="11" Name="BorderThickness"/>

<mypro:PropertyDefinition DisplayName="数据来源类型" Category="数据绑定模块" DisplayOrder="0" Name="DataSouceType"/>
<mypro:PropertyDefinition DisplayName="设备名称" Category="数据绑定模块" DisplayOrder="0" Name="DeviceName"/>
<mypro:PropertyDefinition DisplayName="接口类型" Category="数据绑定模块" DisplayOrder="1" Name="InterfaceMode"/>
@@ -277,39 +280,28 @@
<mypro:PropertyDefinition DisplayName="数据结果" Category="数据绑定模块" DisplayOrder="7" Name="GenerateData"/>
<mypro:PropertyDefinition DisplayName="定时间隔" Category="数据绑定模块" DisplayOrder="8" Name="TimeCount"/>


<mypro:PropertyDefinition DisplayName="列表项" Category="集合设置" Name="ItemsString" />
<mypro:PropertyDefinition DisplayName="列表项" Category="集合设置" Name="TabItems" />
<mypro:PropertyDefinition DisplayName="子控件模板" Category="集合设置" Name="ChildTemplateXml" />

<mypro:PropertyDefinition DisplayName="列表项" Category="集合设置" Name="TabItems" />
<mypro:PropertyDefinition DisplayName="子控件模板" Category="集合设置" Name="ChildTemplateXml" />

<mypro:PropertyDefinition DisplayName="前景色" Category="颜色设置" Name="Foreground"/>
<mypro:PropertyDefinition DisplayName="背景色" Category="颜色设置" Name="Background"/>
<mypro:PropertyDefinition DisplayName="填充颜色" Category="颜色设置" Name="BJColor"/>
<mypro:PropertyDefinition DisplayName="边框宽度" Category="基本属性" Name="BKThickness"/>
<mypro:PropertyDefinition DisplayName="虚线绘制" Category="基本属性" Name="BKStrokeDashArray"/>
<mypro:PropertyDefinition DisplayName="选中色" Category="颜色设置" Name="DKColor"/>


<mypro:PropertyDefinition DisplayName="填充颜色" Category="颜色设置" Name="BJColor"/>
<mypro:PropertyDefinition DisplayName="选中色" Category="颜色设置" Name="DKColor"/>
<mypro:PropertyDefinition DisplayName="边框色" Category="颜色设置" Name="BorderBrush"/>
<mypro:PropertyDefinition DisplayName="填充" Category="基本属性" DisplayOrder="5" Name="WaveFill"/>
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="WaveThickness"/>
<mypro:PropertyDefinition DisplayName="边框" Category="基本属性" DisplayOrder="5" Name="WaveStroke"/>
<mypro:PropertyDefinition DisplayName="填充" Category="基本属性" DisplayOrder="5" Name="Fill"/>
<mypro:PropertyDefinition DisplayName="边框" Category="基本属性" DisplayOrder="5" Name="Stroke"/>
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="StrokeThickness"/>
<mypro:PropertyDefinition DisplayName="边框粗细" Category="基本属性" DisplayOrder="5" Name="BorderThickness"/>

<mypro:PropertyDefinition DisplayName="填充" Category="颜色设置" DisplayOrder="5" Name="WaveFill"/>
<mypro:PropertyDefinition DisplayName="边框" Category="颜色设置" DisplayOrder="5" Name="WaveStroke"/>
<mypro:PropertyDefinition DisplayName="填充" Category="颜色设置" DisplayOrder="5" Name="Fill"/>
<mypro:PropertyDefinition DisplayName="边框" Category="颜色设置" DisplayOrder="5" Name="Stroke"/>
<mypro:PropertyDefinition DisplayName="点击事件" Category="事件绑定" DisplayOrder="0" Name="ClickExec" />
<mypro:PropertyDefinition DisplayName="值改变事件" Category="事件绑定" DisplayOrder="1" Name="ValueChangedExecute" />
<mypro:PropertyDefinition DisplayName="定时触发" Category="事件绑定" DisplayOrder="2" Name="TikcExecute" />
<mypro:PropertyDefinition DisplayName="勾选事件" Category="事件绑定" DisplayOrder="3" Name="CheckedExec" />
<mypro:PropertyDefinition DisplayName="取消勾选事件" Category="事件绑定" DisplayOrder="4" Name="UnCheckedExec" />
<mypro:PropertyDefinition DisplayName="接收消息集" Category="事件绑定" DisplayOrder="5" Name="EventReceiveNameList" />
<mypro:PropertyDefinition DisplayName="出料单击事件" Category="事件绑定" DisplayOrder="6" Name="ChuLiaoExecute" />
<mypro:PropertyDefinition DisplayName="停止出料单击事件" Category="事件绑定" DisplayOrder="7" Name="StopChuLiaoExecute" />
<mypro:PropertyDefinition DisplayName="接收消息集" Category="事件绑定" DisplayOrder="5" Name="EventReceiveNameList" />
<mypro:PropertyDefinition DisplayName="出料单击事件" Category="事件绑定" DisplayOrder="6" Name="ChuLiaoExecute" />
<mypro:PropertyDefinition DisplayName="停止出料单击事件" Category="事件绑定" DisplayOrder="7" Name="StopChuLiaoExecute" />
</mypro:PropertyGrid.PropertyDefinitions>

<mypro:PropertyGrid.EditorDefinitions>
@@ -329,13 +321,29 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="35"/>
</Grid.ColumnDefinitions>
<ToggleButton Grid.Column="1" Height="30" Content="..." Width="26" Margin="5,0,0,0" HorizontalAlignment="Left" Click="LJToggleButton_Click"></ToggleButton>
<ToggleButton Grid.Column="1" Height="20" Content="..." Width="26" Margin="5,0,0,0" HorizontalAlignment="Left" Click="LJToggleButton_Click"></ToggleButton>
<TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</mypro:EditorTemplateDefinition.EditingTemplate>
</mypro:EditorTemplateDefinition>

<mypro:EditorTemplateDefinition TargetProperties="StartPath">
<mypro:EditorTemplateDefinition.EditingTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="35"/>
</Grid.ColumnDefinitions>
<ToggleButton Grid.Column="1" Height="20" Content="选择" Width="26" Margin="5,0,0,0" HorizontalAlignment="Left" Click="XZToggleButton_Click"></ToggleButton>
<TextBox Text="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</mypro:EditorTemplateDefinition.EditingTemplate>
</mypro:EditorTemplateDefinition>

<!--子控件模板编辑-->
<mypro:EditorTemplateDefinition TargetProperties="ChildTemplateXml">
<mypro:EditorTemplateDefinition.EditingTemplate>


+ 25
- 97
BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs View File

@@ -414,6 +414,30 @@ namespace BeDesignerSCADA.Controls
}
}
/// <summary>
/// 选择进程
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void XZToggleButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (sender is ToggleButton)
{
ToggleButton toggle = (ToggleButton)sender;
Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem;
if (propertyGridCommand != null)
{
viewModel.SelectValuePath(propertyGridCommand);
}
}
}
catch (Exception ex)
{

}
}
/// <summary>
/// 设置子控件模板
/// </summary>
/// <param name="sender"></param>
@@ -491,103 +515,7 @@ namespace BeDesignerSCADA.Controls

#endregion

#region 不需要的
///// <summary>
///// 变量选择
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//private void ComboBoxValue_TextChanged(object sender, TextChangedEventArgs e)
//{
// try
// {
// if (sender is System.Windows.Controls.ComboBox)
// {
// System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender;
// Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem;
// if (toggle.Tag != null && !string.IsNullOrEmpty(toggle.Text))
// propertyGridCommand.Value = "{" + $"Binding {toggle.Tag}.{toggle.Text}" + "}";
// }
// }
// catch (Exception ex)
// {

// }
//}
///// <summary>
///// 变量下拉框打开事件
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//private void valuebox_DropDownOpened(object sender, EventArgs e)
//{
// try
// {
// viewModel.DevValueList = new System.Collections.ObjectModel.ObservableCollection<string>();
// if (sender is System.Windows.Controls.ComboBox)
// {
// System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender;
// if (toggle.Tag == null) return;

// CommunicationPar communication = null;
// if (DataBusModel.GetInstance().KeyValues.ContainsKey(viewModel.VariablePath))
// {
// communication = DataBusModel.GetInstance().KeyValues[viewModel.VariablePath];
// }
// CommunicationModel mode = communication?.CommunicationDevices?.ToList().Find(par => par.DeviceName == toggle.Tag.ToString());
// if (mode != null)
// {
// mode?.VarTableModels?.ToList().ForEach(par => { viewModel.DevValueList.Add(par.VarName); });
// }
// }
// }
// catch (Exception ex)
// {

// }

//}
///// <summary>
///// 设备名称选择
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//private void ComboBoxName_TextChanged(object sender, TextChangedEventArgs e)
//{
// try
// {
// if (sender is System.Windows.Controls.ComboBox)
// {
// System.Windows.Controls.ComboBox toggle = (System.Windows.Controls.ComboBox)sender;
// Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyGridCommand = toggle.DataContext as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem;
// if (toggle.Tag != null && !string.IsNullOrEmpty(toggle.Text))
// propertyGridCommand.Value = "{" + $"Binding {toggle.Text}.{toggle.Tag}" + "}";
// else if (!string.IsNullOrEmpty(toggle.Text))
// propertyGridCommand.Value = "{" + $"Binding {toggle.Text}." + "}";

// }
// }
// catch (Exception ex)
// {

// }
//}
///// <summary>
///// 设备名称下拉框打开事件
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//private void namebox_DropDownOpened(object sender, EventArgs e)
//{

// viewModel.DevNameList = new System.Collections.ObjectModel.ObservableCollection<string>();
// CommunicationPar communication = null;
// if (DataBusModel.GetInstance().KeyValues.ContainsKey(viewModel.VariablePath))
// {
// communication = DataBusModel.GetInstance().KeyValues[viewModel.VariablePath];
// }
// communication?.CommunicationDevices?.ToList().ForEach(x => { viewModel.DevNameList.Add(x.DeviceName); });
//}
#endregion
}
}

+ 14
- 0
BeDesignerSCADA/ViewModel/MainViewModelNew.cs View File

@@ -326,6 +326,20 @@ namespace BeDesignerSCADA.ViewModel
((Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem)obj).Value = ofd.FileName;
}
}

/// <summary>
/// 选择路径
/// </summary>
/// <param name="obj"></param>
public void SelectValuePath(object obj)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "请选择|*.*";
if (ofd.ShowDialog() == true)
{
((Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem)obj).Value = ofd.SafeFileName;
}
}
#endregion




Loading…
Cancel
Save