Преглед на файлове

增加变量管理器

master
fyf преди 2 години
родител
ревизия
0995a9040a
променени са 13 файла, в които са добавени 693 реда и са изтрити 7 реда
  1. +1
    -0
      BPASmart.MenuLoad/BPASmart.MenuLoad.csproj
  2. +16
    -0
      BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
  3. Двоични данни
     
  4. Двоични данни
     
  5. Двоични данни
     
  6. Двоични данни
     
  7. +58
    -0
      BPASmartClient.SCADAControl/Themes/Generic.xaml
  8. +254
    -0
      BeDesignerSCADA/Controls/CodeCanvasPanel.xaml
  9. +266
    -0
      BeDesignerSCADA/Controls/CodeCanvasPanel.xaml.cs
  10. +60
    -0
      BeDesignerSCADA/Helper/IniFile.cs
  11. +18
    -0
      BeDesignerSCADA/MainWindow.xaml
  12. +2
    -0
      BeDesignerSCADA/MainWindow.xaml.cs
  13. +18
    -7
      BeDesignerSCADA/ViewModel/MainViewModelNew.cs

+ 1
- 0
BPASmart.MenuLoad/BPASmart.MenuLoad.csproj Целия файл

@@ -19,6 +19,7 @@

<ItemGroup>
<ProjectReference Include="..\BeDesignerSCADA\BeDesignerSCADA.csproj" />
<ProjectReference Include="..\BPASmart.VariableManager\BPASmart.VariableManager.csproj" />
</ItemGroup>

<ItemGroup>


+ 16
- 0
BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj Целия файл

@@ -47,6 +47,8 @@
<None Remove="Images\State2.png" />
<None Remove="Images\Tab4_No.png" />
<None Remove="Images\Tab4_Select.png" />
<None Remove="Images\Tab_NoWZBJ.png" />
<None Remove="Images\Tab_SelectWZBJ.png" />
<None Remove="Images\timericon.png" />
<None Remove="Images\上箭头.png" />
<None Remove="Images\借出.png" />
@@ -70,6 +72,8 @@
<None Remove="Images\矩形边框.png" />
<None Remove="Images\矩形边框1.png" />
<None Remove="Images\系统名称.png" />
<None Remove="Images\组 7.png" />
<None Remove="Images\组 8.png" />
<None Remove="Images\背景2.png" />
<None Remove="Images\返回按钮1.png" />
<None Remove="Images\返回按钮2.png" />
@@ -211,6 +215,12 @@
<Resource Include="Images\Tab4_Select.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Tab_NoWZBJ.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Tab_SelectWZBJ.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\timericon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
@@ -289,6 +299,12 @@
<Resource Include="Images\系统名称.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\组 7.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\组 8.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\背景2.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


Двоични данни
Целия файл


+ 58
- 0
BPASmartClient.SCADAControl/Themes/Generic.xaml Целия файл

@@ -2047,6 +2047,64 @@
</Setter>
</Style>

<Style x:Key="TitleTabItem" TargetType="{x:Type TabItem}">
<Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}" />
<Setter Property="Padding" Value="10,2,10,2" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Border
x:Name="Bd"
Height="30"
Margin="5"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="0">
<ContentPresenter
x:Name="Content"
HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
ContentSource="Header"
Cursor="Hand"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Foreground" Value="#FFD4DEE0" />
<Setter TargetName="Bd" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Images/Tab_SelectWZBJ.png" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter Property="Foreground" Value="#FF18A9C9" />
<Setter TargetName="Bd" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Images/Tab_NoWZBJ.png" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="#FFD4DEE0" />
<Setter TargetName="Bd" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Images/Tab_SelectWZBJ.png" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<!--#region ScrollBar-->
<Style x:Key="UpScrollBarButton" TargetType="{x:Type RepeatButton}">
<Setter Property="OverridesDefaultStyle" Value="true" />


+ 254
- 0
BeDesignerSCADA/Controls/CodeCanvasPanel.xaml Целия файл

@@ -0,0 +1,254 @@
<UserControl x:Class="BeDesignerSCADA.Controls.CodeCanvasPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BeDesignerSCADA.Controls"
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
mc:Ignorable="d"
d:DesignHeight="900" d:DesignWidth="1400">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/可视化配置工具;component/Themes/Styles.xaml"></ResourceDictionary>
<ResourceDictionary Source="/BPASmartClient.SCADAControl;component/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="245"/>
<ColumnDefinition/>
<ColumnDefinition Width="320"/>
</Grid.ColumnDefinitions>

