@@ -21,6 +21,7 @@ namespace BPASmart.ConfigurationSoftware | |||
protected override void OnStartup(StartupEventArgs e) | |||
{ | |||
base.OnStartup(e); | |||
Json<LocalPar>.Read(); | |||
if (e.Args != null && e.Args.Length == 1) | |||
{ | |||
var res = e.Args[0]; | |||
@@ -34,6 +35,7 @@ namespace BPASmart.ConfigurationSoftware | |||
protected override void OnExit(ExitEventArgs e) | |||
{ | |||
base.OnExit(e); | |||
Json<LocalPar>.Save(); | |||
} | |||
} | |||
} |
@@ -6,7 +6,7 @@ | |||
<Nullable>enable</Nullable> | |||
<UseWPF>true</UseWPF> | |||
<UseWindowsForms>true</UseWindowsForms> | |||
<ApplicationIcon>fyf.ico</ApplicationIcon> | |||
<ApplicationIcon>Images\fyf.ico</ApplicationIcon> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
@@ -14,13 +14,13 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Content Include="fyf.ico"> | |||
<Content Include="Images\fyf.ico"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Helper" Version="1.0.9" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.15" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -32,11 +32,6 @@ | |||
<ProjectReference Include="..\BPASmart.VariableManager\BPASmart.VariableManager.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="ViewModel\" /> | |||
<Folder Include="View\" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Reference Include="Interop.IWshRuntimeLibrary"> | |||
<HintPath>..\BPASmartClient.Helper\obj\Debug\net6.0\Interop.IWshRuntimeLibrary.dll</HintPath> | |||
@@ -1,18 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.ConfigurationSoftware | |||
{ | |||
public class BasicInformation | |||
{ | |||
/// <summary> | |||
/// 项目上次保存的目录 | |||
/// </summary> | |||
public string ProjectDefaultPath { get; set; } = string.Empty; | |||
} | |||
} |
@@ -1,89 +0,0 @@ | |||
using BPA.Helper; | |||
using BPASmart.Model; | |||
using Microsoft.Win32; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Runtime.InteropServices; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Forms; | |||
namespace BPASmart.ConfigurationSoftware | |||
{ | |||
public class FileHelper | |||
{ | |||
private volatile static FileHelper _Instance; | |||
public static FileHelper GetInstance => _Instance ?? (_Instance = new FileHelper()); | |||
private FileHelper() { } | |||
public void RegisterOpenFileType() | |||
{ | |||
string icoFile = System.Windows.Forms.Application.StartupPath + $"\\fyf.ico"; | |||
string DirectoryPath = $"{Json<ProjectModel>.Data.ProjectPath}\\Images"; | |||
Directory.CreateDirectory(DirectoryPath); | |||
File.Copy(icoFile, $"{DirectoryPath}\\fyf.ico"); | |||
RegisterFileType(".project", "HBL", ".project", System.Windows.Forms.Application.ExecutablePath, $"{DirectoryPath}\\fyf.ico"); | |||
} | |||
private void RegisterFileType(string typeName, string fileType, string fileContent, string app, string ico) | |||
{ | |||
string toolPath = app;//工具启动路径 | |||
string extension = typeName;//fileType = "自定义文件类型"; | |||
//fileContent = "AAAA"; | |||
//获取信息 | |||
RegistryKey registryKey = Registry.ClassesRoot.OpenSubKey(extension); | |||
if (registryKey != null) | |||
{ | |||
try | |||
{ | |||
RegistryKey _Regkey = Registry.ClassesRoot.OpenSubKey("", true); | |||
RegistryKey _VRPkey = _Regkey.OpenSubKey(extension); | |||
if (_VRPkey != null) _Regkey.DeleteSubKeyTree(extension, true); | |||
if (_VRPkey != null) _Regkey.DeleteSubKeyTree("Exec"); | |||
} | |||
catch (Exception e) | |||
{ | |||
} | |||
} | |||
if (registryKey != null && registryKey.OpenSubKey("shell") != null && registryKey.OpenSubKey("shell").OpenSubKey("open") != null && | |||
registryKey.OpenSubKey("shell").OpenSubKey("open").OpenSubKey("command") != null) | |||
{ | |||
var varSub = registryKey.OpenSubKey("shell").OpenSubKey("open").OpenSubKey("command"); | |||
var varValue = varSub.GetValue(""); | |||
if (Equals(varValue, toolPath + " \"%1\"")) | |||
{ | |||
return; | |||
} | |||
} | |||
//文件注册 | |||
registryKey = Registry.ClassesRoot.CreateSubKey(extension); | |||
registryKey.SetValue("", fileType); | |||
registryKey.SetValue("Content Type", fileContent); | |||
//设置默认图标 | |||
RegistryKey iconKey = registryKey.CreateSubKey("DefaultIcon"); | |||
//iconKey.SetValue("", Application.StartupPath + $"\\{ico}.ico"); | |||
iconKey.SetValue("", ico); | |||
iconKey.Close(); | |||
//设置默认打开程序路径 | |||
registryKey = registryKey.CreateSubKey("shell\\open\\command"); | |||
registryKey.SetValue("", toolPath + " \"%1\""); | |||
//关闭 | |||
registryKey.Close(); | |||
SHChangeNotify(0x8000000, 0, IntPtr.Zero, IntPtr.Zero); | |||
} | |||
[DllImport("shell32.dll")] | |||
public static extern void SHChangeNotify(uint wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2); | |||
} | |||
} | |||
@@ -14,6 +14,7 @@ using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Forms; | |||
namespace BPASmart.ConfigurationSoftware | |||
{ | |||
@@ -135,6 +136,11 @@ namespace BPASmart.ConfigurationSoftware | |||
{ | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
if (Pages.Count <= 0) | |||
{ | |||
Serialization<BinConfigFile>.Data.StartPageName = o.ToString(); | |||
Serialization<BinConfigFile>.Save($"{FileConfigModel.GetBinConfigPath}"); | |||
} | |||
Pages.Add(o.ToString()); | |||
string path = $"{ Json<ProjectModel>.Data.ProjectPath}\\{FileConfigModel.PageDirName}"; | |||
Directory.CreateDirectory(path); | |||
@@ -162,11 +168,32 @@ namespace BPASmart.ConfigurationSoftware | |||
ProjectNameChange?.Invoke(objModel.ProjectName); | |||
FileConfigModel.ConstPath = $"{path}"; | |||
Save(); | |||
FileHelper.GetInstance.RegisterOpenFileType(); | |||
//FileHelper.GetInstance.RegisterOpenFileType(); | |||
RegisterOpenFileType(); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 注册使用默认应用程序打开自定义文件 | |||
/// </summary> | |||
private void RegisterOpenFileType() | |||
{ | |||
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> | |||
/// 打开新建页面弹窗 | |||
/// </summary> | |||
@@ -217,6 +244,54 @@ namespace BPASmart.ConfigurationSoftware | |||
} | |||
} | |||
/// <summary> | |||
/// 删除指定界面 | |||
/// </summary> | |||
/// <param name="o"></param> | |||
public void RemovePageCommand(object o) | |||
{ | |||
MessageLog.GetInstance.Show($"准备删除页面:{o.ToString()}"); | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
if (Pages.FirstOrDefault(p => p == o.ToString()) != null) | |||
{ | |||
Pages.Remove(o.ToString()); | |||
if (Json<ProjectModel>.Data.Pages.ContainsKey(o.ToString())) | |||
Json<ProjectModel>.Data.Pages.Remove(o.ToString()); | |||
string path = $"{FileConfigModel.ConstPath}\\{FileConfigModel.PageDirName}\\{o.ToString()}.lay"; | |||
if (File.Exists(path)) File.Delete(path); | |||
if (!File.Exists(path)) MessageLog.GetInstance.Show($"页面 {o.ToString()} 删除成功"); | |||
else MessageLog.GetInstance.Show($"页面 {o.ToString()} 删除失败"); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 设置界面为启动界面 | |||
/// </summary> | |||
/// <param name="o"></param> | |||
public void SetStartPageCommand(object o) | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
Serialization<BinConfigFile>.Data.StartPageName = o.ToString(); | |||
Serialization<BinConfigFile>.Save($"{FileConfigModel.GetBinConfigPath}"); | |||
} | |||
MessageLog.GetInstance.Show($"当前启动页面:{Serialization<BinConfigFile>.Data.StartPageName}"); | |||
} | |||
/// <summary> | |||
/// 重命名界面名称 | |||
/// </summary> | |||
/// <param name="o"></param> | |||
public void ReNameCommand(object o) | |||
{ | |||
if (!string.IsNullOrEmpty(o?.ToString())) | |||
{ | |||
MessageLog.GetInstance.Show($"页面 {o.ToString()}重命名"); | |||
} | |||
} | |||
/// <summary> | |||
/// 项目保存 | |||
/// </summary> | |||
@@ -231,33 +306,86 @@ namespace BPASmart.ConfigurationSoftware | |||
} | |||
/// <summary> | |||
/// 应用程序打包程序 | |||
/// 运行项目 | |||
/// </summary> | |||
public void ApplicationBale() | |||
/// <returns></returns> | |||
public async Task RunProjectAsync() | |||
{ | |||
if (string.IsNullOrEmpty(FileConfigModel.ConstPath)) | |||
MessageLog.GetInstance.Show("启动中...."); | |||
await ApplicationBaleAsync(); | |||
string publishPath = $"{FileConfigModel.ConstPath}\\Publish\\{Json<ProjectModel>.Data.ProjectName}\\"; | |||
string name = $" {publishPath}{ Json<ProjectModel>.Data.ProjectName}.exe"; | |||
if (File.Exists(name)) | |||
{ | |||
MessageLog.GetInstance.Show("打包路径不合法,打包失败"); | |||
return; | |||
Process[] pro = Process.GetProcesses(); | |||
if (pro?.ToList().FirstOrDefault(p => p.ProcessName.Contains("BPASmart.PageLoad")) == null) | |||
{ | |||
Process.Start(name); | |||
} | |||
} | |||
MessageLog.GetInstance.Show("开始打包"); | |||
string path = $"{FileConfigModel.ConstPath}\\Publish\\{Json<ProjectModel>.Data.ProjectName}"; | |||
Directory.CreateDirectory(path); | |||
MessageLog.GetInstance.Show($"打包路径:{path}"); | |||
MessageLog.GetInstance.Show("启动完成"); | |||
//打包组件 | |||
string dllPath = AppDomain.CurrentDomain.BaseDirectory; | |||
if (Directory.Exists(dllPath)) CopyFolder(dllPath, $"{path}", new string[] { FileConfigModel.ConfigDirName, "Videos" }); | |||
} | |||
//打包配置文件 | |||
string ConfigFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.ConfigDirName}"; | |||
if (Directory.Exists(ConfigFilePath)) CopyFolder(ConfigFilePath, $"{path}\\{FileConfigModel.ConfigDirName}"); | |||
/// <summary> | |||
/// 打开项目 | |||
/// </summary> | |||
public void OpenProject() | |||
{ | |||
OpenFileDialog ofd = new OpenFileDialog(); | |||
ofd.Filter = "项目|*.project;"; | |||
if (ofd.ShowDialog() == DialogResult.OK) | |||
{ | |||
Json<ProjectModel>.Read(ofd.FileName); | |||
var pages = Json<ProjectModel>.Data.Pages.OrderBy(p => p.Key).ToDictionary(p => p.Key, s => s.Value); | |||
ProjectStartInit(); | |||
} | |||
} | |||
//打包页面文件 | |||
string pageFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.PageDirName}"; | |||
if (Directory.Exists(pageFilePath)) CopyFolder(pageFilePath, $"{path}\\{FileConfigModel.PageDirName}"); | |||
/// <summary> | |||
/// 应用程序打包程序 | |||
/// </summary> | |||
public async Task ApplicationBaleAsync() | |||
{ | |||
ProjectSave(); | |||
await Task.Factory.StartNew(new Action(() => | |||
{ | |||
if (string.IsNullOrEmpty(FileConfigModel.ConstPath)) | |||
{ | |||
MessageLog.GetInstance.Show("打包路径不合法,打包失败"); | |||
return; | |||
} | |||
string publishPath = $"{FileConfigModel.ConstPath}\\Publish"; | |||
if (Directory.Exists(publishPath)) | |||
{ | |||
MessageLog.GetInstance.Show("清理旧数据"); | |||
Directory.Delete(publishPath, true); | |||
} | |||
MessageLog.GetInstance.Show("打包完成"); | |||
MessageLog.GetInstance.Show("开始打包"); | |||
string path = $"{FileConfigModel.ConstPath}\\Publish\\{Json<ProjectModel>.Data.ProjectName}"; | |||
Directory.CreateDirectory(path); | |||
MessageLog.GetInstance.Show($"打包路径:{path}"); | |||
//打包组件 | |||
string dllPath = AppDomain.CurrentDomain.BaseDirectory; | |||
if (Directory.Exists(dllPath)) CopyFolder(dllPath, $"{path}", new string[] { FileConfigModel.ConfigDirName, "Videos" }); | |||
//打包配置文件 | |||
string ConfigFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.ConfigDirName}"; | |||
if (Directory.Exists(ConfigFilePath)) CopyFolder(ConfigFilePath, $"{path}\\{FileConfigModel.ConfigDirName}"); | |||
//打包页面文件 | |||
string pageFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.PageDirName}"; | |||
if (Directory.Exists(pageFilePath)) CopyFolder(pageFilePath, $"{path}\\{FileConfigModel.PageDirName}"); | |||
//打包图片文件资源 | |||
string imageFilePath = $"{FileConfigModel.ConstPath}\\{FileConfigModel.ImageDirName}"; | |||
if (Directory.Exists(imageFilePath)) CopyFolder(imageFilePath, $"{path}\\{FileConfigModel.ImageDirName}"); | |||
MessageLog.GetInstance.Show("打包完成"); | |||
})); | |||
} | |||
/// <summary> | |||
@@ -277,6 +405,10 @@ namespace BPASmart.ConfigurationSoftware | |||
foreach (string file in files) | |||
{ | |||
string name = Path.GetFileName(file); | |||
if (name.Contains("BPASmart.PageLoad.exe")) | |||
{ | |||
name = $"{Json<ProjectModel>.Data.ProjectName}.exe"; | |||
} | |||
string dest = Path.Combine(destFolder, name); | |||
File.Copy(file, dest);//复制文件 | |||
} | |||
@@ -320,7 +452,7 @@ namespace BPASmart.ConfigurationSoftware | |||
IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell(); | |||
IWshRuntimeLibrary.IWshShortcut shortcut = shell.CreateShortcut($"{path}{name}.lnk") as IWshRuntimeLibrary.IWshShortcut; | |||
shortcut.TargetPath = path; //目标文件 | |||
//该属性指定应用程序的工作目录,当用户没有指定一个具体的目录时,快捷方式的目标应用程序将使用该属性所指定的目录来装载或保存文件。 | |||
//该属性指定应用程序的工作目录,当用户没有指定一个具体的目录时,快捷方式的目标应用程序将使用该属性所指定的目录来装载或保存文件。 | |||
shortcut.WorkingDirectory = System.Environment.CurrentDirectory; | |||
shortcut.WindowStyle = 1; //目标应用程序的窗口状态分为普通、最大化、最小化【1,3,7】 | |||
shortcut.Description = name; //描述 |
@@ -128,12 +128,13 @@ | |||
<Button | |||
Width="60" | |||
Margin="5" | |||
Command="{Binding}" | |||
Command="{Binding OpenProjectCommand}" | |||
Content="打开" /> | |||
<Button | |||
Width="60" | |||
Margin="5" | |||
Command="{Binding RunCommand}" | |||
Content="运行" /> | |||
<Button | |||
@@ -189,14 +190,43 @@ | |||
Content="{Binding}" | |||
GroupName="All" | |||
Style="{StaticResource RadioMiniButtonStyle}"> | |||
<RadioButton.ContextMenu> | |||
<ContextMenu> | |||
<MenuItem Header="删除页面" /> | |||
<MenuItem Header="设为启动界面" /> | |||
<MenuItem Header="重命名" /> | |||
<!--<RadioButton.ContextMenu> | |||
<ContextMenu ItemsSource="{Binding DataContext}"> | |||
<MenuItem | |||
Command="{Binding DataContext.RemovePageCommand, RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=5, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Header="删除页面" /> | |||
<MenuItem | |||
Command="{Binding DataContext.SetStartPageCommand,RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=5,Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Header="设为启动界面" /> | |||
<MenuItem | |||
Command="{Binding DataContext.ReNameCommand, RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=5, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Header="重命名" /> | |||
</ContextMenu> | |||
</RadioButton.ContextMenu> | |||
</RadioButton.ContextMenu>--> | |||
</RadioButton> | |||
<Grid.ContextMenu> | |||
<ContextMenu ItemsSource="{Binding DataContext}"> | |||
<MenuItem | |||
Command="{Binding DataContext.RemovePageCommand, RelativeSource={RelativeSource AncestorType=ScrollViewer, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Header="删除页面" /> | |||
<MenuItem | |||
Command="{Binding DataContext.SetStartPageCommand, RelativeSource={RelativeSource AncestorType=ScrollViewer, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Header="设为启动界面" /> | |||
<MenuItem | |||
Command="{Binding DataContext.ReNameCommand, RelativeSource={RelativeSource AncestorType=ScrollViewer, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Header="重命名" /> | |||
</ContextMenu> | |||
</Grid.ContextMenu> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> |
@@ -29,7 +29,7 @@ | |||
Height="30" | |||
VerticalAlignment="Top" | |||
FontSize="16" | |||
Text="{Binding NewData.ProjectName}" /> | |||
Text="" /> | |||
<TextBlock | |||
@@ -48,6 +48,7 @@ | |||
<Button | |||
Margin="10,2,10,2" | |||
IsDefault="True" | |||
Click="Button_Click_1" | |||
Content="创建" /> | |||
<Button |
@@ -24,6 +24,22 @@ namespace BPASmart.ConfigurationSoftware | |||
public NewPageView() | |||
{ | |||
InitializeComponent(); | |||
DefaultPageName(); | |||
this.pageName.Focus(); | |||
} | |||
private void DefaultPageName() | |||
{ | |||
int count = 0; | |||
while (true) | |||
{ | |||
count++; | |||
if (!Json<ProjectModel>.Data.Pages.ContainsKey($"Page{count}")) | |||
{ | |||
this.pageName.Text = $"Page{count}"; | |||
break; | |||
} | |||
} | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) |
@@ -6,8 +6,8 @@ | |||
xmlns:local="clr-namespace:BPASmart.ConfigurationSoftware" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
Title="创建新项目" | |||
Width="300" | |||
Height="180" | |||
Width="330" | |||
Height="220" | |||
WindowStartupLocation="CenterScreen" | |||
mc:Ignorable="d"> | |||
@@ -28,8 +28,10 @@ | |||
<TextBlock VerticalAlignment="Center" Text="项目名称:" /> | |||
<TextBox | |||
Name="projectName" | |||
Grid.Row="1" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="{Binding NewData.ProjectName}" /> | |||
<TextBlock | |||
@@ -53,7 +55,8 @@ | |||
Grid.Row="4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Text="{Binding ErrorInfo}" Foreground="Red"/> | |||
Foreground="Red" | |||
Text="{Binding ErrorInfo}" /> | |||
<Grid Grid.Row="5"> | |||
<Grid.ColumnDefinitions> | |||
@@ -65,7 +68,8 @@ | |||
<Button | |||
Margin="10,2,10,2" | |||
Command="{Binding CreateCommand}" | |||
Content="创建" /> | |||
Content="创建" | |||
IsDefault="True" /> | |||
<Button | |||
Grid.Column="1" | |||
Grid.ColumnSpan="2" |
@@ -23,6 +23,7 @@ namespace BPASmart.ConfigurationSoftware | |||
public NewProjectView() | |||
{ | |||
InitializeComponent(); | |||
projectName.Focus(); | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
this.DialogResult = true; |
@@ -31,14 +31,18 @@ namespace BPASmart.ConfigurationSoftware | |||
OpenVarManagerCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenVariableManagerTool(); }); | |||
SelectedPageCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.SelectedPage(o); }); | |||
SaveProjectCommand = new RelayCommand(() => { ServiceCenter.GetInstance.ProjectSave(); }); | |||
GengrateCommand = new RelayCommand(() => { ServiceCenter.GetInstance.ApplicationBale(); }); | |||
GengrateCommand = new RelayCommand(async () => { await ServiceCenter.GetInstance.ApplicationBaleAsync(); }); | |||
RemovePageCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.RemovePageCommand(o); }); | |||
ReNameCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.ReNameCommand(o); }); | |||
SetStartPageCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.SetStartPageCommand(o); }); | |||
RunCommand = new RelayCommand(async () => { await ServiceCenter.GetInstance.RunProjectAsync(); }); | |||
OpenProjectCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenProject(); }); | |||
ServiceCenter.GetInstance.PageChange = new Action<FrameworkElement>((f) => { MainContent = f; }); | |||
ServiceCenter.GetInstance.ProjectNameChange = new Action<string>((s) => { Head = s; }); | |||
mainCanvasPanels = ServiceCenter.GetInstance.mainCanvasPanels; | |||
Pages = ServiceCenter.GetInstance.Pages; | |||
Message = ServiceCenter.GetInstance.Message; | |||
ServiceCenter.GetInstance.Init(); | |||
} | |||
public RelayCommand NewProjectCommand { get; set; } | |||
@@ -53,6 +57,16 @@ namespace BPASmart.ConfigurationSoftware | |||
public RelayCommand GengrateCommand { get; set; } | |||
public RelayCommand OpenProjectCommand { get; set; } | |||
public RelayCommand<object> RemovePageCommand { get; set; } | |||
public RelayCommand<object> SetStartPageCommand { get; set; } | |||
public RelayCommand<object> ReNameCommand { get; set; } | |||
public RelayCommand RunCommand { get; set; } | |||
public string Head { get { return _mHead; } set { _mHead = value; OnPropertyChanged(); } } | |||
private string _mHead; | |||
@@ -16,16 +16,17 @@ namespace BPASmart.ConfigurationSoftware | |||
{ | |||
public NewProjectViewModel() | |||
{ | |||
Json<BasicInformation>.Read(); | |||
NewData.ProjectPath = Json<BasicInformation>.Data.ProjectDefaultPath; | |||
//Json<BasicInformation>.Read(); | |||
NewData.ProjectPath = Json<LocalPar>.Data.ProjectDefaultPath; | |||
DefaultName(); | |||
OpenBrowserDialogCommand = new RelayCommand(() => | |||
{ | |||
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); | |||
if (folderBrowserDialog.ShowDialog() == DialogResult.OK) | |||
{ | |||
NewData.ProjectPath = folderBrowserDialog.SelectedPath; | |||
Json<BasicInformation>.Data.ProjectDefaultPath = NewData.ProjectPath; | |||
Json<BasicInformation>.Save(); | |||
Json<LocalPar>.Data.ProjectDefaultPath = NewData.ProjectPath; | |||
//Json<LocalPar>.Save(); | |||
} | |||
}); | |||
@@ -59,6 +60,21 @@ namespace BPASmart.ConfigurationSoftware | |||
} | |||
private void DefaultName() | |||
{ | |||
var res = Directory.GetDirectories(NewData.ProjectPath); | |||
int count = 0; | |||
while (true) | |||
{ | |||
count++; | |||
if (res?.ToList()?.FirstOrDefault(p => p.Contains($"default{count}")) == null) | |||
{ | |||
NewData.ProjectName = $"default{count}"; | |||
break; | |||
} | |||
} | |||
} | |||
public NewProjectModel NewData { get { return _mNewData; } set { _mNewData = value; OnPropertyChanged(); } } | |||
private NewProjectModel _mNewData = new NewProjectModel(); | |||
@@ -7,13 +7,10 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||
<PackageReference Include="System.IO.Ports" Version="6.0.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="权限\" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,17 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
[Serializable] | |||
public class BinConfigFile | |||
{ | |||
/// <summary> | |||
/// 启动页面名称 | |||
/// </summary> | |||
public string StartPageName { get; set; } | |||
} | |||
} |
@@ -29,6 +29,25 @@ namespace BPASmart.Model | |||
} | |||
} | |||
/// <summary> | |||
/// 获取二进制文件配置路径 | |||
/// </summary> | |||
/// <returns></returns> | |||
public static string GetBinConfigPath | |||
{ | |||
get | |||
{ | |||
string ReturnValue = null; | |||
if (Directory.Exists(ConstPath)) | |||
{ | |||
string path = $"{ConstPath}\\{ConfigDirName}\\{BaseConfig}"; | |||
Directory.CreateDirectory(path); | |||
ReturnValue = $"{ConstPath}\\{ConfigDirName}\\{BaseConfig}\\{BinConfigFileName}"; | |||
} | |||
return ReturnValue; | |||
} | |||
} | |||
/// <summary> | |||
/// 变量管理器路径 | |||
/// </summary> | |||
@@ -43,5 +62,20 @@ namespace BPASmart.Model | |||
/// 配置文件文件夹名称 | |||
/// </summary> | |||
public const string ConfigDirName = "AccessFile"; | |||
/// <summary> | |||
/// 基本配置文件夹名称 | |||
/// </summary> | |||
public const string BaseConfig = "Bin"; | |||
/// <summary> | |||
/// 二进制配置文件名 | |||
/// </summary> | |||
public const string BinConfigFileName = "BinConfigFile.ser"; | |||
/// <summary> | |||
/// 图片文件夹名称 | |||
/// </summary> | |||
public const string ImageDirName = "Images"; | |||
} | |||
} |
@@ -37,6 +37,25 @@ namespace BPASmart.Model | |||
return 1; | |||
} | |||
public static string ToSystemData(this EDataType eData) | |||
{ | |||
switch (eData) | |||
{ | |||
case EDataType.Bool: return "bool"; | |||
case EDataType.Byte: return "byte"; | |||
case EDataType.Int: return "short"; | |||
case EDataType.Word: return "ushort"; | |||
case EDataType.Dint: return "int"; | |||
case EDataType.Dword: return "uint"; | |||
case EDataType.Float: return "float"; | |||
case EDataType.Double: return "double"; | |||
case EDataType.String: return "string"; | |||
default: | |||
break; | |||
} | |||
return default; | |||
} | |||
/// <summary> | |||
/// 获取Modbus Tcp 连续变量数据的组对象 | |||
/// </summary> | |||
@@ -0,0 +1,19 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmart.Model; | |||
namespace BPASmart.Model | |||
{ | |||
public interface IRecipeMaterials | |||
{ | |||
Task<bool> AddAsync(RecipeMaterials recipeMaterials); | |||
Task<bool> AddRangeAsync(RecipeMaterials[] recipeMaterials); | |||
Task<bool> UpdateAsync(RecipeMaterials recipeMaterials); | |||
Task<bool> DeleteAsync(string ID); | |||
Task<List<RecipeMaterials>> GetData(); | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
public interface IMessage | |||
{ | |||
} | |||
} |
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
public class PublishInfo | |||
public class PublishInfo : IMessage | |||
{ | |||
public List<PublishModel> PublishModels { get; set; } = new List<PublishModel>(); | |||
} | |||
@@ -0,0 +1,21 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
public class LocalUser | |||
{ | |||
/// <summary> | |||
/// 普通用户 | |||
/// </summary> | |||
public ObservableCollection<UserManager> UserManagers { get; set; } = new ObservableCollection<UserManager>(); | |||
/// <summary> | |||
/// 高等级用户 | |||
/// </summary> | |||
public ObservableCollection<UserManager> HighGradeUsers { get; set; } = new ObservableCollection<UserManager>(); | |||
} | |||
} |
@@ -0,0 +1,40 @@ | |||
using BPASmart.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
public class UserManager | |||
{ | |||
/// <summary> | |||
/// 用户ID | |||
/// </summary> | |||
public string? UserID { get; set; } | |||
/// <summary> | |||
/// 用户名 | |||
/// </summary> | |||
public string? UserName { get; set; } | |||
/// <summary> | |||
/// 用户密码 | |||
/// </summary> | |||
public string? Password { get; set; } | |||
/// <summary> | |||
/// 用户权限等级 | |||
/// </summary> | |||
public UserPower userPower { get; set; } = UserPower.普通用户权限; | |||
/// <summary> | |||
/// 用户权限列表 | |||
/// </summary> | |||
public ObservableCollection<string> powerList { get; set; } = new ObservableCollection<string>(); | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
public enum UserPower | |||
{ | |||
开发者权限 = 0, | |||
管理员权限 = 1, | |||
普通用户权限 = 2 | |||
} | |||
} |
@@ -5,7 +5,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model.配方 | |||
namespace BPASmart.Model | |||
{ | |||
public class LocalMaterails | |||
{ | |||
@@ -6,11 +6,11 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model.配方 | |||
namespace BPASmart.Model | |||
{ | |||
public class LocalRecipes | |||
public class LocalRecipes | |||
{ | |||
public ObservableCollection<Recipes> locaRecipes { get; set; } = new ObservableCollection<Recipes>(); | |||
} | |||
} |
@@ -6,9 +6,9 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model.配方 | |||
namespace BPASmart.Model | |||
{ | |||
public class Order:ObservableObject | |||
public class Order : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 订单ID | |||
@@ -5,9 +5,9 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model.配方 | |||
namespace BPASmart.Model | |||
{ | |||
public class Property:ObservableObject | |||
public class Property : ObservableObject | |||
{ | |||
public string PropertyId { get { return _propertyId; } set { _propertyId = value; OnPropertyChanged(); } } | |||
private string _propertyId; | |||
@@ -2,13 +2,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.ComponentModel.DataAnnotations.Schema; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model.配方 | |||
namespace BPASmart.Model | |||
{ | |||
public class RecipeMaterials:ObservableObject | |||
public class RecipeMaterials : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料ID | |||
@@ -18,7 +19,7 @@ namespace BPASmart.Model.配方 | |||
/// <summary> | |||
/// 物料名称 | |||
/// </summary> | |||
public string Name { get { return _name; } set { _name = value;OnPropertyChanged(); } } | |||
public string Name { get { return _name; } set { _name = value; OnPropertyChanged(); } } | |||
private string _name; | |||
/// <summary> | |||
/// 物料种类 | |||
@@ -28,22 +29,24 @@ namespace BPASmart.Model.配方 | |||
/// <summary> | |||
/// 物料重量 | |||
/// </summary> | |||
[NotMapped] | |||
public int MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } } | |||
private int _materialWeight; | |||
/// <summary> | |||
/// 原料位置 | |||
/// </summary> | |||
public string MaterialPosion { get { return _materialPosion; } set { _materialPosion = value;OnPropertyChanged(); } } | |||
public string MaterialPosion { get { return _materialPosion; } set { _materialPosion = value; OnPropertyChanged(); } } | |||
private string _materialPosion; | |||
/// <summary> | |||
/// 自定义原料属性集合 | |||
/// </summary> | |||
[NotMapped] | |||
public ObservableCollection<Property> PropertyCollections = new ObservableCollection<Property>(); | |||
} | |||
public enum MaterialType | |||
{ | |||
{ | |||
无 = 0, | |||
干料 = 1, | |||
湿料 = 2, | |||
@@ -6,9 +6,9 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model.配方 | |||
namespace BPASmart.Model | |||
{ | |||
public class Recipes:ObservableObject | |||
public class Recipes : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 配方ID | |||
@@ -38,6 +38,9 @@ namespace BPASmart.Model.配方 | |||
/// </summary> | |||
public ObservableCollection<RecipeMaterials> recipeMaterials { get; set; } | |||
public ObservableCollection<TechnologyProcessModel> TechnologyProcessModels { get; set; } = new ObservableCollection<TechnologyProcessModel>(); | |||
} | |||
public enum RecipeStates | |||
@@ -0,0 +1,48 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.Model | |||
{ | |||
public class TechnologyProcessModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 工艺步骤 | |||
/// </summary> | |||
public string Step { get { return _step; } set { _step = value; OnPropertyChanged(); } } | |||
private string _step; | |||
/// <summary> | |||
/// 炒制原料/桶号 | |||
/// </summary> | |||
public string FryMaterialNum { get { return _fryMaterialNum; } set { _fryMaterialNum = value; OnPropertyChanged(); } } | |||
private string _fryMaterialNum; | |||
/// <summary> | |||
/// 炒制速度 | |||
/// </summary> | |||
public double FrySpeed { get { return _frySpeed; } set { _frySpeed = value; OnPropertyChanged(); } } | |||
private double _frySpeed; | |||
/// <summary> | |||
/// 炒制重量 | |||
/// </summary> | |||
public double FryWeight { get { return _fryMaterialWeight; } set { _fryMaterialWeight = value; OnPropertyChanged(); } } | |||
private double _fryMaterialWeight; | |||
/// <summary> | |||
/// 炒制温度 | |||
/// </summary> | |||
public double FryTemperature { get { return _fryTemperature; } set { _fryTemperature = value; OnPropertyChanged(); } } | |||
private double _fryTemperature; | |||
/// <summary> | |||
/// 炒制时间 | |||
/// </summary> | |||
public double FryPeriodTime { get { return _fryPeriodTime; } set { _fryPeriodTime = value; OnPropertyChanged(); } } | |||
private double _fryPeriodTime; | |||
} | |||
} |
@@ -8,15 +8,11 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<None Remove="Images\bj.png" /> | |||
<None Remove="Images\fyf.ico" /> | |||
<None Remove="Images\logo-pic.png" /> | |||
<None Remove="Images\logo-Text.png" /> | |||
<None Remove="Images\top_h.png" /> | |||
<None Remove="Images\椭圆 22 副本 2.png" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.15" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BeDesignerSCADA\BeDesignerSCADA.csproj" /> | |||
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.MessageName\BPASmartClient.MessageName.csproj" /> | |||
@@ -35,25 +31,4 @@ | |||
</Reference> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Images\fyf.ico" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Images\bj.png" /> | |||
<Resource Include="Images\logo-pic.png" /> | |||
<Resource Include="Images\logo-Text.png" /> | |||
<Resource Include="Images\top_h.png" /> | |||
<Resource Include="Images\椭圆 22 副本 2.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Page Update="FControl\HBLControl.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
<Page Update="FControl\RunCanvas.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
</ItemGroup> | |||
</Project> |
@@ -1,32 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Data; | |||
namespace BPASmart.PageLoad.Converters | |||
{ | |||
public class ZoomConverter : IValueConverter | |||
{ | |||
public bool IsHeight { get; set; } | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
if (double.TryParse(value.ToString(), out double zoom)) | |||
{ | |||
return IsHeight ? zoom * 1080 : zoom * 1920; | |||
} | |||
else | |||
{ | |||
return IsHeight ? 1080 : 1920; | |||
} | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
return value; | |||
} | |||
} | |||
} |
@@ -1,144 +0,0 @@ | |||
<UserControl x:Class="BPASmart.PageLoad.FControl.HBLControl" | |||
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:BPASmart.PageLoad.FControl" | |||
mc:Ignorable="d" | |||
d:DesignHeight="140" d:DesignWidth="140"> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<LinearGradientBrush x:Key="yanjing" EndPoint="0,1"> | |||
<GradientStop Color="#CC00EAFF" Offset="0.08"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.08"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.16"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.16"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.24"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.24"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.32"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.32"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.40"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.40"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.48"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.48"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.56"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.56"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.64"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.64"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.72"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.72"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.80"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.80"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.88"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.88"></GradientStop> | |||
<GradientStop Color="Transparent" Offset="0.96"></GradientStop> | |||
<GradientStop Color="#CC00EAFF" Offset="0.96"></GradientStop> | |||
</LinearGradientBrush> | |||
<Storyboard x:Key="Storyboard1" RepeatBehavior="Forever"> | |||
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" | |||
Storyboard.TargetName="rectangle"> | |||
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.855,0.148"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.852,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.148,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.144,0.149"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,0"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3" Value="0.855,0.148"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3.5" Value="0.852,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4" Value="0.148,0.855"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4.5" Value="0.144,0.149"/> | |||
<EasingPointKeyFrame KeyTime="0:0:5" Value="0,0"/> | |||
</PointAnimationUsingKeyFrames> | |||
<PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" | |||
Storyboard.TargetName="rectangle"> | |||
<EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.145,0.852"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.148,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.852,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2" Value="0.856,0.851"/> | |||
<EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,1"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3" Value="0.145,0.852"/> | |||
<EasingPointKeyFrame KeyTime="0:0:3.5" Value="0.148,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4" Value="0.852,0.145"/> | |||
<EasingPointKeyFrame KeyTime="0:0:4.5" Value="0.856,0.851"/> | |||
<EasingPointKeyFrame KeyTime="0:0:5" Value="0,1"/> | |||
</PointAnimationUsingKeyFrames> | |||
<ColorAnimationUsingKeyFrames Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(Shape.Stroke).(GradientBrush.GradientStops)[1].(GradientStop.Color)"> | |||
<EasingColorKeyFrame KeyTime="00:00:02" Value="Lime"/> | |||
<EasingColorKeyFrame KeyTime="00:00:02.5000000" Value="#FF075AFF"/> | |||
<EasingColorKeyFrame KeyTime="00:00:4.5" Value="Lime"/> | |||
<EasingColorKeyFrame KeyTime="00:00:5" Value="#FF075AFF"/> | |||
</ColorAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="ico_map"> | |||
<EasingDoubleKeyFrame KeyTime="0:0:2.5" Value="-180"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:5" Value="-360"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
<Storyboard x:Key="StoryboardZY" RepeatBehavior="Forever"> | |||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="border"> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="6"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="12"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="border1"> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="6"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:1.4" Value="12"/> | |||
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="12"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<UserControl.Triggers> | |||
<EventTrigger RoutedEvent="FrameworkElement.Loaded"> | |||
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/> | |||
<BeginStoryboard Storyboard="{StaticResource StoryboardZY}"/> | |||
</EventTrigger> | |||
</UserControl.Triggers> | |||
<Grid Width="100" Height="100" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="20"> | |||
<Image x:Name="ico_map" Width="85" Height="85" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" Source="/Images/椭圆 22 副本 2.png" RenderTransformOrigin="0.5,0.5" > | |||
<Image.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform/> | |||
<SkewTransform/> | |||
<RotateTransform/> | |||
<TranslateTransform/> | |||
</TransformGroup> | |||
</Image.RenderTransform> | |||
</Image> | |||
<Image HorizontalAlignment="Center" Margin="0,90,0,0" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" VerticalAlignment="Top" Width="100" Height="20" Source="/Images/top_h.png" /> | |||
<Grid x:Name="grid_xiaoboluo" Width="100" Height="100" MouseEnter="grid_MouseEnter" MouseLeave="grid_MouseLeave"> | |||
<Grid> | |||
<Ellipse x:Name="rectangle" Width="70" Height="70" StrokeThickness="4" Fill="#FF022E50"> | |||
<Ellipse.Stroke> | |||
<LinearGradientBrush Opacity="1"> | |||
<GradientStop Color="Transparent" Offset="0"/> | |||
<GradientStop Color="#FF075AFF" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Ellipse.Stroke> | |||
</Ellipse> | |||
<Image x:Name="ico" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="-20,25,0,0" Width="25" Height="30" Source="/Images/logo-pic.png" /> | |||
<Image Width="31.6" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" Height="7.9" Margin="20,0,0,25" Source="/Images/logo-Text.png" /> | |||
<TextBlock Margin="0,24,0,0" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Foreground="#FF00EAFF" FontFamily="黑体" FontWeight="Bold">智能卓越</TextBlock> | |||
</Grid> | |||
<Grid x:Name="grid_celine" Visibility="Collapsed"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<Ellipse Grid.ColumnSpan="2" Width="70" Height="70" Fill="#2571ac" ></Ellipse> | |||
<Grid x:Name="yanjing_move" Grid.ColumnSpan="2" Width="35" Height="35"> | |||
<Grid > | |||
<Border x:Name="border1" HorizontalAlignment="Left" Grid.Column="0" Background="{DynamicResource yanjing}" CornerRadius="2" Width="8" Height="12"/> | |||
<Border x:Name="border" HorizontalAlignment="Right" Grid.Column="1" Background="{DynamicResource yanjing}" CornerRadius="2" Width="8" Height="12"/> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -1,32 +0,0 @@ | |||
<UserControl x:Class="BPASmart.PageLoad.FControl.RunCanvas" | |||
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:BPASmart.PageLoad.FControl" | |||
xmlns:con="clr-namespace:BPASmart.PageLoad.Converters" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.Resources> | |||
<con:ZoomConverter x:Key="ZoomX" IsHeight="False"/> | |||
<con:ZoomConverter x:Key="ZoomY" IsHeight="True"/> | |||
</UserControl.Resources> | |||
<Grid ClipToBounds="True"> | |||
<Canvas x:Name="RootCanvas" ClipToBounds="True" Background="Transparent" MouseLeftButtonUp="RootCanvas_MouseLeftButtonUp" | |||
MouseMove="RootCanvas_MouseMove" MouseLeftButtonDown="RootCanvas_MouseLeftButtoDown" MouseWheel="RootCanvas_MouseWheel"> | |||
<Canvas.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform x:Name="Scale"/> | |||
<TranslateTransform x:Name="Translate"/> | |||
</TransformGroup> | |||
</Canvas.RenderTransform> | |||
</Canvas> | |||
<Grid VerticalAlignment="Bottom" Background="#4B959595"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="8 0"> | |||
<CheckBox x:Name="DragEnable" Content="拖动" Margin="4"/> | |||
<CheckBox x:Name="ZoomEnable" Content="缩放" Margin="4"/> | |||
</StackPanel> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -1,135 +0,0 @@ | |||
using BPASmartClient.Compiler; | |||
using BPASmartClient.MessageName.接收消息Model; | |||
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 BPASmart.PageLoad.FControl | |||
{ | |||
/// <summary> | |||
/// RunCanvas.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class RunCanvas :UserControl | |||
{ | |||
public RunCanvas() | |||
{ | |||
InitializeComponent(); | |||
Unloaded += (s,e) => Destory(); | |||
} | |||
/// <summary> | |||
/// Dispose子集 | |||
/// </summary> | |||
public void Destory() | |||
{ | |||
foreach (var item in RootCanvas.Children) | |||
{ | |||
if (item is IDisposable disposable) | |||
{ | |||
disposable.Dispose(); | |||
} | |||
} | |||
} | |||
public List<EventReceiveMessage> Run(List<FrameworkElement> canvas) | |||
{ | |||
List<EventReceiveMessage> messages = new List<EventReceiveMessage>(); | |||
RootCanvas.Children.Clear(); | |||
foreach (FrameworkElement element in canvas) | |||
{ | |||
if (element is IExecutable executable) | |||
{ | |||
executable.IsExecuteState = true; | |||
//if (executable.EventNameList != null && executable.EventNameList.Count > 0) | |||
//{ | |||
// messages.AddRange(executable.EventNameList); | |||
//} | |||
} | |||
RootCanvas.Children.Add(element); | |||
RegisterJsName(element); | |||
} | |||
return messages; | |||
} | |||
// 注册名称到Js | |||
static void RegisterJsName(FrameworkElement element) | |||
{ | |||
Config.GetInstance().SetVariable(element.Name,element); | |||
if (element is Panel panel) | |||
{ | |||
foreach (var item in panel.Children) | |||
{ | |||
RegisterJsName(item as FrameworkElement); | |||
} | |||
} | |||
} | |||
#region 拖动与缩放 | |||
private void RootCanvas_MouseMove(object sender,MouseEventArgs e) | |||
{ | |||
if (DragEnable.IsChecked == false) | |||
{ | |||
return; | |||
} | |||
if (e.LeftButton == MouseButtonState.Pressed && isPressed) | |||
{ | |||
Point point = e.GetPosition(this); | |||
var movex = (point.X - last.X); | |||
var movey = (point.Y - last.Y); | |||
Translate.X += movex; | |||
Translate.Y += movey; | |||
last = point; | |||
} | |||
} | |||
bool isPressed = false; | |||
Point last;//记录上次鼠标坐标位置 | |||
private void RootCanvas_MouseLeftButtoDown(object sender,MouseButtonEventArgs e) | |||
{ | |||
last = e.GetPosition(this); | |||
isPressed = true; | |||
} | |||
private void RootCanvas_MouseLeftButtonUp(object sender,MouseButtonEventArgs e) | |||
{ | |||
isPressed = false; | |||
} | |||
// 缩放 | |||
private void RootCanvas_MouseWheel(object sender,MouseWheelEventArgs e) | |||
{ | |||
if (ZoomEnable.IsChecked == false) | |||
{ | |||
return; | |||
} | |||
var zoomS = (e.Delta / 960d); | |||
var zoom = zoomS + Scale.ScaleX; | |||
if (zoom > 3 || zoom < 0.8) | |||
{ | |||
return; | |||
} | |||
Scale.ScaleX = Scale.ScaleY = zoom; | |||
Point mouse = e.GetPosition(RootCanvas); | |||
Point newMouse = new Point(mouse.X * zoomS,mouse.Y * zoomS); | |||
Translate.X -= newMouse.X; | |||
Translate.Y -= newMouse.Y; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -2,17 +2,18 @@ | |||
x:Class="BPASmart.PageLoad.MainWindow" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:ctrl="clr-namespace:BPASmart.PageLoad.FControl" | |||
xmlns:ctrl="clr-namespace:BeDesignerSCADA.Controls;assembly=BeDesignerSCADA" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmart.PageLoad" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
Title="MainWindow" | |||
Width="800" | |||
Height="450" | |||
WindowState="Maximized" | |||
mc:Ignorable="d"> | |||
<Grid> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/Images/bj.png" /> | |||
<ImageBrush ImageSource="/BeDesignerSCADA;component/Images/bj.png" /> | |||
</Grid.Background> | |||
<ctrl:RunCanvas x:Name="runCanvas" /> | |||
</Grid> | |||
@@ -1,5 +1,6 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
@@ -12,6 +13,8 @@ using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
using BPA.Helper; | |||
using BPASmart.Model; | |||
namespace BPASmart.PageLoad | |||
{ | |||
@@ -23,6 +26,23 @@ namespace BPASmart.PageLoad | |||
public MainWindow() | |||
{ | |||
InitializeComponent(); | |||
this.Loaded += MainWindow_Loaded; | |||
} | |||
List<FrameworkElement> frameworkElements = new List<FrameworkElement>(); | |||
private void MainWindow_Loaded(object sender, RoutedEventArgs e) | |||
{ | |||
Serialization<BinConfigFile>.Read(); | |||
if (!string.IsNullOrEmpty(Serialization<BinConfigFile>.Data.StartPageName)) | |||
{ | |||
string path = $"{AppDomain.CurrentDomain.BaseDirectory}{FileConfigModel.PageDirName}\\{Serialization<BinConfigFile>.Data.StartPageName}.lay"; | |||
if (File.Exists(path)) | |||
{ | |||
runCanvas.LoadingData(path); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -4,91 +4,11 @@ | |||
xmlns:local="clr-namespace:BPASmart.RecipeManagement" xmlns:Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic" | |||
StartupUri="MainWindow.xaml"> | |||
<Application.Resources> | |||
<Style TargetType="{x:Type ContextMenu}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ContextMenu}"> | |||
<Border x:Name="Border" CornerRadius="4" Background="#009ACD" BorderThickness="1" Margin="0"> | |||
<Border.BorderBrush> | |||
<SolidColorBrush Color="#104E8B" /> | |||
</Border.BorderBrush> | |||
<ItemsPresenter/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True"/> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.EnterActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)"> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="110"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)"> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.EnterActions> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style TargetType="{x:Type MenuItem}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type MenuItem}"> | |||
<Border Margin="0,5" MinWidth="80" CornerRadius="5"> | |||
<Border.Background> | |||
<SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" /> | |||
</Border.Background> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text=" "/> | |||
<ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
<TextBlock Text=" "/> | |||
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True"/> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.EnterActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color"> | |||
<LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0020000" /> | |||
<LinearColorKeyFrame Value="#B0E2FF" KeyTime="00:00:00.0320000" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.EnterActions> | |||
<MultiTrigger.ExitActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color"> | |||
<LinearColorKeyFrame Value="#7E9C9C9C" KeyTime="00:00:00.0020000" /> | |||
<LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0320000" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.ExitActions> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#region --> | |||
<SolidColorBrush x:Key="menufont" Color="#B7C5DA"/> | |||
<!--#region ScrollViewer --> | |||
<ControlTemplate x:Key="MyScrollViewer" TargetType="{x:Type ScrollViewer}"> | |||
<!--View区域背景色--> | |||
<Grid x:Name="Grid" Background="{TemplateBinding Background}"> | |||
@@ -123,7 +43,7 @@ | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region Combox--> | |||
<!--#region Combox--> | |||
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}"> | |||
<Grid Height="25" HorizontalAlignment="Stretch" Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
@@ -141,7 +61,7 @@ | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Data="M 0 0 6 6 12 0 Z" | |||
Fill="Black" | |||
Fill="#FF2AB2E7" | |||
Stretch="None"> | |||
<Path.Effect> | |||
<DropShadowEffect | |||
@@ -432,17 +352,92 @@ | |||
<!--#endregion--> | |||
<Style x:Key="ButtonStyle" TargetType="Button"> | |||
<Setter Property="Background" Value="#2219b7ec" /> | |||
<Setter Property="BorderBrush" Value="#ff19b7ec" /> | |||
<Setter Property="BorderThickness" Value="2" /> | |||
<Setter Property="Foreground" Value="Aqua"/> | |||
<Style.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="Background" Value="#0041D4"/> | |||
</Trigger> | |||
</Style.Triggers> | |||
<!--#region右键菜单--> | |||
<Style TargetType="{x:Type ContextMenu}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ContextMenu}"> | |||
<Border x:Name="Border" CornerRadius="4" Background="#1E2D45" BorderThickness="1" Margin="0" | |||
Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"> | |||
<Border.BorderBrush> | |||
<SolidColorBrush Color="#104E8B" /> | |||
</Border.BorderBrush> | |||
<ItemsPresenter/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True"/> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.EnterActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)"> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="130"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)"> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.EnterActions> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style TargetType="{x:Type MenuItem}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type MenuItem}"> | |||
<Border Margin="0,5,0,0" CornerRadius="5" > | |||
<Border.Background> | |||
<SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" /> | |||
</Border.Background> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text=" "/> | |||
<ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
<TextBlock Text=" "/> | |||
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True"/> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.EnterActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color"> | |||
<LinearColorKeyFrame Value="#1E2D45" KeyTime="00:00:00.0020000" /> | |||
<LinearColorKeyFrame Value="#05173B" KeyTime="00:00:00.332" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.EnterActions> | |||
<MultiTrigger.ExitActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color"> | |||
<LinearColorKeyFrame Value="#05173B" KeyTime="00:00:00.0020000" /> | |||
<LinearColorKeyFrame Value="#1E2D45" KeyTime="00:00:00.30000" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.ExitActions> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
<Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}"> | |||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/> | |||
@@ -509,19 +504,110 @@ | |||
</Setter> | |||
</Style> | |||
<Style x:Key="CommonButton" TargetType="{x:Type Button}"> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Foreground" Value="#FF2AB2E7"/> | |||
<Setter Property="BorderBrush" Value="#FF2AB2E7"/> | |||
<Style x:Key="menuText" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="pack://application:,,,/Font/#iconfont"/> | |||
<Setter Property="Foreground" Value="{DynamicResource menufont}"/> | |||
<Setter Property="FontSize" Value="16"/> | |||
<Setter Property="Margin" Value="2,0"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
</Style> | |||
<Style x:Key="CommonTextBox" TargetType="{x:Type TextBox}"> | |||
<Setter Property="Foreground" Value="Orange"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="BorderBrush" Value="#FF2AB2E7"/> | |||
<Setter Property="VerticalContentAlignment" Value="Center"/> | |||
</Style> | |||
<!--#region Button--> | |||
<Style x:Key="CommonButton" TargetType="{x:Type Button}"> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Foreground" Value="#FF2AB2E7"/> | |||
<Setter Property="BorderBrush" Value="#FF2AB2E7"/> | |||
<Setter Property="FontSize" Value="14"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"> | |||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="border" Property="Background" Value="#442AB2E7"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ButtonStyle" TargetType="Button"> | |||
<Setter Property="Background" Value="#2219b7ec" /> | |||
<Setter Property="BorderBrush" Value="#ff19b7ec" /> | |||
<Setter Property="BorderThickness" Value="2" /> | |||
<Setter Property="Foreground" Value="Aqua"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="border" BorderBrush="#ff19b7ec" BorderThickness="1"> | |||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="border" Property="Background" Value="#442AB2E7"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="DeleteButton" TargetType="{x:Type Button}"> | |||
<Setter Property="Foreground" Value="#FFF53F62"/> | |||
<Setter Property="Background" Value="#44F53F62"/> | |||
<Setter Property="Opacity" Value="0.9"/> | |||
<Setter Property="BorderBrush" Value="Transparent" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="Foreground" Value="#FFF53F62"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"> | |||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="border" Property="Background" Value="#77F53F62"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="GreenButton" TargetType="{x:Type Button}"> | |||
<Setter Property="Foreground" Value="#ff2bd06f"/> | |||
<Setter Property="Background" Value="#332bd06f"/> | |||
<Setter Property="Opacity" Value="0.9"/> | |||
<Setter Property="BorderBrush" Value="Transparent" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type Button}"> | |||
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}"> | |||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="border" Property="Background" Value="#772bd06f"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</Application.Resources> | |||
</Application> |
@@ -16,12 +16,35 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<None Remove="Font\iconfont.ttf" /> | |||
<None Remove="Image\AddGreen.png" /> | |||
<None Remove="Image\Close.png" /> | |||
<None Remove="Image\Delete.png" /> | |||
<None Remove="Image\Exit.png" /> | |||
<None Remove="Image\left.png" /> | |||
<None Remove="Image\leftImage.png" /> | |||
<None Remove="Image\recipe.png" /> | |||
<None Remove="Image\right.png" /> | |||
<None Remove="Image\中间.png" /> | |||
<None Remove="Image\元素1.png" /> | |||
<None Remove="Image\内部背景.png" /> | |||
<None Remove="Image\双右箭头.png" /> | |||
<None Remove="Image\增加.png" /> | |||
<None Remove="Image\外边框1.png" /> | |||
<None Remove="Image\容器边框.png" /> | |||
<None Remove="Image\按钮背景蓝色.png" /> | |||
<None Remove="Image\直线.png" /> | |||
<None Remove="Image\矩形.png" /> | |||
<None Remove="Image\矩形1.png" /> | |||
<None Remove="Image\矩形2.png" /> | |||
<None Remove="Image\矩形样式.png" /> | |||
<None Remove="Image\移除.png" /> | |||
<None Remove="Image\背景.png" /> | |||
<None Remove="Image\蓝边框.png" /> | |||
<None Remove="Image\边框元素.png" /> | |||
<None Remove="Image\边框元素1.png" /> | |||
<None Remove="Image\边框效果2.png" /> | |||
<None Remove="Image\边角.png" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -43,6 +66,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Font\iconfont.ttf" /> | |||
<Resource Include="Image\Close.png" /> | |||
<Resource Include="Image\Delete.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
@@ -51,9 +75,33 @@ | |||
<ItemGroup> | |||
<Resource Include="Image\AddGreen.png" /> | |||
<Resource Include="Image\Exit.png" /> | |||
<Resource Include="Image\left.png" /> | |||
<Resource Include="Image\leftImage.png" /> | |||
<Resource Include="Image\recipe.png" /> | |||
<Resource Include="Image\right.png" /> | |||
<Resource Include="Image\中间.png" /> | |||
<Resource Include="Image\元素1.png" /> | |||
<Resource Include="Image\内部背景.png" /> | |||
<Resource Include="Image\双右箭头.png" /> | |||
<Resource Include="Image\增加.png" /> | |||
<Resource Include="Image\外边框1.png" /> | |||
<Resource Include="Image\容器边框.png" /> | |||
<Resource Include="Image\按钮背景蓝色.png" /> | |||
<Resource Include="Image\直线.png" /> | |||
<Resource Include="Image\矩形.png" /> | |||
<Resource Include="Image\矩形1.png" /> | |||
<Resource Include="Image\矩形2.png" /> | |||
<Resource Include="Image\矩形样式.png" /> | |||
<Resource Include="Image\移除.png" /> | |||
<Resource Include="Image\背景.png"> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Image\蓝边框.png" /> | |||
<Resource Include="Image\边框元素.png" /> | |||
<Resource Include="Image\边框元素1.png" /> | |||
<Resource Include="Image\边框效果2.png" /> | |||
<Resource Include="Image\边角.png" /> | |||
</ItemGroup> | |||
</Project> |
@@ -1,4 +1,4 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
@@ -10,10 +10,24 @@ namespace BPASmart.RecipeManagement.Globle | |||
{ | |||
public class GlobleData | |||
{ | |||
public static RecipeMaterials ChangeMaterail; | |||
/// <summary> | |||
/// 原料传值 | |||
/// </summary> | |||
public static RecipeMaterials ChangeMaterail = new RecipeMaterials(); | |||
public static Recipes ChangeRecipes; | |||
/// <summary> | |||
/// 修改配方传值 | |||
/// </summary> | |||
public static Recipes ChangeRecipes = new Recipes(); | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public static ObservableCollection<Order> orders { get; set; } = new ObservableCollection<Order>(); | |||
/// <summary> | |||
/// 配方的工艺流程传值 | |||
/// </summary> | |||
public static Recipes recipeTechnologyProcess = new Recipes(); | |||
} | |||
} |
@@ -7,13 +7,23 @@ | |||
xmlns:view="clr-namespace:BPASmart.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
Title="MainWindow" Height="800" Width="1400" WindowStyle="None" WindowStartupLocation="CenterScreen" Background="#01003B" AllowsTransparency="True"> | |||
Title="MainWindow" Height="800" Width="1400" WindowStyle="None" WindowStartupLocation="CenterScreen" Background="#01003B" AllowsTransparency="True"> | |||
<Window.DataContext> | |||
<vm:MainWindowViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<Style x:Key="fonticon" TargetType="{x:Type TextBlock}"> | |||
<Setter Property="FontFamily" Value="pack://application:,,,/Font/#iconfont"/> | |||
<Setter Property="FontSize" Value="24"/> | |||
<Setter Property="Foreground" Value="White"/> | |||
<Setter Property="HorizontalAlignment" Value="Center"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="Margin" Value="0,0,20,0"/> | |||
</Style> | |||
<Style x:Key="RadioNavigation" TargetType="RadioButton"> | |||
<Setter Property="Margin" Value="-4,10"/> | |||
<Setter Property="Margin" Value="-4,0"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="GroupName" Value="Navigation"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
@@ -23,49 +33,67 @@ | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Border x:Name="_borderOver" Background="Transparent" Width="200" BorderBrush="Transparent" BorderThickness="0,1"> | |||
<Grid Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}"> | |||
<TextBlock Foreground="White" Text="{TemplateBinding Content}" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" TargetName="_borderOver" Value="#1971B6"/> | |||
<Setter Property="Background" TargetName="_borderOver"> | |||
<Setter.Value> | |||
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1"> | |||
<GradientStop Color="#104E8B" Offset="0"/> | |||
<GradientStop Color="#1874CD" Offset="0.4"/> | |||
<GradientStop Color="#1874CD" Offset="0.6"/> | |||
<GradientStop Color="#27408B" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter Property="Background" TargetName="_borderOver" Value="#1E90FF"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="ButtonNavigation" TargetType="Button"> | |||
<Setter Property="Height" Value="40"/> | |||
<Setter Property="Foreground" Value="White"/> | |||
<Setter Property="FontSize" Value="20"/> | |||
<Setter Property="VerticalAlignment" Value="Center"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid Background="{TemplateBinding Background}" Margin="{TemplateBinding Margin}"> | |||
<Border x:Name="_borderOver" Background="Transparent" Width="200" BorderBrush="Transparent" BorderThickness="0,1"> | |||
<TextBlock Foreground="White" Text="{TemplateBinding Content}" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
</Border> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="Background" TargetName="_borderOver" Value="#1971B6"/> | |||
<Setter Property="Background" TargetName="_borderOver" > | |||
<Setter.Value> | |||
<ImageBrush ImageSource="../Image/leftImage.png"/> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="butonTempalte" TargetType="RadioButton"> | |||
<Border x:Name="_borderOver" Background="Transparent" Width="200" Height="60" BorderBrush="Transparent" BorderThickness="0,1"> | |||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" TargetName="_borderOver" Value="#1971B6"/> | |||
<Setter Property="Background" TargetName="_borderOver"> | |||
<Setter.Value> | |||
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1"> | |||
<GradientStop Color="#104E8B" Offset="0"/> | |||
<GradientStop Color="#1874CD" Offset="0.4"/> | |||
<GradientStop Color="#1874CD" Offset="0.6"/> | |||
<GradientStop Color="#27408B" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter Property="Background" TargetName="_borderOver" > | |||
<Setter.Value> | |||
<ImageBrush ImageSource="../Image/leftImage.png"/> | |||
</Setter.Value> | |||
</Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Window.Resources> | |||
<Grid > | |||
<Grid.ColumnDefinitions> | |||
@@ -74,40 +102,133 @@ | |||
<ColumnDefinition Width="2"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="10"/> | |||
</Grid.RowDefinitions> | |||
<Border Background="#02255E" Grid.ColumnSpan="3 " MouseLeftButtonDown="Border_MouseLeftButtonDown" BorderBrush="#4682B4" BorderThickness="0,0,0,1"> | |||
<StackPanel Orientation="Horizontal" Margin="60,0,0,0"> | |||
<Border x:Name="br" Grid.ColumnSpan="3 " MouseLeftButtonDown="Border_MouseLeftButtonDown" BorderBrush="#4682B4" BorderThickness="0,0,0,1"> | |||
<Border.Background> | |||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> | |||
<GradientStop Color="#0C2349" Offset="0.2"/> | |||
<GradientStop Color="#6495ED" Offset="0.4"/> | |||
<GradientStop Color="#0C2349" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Border.Background> | |||
<StackPanel Orientation="Horizontal" Margin="60,0,0,0" VerticalAlignment="Center"> | |||
<Image Source="../image/recipe.png" Width="20" Height="20"/> | |||
<TextBlock Text="配方集成管理" Foreground="#E8E8E8" FontSize="28" FontFamily="楷体" | |||
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0"/> | |||
<TextBlock Text="配方集成管理" Foreground="#E8E8E8" FontSize="30" FontFamily="楷体" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0"> | |||
<TextBlock.Effect> | |||
<DropShadowEffect Direction="70" Color="Black" /> | |||
</TextBlock.Effect> | |||
</TextBlock> | |||
</StackPanel> | |||
</Border> | |||
<Button FontSize="28 " HorizontalAlignment="Right" VerticalAlignment="Top" | |||
HorizontalContentAlignment="Right" | |||
Grid.Column="1" | |||
Background="Red" Height="30" | |||
Click="Button_Click"> | |||
<Image Source="../Image/Close.png" HorizontalAlignment="Stretch"/> | |||
<Button Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Top" Background="Transparent" | |||
Height="45" Width="45" Click="Button_Click" BorderBrush="Transparent" > | |||
<Button.Style> | |||
<Style TargetType="Button" > | |||
<Style.Setters> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border x:Name="border" BorderThickness="1" Background="Transparent" Padding="0" > | |||
<Image x:Name="image" Source="../image/Exit.png" Stretch="UniformToFill" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="image" Property="Margin" Value="-3"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
</Button.Style> | |||
</Button> | |||
<Border Grid.Row="1" Grid.RowSpan="2" Background="Transparent" BorderBrush="#1E90FF" BorderThickness="0,0,2,0"/> | |||
<Border Grid.Row="1" Grid.RowSpan="2" BorderBrush="#1E90FF" BorderThickness="0,0,2,0"> | |||
<Border.Background> | |||
<LinearGradientBrush StartPoint="0,1" EndPoint="1,1"> | |||
<GradientStop Color="#01003B" Offset="0.2"/> | |||
<GradientStop Color="#010050" Offset="1"/> | |||
</LinearGradientBrush> | |||
</Border.Background> | |||
</Border> | |||
<StackPanel x:Name="mylistview" Background="Transparent" Grid.RowSpan="1" Grid.Row="1" | |||
ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" | |||
MouseDown="mylistview_MouseDown" > | |||
<RadioButton Content="订单管理" Style="{DynamicResource RadioNavigation}" IsChecked="True" | |||
Click="NavButton_Click" Tag="OrderManager"/> | |||
<RadioButton Content="配方管理" Style="{DynamicResource RadioNavigation}" | |||
Click="NavButton_Click" Tag="RecipeManager"/> | |||
<RadioButton Content="原料管理" Style="{DynamicResource RadioNavigation}" | |||
Click="NavButton_Click" Tag="MaterialManager"/> | |||
<RadioButton Content="工艺参数" Style="{DynamicResource RadioNavigation}" | |||
Click="NavButton_Click" Tag="TechnologySetting"/> | |||
<RadioButton Content="权限分配" Style="{DynamicResource RadioNavigation}" | |||
Click="NavButton_Click" Tag="PowerManager"/> | |||
MouseLeftButtonDown="mylistview_MouseDown" > | |||
<RadioButton Style="{DynamicResource RadioNavigation}" IsChecked="True" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="OrderManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="订单管理" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="RecipeManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="配方管理" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="MaterialManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="原料管理" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
<!--<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="TechnologySetting"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="工艺参数" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton>--> | |||
<RadioButton Style="{DynamicResource RadioNavigation}" Template="{DynamicResource butonTempalte }" | |||
Click="NavButton_Click" Tag="PowerManager"> | |||
<Grid Background="Transparent" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="" Style="{DynamicResource fonticon}"/> | |||
<TextBlock Grid.Column="1" Foreground="White" Text="权限分配" FontSize="24" Background="Transparent" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="楷体"/> | |||
</Grid> | |||
</RadioButton> | |||
</StackPanel> | |||
@@ -24,7 +24,18 @@ namespace BPASmart.RecipeManagement | |||
public MainWindow() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => | |||
{ | |||
if (e.ClickCount > 1) | |||
{ | |||
if (this.WindowState == WindowState.Maximized) | |||
this.WindowState = WindowState.Normal; | |||
else if (this.WindowState == WindowState.Normal) | |||
this.WindowState = WindowState.Maximized; | |||
} | |||
}; | |||
} | |||
private void mylistview_MouseDown(object sender, MouseButtonEventArgs e) | |||
@@ -6,7 +6,7 @@ | |||
xmlns:local="clr-namespace:BPASmart.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
Title="CreateOrder" Height="250" Width="400" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="White" MouseLeftButtonDown="Window_MouseLeftButtonDown" | |||
Title="CreateOrder" Height="300" Width="500" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="Transparent" MouseLeftButtonDown="Window_MouseLeftButtonDown" | |||
AllowsTransparency="True" Foreground="#FF2AB2E7"> | |||
<Window.DataContext> | |||
<vm:CreateOrderViewModel/> | |||
@@ -14,31 +14,38 @@ | |||
<Window.Resources> | |||
</Window.Resources> | |||
<Grid Background="#264c73"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="40"/> | |||
</Grid.RowDefinitions> | |||
<Button Content="增加配方" Width="100" Height="30" HorizontalAlignment="Right" Margin="10,0" Style="{DynamicResource ButtonStyle}" | |||
<Border> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../image/容器边框.png"/> | |||
</Border.Background> | |||
<Grid Background="Transparent"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="5"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="创建订单" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" Margin="0,3,0,0 "/> | |||
<Button Content="添加配方" Width="80" Height="24" HorizontalAlignment="Right" Margin="10,10,2,0" VerticalAlignment="Bottom" | |||
Style="{DynamicResource ButtonStyle}" | |||
Command="{Binding AddRecipeCommand}"/> | |||
<Border Grid.Row="1" BorderBrush="#B0E2FF" BorderThickness="0,1"> | |||
<ItemsControl ItemsSource="{Binding recipes}" Grid.Row="1" HorizontalAlignment="Center"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Border Background="Transparent" BorderBrush="Transparent" BorderThickness="1"> | |||
<Grid Name="gr" Height="40"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="150"/> | |||
<ColumnDefinition Width="100" /> | |||
<ColumnDefinition Width="60" /> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.Row="1" BorderBrush="#B0E2FF" BorderThickness="0,1"> | |||
<ItemsControl ItemsSource="{Binding recipes}" Grid.Row="1" HorizontalAlignment="Center"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Border Background="Transparent" BorderBrush="Transparent" BorderThickness="1"> | |||
<Grid Name="gr" Height="40"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="150"/> | |||
<ColumnDefinition Width="100" /> | |||
<ColumnDefinition Width="60" /> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox | |||
<ComboBox | |||
Name="cb" | |||
Grid.Column="0" | |||
Margin="3,1" | |||
@@ -52,11 +59,11 @@ | |||
/> | |||
<StackPanel | |||
<StackPanel | |||
Grid.Column="1" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<TextBox | |||
<TextBox | |||
Name="tb" | |||
Foreground="Orange" | |||
Background="Transparent" | |||
@@ -66,9 +73,10 @@ | |||
Margin="3,1" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Text="{Binding RecipeCount}" /> | |||
Text="{Binding RecipeCount}" | |||
/> | |||
<TextBlock | |||
<TextBlock | |||
Grid.Column="1" | |||
Foreground="#FF2AB2E7" | |||
Margin="0,0,8,4" | |||
@@ -77,9 +85,9 @@ | |||
FontSize="20" | |||
Text="单" /> | |||
</StackPanel> | |||
</StackPanel> | |||
<Button | |||
<Button | |||
Grid.Column="2" | |||
Width="50" | |||
Height="24" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" | |||
@@ -89,25 +97,28 @@ | |||
CommandParameter="{Binding ID}" | |||
Content="删 除" /> | |||
</Grid> | |||
</Border> | |||
</Grid> | |||
</Border> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Border> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Border> | |||
<StackPanel Grid.Row="4" Grid.ColumnSpan="3" Orientation="Horizontal" | |||
<StackPanel Grid.Row="2" Grid.ColumnSpan="3" Orientation="Horizontal" | |||
HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Content="保存" FontSize="22" Width="120" Height="30" Margin="10,2" Background="Transparent" | |||
BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" | |||
<Button Content="保存" FontSize="18" Width="100" Height="24" Margin="10,2" Background="Transparent" | |||
HorizontalContentAlignment="Center" VerticalContentAlignment="Center" | |||
BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Style="{DynamicResource ButtonStyle}" | |||
Command="{Binding SaveCommand}"/> | |||
<Button Content="取消" FontSize="22" Width="120" Height="30" Margin="10,2" Background="Transparent" | |||
BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" | |||
<Button Content="取消" FontSize="18" Width="100" Height="24" Margin="10,2" Background="Transparent" | |||
HorizontalContentAlignment="Center" VerticalContentAlignment="Center" | |||
BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Style="{DynamicResource ButtonStyle}" | |||
Click="Button_Click"/> | |||
</StackPanel> | |||
</Grid> | |||
</StackPanel> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -14,95 +14,132 @@ | |||
<Window.Resources> | |||
</Window.Resources> | |||
<Border CornerRadius="20" Background="#264c73" > | |||
<Border > | |||
<Grid Width="900"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="17*"/> | |||
<ColumnDefinition Width="33*"/> | |||
<ColumnDefinition Width="40"/> | |||
<ColumnDefinition Width="400"/> | |||
<ColumnDefinition Width="500"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="原料名称:" FontSize="22" | |||
<Border Background="#264c73" CornerRadius="20" > | |||
<Grid > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="17*"/> | |||
<ColumnDefinition Width="33*"/> | |||
<ColumnDefinition Width="40"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="原料名称:" FontSize="22" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/> | |||
<TextBlock Text="原料种类:" FontSize="22" Grid.Row="1" | |||
<TextBlock Text="原料种类:" FontSize="22" Grid.Row="1" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/> | |||
<TextBlock Text="原料位置:" FontSize="22" Grid.Row="2" | |||
<TextBlock Text="原料位置:" FontSize="22" Grid.Row="2" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/> | |||
<TextBox Text="{Binding MaterialName}" FontSize="22" Grid.Column="1" Width="200" Height="40" Background="Transparent" Foreground="Orange" | |||
<TextBox Text="{Binding MaterialName}" FontSize="22" Grid.Column="1" Width="200" Height="40" Background="Transparent" Foreground="Orange" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" BorderBrush="#FF2AB2E7" | |||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/> | |||
<ComboBox ItemsSource="{Binding MaterialTypes}" | |||
<ComboBox ItemsSource="{Binding MaterialTypes}" | |||
FontSize="18" Foreground="#FF2AB2E7" | |||
Grid.Column="1" Grid.Row="1" Width="200" Height="40" | |||
SelectedItem="{Binding MaterialType}" /> | |||
<TextBox Text="{Binding MaterialPosion}" FontSize="22" Grid.Column="1" Grid.Row="2" | |||
<TextBox Text="{Binding MaterialPosion}" FontSize="22" Grid.Column="1" Grid.Row="2" | |||
Width="100" Height="40" Background="Transparent" Foreground="Orange" | |||
HorizontalContentAlignment="Center" VerticalContentAlignment="Center" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" BorderBrush="#FF2AB2E7"/> | |||
<TextBlock Text="{Binding ErrorMessage}" Grid.Row="3" Grid.ColumnSpan=" 2" | |||
<TextBlock Text="{Binding ErrorMessage}" Grid.Row="3" Grid.ColumnSpan=" 2" | |||
Foreground="Red" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<StackPanel Grid.Row="4" Grid.ColumnSpan="2" Orientation="Horizontal" | |||
<StackPanel Grid.Row="4" Grid.ColumnSpan="2" Orientation="Horizontal" | |||
HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Content="保存" FontSize="22" Width="120" Height="36" Margin="10" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" | |||
Command="{Binding SaveCommand}"/> | |||
<Button Content="取消" FontSize="22" Width="120" Height="36" Margin="10" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" | |||
Click="Button_Click"/> | |||
</StackPanel> | |||
<Button x:Name="expand" Grid.Column="2" Grid.RowSpan="5" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{DynamicResource ButtonStyle}" | |||
Click="expand_Click" > | |||
<Grid> | |||
<Button Content="保存" FontSize="18" Width="120" Height="28" Margin="10" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" | |||
Command="{Binding SaveCommand}" Style="{DynamicResource ButtonStyle}"/> | |||
<Button Content="取消" FontSize="18" Width="120" Height="28" Margin="10" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" | |||
Click="Button_Click" Style="{DynamicResource ButtonStyle}"/> | |||
</StackPanel> | |||
<Button x:Name="expand" Grid.Column="2" Grid.RowSpan="5" HorizontalAlignment="Right" VerticalAlignment="Center" Style="{DynamicResource ButtonStyle}" | |||
Click="expand_Click" BorderThickness="1,1,0,1"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="拓展属性" TextWrapping="Wrap" FontSize="16" HorizontalAlignment="Center" | |||
VerticalAlignment="Center" Width="20" FontFamily="楷体"/> | |||
</Grid> | |||
</Button> | |||
</Grid> | |||
</Border> | |||
<Border Grid.Column="1" Background="#264c73" BorderThickness="1,0,0,0" CornerRadius="20,20,20,20"> | |||
<Grid > | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition/> | |||
<RowDefinition Height="20"/> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="拓展属性" TextWrapping="Wrap" FontSize="18" HorizontalAlignment="Center" /> | |||
<Image x:Name="expandImage" Source="../image/right.png" Grid.Row="1" Width="22" Margin="0,5"/> | |||
</Grid> | |||
</Button> | |||
<ScrollViewer Grid.Column="3" | |||
Grid.RowSpan="5" | |||
<Border Grid.Row="1" Background="#dd2AB2E7" > | |||
<Grid > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="120"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="属性名称" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" Foreground="White"/> | |||
<TextBlock Grid.Column="1" Text="属性值" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,40,0" FontSize="20" Foreground="White"/> | |||
</Grid> | |||
</Border> | |||
<ScrollViewer Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden" Margin="10,5"> | |||
<Border Background="Transparent" BorderBrush="White" BorderThickness="1,0,0,0"> | |||
<ListBox Margin="5,20" Background="Transparent" BorderBrush="Transparent" Foreground="#FF2AB2E7" FontSize="20" HorizontalAlignment="Left" | |||
<Border Background="Transparent" BorderBrush="Transparent" BorderThickness="1,0,0,0"> | |||
<ListBox Margin="5,0" Width="380" Background="Transparent" BorderBrush="Transparent" Foreground="#FF2AB2E7" FontSize="16" HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
ItemsSource="{Binding currentProperty}"> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="{Binding PropertyName}" Margin="0,5,2,0" > | |||
<TextBlock.ToolTip > | |||
<TextBlock Text="{Binding PropertyDescription}"/> | |||
</TextBlock.ToolTip> | |||
</TextBlock> | |||
<TextBlock Grid.Column="1" Text=":" Margin="0,5,0,0"/> | |||
<TextBox Grid.Column="2" Text="{Binding PropertyValue}" Background="Transparent" Foreground="Orange" | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" HorizontalContentAlignment="Center" | |||
Width="150" Margin="20,5"/> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="{Binding PropertyName}" Margin="0,5,2,0" > | |||
<TextBlock.ToolTip > | |||
<TextBlock Text="{Binding PropertyDescription}"/> | |||
</TextBlock.ToolTip> | |||
</TextBlock> | |||
<TextBlock Text=":" Margin="0,5,0,0"/> | |||
</StackPanel> | |||
<TextBox Grid.Column="2" Text="{Binding PropertyValue}" Background="Transparent" Foreground="Orange" | |||
BorderBrush="#FF2AB2E7" VerticalAlignment="Center" HorizontalAlignment="Center" HorizontalContentAlignment="Center" MinWidth="110" | |||
Margin="20,5"/> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox> | |||
</Border> | |||
</ScrollViewer> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Border> | |||
</ScrollViewer> | |||
</Grid> | |||
</Border> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -46,13 +46,13 @@ namespace BPASmart.RecipeManagement.View | |||
{ | |||
this.Width = 500; | |||
isExpend = false; | |||
expandImage.Source = new BitmapImage(new Uri("pack://application:,,,/Image/right.png")); | |||
} | |||
else | |||
{ | |||
this.Width = 900; | |||
isExpend = true; | |||
expandImage.Source = new BitmapImage(new Uri("pack://application:,,,/Image/left.png")); | |||
} | |||
} | |||
@@ -17,41 +17,40 @@ | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ListViewItem"> | |||
<Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="2,5 " CornerRadius="10"> | |||
<Border.Background> | |||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0"> | |||
<GradientStop Color="#4F94CD" Offset="0"/> | |||
<GradientStop Color="White" Offset="0.3"/> | |||
<GradientStop Color="White" Offset="0.7"/> | |||
<GradientStop Color="#4F94CD" Offset="1" /> | |||
</LinearGradientBrush> | |||
</Border.Background> | |||
<Grid Width="100" > | |||
<Border Padding="4" Opacity="0.7" x:Name="mborder" BorderBrush="Transparent" BorderThickness="1"> | |||
<Border > | |||
<Border.Background> | |||
<ImageBrush ImageSource="../image/蓝边框.png"/> | |||
</Border.Background> | |||
<Grid Width="100" > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60"/> | |||
<RowDefinition Height="25"/> | |||
<RowDefinition Height="25"/> | |||
<RowDefinition Height="5"/> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="{Binding MaterialPosion}" Height="20" Width="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,0"/> | |||
<TextBlock Text="{Binding Name}" Grid.ColumnSpan="2" | |||
<TextBlock Text="{Binding MaterialPosion}" Foreground="White" Height="20" Width="20" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,0"/> | |||
<TextBlock Text="{Binding Name}" Grid.ColumnSpan="2" Foreground="Orange" | |||
FontSize="24" | |||
HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Grid.Row="1" Text="种类:" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"/> | |||
<TextBlock Grid.Row="1" Text="种类:" Foreground="#FF2AB2E7" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"/> | |||
<TextBlock Grid.Row="1" Grid.Column="1" FontSize="16" | |||
VerticalAlignment="Center" HorizontalAlignment="Left" | |||
VerticalAlignment="Center" HorizontalAlignment="Left" Foreground="#FF2AB2E7" | |||
Text="{Binding MaterialType}" TextAlignment="Center"></TextBlock> | |||
</Grid> | |||
</Border> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" Value="orange" TargetName="mborder"/> | |||
<Setter Property="BorderBrush" Value="#4169E1" TargetName="mborder"/> | |||
<Setter Property="Opacity" Value="1" TargetName="mborder"/> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="True"> | |||
@@ -62,128 +61,89 @@ | |||
</Setter> | |||
</Style> | |||
<Style TargetType="{x:Type ContextMenu}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ContextMenu}"> | |||
<Border x:Name="Border" CornerRadius="4" Background="#009ACD" BorderThickness="1" Margin="0"> | |||
<Border.BorderBrush> | |||
<SolidColorBrush Color="#104E8B" /> | |||
</Border.BorderBrush> | |||
<ItemsPresenter/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True"/> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.EnterActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Width)"> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="110"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(FrameworkElement.Height)"> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.0020000" Value="0"/> | |||
<SplineDoubleKeyFrame KeyTime="00:00:00.20000" Value="100"/> | |||
</DoubleAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.EnterActions> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style TargetType="{x:Type MenuItem}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type MenuItem}"> | |||
<Border Margin="0,5" MinWidth="80" CornerRadius="5"> | |||
<Border.Background> | |||
<SolidColorBrush x:Name="MyAnimatedBrushBackground" Color="Transparent" /> | |||
</Border.Background> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text=" "/> | |||
<ContentPresenter ContentSource="Icon" HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
<TextBlock Text=" "/> | |||
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsMouseOver" Value="True"/> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.EnterActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color"> | |||
<LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0020000" /> | |||
<LinearColorKeyFrame Value="#B0E2FF" KeyTime="00:00:00.0320000" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.EnterActions> | |||
<MultiTrigger.ExitActions> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="MyAnimatedBrushBackground" Storyboard.TargetProperty="Color"> | |||
<LinearColorKeyFrame Value="#7E9C9C9C" KeyTime="00:00:00.0020000" /> | |||
<LinearColorKeyFrame Value="Transparent" KeyTime="00:00:00.0320000" /> | |||
</ColorAnimationUsingKeyFrames> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</MultiTrigger.ExitActions> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<Grid Grid.RowSpan="2"> | |||
<Border> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../image/中间.png"/> | |||
</Border.Background> | |||
<Grid Background="Transparent"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="20*"/> | |||
<RowDefinition Height="20*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="原料清单" FontSize="28" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<Button x:Name="MateraisProperty" Style="{DynamicResource ButtonStyle}" Content="原料扩展属性" | |||
<Grid Grid.RowSpan="2" Grid.Row="1"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="原料清单" FontSize="28" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<Button Grid.Row="1" x:Name="MateraisProperty" Style="{DynamicResource CommonButton}" Content="原料扩展属性" | |||
VerticalAlignment="Center" HorizontalAlignment="Right" | |||
FontSize="16" Margin="0,7,20,0" Height="34" Width="150" | |||
FontSize="14" Margin="0,0,20,0" Height="26" Width="120" | |||
Click="MateraisProperty_Click"/> | |||
<ListView x:Name="mylistview" Grid.Row="1" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding MaterialList}" Margin=" 10" Background="Transparent" > | |||
<ListView.ContextMenu> | |||
<ContextMenu FontSize="16" Foreground="White"> | |||
<MenuItem Header="新建原料" Name="MenuAdd" Command="{Binding CreateMaterailCommand}"></MenuItem> | |||
<MenuItem Header="编辑原料" Name="MenuEdit" | |||
Command="{Binding EditMaterailCommand }" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem> | |||
<MenuItem Header="删除原料" Name="MenuDelete" | |||
<ListView x:Name="mylistview" Grid.Row="2" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding MaterialList}" Margin=" 0" Background="Transparent" | |||
BorderBrush="Transparent"> | |||
<ListView.ContextMenu> | |||
<ContextMenu FontSize="16" Foreground="White"> | |||
<MenuItem Name="MenuAdd" Command="{Binding CreateMaterailCommand}"> | |||
<MenuItem.Header> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Style="{DynamicResource menuText}" Text=""/> | |||
<TextBlock Grid.Column="1" Text="新建原料" Style="{DynamicResource menuText}" FontFamily="楷体"/> | |||
</Grid> | |||
</MenuItem.Header> | |||
</MenuItem> | |||
<MenuItem Command="{Binding EditMaterailCommand }" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"> | |||
<MenuItem.Header> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Style="{DynamicResource menuText}" Text="󰈓"/> | |||
<TextBlock Grid.Column="1" Text="编辑原料" Style="{DynamicResource menuText}" FontFamily="楷体" /> | |||
</Grid> | |||
</MenuItem.Header> | |||
</MenuItem> | |||
<MenuItem Name="MenuDelete" | |||
Command="{Binding DeleteMaterailCommand}" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem> | |||
</ContextMenu> | |||
</ListView.ContextMenu> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Margin="10"/> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
</ListView> | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"> | |||
<MenuItem.Header> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Style="{DynamicResource menuText}" Text=""/> | |||
<TextBlock Grid.Column="1" Text="删除原料" Style="{DynamicResource menuText}" FontFamily="楷体" /> | |||
</Grid> | |||
</MenuItem.Header> | |||
</MenuItem> | |||
</ContextMenu> | |||
</ListView.ContextMenu> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Margin="10"/> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
</ListView> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</UserControl> |
@@ -6,7 +6,7 @@ | |||
xmlns:local="clr-namespace:BPASmart.RecipeManagement.View" | |||
xmlns:vm ="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800" Background="Transparent"> | |||
d:DesignHeight="450" d:DesignWidth="800" Background="Transparent" Foreground="#FF2AB2E7"> | |||
<UserControl.DataContext> | |||
<vm:OrderManagerViewModel/> | |||
</UserControl.DataContext> | |||
@@ -15,11 +15,12 @@ | |||
<Setter Property="Margin" Value="2"/> | |||
<Setter Property="FontSize" Value="22"/> | |||
<Setter Property="FontWeight" Value="Black"/> | |||
<Setter Property="Background" Value="#104E8B"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="FontFamily" Value="楷体"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ListBoxItem"> | |||
<Border BorderBrush="Black" BorderThickness="0" Background="{TemplateBinding Background}"> | |||
<Border BorderBrush="Black" BorderThickness="0" Background="Transparent"> | |||
<Grid HorizontalAlignment="Center" Margin="10 "> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
@@ -35,21 +36,27 @@ | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Orange" | |||
Foreground="#aa2AB2E7" | |||
FontFamily="微软雅黑" | |||
FontWeight="Light" | |||
Text="配方:" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Orange" | |||
Foreground="#aa2AB2E7" | |||
FontFamily="微软雅黑" | |||
FontWeight="Light" | |||
Text="数量:" /> | |||
<TextBlock | |||
Grid.Row="2" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Orange" | |||
Foreground="#aa2AB2E7" | |||
FontFamily="微软雅黑" | |||
FontWeight="Light" | |||
Text="已完成:" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
@@ -57,16 +64,19 @@ | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Orange" | |||
Foreground="#aa2AB2E7" | |||
FontFamily="微软雅黑" | |||
FontWeight="Light" | |||
Text="{Binding Name}" /> | |||
<TextBlock | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Orange" | |||
Foreground="#aa2AB2E7" | |||
FontFamily="微软雅黑" | |||
FontWeight="Light" | |||
Text="{Binding RecipeCount}" /> | |||
<TextBlock | |||
Grid.Row="2" | |||
@@ -74,7 +84,9 @@ | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
Foreground="Orange" | |||
Foreground="#aa2AB2E7" | |||
FontFamily="微软雅黑" | |||
FontWeight="Light" | |||
Text="" /> | |||
</Grid> | |||
</Border> | |||
@@ -84,71 +96,81 @@ | |||
</Style> | |||
<Style TargetType="ListViewItem" > | |||
<Setter Property="Margin" Value="10"/> | |||
<Setter Property="Background" Value="#104E8B"/> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ListViewItem"> | |||
<Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="5,5,5,5" CornerRadius="5,5,5,5" Margin="10" | |||
Background="#104E8B"> | |||
<Grid | |||
<Border x:Name="mborder" Margin="10" Padding="2" BorderThickness="1" BorderBrush="Transparent" Opacity="0.7" | |||
> | |||
<Border> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../image/边框效果2.png"/> | |||
</Border.Background> | |||
<Grid | |||
Background="Transparent" | |||
Name="tt" | |||
Height="250" | |||
Width="300" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="*" /> | |||
<RowDefinition Height="2" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"> | |||
<TextBlock | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition Height="*" /> | |||
<RowDefinition Height="4" /> | |||
<RowDefinition Height="40" /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="White" | |||
FontFamily="楷体" | |||
Text="下单时间: " /> | |||
<TextBlock | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="2,5,0,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="18" | |||
Foreground="White" | |||
FontFamily="楷体" | |||
Text="{Binding OrderdateTime}" /> | |||
</StackPanel> | |||
<ScrollViewer | |||
</StackPanel> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
Margin="20,10" | |||
VerticalAlignment="Top" | |||
Background="#104E8B" | |||
Background="#11F53F62" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Auto"> | |||
<ListBox ItemsSource="{Binding Recipes}" FontFamily="楷体" Background="#104E8B" > | |||
</ListBox> | |||
<ListBox ItemsSource="{Binding Recipes}" FontFamily="楷体" BorderBrush="Transparent" Background="Transparent" > | |||
</ListBox> | |||
</ScrollViewer> | |||
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Content="执行订单" Width="100" Height="24" HorizontalAlignment="Right" Margin="10,0" | |||
Style="{DynamicResource ButtonStyle}" | |||
</ScrollViewer> | |||
<Image Grid.Row="2" Source="../image/直线.png" Stretch="Fill"/> | |||
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Content="执行订单" Width="100" Height="24" HorizontalAlignment="Right" Margin="10,0" Foreground="#ff2bd06f" | |||
BorderBrush="Transparent" Background="#332bd06f" Opacity="0.9" Style="{DynamicResource GreenButton}" | |||
Command="{Binding }" | |||
/> | |||
<Button Content="删除订单" Width="100" Height="24" HorizontalAlignment="Right" Margin="10,0" | |||
Style="{DynamicResource ButtonStyle}" | |||
<Button Content="删除订单" Width="100" Height="24" HorizontalAlignment="Right" Margin="10,0" Foreground="#FFF53F62" | |||
BorderBrush="Transparent" Background="#24F53F62" Opacity="0.9" | |||
Style="{DynamicResource DeleteButton}" | |||
Command="{Binding }" | |||
CommandParameter="{Binding}"/> | |||
</StackPanel> | |||
</Grid> | |||
</StackPanel> | |||
</Grid> | |||
</Border> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" Value="#D2B48C" TargetName="mborder"/> | |||
<Setter Property="BorderBrush" Value="#4169E1" TargetName="mborder"/> | |||
<Setter Property="Opacity" Value="1" TargetName="mborder"/> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="True"> | |||
@@ -159,21 +181,30 @@ | |||
</Setter> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Button Content="创建订单" Width="100" Height="30" HorizontalAlignment="Right" Margin="10,0" Style="{DynamicResource ButtonStyle}" | |||
<Border> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../image/中间.png"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="17"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="28"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock Grid.Row="1" Text="订单列表" FontSize="28" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<Button Grid.Row="2" Content="创建订单" Width="100" Height="28" HorizontalAlignment="Right" Margin="20,0" Style="{DynamicResource CommonButton}" | |||
Command="{Binding CreateOrderCommand}"/> | |||
<ListView Grid.Row="1" Background="Transparent" Margin="10" | |||
<ListView Grid.Row="3" Margin="0" Background="Transparent" BorderBrush="Transparent" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding orders}" > | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Margin="10"/> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
</ListView> | |||
</Grid> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Margin="10"/> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
</ListView> | |||
</Grid> | |||
</Border> | |||
</UserControl> |
@@ -6,11 +6,12 @@ | |||
xmlns:local="clr-namespace:BPASmart.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800" Foreground="#FF2AB2E7"> | |||
d:DesignHeight="450" d:DesignWidth="800" Foreground="#FF2AB2E7" FontFamily="楷体"> | |||
<UserControl.DataContext> | |||
<vm:PowerManagerViewModel/> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ImageBrush x:Key="powerback" ImageSource="../Image/边框元素1.png"/> | |||
<ImageBrush x:Key="ImageBrushAddBlue" ImageSource="../Image/AddGreen.png"></ImageBrush> | |||
<ImageBrush x:Key="ImageBrushAddGray" ImageSource="../Image/Delete.png"></ImageBrush> | |||
@@ -99,263 +100,312 @@ | |||
</Grid> | |||
</ControlTemplate> | |||
</UserControl.Resources> | |||
<Grid Margin="0,10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="20"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Text="选择用户" FontSize="22" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="20,0"/> | |||
<ComboBox Width="120" Margin="20,0" ItemsSource="{Binding UserName }" FontSize="16" Foreground="#FF2AB2E7"/> | |||
<Button Style="{DynamicResource CommonButton}" Margin="20,0" | |||
<Border> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../image/背景.png"/> | |||
</Border.Background> | |||
<Grid Margin="0,10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="20"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Text="选择用户" FontSize="22" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="20,0"/> | |||
<ComboBox Width="120" Margin="20,0" ItemsSource="{Binding UserName }" FontSize="16" Foreground="#FF2AB2E7"/> | |||
<Button Style="{DynamicResource ButtonStyle}" Margin="20,0" Content="保 存" | |||
FontSize="18" Height="30" Width="120" | |||
Command="{Binding SaveCommand}" CommandParameter="Materials"> | |||
<TextBlock Text="保存" TextWrapping="Wrap"/> | |||
</Button> | |||
</Button> | |||
</StackPanel> | |||
</StackPanel> | |||
<Grid Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="原料权限" FontSize="22" VerticalAlignment="Bottom" HorizontalAlignment="Center" /> | |||
<TextBlock Grid.Column="1" Text="配方权限" FontSize="22" VerticalAlignment="Bottom" HorizontalAlignment="Center" /> | |||
</Grid> | |||
<Grid Grid.Row="3" Margin="5,10,5,50"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="70"/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="20"/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="70"/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<!--#region原料权限--> | |||
<Border Grid.Column="0" BorderBrush="#1874CD" BorderThickness="1" /> | |||
<Border Grid.Column="2" BorderBrush="#1874CD" BorderThickness="1" /> | |||
<ScrollViewer Margin="5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" | |||
<Grid Grid.Row="2"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Border Width="150"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../Image/元素1.png"/> | |||
</Border.Background> | |||
<TextBlock Text="原料权限" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5" /> | |||
</Border> | |||
<Border Width="150" Grid.Column="1"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../Image/元素1.png"/> | |||
</Border.Background> | |||
<TextBlock Text="配方权限" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5" /> | |||
</Border> | |||
</Grid> | |||
<Grid Grid.Row="3" Margin="5,10,5,50"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="80"/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="20"/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="80"/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<!--#region原料权限--> | |||
<Border Grid.Column="0" Margin="10,0,10,0" CornerRadius="5" Background="{DynamicResource powerback}" > | |||
<ScrollViewer Margin="20,42" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" | |||
Width="auto"> | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
ItemsSource="{Binding AllMaterials}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Command="{Binding DataContext.AddMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_Name}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/AddGreen.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/AddGreen.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
</Border> | |||
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Style="{DynamicResource ButtonStyle}" | |||
FontSize="18" Height="60" Width="60" Margin="0,20" | |||
Command="{Binding AddAllCommand}" CommandParameter="Materials"> | |||
<TextBlock Text="全部 | |||
添加" TextWrapping="Wrap"/> | |||
</Button> | |||
<Button Style="{DynamicResource ButtonStyle}" | |||
FontSize="18" Height="60" Width="60" Margin="0,20" | |||
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" > | |||
<Button | |||
FontSize="14" Height="30" Width="100" Margin="0,20" VerticalAlignment="Center" HorizontalAlignment="Center" | |||
Command="{Binding AddAllCommand}" CommandParameter="Materials" Style="{DynamicResource GreenButton}" > | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="auto"/> | |||
</Grid.ColumnDefinitions> | |||
<Image Source="../Image/增加.png" Width="15" Margin="2"/> | |||
<TextBlock Grid.Column="1" Text="全部添加" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</Grid> | |||
</Button> | |||
<Button Style="{DynamicResource DeleteButton}" VerticalAlignment="Center" HorizontalAlignment="Center" | |||
FontSize="18" Height="30" Width="100" Margin="0,20" | |||
Command="{Binding DeleteAllCommand}" CommandParameter="Materials"> | |||
<TextBlock Text="全部 | |||
移除" TextWrapping="Wrap"/> | |||
</Button> | |||
</StackPanel> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="auto"/> | |||
</Grid.ColumnDefinitions> | |||
<Image Source="../Image/移除.png" Width="15" Margin="2"/> | |||
<TextBlock Grid.Column="1" Text="全部移除" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
</Grid> | |||
</Button> | |||
</StackPanel> | |||
<Border Grid.Column="2" Background="{DynamicResource powerback}" Margin="10,0,10,0"> | |||
<ScrollViewer Grid.Column="2" Margin="5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"> | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" Width="auto" | |||
<ScrollViewer Grid.Column="2" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" Margin="20,42"> | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" Width="auto" | |||
ItemsSource="{Binding UserMaterials}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Command="{Binding DataContext.DeleteMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_Name}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/Delete.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
<!--#region 配方权限--> | |||
<Border Grid.Column="4" BorderBrush="#1874CD" BorderThickness="1" /> | |||
<Border Grid.Column="6" BorderBrush="#1874CD" BorderThickness="1" /> | |||
<ScrollViewer Grid.Column="4" Width="auto" Margin="5,5,5,5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" > | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/Delete.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
</Border> | |||
<!--#endregion--> | |||
<!--#region 配方权限--> | |||
<Border Grid.Column="4" Background="{DynamicResource powerback}" Margin="10,0,10,0"> | |||
<ScrollViewer Margin="20,42" Grid.Column="4" Width="auto" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" > | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
ItemsSource="{Binding AllRecipes}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Command="{Binding DataContext.AddRecipeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_Name}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/AddGreen.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
<StackPanel Grid.Column="5" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Style="{DynamicResource ButtonStyle}" | |||
FontSize="18" Height="60" Width="60" Margin="0,20" | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/AddGreen.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
</Border> | |||
<StackPanel Grid.Column="5" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Style="{DynamicResource GreenButton}" HorizontalAlignment="Center" VerticalAlignment="Center" | |||
FontSize="18" Height="30" Width="80" Margin="0,20" | |||
Command="{Binding AddAllCommand}" CommandParameter="Recipes"> | |||
<TextBlock Text="全部 | |||
添加" TextWrapping="Wrap"/> | |||
</Button> | |||
<Button Style="{DynamicResource ButtonStyle}" | |||
FontSize="18" Height="60" Width="60" Margin="0,20" | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="auto"/> | |||
</Grid.ColumnDefinitions> | |||
<Image Source="../Image/增加.png" Width="15" Margin="2"/> | |||
<TextBlock Grid.Column="1" Text="全部添加" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center"/> | |||
</Grid> | |||
</Button> | |||
<Button Style="{DynamicResource DeleteButton}" HorizontalAlignment="Center" VerticalAlignment="Center" | |||
FontSize="18" Height="30" Width="80" Margin="0,20" | |||
Command="{Binding DeleteAllCommand}" CommandParameter="Recipes"> | |||
<TextBlock Text="全部 | |||
移除" TextWrapping="Wrap"/> | |||
</Button> | |||
</StackPanel> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="auto"/> | |||
</Grid.ColumnDefinitions> | |||
<Image Source="../Image/移除.png" Width="15" Margin="2"/> | |||
<TextBlock Grid.Column="1" Text="全部移除" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||
</Grid> | |||
</Button> | |||
</StackPanel> | |||
<ScrollViewer Grid.Column="6" Margin="5" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"> | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
<Border Grid.Column="6" Background="{DynamicResource powerback}" Margin="10,0,10,0"> | |||
<ScrollViewer Grid.Column="6" Margin="20,42" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"> | |||
<ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" | |||
Width="auto" | |||
ItemsSource="{Binding UserRecipes}" > | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
<ListBox.Template> | |||
<ControlTemplate> | |||
<StackPanel Background="Transparent" IsItemsHost="True"></StackPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="28" Margin="5"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"></ColumnDefinition> | |||
<ColumnDefinition Width="60"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" /> | |||
<Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left" | |||
Command="{Binding DataContext.DeleteRecipeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}" | |||
CommandParameter="{Binding Path=Text,ElementName=tb_Name}"> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/Delete.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
<Button.Template> | |||
<ControlTemplate TargetType="Button"> | |||
<Grid> | |||
<Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left"> | |||
<Rectangle.Fill> | |||
<ImageBrush ImageSource="../Image/Delete.png"></ImageBrush> | |||
</Rectangle.Fill> | |||
</Rectangle> | |||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter> | |||
<Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Button.Template> | |||
</Button> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</ScrollViewer> | |||
</Border> | |||
<!--#endregion--> | |||
<!--#endregion--> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</UserControl> |
@@ -11,12 +11,22 @@ | |||
<Window.DataContext> | |||
<vm:PropertySettingViewModel/> | |||
</Window.DataContext> | |||
<Grid> | |||
<Border> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../image/矩形.png"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="200"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<Grid Margin="0,0,0,10"> | |||
<Border> | |||
<TextBlock Text="原料扩展属性" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" Margin="0,10,0,0"/> | |||
</Border> | |||
<Grid Grid.Row="1" Margin="0,0,0,10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="49*"/> | |||
<RowDefinition Height="30"/> | |||
@@ -37,7 +47,7 @@ | |||
VerticalContentAlignment="Top"/> | |||
</StackPanel> | |||
</Grid> | |||
<Grid Grid.Row="1"> | |||
<Grid Grid.Row="2"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition /> | |||
@@ -82,7 +92,7 @@ | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ListBox ItemsSource="{Binding properties}" x:Name="lb" | |||
<ListBox ItemsSource="{Binding properties}" x:Name="lb" BorderBrush="Transparent" | |||
ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" | |||
Background="Transparent" Foreground="#FF2AB2E7" > | |||
<ListBox.ItemTemplate> | |||
@@ -138,4 +148,6 @@ | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -17,9 +17,15 @@ | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ListViewItem"> | |||
<Border x:Name="mborder" BorderBrush="#009AC0" BorderThickness="1,5" CornerRadius="10" Margin="10" | |||
Background="#104E8B"> | |||
<Grid | |||
<Border x:Name="mborder" BorderThickness="1" Background="Transparent" | |||
Opacity="0.6" Margin="10" Padding="2" | |||
> | |||
<Border Margin="4"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../image/外边框1.png" /> | |||
</Border.Background> | |||
<Grid | |||
Name="tt" | |||
Height="200" | |||
Width="150" | |||
@@ -117,12 +123,13 @@ | |||
Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor},Path=DataContext.PecipeSettingCommand}" | |||
CommandParameter="{Binding ID}"/> | |||
</Grid> | |||
</Border> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="BorderBrush" Value="#CD8500" TargetName="mborder"/> | |||
<Setter Property="BorderBrush" Value="#4169E1" TargetName="mborder"/> | |||
<Setter Property="Opacity" Value="1" TargetName="mborder"/> | |||
</Trigger> | |||
<Trigger Property="IsFocused" Value="True"> | |||
@@ -134,30 +141,72 @@ | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="配方清单" FontSize="28" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<ListView Grid.Row="1" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding RecipeList}" Margin=" 10" Background="Transparent" > | |||
<ListView.ContextMenu> | |||
<ContextMenu FontSize="16" Foreground="White"> | |||
<MenuItem Header="新建配方" Name="MenuAdd" Command="{Binding CreateRecipeCommand}"></MenuItem> | |||
<MenuItem Header="编辑配方" Name="MenuEdit" | |||
Command="{Binding EditRecipeCommand }" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem> | |||
<MenuItem Header="删除配方" Name="MenuDelete" | |||
Command="{Binding DeleteRecipeCommand}" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"></MenuItem> | |||
</ContextMenu> | |||
</ListView.ContextMenu> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Margin="10"/> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
</ListView> | |||
</Grid> | |||
<Border> | |||
<Border.Background> | |||
<ImageBrush ImageSource="../image/中间.png"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="17"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="25"/> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<TextBlock Grid.Row="1" Text="配方清单" FontSize="28" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<Button Grid.Row="2" Content="工艺流程" Style="{DynamicResource CommonButton}" HorizontalAlignment="Right" Margin="20,0" Width="100"/> | |||
<ListView Grid.Row="3" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding RecipeList}" Margin=" 10" Background="Transparent" | |||
BorderBrush="Transparent"> | |||
<ListView.ContextMenu> | |||
<ContextMenu FontSize="16" Foreground="White"> | |||
<MenuItem Command="{Binding CreateRecipeCommand}"> | |||
<MenuItem.Header> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Style="{DynamicResource menuText}" Text=""/> | |||
<TextBlock Grid.Column="1" Text="新建配方" Style="{DynamicResource menuText}" FontFamily="楷体"/> | |||
</Grid> | |||
</MenuItem.Header> | |||
</MenuItem> | |||
<MenuItem Command="{Binding EditRecipeCommand }" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"> | |||
<MenuItem.Header> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Style="{DynamicResource menuText}" Text="󰈓"/> | |||
<TextBlock Grid.Column="1" Text="编辑配方" Style="{DynamicResource menuText}" FontFamily="楷体" /> | |||
</Grid> | |||
</MenuItem.Header> | |||
</MenuItem> | |||
<MenuItem Command="{Binding DeleteRecipeCommand}" | |||
CommandParameter="{Binding PlacementTarget.SelectedIndex,RelativeSource={RelativeSource AncestorType=ContextMenu}}"> | |||
<MenuItem.Header> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Style="{DynamicResource menuText}" Text=""/> | |||
<TextBlock Grid.Column="1" Text="删除配方" Style="{DynamicResource menuText}" FontFamily="楷体" /> | |||
</Grid> | |||
</MenuItem.Header> | |||
</MenuItem> | |||
</ContextMenu> | |||
</ListView.ContextMenu> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<WrapPanel Margin="10"/> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
</ListView> | |||
</Grid> | |||
</Border> | |||
</UserControl> |
@@ -6,7 +6,7 @@ | |||
xmlns:local="clr-namespace:BPASmartClient.RecipeManagement.View" | |||
xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
Title="RecipesConfigure" Height="600" Width="400" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="White" MouseLeftButtonDown="Window_MouseLeftButtonDown" | |||
Title="RecipesConfigure" Height="600" Width="600" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="#01003B" MouseLeftButtonDown="Window_MouseLeftButtonDown" | |||
AllowsTransparency="True" Foreground="#FF2AB2E7"> | |||
<Window.DataContext> | |||
<vm:RecipesConfigureViewModel/> | |||
@@ -16,65 +16,75 @@ | |||
</Window.Resources> | |||
<Grid Background="#264c73"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition /> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition Height="60"/> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="103*" /> | |||
<ColumnDefinition Width="147*" /> | |||
<ColumnDefinition Width="100*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="配方名称:" FontSize="22" | |||
HorizontalAlignment="Center" VerticalAlignment="Center" Height="28" Width="92"/> | |||
<TextBox Text="{Binding RecipeName}" FontSize="20" Grid.Column="1" Width="160" Height="36" Background="Transparent" Foreground="Orange" | |||
<Border > | |||
<Border.Background> | |||
<ImageBrush ImageSource="../Image/边框元素.png" Stretch="Fill"/> | |||
</Border.Background> | |||
<Grid Background="Transparent" Margin="40,10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition /> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition Height="60"/> | |||
<RowDefinition Height="26"/> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="103*" /> | |||
<ColumnDefinition Width="147*" /> | |||
<ColumnDefinition Width="100*" /> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal" Grid.ColumnSpan="3 " HorizontalAlignment="Center"> | |||
<TextBlock Text="配方名称:" FontSize="16" | |||
HorizontalAlignment="Right" VerticalAlignment="Center" Margin="50,0,10,0"/> | |||
<TextBox Text="{Binding RecipeName}" FontSize="16" Grid.Column="1" Width="160" Background="Transparent" Foreground="Orange" | |||
BorderBrush="#FF2AB2E7" | |||
VerticalAlignment="Center" HorizontalAlignment="Center" | |||
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" | |||
VerticalContentAlignment="Center"/> | |||
<Button Grid.Column="2" | |||
<Button Grid.Column="2" | |||
Content="添加原料" | |||
FontSize="16" Width="90" Height="30" Margin="10" Style="{DynamicResource ButtonStyle}" | |||
FontSize="16" Width="90" Height="22" Margin="10" Style="{DynamicResource CommonButton}" | |||
Command="{Binding AddMaterailsCommand}"/> | |||
<ScrollViewer Grid.ColumnSpan="3" | |||
Grid.Row="1" | |||
Margin="15,10" | |||
</StackPanel> | |||
<ScrollViewer Grid.ColumnSpan="3" | |||
Grid.Row="2" | |||
Margin="30,10" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Auto"> | |||
<ItemsControl ItemsSource="{Binding recipeMaterials}" > | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="40"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.4*" /> | |||
<ColumnDefinition Width="0.4*" /> | |||
</Grid.ColumnDefinitions> | |||
<ItemsControl ItemsSource="{Binding recipeMaterials}" > | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton GroupName="all"> | |||
<RadioButton.Template> | |||
<ControlTemplate TargetType="RadioButton"> | |||
<Grid Name="gr" Height="40"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="2*" /> | |||
<ColumnDefinition Width="2*" /> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox | |||
<ComboBox | |||
Name="cb" | |||
Grid.Column="0" | |||
Margin="3,1" | |||
Foreground="#FF2AB2E7" | |||
VerticalAlignment="Center" | |||
HorizontalAlignment="Right" | |||
Width="200" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.materialsName, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedItem="{Binding Name}" | |||
/> | |||
<StackPanel | |||
<StackPanel | |||
Grid.Column="1" | |||
VerticalAlignment="Center" | |||
VerticalAlignment="Center" HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<TextBox | |||
<TextBox | |||
Name="tb" | |||
Grid.Column="1" | |||
Width="50" | |||
@@ -85,49 +95,53 @@ | |||
FontSize="20" | |||
Text="{Binding MaterialWeight}" /> | |||
<TextBlock | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="0,0,5,4" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="g" /> | |||
</StackPanel> | |||
</StackPanel> | |||
<Button | |||
<Button | |||
Grid.Column="2" | |||
Width="70" | |||
Height="28" | |||
Margin="25,0,0,0" | |||
Height="25" | |||
Margin="15,0,0,0" | |||
FontSize="16" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="1" | |||
HorizontalAlignment="Left" | |||
Style="{DynamicResource CommonButton}" | |||
Style="{DynamicResource DeleteButton}" | |||
Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}" | |||
CommandParameter="{Binding ID}" | |||
Content="删 除" /> | |||
</Grid> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
</RadioButton> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
<TextBlock Text="{Binding ErrorMessage}" Grid.Row="2" Grid.ColumnSpan="3" | |||
<TextBlock Text="{Binding ErrorMessage}" Grid.Row="2" Grid.ColumnSpan="3" | |||
Foreground="Red" VerticalAlignment="Center" HorizontalAlignment="Center"/> | |||
<StackPanel Grid.Row="4" Grid.ColumnSpan="3" Orientation="Horizontal" | |||
<StackPanel Grid.Row="4" Grid.ColumnSpan="3" Orientation="Horizontal" | |||
HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<Button Content="保存" FontSize="22" Width="120" Height="40" Margin="10" Style="{DynamicResource CommonButton}" | |||
<Button Content="保存" FontSize="18" Width="120" Height="24" Margin="10" Style="{DynamicResource ButtonStyle}" | |||
Command="{Binding SaveCommand}"/> | |||
<Button Content="取消" FontSize="22" Width="120" Height="40" Margin="10" Style="{DynamicResource CommonButton}" | |||
<Button Content="取消" FontSize="18" Width="120" Height="24" Margin="10" Style="{DynamicResource ButtonStyle}" | |||
Click="Button_Click"/> | |||
</StackPanel> | |||
</Grid> | |||
</StackPanel> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,445 @@ | |||
<Window x:Class="BPASmart.RecipeManagement.View.TechnologyProcess" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmart.RecipeManagement.View" xmlns:Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna" xmlns:Themes11="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic" | |||
xmlns:vm ="clr-namespace:BPASmart.RecipeManagement.ViewModel" | |||
mc:Ignorable="d" | |||
Title="TechnologyProcess" Height="550" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True"> | |||
<Window.DataContext> | |||
<vm:TechnologyProcessViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<SolidColorBrush x:Key="foreground" Color="#a2c2e8" /> | |||
<SolidColorBrush x:Key="borderBrush" Color="#FF074B92" /> | |||
<Style x:Key="ComboBoxFocusVisual"> | |||
<Setter Property="Control.Template"> | |||
<Setter.Value> | |||
<ControlTemplate> | |||
<Rectangle | |||
Margin="4,4,21,4" | |||
SnapsToDevicePixels="true" | |||
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" | |||
StrokeDashArray="1 2" | |||
StrokeThickness="1" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Geometry x:Key="DownArrowGeometry">M 0 0 L 3.5 4 L 7 0 Z</Geometry> | |||
<Style x:Key="ComboBoxTransparentButtonStyle" TargetType="{x:Type ToggleButton}"> | |||
<Setter Property="MinWidth" Value="0" /> | |||
<Setter Property="MinHeight" Value="0" /> | |||
<Setter Property="Width" Value="Auto" /> | |||
<Setter Property="Height" Value="Auto" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="White" /> | |||
<Setter Property="BorderBrush" Value="{x:Static Themes11:ClassicBorderDecorator.ClassicBorderBrush}" /> | |||
<Setter Property="BorderThickness" Value="2" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | |||
<DockPanel | |||
Background="{TemplateBinding Background}" | |||
LastChildFill="false" | |||
SnapsToDevicePixels="true"> | |||
<Themes11:ClassicBorderDecorator | |||
x:Name="Border" | |||
Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderStyle="None" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
DockPanel.Dock="Right"> | |||
<Path | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Data="{StaticResource DownArrowGeometry}" | |||
Fill="{TemplateBinding Foreground}" /> | |||
</Themes11:ClassicBorderDecorator> | |||
</DockPanel> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="Border" Property="BorderStyle" Value="AltPressed" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}"> | |||
<Setter Property="OverridesDefaultStyle" Value="true" /> | |||
<Setter Property="AllowDrop" Value="true" /> | |||
<Setter Property="MinWidth" Value="0" /> | |||
<Setter Property="Foreground" Value="{DynamicResource foreground}" /> | |||
<Setter Property="MinHeight" Value="0" /> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}" /> | |||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" /> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type TextBox}"> | |||
<ScrollViewer | |||
x:Name="PART_ContentHost" | |||
Background="Transparent" | |||
Focusable="false" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden" /> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}"> | |||
<Border | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
SnapsToDevicePixels="true"> | |||
<Grid> | |||
<Themes11:ClassicBorderDecorator | |||
x:Name="Border" | |||
BorderBrush="{x:Static Themes11:ClassicBorderDecorator.ClassicBorderBrush}" | |||
BorderStyle="None" | |||
BorderThickness="2"> | |||
<Popup | |||
x:Name="PART_Popup" | |||
AllowsTransparency="true" | |||
Focusable="False" | |||
IsOpen="{TemplateBinding IsDropDownOpen}" | |||
Placement="Bottom" | |||
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"> | |||
<Themes1:SystemDropShadowChrome | |||
x:Name="Shdw" | |||
MinWidth="{Binding ActualWidth, ElementName=Border}" | |||
MaxHeight="{TemplateBinding MaxDropDownHeight}" | |||
Color="Transparent"> | |||
<Border | |||
x:Name="DropDownBorder" | |||
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" | |||
BorderThickness="1"> | |||
<Border.Background> | |||
<ImageBrush | |||
ImageSource="../Image/内部背景.png" | |||
Opacity="0.5" | |||
Stretch="Fill" /> | |||
</Border.Background> | |||
<ScrollViewer x:Name="DropDownScrollViewer"> | |||
<Grid RenderOptions.ClearTypeHint="Enabled"> | |||
<Canvas | |||
Width="0" | |||
Height="0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top"> | |||
<Rectangle | |||
x:Name="OpaqueRect" | |||
Width="{Binding ActualWidth, ElementName=DropDownBorder}" | |||
Height="{Binding ActualHeight, ElementName=DropDownBorder}" | |||
Fill="{Binding Background, ElementName=DropDownBorder}" /> | |||
</Canvas> | |||
<ItemsPresenter | |||
x:Name="ItemsPresenter" | |||
KeyboardNavigation.DirectionalNavigation="Contained" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Grid> | |||
</ScrollViewer> | |||
</Border> | |||
</Themes1:SystemDropShadowChrome> | |||
</Popup> | |||
</Themes11:ClassicBorderDecorator> | |||
<ToggleButton | |||
Width="Auto" | |||
MinWidth="0" | |||
MinHeight="0" | |||
ClickMode="Press" | |||
Focusable="false" | |||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Style="{StaticResource ComboBoxTransparentButtonStyle}" /> | |||
<DockPanel> | |||
<FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right" /> | |||
<TextBox | |||
x:Name="PART_EditableTextBox" | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" | |||
CaretBrush="White" | |||
IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" | |||
Style="{StaticResource ComboBoxEditableTextBox}" /> | |||
</DockPanel> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="HasItems" Value="false"> | |||
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" /> | |||
</Trigger> | |||
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true"> | |||
<Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" /> | |||
<Setter TargetName="Shdw" Property="Color" Value="#71000000" /> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> | |||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true" /> | |||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" /> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="false" /> | |||
</MultiTrigger> | |||
<Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false"> | |||
<Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" /> | |||
<Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
<Style x:Key="BaseComboBoxStyle" TargetType="{x:Type ComboBox}"> | |||
<Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}" /> | |||
<Setter Property="Foreground" Value="{DynamicResource foreground}" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="BorderBrush" Value="{DynamicResource borderBrush}" /> | |||
<Setter Property="BorderThickness" Value="1" /> | |||
<Setter Property="Margin" Value="0,0,0,0" /> | |||
<Setter Property="Padding" Value="0" /> | |||
<Setter Property="Height" Value="24" /> | |||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" /> | |||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" /> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="true" /> | |||
<Setter Property="ScrollViewer.PanningMode" Value="Both" /> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="IsTextSearchCaseSensitive" Value="true" /> | |||
<Setter Property="IsEditable" Value="true" /> | |||
<Setter Property="StaysOpenOnEdit" Value="true" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type ComboBox}"> | |||
<Border | |||
Background="{TemplateBinding Background}" | |||
BorderBrush="{TemplateBinding BorderBrush}" | |||
BorderThickness="{TemplateBinding BorderThickness}" | |||
SnapsToDevicePixels="true"> | |||
<Grid> | |||
<Themes11:ClassicBorderDecorator | |||
x:Name="Border" | |||
BorderBrush="{x:Static Themes11:ClassicBorderDecorator.ClassicBorderBrush}" | |||
BorderStyle="None" | |||
BorderThickness="2"> | |||
<Popup | |||
x:Name="PART_Popup" | |||
AllowsTransparency="true" | |||
Focusable="False" | |||
IsOpen="{TemplateBinding IsDropDownOpen}" | |||
Placement="Bottom" | |||
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"> | |||
<Themes1:SystemDropShadowChrome | |||
x:Name="Shdw" | |||
MinWidth="{Binding ActualWidth, ElementName=Border}" | |||
MaxHeight="{TemplateBinding MaxDropDownHeight}" | |||
Color="Transparent"> | |||
<Border | |||
x:Name="DropDownBorder" | |||
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" | |||
BorderThickness="1"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/窗体样式/From/内部背景.png" /> | |||
</Border.Background> | |||
<ScrollViewer x:Name="DropDownScrollViewer"> | |||
<Grid RenderOptions.ClearTypeHint="Enabled"> | |||
<Canvas | |||
Width="0" | |||
Height="0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top"> | |||
<Rectangle | |||
x:Name="OpaqueRect" | |||
Width="{Binding ActualWidth, ElementName=DropDownBorder}" | |||
Height="{Binding ActualHeight, ElementName=DropDownBorder}" | |||
Fill="{Binding Background, ElementName=DropDownBorder}" /> | |||
</Canvas> | |||
<ItemsPresenter | |||
x:Name="ItemsPresenter" | |||
KeyboardNavigation.DirectionalNavigation="Contained" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Grid> | |||
</ScrollViewer> | |||
</Border> | |||
</Themes1:SystemDropShadowChrome> | |||
</Popup> | |||
</Themes11:ClassicBorderDecorator> | |||
<DockPanel Margin="2"> | |||
<FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right" /> | |||
<Border x:Name="SelectedItemBorder" Margin="{TemplateBinding Padding}"> | |||
<ContentPresenter | |||
Margin="1,1,1,1" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Content="{TemplateBinding SelectionBoxItem}" | |||
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" | |||
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" | |||
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
</Border> | |||
</DockPanel> | |||
<ToggleButton | |||
Width="Auto" | |||
MinWidth="0" | |||
MinHeight="0" | |||
Margin="2" | |||
ClickMode="Press" | |||
Focusable="false" | |||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" | |||
Style="{StaticResource ComboBoxTransparentButtonStyle}" /> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<!--<Condition Property="IsSelectionBoxHighlighted" Value="true"/>--> | |||
<Condition Property="IsDropDownOpen" Value="false" /> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" /> | |||
</MultiTrigger> | |||
<!--<Trigger Property="IsSelectionBoxHighlighted" Value="true"> | |||
<Setter Property="Background" TargetName="SelectedItemBorder" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/> | |||
</Trigger>--> | |||
<Trigger Property="HasItems" Value="false"> | |||
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" /> | |||
</Trigger> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> | |||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsGrouping" Value="true" /> | |||
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" /> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="ScrollViewer.CanContentScroll" Value="false" /> | |||
</MultiTrigger> | |||
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true"> | |||
<Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" /> | |||
<Setter TargetName="Shdw" Property="Color" Value="#71000000" /> | |||
</Trigger> | |||
<Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false"> | |||
<Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" /> | |||
<Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<Trigger Property="IsEditable" Value="true"> | |||
<Setter Property="IsTabStop" Value="false" /> | |||
<Setter Property="Padding" Value="1" /> | |||
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" /> | |||
</Trigger> | |||
</Style.Triggers> | |||
</Style> | |||
<Style BasedOn="{StaticResource BaseComboBoxStyle}" TargetType="ComboBox" /> | |||
<!--#endregion--> | |||
<!--#region ColorCommboxStyle--> | |||
<ObjectDataProvider | |||
x:Key="colorPropertieOdp" | |||
MethodName="GetProperties" | |||
ObjectInstance="{x:Type Colors}" /> | |||
<Style | |||
x:Key="ColorCommboxStyle" | |||
BasedOn="{StaticResource BaseComboBoxStyle}" | |||
TargetType="ComboBox"> | |||
<Setter Property="IsTextSearchCaseSensitive" Value="False" /> | |||
<Setter Property="IsEditable" Value="False" /> | |||
<Setter Property="StaysOpenOnEdit" Value="False" /> | |||
<Setter Property="ItemsSource" Value="{Binding Source={StaticResource colorPropertieOdp}}" /> | |||
<Setter Property="ItemTemplate"> | |||
<Setter.Value> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal"> | |||
<Rectangle | |||
Width="40" | |||
Height="10" | |||
Fill="{Binding Name}" /> | |||
<TextBlock Text="{Binding Name}" /> | |||
</StackPanel> | |||
</DataTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<!--#endregion--> | |||
</Window.Resources> | |||
<Border x:Name="br"> | |||
<Border.Background> | |||
<SolidColorBrush Color="#264c73"/> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<TextBlock Text="工艺流程" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" Background="Transparent" FontSize="25" Cursor="Arrow" ></TextBlock> | |||
<Border BorderThickness="0,0,0,1" BorderBrush="#FF2AB2E7"></Border> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<Button Content="向前新增" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding AddFrontFlowItemCommand}" ></Button> | |||
<Button Content="向后新增" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding AddLastFlowItemCommand}" ></Button> | |||
<Button Content="删除选项" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding DeleteFlowItemCommand}" ></Button> | |||
<Button Content="保存工艺" Width="100" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" FontSize="18" Command="{Binding ConfirmCommand}" ></Button> | |||
<Button Content="取消" Height="30" Width="100" Margin="0,0,10,0" Background="Transparent" FontSize="18" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding CloseWindowCommand}"></Button> | |||
</StackPanel> | |||
<Grid Grid.Row="2" Background="#FF2AB2E7" Margin="0,0,0,8"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="100"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
<ColumnDefinition Width="140"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="工艺步骤" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="1" Text="炒制原料/桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter Grid.Column="1" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="2" Text="炒制速度" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter Grid.Column="2" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="3" Text="炒制重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"></TextBlock> | |||
<GridSplitter Grid.Column="3" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="4" Text="炒制温度" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/> | |||
<GridSplitter Grid.Column="4" BorderThickness="0.2" BorderBrush="White"></GridSplitter> | |||
<TextBlock Grid.Column="5" Text="炒制时间" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="white" FontSize="18"/> | |||
</Grid> | |||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl x:Name="itemcontrols" AlternationCount="{Binding technologyProcessModels.Count}" ItemsSource="{Binding technologyProcessModels}" Margin="0,1,0,-1"> | |||
<ItemsControl.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<StackPanel/> | |||
</ItemsPanelTemplate> | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel x:Name="stk" Orientation="Horizontal" > | |||
<Label MouseLeftButtonDown="Label_MouseLeftButtonDown" Content="{Binding Path=(ItemsControl.AlternationIndex),RelativeSource={ RelativeSource TemplatedParent}}" Foreground="SkyBlue" Width="100" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="18" Background="Transparent" BorderBrush="#FF2AB2E7" BorderThickness="1,1,0.5,1"/> | |||
<ComboBox ItemsSource="{Binding DataContext.meterailItems, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" Text="{Binding FryMaterialNum}" Style="{StaticResource BaseComboBoxStyle}" IsReadOnly="True" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FrySpeed}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryWeight}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryTemperature}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,0.5,1"/> | |||
<TextBox Text="{Binding FryPeriodTime}" Width="140" Height="40" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Background="Transparent" Foreground="SkyBlue" FontSize="18" BorderBrush="#FF2AB2E7" BorderThickness="0.5,1,1,1"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -0,0 +1,70 @@ | |||
using BPASmartClient.Helper; | |||
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.Shapes; | |||
namespace BPASmart.RecipeManagement.View | |||
{ | |||
/// <summary> | |||
/// TechnologyProcess.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class TechnologyProcess : Window | |||
{ | |||
public TechnologyProcess() | |||
{ | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.CancelRegister("CloseTechnologyProcessView"); | |||
ActionManage.GetInstance.Register(new Action(() => | |||
{ | |||
this.Close(); | |||
}), "CloseTechnologyProcessView"); | |||
} | |||
private void Label_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
Label txt = sender as Label; | |||
if (txt != null) | |||
{ | |||
StackPanel oldSp = FindFirstVisualChild(itemcontrols, "stk"); | |||
if (oldSp != null) | |||
oldSp.Background = new SolidColorBrush(Color.FromRgb(38, 76, 115)); | |||
StackPanel sp = VisualTreeHelper.GetParent(txt) as StackPanel; | |||
sp.Background = new SolidColorBrush(Color.FromRgb(8, 20, 36)); | |||
ActionManage.GetInstance.Send("CurrentItemId", txt.Content); | |||
} | |||
} | |||
public StackPanel FindFirstVisualChild(DependencyObject obj, string childName) | |||
{ | |||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) | |||
{ | |||
DependencyObject child = VisualTreeHelper.GetChild(obj, i); | |||
if (child != null && child is StackPanel && child.GetValue(NameProperty).ToString() == childName) | |||
{ | |||
if (child is StackPanel stack && stack.Background?.ToString() == "#FF081424") | |||
return stack; | |||
} | |||
else | |||
{ | |||
StackPanel SP = FindFirstVisualChild(child, childName); | |||
if (SP != null) | |||
{ | |||
return SP; | |||
} | |||
} | |||
} | |||
return null; | |||
} | |||
} | |||
} |
@@ -1,12 +1,12 @@ | |||
<UserControl x:Class="BPASmart.RecipeManagement.View.TechnologySetting" | |||
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:BPASmart.RecipeManagement.View" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<Window x:Class="BPASmart.RecipeManagement.View.TechnologySetting" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmart.RecipeManagement.View" | |||
mc:Ignorable="d" | |||
Title="TechnologySetting" Height="450" Width="800"> | |||
<Grid> | |||
</Grid> | |||
</UserControl> | |||
</Window> |
@@ -10,7 +10,6 @@ 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 BPASmart.RecipeManagement.View | |||
@@ -18,7 +17,7 @@ namespace BPASmart.RecipeManagement.View | |||
/// <summary> | |||
/// TechnologySetting.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class TechnologySetting : UserControl | |||
public partial class TechnologySetting : Window | |||
{ | |||
public TechnologySetting() | |||
{ | |||
@@ -1,4 +1,4 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
@@ -9,10 +9,10 @@ using System.Linq; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class CreateOrderViewModel: ObservableObject | |||
public class CreateOrderViewModel : ObservableObject | |||
{ | |||
public ObservableCollection<Recipes> recipes { get; set; } = new ObservableCollection<Recipes>(); | |||
public ObservableCollection<Recipes> recipes { get; set; } = new ObservableCollection<Recipes>(); | |||
public ObservableCollection<string> recipesName { get; set; } = new ObservableCollection<string>(); | |||
@@ -24,8 +24,8 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
private void Delete(object o) | |||
{ | |||
if(o == null) return; | |||
if(o is string id) | |||
if (o == null) return; | |||
if (o is string id) | |||
{ | |||
var res = recipes.FirstOrDefault(x => x.ID == id); | |||
recipes.Remove(res); | |||
@@ -44,15 +44,15 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
}); | |||
ActionManage.GetInstance.Send("CloseCreateOrderView"); | |||
}); | |||
DeleteCommand = new RelayCommand<object>(Delete); | |||
AddRecipeCommand = new RelayCommand(() => | |||
{ | |||
recipes.Add(new Recipes() { ID = Guid.NewGuid().ToString() }); | |||
recipes.Add(new Recipes() { ID = Guid.NewGuid().ToString(), RecipeCount = 1, }); | |||
}); | |||
foreach( var item in Json<LocalRecipes>.Data.locaRecipes ) | |||
foreach (var item in Json<LocalRecipes>.Data.locaRecipes) | |||
{ | |||
recipesName.Add(item.Name); | |||
} | |||
@@ -1,4 +1,4 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
@@ -9,7 +9,7 @@ using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class MainWindowViewModel: ObservableObject | |||
public class MainWindowViewModel : ObservableObject | |||
{ | |||
public MainWindowViewModel() | |||
@@ -1,4 +1,4 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.Model; | |||
using BPASmart.RecipeManagement.Globle; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
@@ -12,16 +12,16 @@ using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class MaterialConfigureViewModel:ObservableObject | |||
public class MaterialConfigureViewModel : ObservableObject | |||
{ | |||
public ObservableCollection<Property> currentProperty { get; set; } = new ObservableCollection<Property>(); | |||
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } } | |||
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } } | |||
private string _materialName; | |||
public ObservableCollection<MaterialType> MaterialTypes { get; set; } = new ObservableCollection<MaterialType>(); | |||
public MaterialType MaterialType { get{ return _materialType; } set { _materialType = value; OnPropertyChanged(); } } | |||
public MaterialType MaterialType { get { return _materialType; } set { _materialType = value; OnPropertyChanged(); } } | |||
private MaterialType _materialType = 0; | |||
public string MaterialPosion { get { return _materialPosion; } set { _materialPosion = value; OnPropertyChanged(); } } | |||
@@ -61,46 +61,46 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
MaterialName = GlobleData.ChangeMaterail.Name; | |||
MaterialType = GlobleData.ChangeMaterail.MaterialType; | |||
MaterialPosion = GlobleData.ChangeMaterail.MaterialPosion; | |||
foreach(var item in currentProperty) | |||
foreach (var item in currentProperty) | |||
{ | |||
var res = GlobleData.ChangeMaterail.PropertyCollections.FirstOrDefault(p => p.PropertyId == item.PropertyId); | |||
if (res != null) | |||
{ | |||
item.PropertyValue = res.PropertyValue; | |||
} | |||
} | |||
} | |||
foreach(MaterialType item in Enum.GetValues(typeof(MaterialType))) | |||
foreach (MaterialType item in Enum.GetValues(typeof(MaterialType))) | |||
{ | |||
MaterialTypes.Add(item); | |||
} | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if(MaterialName == null) | |||
if (MaterialName == null) | |||
{ | |||
ErrorMessage = "原料名称不能为空"; | |||
return; | |||
} | |||
if(GlobleData.ChangeMaterail!=null)//编辑原料 | |||
{ | |||
var res = Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p=>p.ID == GlobleData.ChangeMaterail.ID); | |||
if (res != null) | |||
if (GlobleData.ChangeMaterail != null)//编辑原料 | |||
{ | |||
var res = Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p => p.ID == GlobleData.ChangeMaterail.ID); | |||
if (res != null) | |||
{ | |||
if (MaterialName != res.Name )//修改了原料名称 | |||
if (MaterialName != res.Name)//修改了原料名称 | |||
{ | |||
if (Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p => p.Name == MaterialName) != null) | |||
{ | |||
ErrorMessage = "原料名称已存在"; | |||
return ; | |||
return; | |||
} | |||
} | |||
if(MaterialPosion != res.MaterialPosion)//修改了原料位置 | |||
if (MaterialPosion != res.MaterialPosion)//修改了原料位置 | |||
{ | |||
if (Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p => p.MaterialPosion == MaterialPosion) != null) | |||
{ | |||
@@ -116,7 +116,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
} | |||
else //添加新原料 | |||
{ | |||
if(Json<LocalMaterails>.Data.locaMaterails != null) | |||
if (Json<LocalMaterails>.Data.locaMaterails != null) | |||
{ | |||
var res = Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p => p.Name == MaterialName); | |||
if (res != null) | |||
@@ -124,7 +124,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
ErrorMessage = "原料名称已存在"; | |||
return; | |||
} | |||
var item = Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p=>p.MaterialPosion == MaterialPosion); | |||
var item = Json<LocalMaterails>.Data.locaMaterails.FirstOrDefault(p => p.MaterialPosion == MaterialPosion); | |||
if (item != null) | |||
{ | |||
ErrorMessage = "原料位置重复"; | |||
@@ -134,7 +134,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
else | |||
{ | |||
AddMaterials(); | |||
} | |||
} | |||
} | |||
Json<LocalMaterails>.Save(); | |||
ActionManage.GetInstance.Send("CloseMaterialConfigureView"); | |||
@@ -5,7 +5,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using BPASmart.Model.配方; | |||
using BPASmart.Model; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmart.RecipeManagement.View; | |||
using System.Windows.Controls; | |||
@@ -14,7 +14,7 @@ using BPASmartClient.Helper; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class MaterialManagerViewModel:ObservableObject | |||
public class MaterialManagerViewModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 原料集合 | |||
@@ -24,12 +24,12 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
public RelayCommand CreateMaterailCommand { get; set; } | |||
public RelayCommand<object> EditMaterailCommand { get; set; } | |||
public RelayCommand<object> DeleteMaterailCommand { get; set; } | |||
private void EditMaterail(object o) | |||
{ | |||
if(o == null) return; | |||
if(o is int item) | |||
if (o == null) return; | |||
if (o is int item && item >= 0) | |||
{ | |||
GlobleData.ChangeMaterail = new RecipeMaterials(); | |||
GlobleData.ChangeMaterail = MaterialList[item]; | |||
@@ -41,7 +41,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
private void DeleteMaterail(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is int item) | |||
if (o is int item && item >= 0) | |||
{ | |||
MaterialList.RemoveAt(item); | |||
Json<LocalMaterails>.Save(); | |||
@@ -50,7 +50,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
public MaterialManagerViewModel() | |||
{ | |||
CreateMaterailCommand = new RelayCommand(() => | |||
{ | |||
@@ -1,4 +1,4 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.Model; | |||
using BPASmart.RecipeManagement.View; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
@@ -11,7 +11,7 @@ using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class OrderManagerViewModel:ObservableObject | |||
public class OrderManagerViewModel : ObservableObject | |||
{ | |||
/// <summary> | |||
/// 订单集合 | |||
@@ -1,4 +1,4 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
@@ -11,7 +11,7 @@ using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class PowerManagerViewModel:ObservableObject | |||
public class PowerManagerViewModel : ObservableObject | |||
{ | |||
public ObservableCollection<string> UserName { get; set; } = new ObservableCollection<string>(); | |||
/// <summary> | |||
@@ -66,7 +66,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
UserMaterials.Clear(); | |||
foreach (RecipeMaterials item in AllMaterials) | |||
{ | |||
UserMaterials.Add(item); | |||
UserMaterials.Add(item); | |||
} | |||
} | |||
@@ -78,7 +78,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
UserRecipes.Add(item); | |||
} | |||
} | |||
} | |||
private void AddMaterial(object o) | |||
@@ -1,4 +1,4 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
@@ -11,7 +11,7 @@ using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class PropertySettingViewModel:ObservableObject | |||
public class PropertySettingViewModel : ObservableObject | |||
{ | |||
public ObservableCollection<Property> properties { get; set; } = Json<LocalMaterails>.Data.PorpertyCollections; | |||
@@ -31,7 +31,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
private void Delete(object o) | |||
{ | |||
if (o == null) return; | |||
if(o is string id) | |||
if (o is string id) | |||
{ | |||
var res = properties.FirstOrDefault(p => p.PropertyId == id); | |||
if (res != null) | |||
@@ -45,7 +45,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if(PropertyName == null) | |||
if (PropertyName == null) | |||
{ | |||
ErrorName = "属性名称不能为空"; | |||
return; | |||
@@ -55,7 +55,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
ErrorName = "请添加属性说明"; | |||
return; | |||
} | |||
if(properties.FirstOrDefault(p=>p.PropertyName == PropertyName) != null) | |||
if (properties.FirstOrDefault(p => p.PropertyName == PropertyName) != null) | |||
{ | |||
ErrorName = "属性名重复"; | |||
return; | |||
@@ -1,4 +1,5 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.Model; | |||
using BPASmart.RecipeManagement.View; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.RecipeManagement.View; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
@@ -12,7 +13,7 @@ using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class RecipeManagerViewModel:ObservableObject | |||
public class RecipeManagerViewModel : ObservableObject | |||
{ | |||
public ObservableCollection<Recipes> RecipeList { get; set; } = Json<LocalRecipes>.Data.locaRecipes; | |||
@@ -25,7 +26,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
private void EditRecipe(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is int item && item >= 0) | |||
if (o is int item && item >= 0) | |||
{ | |||
Globle.GlobleData.ChangeRecipes = new Recipes(); | |||
Globle.GlobleData.ChangeRecipes = RecipeList[item]; | |||
@@ -47,11 +48,15 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
private void PecipeSetting(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is string id ) | |||
if (o is string id) | |||
{ | |||
var res = Json<LocalRecipes>.Data.locaRecipes.FirstOrDefault(p=>p.ID == id); | |||
var res = Json<LocalRecipes>.Data.locaRecipes.FirstOrDefault(p => p.ID == id); | |||
if (res != null) | |||
{ | |||
Globle.GlobleData.recipeTechnologyProcess = null; | |||
Globle.GlobleData.recipeTechnologyProcess = res; | |||
TechnologyProcess technologyProcess = new TechnologyProcess(); | |||
technologyProcess.ShowDialog(); | |||
} | |||
} | |||
@@ -1,4 +1,4 @@ | |||
using BPASmart.Model.配方; | |||
using BPASmart.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
@@ -11,7 +11,7 @@ using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class RecipesConfigureViewModel:ObservableObject | |||
public class RecipesConfigureViewModel : ObservableObject | |||
{ | |||
public ObservableCollection<RecipeMaterials> recipeMaterials { get; set; } = new ObservableCollection<RecipeMaterials>(); | |||
@@ -26,7 +26,7 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
public string RecipeName { get { return _repiceName; } set { _repiceName = value; OnPropertyChanged(); } } | |||
private string _repiceName; | |||
public string ErrorMessage { get { return _errorMessage; } set { _errorMessage = value; OnPropertyChanged(); } } | |||
@@ -37,13 +37,13 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
public RelayCommand SaveCommand { get; set; } | |||
public RelayCommand<object> DeleteCommand { get; set; } | |||
private void Delete(object o) | |||
{ | |||
if (o == null) return; | |||
if(o is string id) | |||
if (o is string id) | |||
{ | |||
var res = recipeMaterials.FirstOrDefault(p=>p.ID == id); | |||
var res = recipeMaterials.FirstOrDefault(p => p.ID == id); | |||
if (res != null) recipeMaterials.Remove(res); | |||
} | |||
} | |||
@@ -60,17 +60,17 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
}); | |||
}); | |||
SaveCommand = new RelayCommand(() => | |||
{ | |||
if(RecipeName == null) | |||
if (RecipeName == null) | |||
{ | |||
ErrorMessage = "配方名称为空"; | |||
return; | |||
} | |||
if (Globle.GlobleData.ChangeRecipes!=null) | |||
if (Globle.GlobleData.ChangeRecipes != null) | |||
{ | |||
var res = Json<LocalRecipes>.Data.locaRecipes.FirstOrDefault(p => p.ID == Globle.GlobleData.ChangeRecipes.ID); | |||
res.recipeMaterials = recipeMaterials; | |||
@@ -84,9 +84,9 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
ErrorMessage = "配方名称已存在"; | |||
return; | |||
} | |||
Json<LocalRecipes>.Data.locaRecipes.Add(new Recipes | |||
{ | |||
ID = Guid.NewGuid().ToString() , | |||
Json<LocalRecipes>.Data.locaRecipes.Add(new Recipes | |||
{ | |||
ID = Guid.NewGuid().ToString(), | |||
Name = RecipeName, | |||
recipeMaterials = recipeMaterials | |||
}); | |||
@@ -104,12 +104,12 @@ namespace BPASmart.RecipeManagement.ViewModel | |||
materialsName.Add(materail.Name); | |||
} | |||
} | |||
if(Globle.GlobleData.ChangeRecipes != null) | |||
if (Globle.GlobleData.ChangeRecipes != null) | |||
{ | |||
RecipeName = Globle.GlobleData.ChangeRecipes.Name.ToString(); | |||
recipeMaterials = Globle.GlobleData.ChangeRecipes.recipeMaterials; | |||
recipeMaterials = Globle.GlobleData.ChangeRecipes.recipeMaterials; | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,130 @@ | |||
using BPASmart.Model; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmart.RecipeManagement.ViewModel | |||
{ | |||
public class TechnologyProcessViewModel : ObservableObject | |||
{ | |||
public static int currentItemId; | |||
public int Id { get { return _id; } set { _id = value; OnPropertyChanged(); } } | |||
private int _id = 0; | |||
public ObservableCollection<TechnologyProcessModel> technologyProcessModels { get; set; } = new ObservableCollection<TechnologyProcessModel>(); | |||
public string currentRecipeName { get { return _currentRecipeName; } set { _currentRecipeName = value; OnPropertyChanged(); } } | |||
private string _currentRecipeName = string.Empty; | |||
public RelayCommand CloseWindowCommand { get; set; } | |||
public ObservableCollection<string> meterailItems { get; set; } = new ObservableCollection<string>(); | |||
public RelayCommand ConfirmCommand { get; set; } | |||
public RelayCommand AddLastFlowItemCommand { get; set; } | |||
public RelayCommand AddFrontFlowItemCommand { get; set; } | |||
public RelayCommand DeleteFlowItemCommand { get; set; } | |||
public TechnologyProcessViewModel() | |||
{ | |||
foreach (var item in Globle.GlobleData.recipeTechnologyProcess.recipeMaterials) | |||
{ | |||
meterailItems.Add(item.Name); | |||
} | |||
ActionManage.GetInstance.Register(new Action<object>((obj) => | |||
{ | |||
if (obj != null) | |||
try | |||
{ | |||
currentItemId = Convert.ToInt32(obj); | |||
} | |||
catch (Exception) | |||
{ | |||
} | |||
}), "CurrentItemId"); | |||
technologyProcessModels = Globle.GlobleData.recipeTechnologyProcess.TechnologyProcessModels; | |||
CloseWindowCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("CloseTechnologyProcessView"); | |||
}); | |||
ConfirmCommand = new RelayCommand(() => | |||
{ | |||
var res = Json<LocalRecipes>.Data.locaRecipes.FirstOrDefault(p => p.ID == Globle.GlobleData.recipeTechnologyProcess.ID); | |||
if (res != null) | |||
{ | |||
res.TechnologyProcessModels = technologyProcessModels; | |||
} | |||
Json<LocalRecipes>.Save(); | |||
; | |||
ActionManage.GetInstance.Send("CloseTechnologyProcessView"); | |||
}); | |||
AddFrontFlowItemCommand = new RelayCommand(() => | |||
{ | |||
try | |||
{ | |||
if (currentItemId == 0) | |||
{ | |||
technologyProcessModels.Insert(0, new TechnologyProcessModel()); | |||
} | |||
else | |||
{ | |||
technologyProcessModels.Insert(currentItemId, new TechnologyProcessModel()); | |||
currentItemId = currentItemId + 1; | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
//throw; | |||
} | |||
}); | |||
AddLastFlowItemCommand = new RelayCommand(() => | |||
{ | |||
try | |||
{ | |||
if (technologyProcessModels.Count <= 0) | |||
{ | |||
technologyProcessModels.Insert(0, new TechnologyProcessModel()); | |||
} | |||
else if (currentItemId != 0) | |||
{ | |||
technologyProcessModels.Insert(currentItemId + 1, new TechnologyProcessModel()); | |||
} | |||
else | |||
{ | |||
technologyProcessModels.Add(new TechnologyProcessModel()); | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
// throw; | |||
} | |||
}); | |||
DeleteFlowItemCommand = new RelayCommand(() => | |||
{ | |||
if (technologyProcessModels.Count > 0) | |||
technologyProcessModels.RemoveAt(currentItemId); | |||
currentItemId = 0; | |||
}); | |||
} | |||
} | |||
} |
@@ -8,14 +8,14 @@ | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Communication" Version="1.0.17" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.9" /> | |||
<PackageReference Include="BPA.Communication" Version="1.0.19" /> | |||
<PackageReference Include="BPA.Helper" Version="1.0.15" /> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmart.Model\BPASmart.Model.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Message\BPASmartClient.Message.csproj" /> | |||
<ProjectReference Include="..\Communication\Communication.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -2,7 +2,6 @@ | |||
using BPA.Helper; | |||
using BPA.Communication; | |||
using Microsoft.EntityFrameworkCore.Metadata.Conventions; | |||
using Communication; | |||
using System.Collections.Concurrent; | |||
using Newtonsoft.Json; | |||
@@ -15,7 +14,11 @@ namespace BPASmart.Server | |||
public void Init() | |||
{ | |||
BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog("通讯模块初始化"); | |||
RedisHelper.GetInstance.ConnectAsync(); | |||
MessageLog.GetInstance.NotifyShow = new Action<string>((s) => | |||
{ | |||
BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog(s); | |||
}); | |||
RedisHelper.GetInstance.ConnectAsync("124.222.238.75", 16000, "123456", 1); | |||
MqttInit(); | |||
Json<CommunicationPar>.Data.CommunicationDevices.ToList()?.ForEach(item => | |||
{ | |||
@@ -95,7 +98,18 @@ namespace BPASmart.Server | |||
{ | |||
while (msg.Count > 0) | |||
{ | |||
DeviceControl(); | |||
if (msg.TryDequeue(out string s)) | |||
{ | |||
var res = JsonConvert.DeserializeObject(s) as IMessage; | |||
if (res != null) | |||
{ | |||
if (res is PublishInfo _mPublishInfo) | |||
{ | |||
DeviceControl(_mPublishInfo); | |||
} | |||
} | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "MQTT 消息监听"); | |||
@@ -106,14 +120,14 @@ namespace BPASmart.Server | |||
}); | |||
} | |||
private void DeviceControl() | |||
private void DeviceControl(PublishInfo publishInfo) | |||
{ | |||
if (msg.TryDequeue(out string s)) | |||
{ | |||
var res = JsonConvert.DeserializeObject<PublishInfo>(s); | |||
if (res != null) | |||
{ | |||
res.PublishModels.ForEach(item => | |||
//if (msg.TryDequeue(out string s)) | |||
//{ | |||
// var res = JsonConvert.DeserializeObject<PublishInfo>(s); | |||
// if (res != null) | |||
// { | |||
publishInfo.PublishModels.ForEach(item => | |||
{ | |||
if (CommunicationDevices.ContainsKey(item.DeviceName)) | |||
{ | |||
@@ -157,8 +171,8 @@ namespace BPASmart.Server | |||
} | |||
}); | |||
} | |||
} | |||
//} | |||
//} | |||
} | |||
private void SetValue(Array arrays, string DeviceName, ReadDataModel readDataModel, EDataType eDataType) | |||
@@ -0,0 +1,72 @@ | |||
using Microsoft.EntityFrameworkCore; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmart.Model; | |||
using System.Collections.ObjectModel; | |||
namespace BPASmart.Server | |||
{ | |||
public class SqliteContext : DbContext, IRecipeMaterials | |||
{ | |||
private volatile static SqliteContext _Instance; | |||
public static SqliteContext GetInstance => _Instance ?? (_Instance = new SqliteContext()); | |||
private SqliteContext() { } | |||
string path | |||
{ | |||
get | |||
{ | |||
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\DB")); | |||
return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\DB\\RecipeInfo.db"; | |||
} | |||
} | |||
public DbSet<RecipeMaterials> RecipeMaterialsS { get; set; } | |||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |||
{ | |||
optionsBuilder.UseSqlite($"FileName={path}"); | |||
} | |||
public async Task<bool> AddAsync(RecipeMaterials recipeMaterials) | |||
{ | |||
Database.EnsureCreated(); | |||
await RecipeMaterialsS.AddAsync(recipeMaterials); | |||
return await SaveChangesAsync() > 1; | |||
} | |||
public async Task<bool> AddRangeAsync(RecipeMaterials[] recipeMaterials) | |||
{ | |||
Database.EnsureCreated(); | |||
await RecipeMaterialsS.AddRangeAsync(recipeMaterials); | |||
return await SaveChangesAsync() > 1; | |||
} | |||
public async Task<bool> UpdateAsync(RecipeMaterials recipeMaterials) | |||
{ | |||
Database.EnsureCreated(); | |||
RecipeMaterialsS.Update(recipeMaterials); | |||
return await SaveChangesAsync() > 1; | |||
} | |||
public async Task<bool> DeleteAsync(string ID) | |||
{ | |||
Database.EnsureCreated(); | |||
RecipeMaterialsS.Remove(RecipeMaterialsS.FirstOrDefault(p => p.ID == ID)); | |||
return await SaveChangesAsync() > 1; | |||
} | |||
public async Task<List<RecipeMaterials>> GetData() | |||
{ | |||
return await Task.Factory.StartNew(new Func<List<RecipeMaterials>>(() => | |||
{ | |||
Database.EnsureCreated(); | |||
return RecipeMaterialsS.ToList(); | |||
})); | |||
} | |||
} | |||
} |