<!--左侧选择区域-->
<TabControl x:Name="LeftSelectTab" SelectedIndex="0">
<TabItem Header="页面编辑">
<Border BorderThickness="1" BorderBrush="#FFA9A9A9" Background="Transparent" >
<Grid >
</Grid>
</Border>
</TabItem>

<TabItem Header="组件列表">
<Border BorderThickness="1" BorderBrush="#FFA9A9A9" Background="Transparent">
</Border>
</TabItem>

<TabItem Header="菜单布局">
<Border BorderThickness="1" BorderBrush="#FFA9A9A9" Background="Transparent">

</Border>
</TabItem>
</TabControl>

<!--中间控制区域-->
<DockPanel Grid.Column="1">
<!--按钮控制-->
<DockPanel LastChildFill="False" DockPanel.Dock="Top" Height="24" Margin="4 4 4 0">
<Button Margin="5" Grid.Column="2" Click="OnNew" Name="ButtonNew" ToolTip="创建新工程" Focusable="True" Width="24">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="PageCode"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="2" Click="OnOpen" Name="ButtonOpen" IsEnabled="True" ToolTip="" Width="24">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="FolderOpen"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="2" Click="OnSave" Name="ButtonSave" IsEnabled="False" ToolTip="" Width="24">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="Save"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="2" Name="ButtonSaveAs" IsEnabled="False" ToolTip="" Width="24" Click="OnSaveAs">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="Archive"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="2" Name="ButtonPrint" IsEnabled="False" ToolTip="" Width="24" Visibility="Collapsed" Click="OnPrint">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="Printer"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"/>
<Button Margin="5" Grid.Column="2" Name="ButtonCopy" IsEnabled="{Binding ElementName=Editor, Path=IsCopyEnabled}" ToolTip="" Width="24" Click="OnCopy">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="PageCopy"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="2" Name="ButtonPaste" IsEnabled="{Binding ElementName=Editor, Path=IsPasteEnabled}" ToolTip="" Width="24" Click="OnPaste">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="ClipboardPaste"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"/>
<Button Margin="5" Grid.Column="2" Click="OnStartRun" Name="ButtonStart" IsEnabled="False" ToolTip="" Width="24">
<Button.Template>
<ControlTemplate>
<icon:PackIconModern x:Name="Icon" Kind="ControlPlay"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="DarkBlue"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="3" Click="OnStopRun" Name="ButtonStop" IsEnabled="False" Visibility="Visible" ToolTip="">
<Button.Template>
<ControlTemplate TargetType="Button">
<icon:PackIconModern x:Name="Icon" Kind="ControlStop"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="DarkBlue"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Margin="5" Grid.Column="3" Click="OnClearError" IsEnabled="False" Name="ButtonClearError" Visibility="Visible" ToolTip="" Width="24">
<Button.Template>
<ControlTemplate TargetType="Button">
<icon:PackIconModern x:Name="Icon" Kind="StarRemove"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
<Setter TargetName="Icon" Property="Spin" Value="False"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<ToggleButton Name="ButtonHighligh" ToolTip="" IsChecked="False" Width="24"
Click="OnHighlightClicked">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<icon:PackIconModern x:Name="Icon" Kind="Flag"/>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Icon" Property="Foreground" Value="Gray"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Icon" Property="Foreground" Value="Green"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Slider ToolTip="运行速度" Minimum="0" Maximum="100" Margin="15, 0" Value="20" Name="SliderSpeeder"
Width="150" VerticalAlignment="Center" ValueChanged="OnSpeedValueChanged"/>
</DockPanel>

<!--中间画布-->
<Border BorderThickness="1" BorderBrush="{StaticResource AccentBrush}" Margin="4">
<Border.Background>
<ImageBrush ImageSource="../Images/bj.png" Stretch="UniformToFill"/>
</Border.Background>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>

<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
<Grid>
<!--画布区域-->
</Grid>
</ScrollViewer>


<TextBlock HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,20,20" FontSize="16" Foreground="Red">分辨率:1920×1080</TextBlock>
</Grid>
</Border>
</DockPanel>
<!--右侧属性栏-->
<Grid Grid.Column="2">
<TabControl x:Name="ReditSeleceTab" SelectedIndex="0">
<TabItem Header="属性栏">

</TabItem>
</TabControl>
</Grid>


</Grid>
</UserControl>

+ 266
- 0
BeDesignerSCADA/Controls/CodeCanvasPanel.xaml.cs Целия файл

@@ -0,0 +1,266 @@
using BeDesignerSCADA.Helper;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BeDesignerSCADA.Controls
{
/// <summary>
/// CodeCanvasPanel.xaml 的交互逻辑
/// </summary>
public partial class CodeCanvasPanel : UserControl
{
public CodeCanvasPanel()
{
InitializeComponent();
}

#region 变量
string _currentFile;
public string File
{
get
{
if (string.IsNullOrEmpty(_currentFile))
_currentFile = IniFile.ReadValue("Editor", "LastOpen");
return _currentFile;
}
set
{
_currentFile = value;
IniFile.WriteValue("Editor", "LastOpen", value);
}
}
string _lastFolder = null;
public string LastFolder
{
get
{
if (string.IsNullOrEmpty(_lastFolder))
{
_lastFolder = IniFile.ReadValue("Editor", "LastFolder");
}
if (string.IsNullOrEmpty(_lastFolder))
{
_lastFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "VisualCodeEditor");

}
return _lastFolder;
}
set
{
_lastFolder = value;
IniFile.WriteValue("Editor", "LastFolder", value);
}
}
#endregion

#region 操作按钮
private void OnNew(object sender, RoutedEventArgs e)
{
e.Handled = true;
File = null;
//Title = "Visual Code Editor";
//using (var stream = GetType().Assembly.GetManifestResourceStream("ScratchNet.scripts.main.vsc"))
//{
// //Script script = Serialization.Load(stream) as Script;
// //SetupScriptToolbar(script);
// //Editor.Script = script;
// stream.Close();
//}
//Editor.IsEnabled = true;
ButtonOpen.IsEnabled = true;
ButtonSave.IsEnabled = true;
ButtonStart.IsEnabled = true;
ButtonSaveAs.IsEnabled = true;
ButtonPrint.IsEnabled = true;
//Editor.IsModified = true;
}
private void OnOpen(object sender, RoutedEventArgs e)
{
e.Handled = true;
OpenFileDialog dlg = new OpenFileDialog();
dlg.DefaultExt = ".vsc";
dlg.Filter = "Visual Script Files (*.vsc)|*.vsc|All Files (*.*)|*.*";
dlg.Multiselect = false;
dlg.InitialDirectory = LastFolder;
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
//Editor.Script = null;
//Editor.IsEnabled = false;
//File = dlg.FileName;
//LastFolder = new FileInfo(dlg.FileName).DirectoryName;
//try
//{
// Script script = Serialization.Load(File) as Script;
// SetupScriptToolbar(script);
// Editor.Script = script;
// if (script == null)
// return;
// this.Title = Properties.Resources.VisualCodeEditor + " - " + File;
// Editor.IsModified = false;
// ShowMessage(toast.ShowSuccess, string.Format(Properties.Resources.SuccessLodFile, File));
//}
//catch (Exception ex)
//{
// MessageBox.Show(string.Format(Properties.Resources.ExceptionLoadFile, File));
// return;
//}
//Editor.IsEnabled = true;
ButtonOpen.IsEnabled = true;
ButtonSave.IsEnabled = true;
ButtonStart.IsEnabled = true;
ButtonSaveAs.IsEnabled = true;
ButtonPrint.IsEnabled = true;
ButtonStart.IsEnabled = true;
}
}
private void OnSave(object sender, RoutedEventArgs e)
{
//if (string.IsNullOrEmpty(File))
//{
// SaveFileDialog dlg = new SaveFileDialog();
// dlg.DefaultExt = ".vsc";
// dlg.Filter = "Visual Script Files (*.vsc)|*.vsc|All Files (*.*)|*.*";
// //dlg.Multiselect = false;
// if (!string.IsNullOrEmpty(LastFolder))
// dlg.InitialDirectory = LastFolder;

// Nullable<bool> result = dlg.ShowDialog();
// if (result != true)
// {
// return;
// }
// File = dlg.FileName;
// Title = Properties.Resources.VisualCodeEditor + " - " + File;
// LastFolder = new FileInfo(dlg.FileName).DirectoryName;
//}
//Serialization.Save((Script)Editor.Script, File);
//ShowMessage(toast.ShowSuccess, string.Format(Properties.Resources.SuccessLodFile, File));
//Editor.IsModified = false;
//ButtonOpen.IsEnabled = true;
//ButtonSave.IsEnabled = true;
//ButtonStart.IsEnabled = true;
//ButtonSaveAs.IsEnabled = true;
//ButtonPrint.IsEnabled = true;
}
private void OnSaveAs(object sender, RoutedEventArgs e)
{
//e.Handled = true;
//SaveFileDialog dlg = new SaveFileDialog();
//dlg.DefaultExt = ".vsc";
//dlg.Filter = "Visual Script Files (*.vsc)|*.vsc|All Files (*.*)|*.*";
////dlg.Multiselect = false;
//dlg.InitialDirectory = LastFolder;

//Nullable<bool> result = dlg.ShowDialog();
//if (result != true)
//{
// return;
//}
//File = dlg.FileName;
//LastFolder = new FileInfo(dlg.FileName).DirectoryName;
//Serialization.Save((Script)Editor.Script, File);
//Title = Properties.Resources.VisualCodeEditor + " - " + File;
//ShowMessage(toast.ShowSuccess, string.Format(Properties.Resources.SuccessLodFile, File));
//Editor.IsModified = false;
//ButtonOpen.IsEnabled = true;
//ButtonSave.IsEnabled = true;
//ButtonStart.IsEnabled = true;
//ButtonSaveAs.IsEnabled = true;
//ButtonPrint.IsEnabled = true;
}
private void OnPrint(object sender, RoutedEventArgs e)
{
//e.Handled = true;
//Editor.Print();
}
private void OnCopy(object sender, RoutedEventArgs e)
{
//Editor.Copy();
}
private void OnPaste(object sender, RoutedEventArgs e)
{
//Editor.Paste(new Point());
}
private void OnStartRun(object sender, RoutedEventArgs e)
{
//Editor.ClearHighlight();
//stackTrace.Clear();
////check main function
//bool hasMain = false;
//foreach (var f in Editor.Script.Functions)
//{
// if (f.Name.Equals("main", StringComparison.OrdinalIgnoreCase))
// {
// hasMain = true;
// break;
// }
//}
//if (!hasMain)
//{
// MessageBox.Show(Properties.Resources.MainNotFound, Properties.Resources.NoMain, MessageBoxButton.OK, MessageBoxImage.Warning);
// return;
//}
//ButtonClearError.IsEnabled = false;
//IsHighlightStep = ButtonHighligh.IsChecked.Value;
//stackTrace.Clear();
//engine = new ExecutionEnvironment();
//engine.EnterNode += Engine_EnterNode;
//engine.LeaveNode += Engine_LeaveNode;
//ButtonStart.IsEnabled = false;
//ButtonStop.IsEnabled = true;
////Editor.IsEnabled = false;
//engine.ExecutionCompleted += Engine_ExecutionCompleted;
//engine.ExecutionAborted += Engine_ExecutionAborted;
//engine.ExecuteAsync(Editor.Script);
//Console.WriteLine("Start run");
return;
}
private void OnStopRun(object sender, RoutedEventArgs e)
{

//if (engine != null)
//{
// engine.EnterNode -= Engine_EnterNode;
// engine.LeaveNode -= Engine_LeaveNode;
// //Editor.IsEnabled = false;
// engine.ExecutionCompleted -= Engine_ExecutionCompleted;
// engine.ExecutionAborted -= Engine_ExecutionAborted;
// engine.Stop();
// PrintLnStatement.Stop();
// engine = null;
// ButtonStart.IsEnabled = true;
// ButtonStop.IsEnabled = false;
//}

}
private void OnClearError(object sender, RoutedEventArgs e)
{
//ButtonClearError.IsEnabled = false;
//Editor.ClearHighlight();
}
private void OnHighlightClicked(object sender, RoutedEventArgs e)
{
// IsHighlightStep = ButtonHighligh.IsChecked.Value;
}
private void OnSpeedValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{

}
#endregion
}
}

+ 60
- 0
BeDesignerSCADA/Helper/IniFile.cs Целия файл

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace BeDesignerSCADA.Helper
{
/// <summary>
/// 文件帮助类
/// </summary>
public class IniFile
{
#region ini
[DllImport("kernel32")]
internal static extern long WritePrivateProfileString(string section,
string key, string val, string filePath);
[DllImport("kernel32")]
internal static extern int GetPrivateProfileString(string section,
string key, string def, StringBuilder retVal,
int size, string filePath);
[DllImport("kernel32.dll")]
private static extern int GetPrivateProfileSection(string lpAppName, byte[] lpszReturnBuffer, int nSize, string lpFileName);

static string configFile = null;
public static string ConfigFileName
{
get
{
if (string.IsNullOrEmpty(configFile))
{
string configFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "VisualCodeEditor");
if (!Directory.Exists(configFolder))
Directory.CreateDirectory(configFolder);
configFile = System.IO.Path.Combine(configFolder, ".config");
}
return configFile;
}
}
public static void WriteValue(string Section, string Key, string Value)
{
WritePrivateProfileString(Section, Key, Value, ConfigFileName);
}

public static string ReadValue(string Section, string Key)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section, Key, "", temp,
255, ConfigFileName);
if (i <= 0)
return null;
String Value = temp.ToString();
return Value;

}
#endregion ini
}
}

+ 18
- 0
BeDesignerSCADA/MainWindow.xaml Целия файл

@@ -12,6 +12,24 @@
mc:Ignorable="d"
WindowStartupLocation="CenterScreen" Height="900" Width="1400"
Title="黑菠萝科技-[组态软件1.0]" Icon="/Images/ico.ico" >
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/可视化配置工具;component/Themes/Styles.xaml"></ResourceDictionary>
<ResourceDictionary Source="/BPASmartClient.SCADAControl;component/Themes/Generic.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<!--<TabControl x:Name="ReditSeleceTab" SelectedIndex="0">
<TabItem Header="可视化界面编辑器" >
<Border x:Name="grid">
</Border>
</TabItem>
<TabItem Header="图形化服务编辑器" >
<Border x:Name="gridCode">
</Border>
</TabItem>
</TabControl>-->
<Border x:Name="grid">
</Border>
</Window>

+ 2
- 0
BeDesignerSCADA/MainWindow.xaml.cs Целия файл

@@ -9,10 +9,12 @@ namespace BeDesignerSCADA
public partial class MainWindow : Window
{
CanvasPanelNew mainCanvas = new CanvasPanelNew($"{System.AppDomain.CurrentDomain.BaseDirectory}Layouts\\可视化界面菜单布局.yf");
CodeCanvasPanel codeCanvasPanel = new CodeCanvasPanel();
public MainWindow()
{
InitializeComponent();
grid.Child = mainCanvas;
//gridCode.Child = codeCanvasPanel;
}
}
}

+ 18
- 7
BeDesignerSCADA/ViewModel/MainViewModelNew.cs Целия файл

@@ -11,6 +11,7 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
@@ -664,7 +665,6 @@ namespace BeDesignerSCADA.ViewModel

}
}
/// <summary>
/// 根据路径保存菜单布局
/// </summary>
@@ -733,14 +733,25 @@ namespace BeDesignerSCADA.ViewModel
/// </summary>
public void LoadValuesHeader()
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "变量管理器文件|*.json";
if (ofd.ShowDialog() == true)
try
{
string path= AppDomain.CurrentDomain.BaseDirectory + "BPASmart.VariableManager.exe";
if (File.Exists(path))
{
Process.Start(path);
}
}
catch (Exception ex)
{
VariablePath = ofd.FileName;
bool isSucess = DataBusModel.GetInstance().RefreshVariableManager(ofd.FileName);
System.Windows.MessageBox.Show(isSucess ? "加载成功!" : "加载失败!");
}
//OpenFileDialog ofd = new OpenFileDialog();
//ofd.Filter = "变量管理器文件|*.json";
//if (ofd.ShowDialog() == true)
//{
// VariablePath = ofd.FileName;
// bool isSucess = DataBusModel.GetInstance().RefreshVariableManager(ofd.FileName);
// System.Windows.MessageBox.Show(isSucess ? "加载成功!" : "加载失败!");
//}
}
#endregion
}


Зареждане…
Отказ
Запис