Browse Source

产线项目搭建

样式分支
pry 2 years ago
parent
commit
eb39d1ce20
46 changed files with 3431 additions and 115 deletions
  1. +7
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  2. BIN
     
  3. BIN
     
  4. BIN
     
  5. BIN
     
  6. +16
    -0
      BPASmartClient.CustomResource/Pages/Enums/Permission.cs
  7. +1
    -2
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  8. +7
    -3
      BPASmartClient.CustomResource/Pages/Model/Config.cs
  9. +6
    -2
      BPASmartClient.CustomResource/Pages/Model/Global.cs
  10. +98
    -0
      BPASmartClient.CustomResource/Pages/Model/MenuManage.cs
  11. +67
    -0
      BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
  12. +73
    -0
      BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs
  13. +32
    -0
      BPASmartClient.CustomResource/Pages/Model/RunLog.cs
  14. +17
    -0
      BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
  15. +37
    -0
      BPASmartClient.CustomResource/Pages/Model/UserLog.cs
  16. +13
    -0
      BPASmartClient.CustomResource/Pages/Model/UserManager.cs
  17. +396
    -3
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml
  18. +23
    -1
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
  19. +465
    -0
      BPASmartClient.CustomResource/Pages/View/MainView.xaml
  20. +42
    -0
      BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
  21. +348
    -0
      BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml
  22. +72
    -0
      BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs
  23. +372
    -0
      BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
  24. +28
    -0
      BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs
  25. +335
    -0
      BPASmartClient.CustomResource/Pages/View/UserLogView.xaml
  26. +28
    -0
      BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs
  27. +2
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
  28. +60
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
  29. +64
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  30. +69
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs
  31. +126
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs
  32. +126
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs
  33. +37
    -0
      BPASmartClient.ZhuoDian/App.xaml
  34. +173
    -0
      BPASmartClient.ZhuoDian/App.xaml.cs
  35. +10
    -0
      BPASmartClient.ZhuoDian/AssemblyInfo.cs
  36. +23
    -0
      BPASmartClient.ZhuoDian/BPASmartClient.ZhuoDian.csproj
  37. +1
    -0
      DosingSystem/App.xaml
  38. +163
    -4
      DosingSystem/App.xaml.cs
  39. +2
    -2
      DosingSystem/Model/ActionMenu.cs
  40. +1
    -0
      DosingSystem/Model/RecipeModel.cs
  41. +0
    -30
      DosingSystem/Model/UserManager.cs
  42. +0
    -1
      DosingSystem/View/DeviceListView.xaml
  43. +1
    -1
      DosingSystem/View/RecipeControlView.xaml
  44. +64
    -64
      DosingSystem/ViewModel/MainViewModel.cs
  45. +2
    -0
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  46. +24
    -1
      SmartClient.sln

+ 7
- 1
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj View File

@@ -109,6 +109,8 @@
<None Remove="Image\环形切图\外圈\未选中.png" />
<None Remove="Image\环形切图\外圈\选中.png" />
<None Remove="Image\界面2.png" />
<None Remove="Image\登录界面背景.jpg" />
<None Remove="Image\登录界面背景1.jpg" />
<None Remove="Image\矩形.png" />
<None Remove="Image\矩形1.png" />
<None Remove="Image\矩形样式.png" />
@@ -146,6 +148,7 @@
<None Remove="Image\维护.png" />
<None Remove="Image\背景.png" />
<None Remove="Image\背景2.png" />
<None Remove="Image\背景3.jpg" />
<None Remove="Image\背景图片.png" />
<None Remove="Image\背景矢量\内部.png" />
<None Remove="Image\背景矢量\右上.png" />
@@ -188,6 +191,7 @@
</ItemGroup>

<ItemGroup>
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\Quartz Regular.ttf" />
<Resource Include="Image\btn_close.png" />
<Resource Include="Image\ComboBoxPopSelect.png" />
@@ -212,7 +216,10 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Image\圆角矩形 30 拷贝.png" />
<Resource Include="Image\登录界面背景.jpg" />
<Resource Include="Image\登录界面背景1.jpg" />
<Resource Include="Image\背景2.png" />
<Resource Include="Image\背景3.jpg" />
<Resource Include="Image\边角.png" />
</ItemGroup>

@@ -245,7 +252,6 @@
</ItemGroup>

<ItemGroup>
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Image\bg.png" />
<Resource Include="Image\btn_normal.png" />
<Resource Include="Image\buttonOff.png" />


BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 16
- 0
BPASmartClient.CustomResource/Pages/Enums/Permission.cs View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Enums
{
public enum Permission : int
{
管理员 = 1,
操作员 = 2,
观察员 = 3,
技术员 = 4
}
}

+ 1
- 2
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.Helper;
using BPASmartClient.Message;
//using BPASmartClient.Message;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
@@ -98,7 +98,6 @@ namespace BPASmartClient.CustomResource.Pages.Model

AddAction?.Invoke(AlarmInfo);//添加报警通知
ChangeAction?.Invoke();//更改报警通知
MessageLog.GetInstance.AddDeviceAlarmLogShow(tempAlarm.Info, Guid.NewGuid().ToString());
}
}



DosingSystem/Model/Config.cs → BPASmartClient.CustomResource/Pages/Model/Config.cs View File

@@ -1,4 +1,5 @@
using BPA.Message;
using BPASmartClient.CustomResource.Pages.Enums;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -7,16 +8,14 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingSystem.Model
namespace BPASmartClient.CustomResource.Pages.Model
{
public class Config
{

private volatile static Config _Instance;
public static Config GetInstance => _Instance ?? (_Instance = new Config());
private Config() { }


public void Init()
{
if (File.Exists("up.hbl"))
@@ -43,6 +42,11 @@ namespace BPASmartClient.DosingSystem.Model
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.操作员, UserName = "czy", Password = "123456" });
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.观察员, UserName = "gcy", Password = "654321" });
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.技术员, UserName = "jsy", Password = "88888888" });
SaveUser();
}

public void SaveUser()
{
File.WriteAllText("up.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());
}
}

DosingSystem/Model/Global.cs → BPASmartClient.CustomResource/Pages/Model/Global.cs View File

@@ -1,13 +1,17 @@
using System;
using BPASmartClient.CustomResource.Pages.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingSystem.Model
namespace BPASmartClient.CustomResource.Pages.Model
{
public class Global
{
public static UserManager userManager { get; set; } = new UserManager();

public static UserInfo userInfo { get; set; } = new UserInfo();

}
}

+ 98
- 0
BPASmartClient.CustomResource/Pages/Model/MenuManage.cs View File

@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPASmartClient.CustomResource.Pages.Enums;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
{
/// <summary>
/// 在启动界面之前设置菜单项
/// </summary>
public class MenuManage : ObservableObject
{
private volatile static MenuManage _Instance;
public static MenuManage GetInstance => _Instance ?? (_Instance = new MenuManage());
private MenuManage() { }

public ObservableCollection<MenuModel> menuModels { get; set; } = new ObservableCollection<MenuModel>();
}

public class MenuModel : ObservableObject
{
/// <summary>
/// 主菜单权限
/// </summary>
public Permission[] MainMenuPermission { get { return _mMainMenuPermission; } set { _mMainMenuPermission = value; OnPropertyChanged(); } }
private Permission[] _mMainMenuPermission;

/// <summary>
/// 主菜单图标
/// </summary>
public string MainMenuIcon { get { return _mMainMenuIcon; } set { _mMainMenuIcon = value; OnPropertyChanged(); } }
private string _mMainMenuIcon = string.Empty;

/// <summary>
/// 主菜单名称
/// </summary>
public string MainMenuName { get { return _mMainMenuName; } set { _mMainMenuName = value; OnPropertyChanged(); } }
private string _mMainMenuName = string.Empty;

/// <summary>
/// 别名(英文名)
/// </summary>
public string Alias { get { return _mAlias; } set { _mAlias = value; OnPropertyChanged(); } }
private string _mAlias = string.Empty;

/// <summary>
/// 主菜单的显示隐藏设置
/// </summary>
public Visibility MainMenuVisibility { get { return _mMainMenuVisibility; } set { _mMainMenuVisibility = value; OnPropertyChanged(); } }
private Visibility _mMainMenuVisibility;

/// <summary>
/// 子菜单集合
/// </summary>
public ObservableCollection<SubMenumodel> subMenumodels { get; set; } = new ObservableCollection<SubMenumodel>();

}

public class SubMenumodel : ObservableObject
{
/// <summary>
/// 子菜单名称
/// </summary>
public string SubMenuName { get { return _mSubMenuName; } set { _mSubMenuName = value; OnPropertyChanged(); } }
private string _mSubMenuName = string.Empty;

/// <summary>
/// 子菜单权限管理
/// </summary>
public Permission[] SubMenuPermission { get { return _mSubMenuPermission; } set { _mSubMenuPermission = value; OnPropertyChanged(); } }
private Permission[] _mSubMenuPermission;

/// <summary>
/// 切换界面路径
/// </summary>
public string ToggleWindowPath { get { return _mToggleWindowPath; } set { _mToggleWindowPath = value; OnPropertyChanged(); } }
private string _mToggleWindowPath = string.Empty;

/// <summary>
/// 程序集名称
/// </summary>
public string AssemblyName { get { return _mAssemblyName; } set { _mAssemblyName = value; OnPropertyChanged(); } }
private string _mAssemblyName = string.Empty;

/// <summary>
/// 子菜单的显示隐藏设置
/// </summary>
public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } }
private Visibility _mSubMenuVisibility;

}

}

+ 67
- 0
BPASmartClient.CustomResource/Pages/Model/MessageLog.cs View File

@@ -0,0 +1,67 @@
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.ObjectModel;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class MessageLog
{
private volatile static MessageLog _Instance;
public static MessageLog GetInstance => _Instance ?? (_Instance = new MessageLog());
private MessageLog() { }

public Action<string> UserLog { get; set; }

public Action<string> RunLog { get; set; }

public ObservableCollection<RunLog> runLogs { get; set; } = new ObservableCollection<RunLog>();

public ObservableCollection<UserLog> userLogs { get; set; } = new ObservableCollection<UserLog>();

public void LogSave()
{
Sqlite<UserLog>.GetInstance.Save();
Sqlite<RunLog>.GetInstance.Save();
}

//public void GetLog()
//{
// Sqlite<UserLog>.GetInstance.GetData();
// Sqlite<RunLog>.GetInstance.GetData();
//}

public void ShowUserLog(string info)
{
UserLog userLog = new UserLog()
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
Permission = Global.userInfo.permission.ToString(),
LogInfo = info
};
Sqlite<UserLog>.GetInstance.Base.Add(userLog);
Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); }));
UserLog?.Invoke(info);
}

public void ShowRunLog(string info)
{
RunLog runLog = new RunLog()
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
RunLogInfo = info
};
Sqlite<RunLog>.GetInstance.Base.Add(runLog);
Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); }));
RunLog?.Invoke(info);
}


}
}

+ 73
- 0
BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs View File

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace BPASmartClient.CustomResource.Pages.Model
{
/// <summary>
/// 给PasswordBox添加一个可以绑定的附加类
/// </summary>
public class PasswordHelper
{

static bool IsUpdete = false;

#region PasswordProperty
public static readonly DependencyProperty PasswordProperty = DependencyProperty.RegisterAttached("Password", typeof(string),
typeof(PasswordHelper), new FrameworkPropertyMetadata("", new PropertyChangedCallback(OnPropertyChanged)));


public static string GetPassword(DependencyObject d)
{
return d.GetValue(PasswordProperty).ToString();
}

public static void SetPassword(DependencyObject d, string value)
{
d.SetValue(PasswordProperty, value);
}

private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
PasswordBox password = d as PasswordBox;
password.PasswordChanged -= password_PasswordChanged;
if (!IsUpdete) password.Password = e.NewValue?.ToString();
password.PasswordChanged += password_PasswordChanged;
}
#endregion

#region AttachProperty
public static readonly DependencyProperty AttachProperty = DependencyProperty.RegisterAttached("Attach", typeof(bool),
typeof(PasswordHelper), new FrameworkPropertyMetadata(default(bool), new PropertyChangedCallback(OnAttachChanged)));

public static bool GetAttach(DependencyObject d)
{
return (bool)d.GetValue(AttachProperty);
}

public static void SetAttach(DependencyObject d, bool value)
{
d.SetValue(AttachProperty, value);
}

private static void OnAttachChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
PasswordBox password = d as PasswordBox;
password.PasswordChanged += password_PasswordChanged;
}

private static void password_PasswordChanged(object sender, RoutedEventArgs e)
{
PasswordBox passwordBox = sender as PasswordBox;
IsUpdete = true;
SetPassword(passwordBox, passwordBox.Password);
IsUpdete = false;
}

#endregion
}
}

+ 32
- 0
BPASmartClient.CustomResource/Pages/Model/RunLog.cs View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class RunLog : ObservableObject
{
[Key]
public int Id { get; set; }

//public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } }
//private string _mDate;

//public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } }
//private string _mTime;

//public string RunLogInfo { get { return _mRunLogInfo; } set { _mRunLogInfo = value; OnPropertyChanged(); } }
//private string _mRunLogInfo;

public string Date { get; set; }

public string Time { get; set; }

public string RunLogInfo { get; set; }

}
}

+ 17
- 0
BPASmartClient.CustomResource/Pages/Model/UserInfo.cs View File

@@ -0,0 +1,17 @@
using BPASmartClient.CustomResource.Pages.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserInfo
{
public Permission permission { get; set; }
public string UserName { get; set; }
public string Password { get; set; }

}
}

+ 37
- 0
BPASmartClient.CustomResource/Pages/Model/UserLog.cs View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserLog : ObservableObject
{
[Key]
public int Id { get; set; }

//public string Permission { get { return _mPermission; } set { _mPermission = value; OnPropertyChanged(); } }
//private string _mPermission;

//public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } }
//private string _mDate;

//public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } }
//private string _mTime;

//public string LogInfo { get { return _mLogInfo; } set { _mLogInfo = value; OnPropertyChanged(); } }
//private string _mLogInfo;

public string Permission { get; set; }

public string Date { get; set; }

public string Time { get; set; }

public string LogInfo { get; set; }

}
}

+ 13
- 0
BPASmartClient.CustomResource/Pages/Model/UserManager.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserManager
{
public List<UserInfo> userInfos { get; set; } = new List<UserInfo>();
}
}

+ 396
- 3
BPASmartClient.CustomResource/Pages/View/LoginView.xaml View File

@@ -2,15 +2,17 @@
x:Class="BPASmartClient.CustomResource.Pages.View.LoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="LoginView"
Width="800"
Height="450"
Width="500"
Height="300"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
@@ -26,9 +28,400 @@
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<!--#region 密码输入框样式-->
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontFamily" Value="Times New Roman" />
<Setter Property="PasswordChar" Value="●" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Padding" Value="1" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="AllowDrop" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type PasswordBox}">
<Border
x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="UserTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="20"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe850;" />

<!--<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
Text="请输入账号密码"
Visibility="Collapsed" />-->

<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="Bd" Property="Opacity" Value="0.56" />
<Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF7EB4EA" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
</Trigger>
<!--<DataTrigger Binding="{Binding Path=Password, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>-->

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
<Condition Property="IsSelectionActive" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<!--#endregion-->

<!--#region 用户输入框样式-->
<Style x:Key="UserTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border
x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="PasswordTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="20"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe66d;" />

<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
Text="请输入账号名称"
Visibility="Collapsed" />


<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>

<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
</Trigger>
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</Window.Resources>

<Grid />
<Border
x:Name="br"
BorderBrush="#009dff"
BorderThickness="2">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
ShadowDepth="1"
Color="#009DFF" />
</Border.Effect>
<Grid>
<Image Source="../../Image/登录界面背景.jpg" Stretch="Fill" />
<Image Source="../../Image/阴影边框.png" Stretch="Fill" />

<Grid Margin="50,20">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,10,0,0"
HorizontalAlignment="Center"
FontSize="20"
Foreground="#ddd"
Text="用户登录" />

<TextBlock
Margin="20,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
FontSize="16"
Foreground="#FFEF2020"
Text="{Binding ErrorInfo}" />

<TextBox
Grid.Row="1"
Height="40"
Margin="20,0"
TabIndex="1"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
Style="{DynamicResource UserTextBoxStyle}"
Text="{Binding UserName}" />

<PasswordBox
Name="pb"
Grid.Row="2"
Height="40"
Margin="20,0"
TabIndex="2"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="PasswordBox_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}" />

<TextBlock
Name="markText"
Grid.Row="2"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入账号密码"
Visibility="Visible" />


<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding ExitCommand}"
Content="退 出"
FontSize="20"
Foreground="White" />

<Button
Grid.Column="1"
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding LoginCommand}"
TabIndex="3"
Content="登 录"
FontSize="20"
Foreground="White" />

</Grid>

</Grid>
</Grid>

</Border>

<!--<Grid x:Name="gr">
<Grid.Background>
<ImageBrush Opacity="0.8" ImageSource="../../Image/登录界面背景.jpg" />
</Grid.Background>

<Image
Margin="201 101"
Source="../../Image/阴影边框.png"
Stretch="Fill" />

<Border
Margin="200 100"
BorderBrush="#009dff"
BorderThickness="1">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
ShadowDepth="1"
Color="#009DFF" />
</Border.Effect>
-->
<!--<Border.Background>
<ImageBrush ImageSource="../../Image/矩形样式.png"/>
</Border.Background>-->
<!--

<Grid>

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,10,0,0"
HorizontalAlignment="Center"
FontSize="20"
Foreground="#ddd"
Text="用户登录" />

<TextBlock
Margin="20,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
FontSize="16"
Foreground="#FFEF2020"
Text="{Binding ErrorInfo}" />

<TextBox
Grid.Row="1"
Height="40"
Margin="20,0"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
Style="{DynamicResource UserTextBoxStyle}"
Text="{Binding UserName}" />

<PasswordBox
Name="pb"
Grid.Row="2"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="PasswordBox_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}" />

<TextBlock
Name="markText"
Grid.Row="2"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入账号密码"
Visibility="Visible" />


<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding ExitCommand}"
Content="退 出"
FontSize="20"
Foreground="White" />

<Button
Grid.Column="1"
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding LoginCommand}"
Content="登 录"
FontSize="20"
Foreground="White" />

</Grid>

</Grid>

</Border>




</Grid>-->





+ 23
- 1
BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs View File

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -22,6 +23,27 @@ namespace BPASmartClient.CustomResource.Pages.View
public LoginView()
{
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) =>
{
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
ActionManage.GetInstance.CancelRegister("LoginOk");
ActionManage.GetInstance.CancelRegister("ExitAction");
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk");
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "ExitAction");

}

private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.pb.Password.Length > 0)
{
this.markText.Visibility = Visibility.Collapsed;
}
else
{
this.markText.Visibility = Visibility.Visible;
}
}
}
}

+ 465
- 0
BPASmartClient.CustomResource/Pages/View/MainView.xaml View File

@@ -0,0 +1,465 @@
<Window
x:Class="BPASmartClient.CustomResource.Pages.View.MainView"
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:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="MainView"
Width="1200"
Height="700"
AllowsTransparency="True"
Background="{x:Null}"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:MainViewModel />
</Window.DataContext>

<Window.Resources>

<!--#region 静态资源-->
<ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" />
<ImageBrush x:Key="leftImageSub" ImageSource="../../Image/leftImageSub.png" />
<ImageBrush x:Key="topImage" ImageSource="../../Image/topImage.png" />
<!--#endregion-->

<!--#region 标题栏按钮样式-->
<Style x:Key="TitleBarStyle" TargetType="Button">
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="24" />
<Setter Property="FontFamily" Value="../../Fonts/#iconfont" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Name="TitleBarBr" Background="Transparent">
<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Background" Value="#22ffffff" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 导航栏样式-->
<Style x:Key="NavButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Foreground" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#55ffffff"
BorderThickness="0,0,0,1.5">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#865eec" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0,0,1.5,1.5" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 下拉列表单选按钮样式-->
<Style x:Key="RadioMiniButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Margin" Value="5,10,1,5" />
<Setter Property="Width" Value="160" />
<Setter Property="Height" Value="30" />
<Setter Property="FontSize" Value="14" />
<Setter Property="FontFamily" Value="粗体" />
<Setter Property="Foreground" Value="#DDD" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="#DDD" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid
x:Name="templateRoot"
Background="Transparent"
SnapsToDevicePixels="True">
<Border x:Name="border2" />
<ContentPresenter
x:Name="contentPresenter"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Focusable="False"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />

</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="True">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle
Margin="14,0,0,0"
SnapsToDevicePixels="True"
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
StrokeDashArray="1 2"
StrokeThickness="1" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Padding" Value="4,-1,0,0" />
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}" />

<Trigger Property="IsChecked" Value="true">
<Setter Property="Foreground" Value="White" />
<Setter TargetName="border2" Property="Background" Value="{StaticResource ResourceKey=leftImageSub}">
<!--<Setter.Value>
<ImageBrush ImageSource="./images/back.png" />
</Setter.Value>-->
</Setter>
</Trigger>

<Trigger Property="IsChecked" Value="false">
<Setter TargetName="border2" Property="Background" Value="#101F3F" />
<Setter Property="Foreground" Value="#4B8EC4" />
</Trigger>

<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="border2" Property="Background" Value="#55007acc" />
</MultiTrigger.Setters>
</MultiTrigger>

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

<!--#region 下拉列表样式-->
<Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Height" Value="80" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="10,10" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid>
<Border
x:Name="border2"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Background="{TemplateBinding Background}">
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</Grid>

<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="#FFd2e7f4" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="border2" Property="Background" Value="{StaticResource ResourceKey=leftImage}" />
</Trigger>
<Trigger Property="IsChecked" Value="false">
<Setter TargetName="border2" Property="Background" Value="#191E36" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="White" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<DockPanel>
<ToggleButton
x:Name="HeaderSite"
Height="60"
MinWidth="0"
MinHeight="0"
Margin="1"
Padding="{TemplateBinding Padding}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
DockPanel.Dock="Top"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontStretch="{TemplateBinding FontStretch}"
FontStyle="{TemplateBinding FontStyle}"
FontWeight="{TemplateBinding FontWeight}"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ToggleButtonStyle}" />
<ContentPresenter
x:Name="ExpandSite"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
DockPanel.Dock="Left"
Focusable="false"
Visibility="Collapsed" />
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="true">
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</Window.Resources>

<Grid Background="#103153">

<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 标题栏设置-->
<Border
x:Name="MoveBorder"
Height="50"
VerticalAlignment="Top"
Background="#0C2349"
BorderBrush="#55ffffff"
BorderThickness="0,0,0,1">

<StackPanel Orientation="Horizontal">
<Image Margin="15,5,0,5" Source="../../Image/HBL.png" />
<TextBlock
Name="tbTitle"
Margin="20,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="18"
Foreground="White"
Text="上位机监控系统" />
</StackPanel>


</Border>

<UniformGrid
Width="150"
Height="50"
HorizontalAlignment="Right"
Columns="3">
<Button
Name="ButMin"
Content="&#xe664;"
Style="{StaticResource TitleBarStyle}" />
<Button
Name="ButMax"
Content="&#xe65d;"
FontSize="22"
Style="{StaticResource TitleBarStyle}" />
<Button
Name="ButClose"
Content="&#xe639;"
Style="{StaticResource TitleBarStyle}" />
</UniformGrid>
<!--#endregion-->

<!--#region 显示区设置-->

<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<!-- 侧边栏菜单设置 -->
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<Grid>
<Border BorderBrush="#121F40" BorderThickness="1">
<Border.Background>
<ImageBrush ImageSource="../../Image/leftback.png" />
</Border.Background>
</Border>

<ScrollViewer
Grid.Row="1"
Margin="10"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding menuModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Visibility="{Binding MainMenuVisibility}">
<Expander x:Name="E1" Style="{DynamicResource ExpanderStyle}">
<Expander.Header>
<StackPanel
Margin="10,0,0,10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="25"
Foreground="#ddd"
Text="{Binding MainMenuIcon, Converter={StaticResource StringToIconConverter}}" />
<StackPanel Margin="10,0,0,0" VerticalAlignment="Center">
<TextBlock
FontSize="16"
Foreground="White"
Text="{Binding MainMenuName}" />
<TextBlock
FontSize="13"
Foreground="Gray"
Text="{Binding Alias}" />
</StackPanel>
</StackPanel>
</Expander.Header>
<Expander.Content>
<StackPanel>
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding subMenumodels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton
Command="{Binding DataContext.NavChangedCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
CommandParameter="{Binding ToggleWindowPath}"
Content="{Binding SubMenuName}"
GroupName="All"
Style="{StaticResource RadioMiniButtonStyle}"
Visibility="{Binding SubMenuVisibility}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</StackPanel>
</Expander.Content>
</Expander>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</ScrollViewer>
<!--#endregion-->

<!--#region 页面显示-->
<Grid Grid.Column="1">
<Grid.Background>
<ImageBrush ImageSource="../../Image/WindowImages.png" />
</Grid.Background>

<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,0,0,20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Foreground="#1A8ADE"
Text="{Binding DisplayName}" />

<TextBlock
Margin="10,10,0,5"
HorizontalAlignment="left"
VerticalAlignment="Center"
FontSize="18"
Foreground="#1A8ADE"
Text="{Binding DateVisible}" />

<TextBlock
Margin="0,10,50,5"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="18"
Foreground="#1A8ADE"
Text="{Binding TimeVisible}" />

<ContentControl Grid.Row="1" Content="{Binding MainContent}" />

</Grid>

<!--#endregion-->

</Grid>


<!--#endregion-->

</Grid>

</Window>

+ 42
- 0
BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
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 BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// MainView.xaml 的交互逻辑
/// </summary>
public partial class MainView : Window
{
public MainView()
{
InitializeComponent();
this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; };
this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; };
this.ButClose.Click += (o, e) => { this.Close(); };
this.MoveBorder.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;
}
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
}
}
}

+ 348
- 0
BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml View File

@@ -0,0 +1,348 @@
<Window
x:Class="BPASmartClient.CustomResource.Pages.View.PasswordChangeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="PasswordChangeView"
Width="500"
Height="350"
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">

<Window.DataContext>
<vm:PasswordChangeViewModel />
</Window.DataContext>

<Window.Resources>
<Style x:Key="TxLogin" TargetType="TextBlock">
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="#ddd" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<!--#region 密码输入框样式-->
<Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="FontFamily" Value="Times New Roman" />
<Setter Property="PasswordChar" Value="●" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Padding" Value="1" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="AllowDrop" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type PasswordBox}">
<Border
x:Name="Bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="UserTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="20"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe850;" />

<!--<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
Text="请输入账号密码"
Visibility="Collapsed" />-->

<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="Bd" Property="Opacity" Value="0.56" />
<Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF7EB4EA" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
<Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
</Trigger>
<!--<DataTrigger Binding="{Binding Path=Password, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>-->

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
<Condition Property="IsSelectionActive" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<!--#endregion-->

<!--#region 用户输入框样式-->
<Style x:Key="UserTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CaretBrush" Value="#009DFF" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border
x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
SnapsToDevicePixels="true">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
x:Name="PasswordTextBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../../Fonts/#iconfont"
FontSize="20"
Foreground="{TemplateBinding BorderBrush}"
Text="&#xe66d;" />

<TextBlock
Name="markText"
Grid.Column="1"
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
Text="请输入账号名称"
Visibility="Collapsed" />


<ScrollViewer
x:Name="PART_ContentHost"
Grid.Column="1"
MinHeight="20"
VerticalAlignment="Center"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>

</Border>

<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="border" Property="Opacity" Value="0.56" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
</Trigger>
<DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
<Setter TargetName="markText" Property="Visibility" Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--#endregion-->

</Window.Resources>

<Border
x:Name="br"
BorderBrush="#009dff"
BorderThickness="2">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
ShadowDepth="1"
Color="#009DFF" />
</Border.Effect>
<Grid>
<Image Source="../../Image/登录界面背景.jpg" Stretch="Fill" />
<Image Source="../../Image/阴影边框.png" Stretch="Fill" />

<Grid Margin="50,20">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<TextBlock
Margin="0,10,0,0"
HorizontalAlignment="Center"
FontSize="20"
Foreground="#ddd"
Text="密码修改" />

<TextBlock
Margin="20,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
FontSize="16"
Foreground="#FFEF2020"
Text="{Binding ErrorInfo}" />

<Grid Grid.Row="1">
<PasswordBox
Name="oldpb"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding OldPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="oldpb_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="oldmarkText"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入原密码"
Visibility="Visible" />

</Grid>

<Grid Grid.Row="2">
<PasswordBox
Name="newpb1"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding NewPassword1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="newpb1_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="newmarkText1"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请输入新密码"
Visibility="Visible" />

</Grid>

<Grid Grid.Row="3">
<PasswordBox
Name="newpb2"
Height="40"
Margin="20,0"
common:PasswordHelper.Attach="True"
common:PasswordHelper.Password="{Binding NewPassword2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
BorderBrush="#009DFF"
FontSize="16"
Foreground="#aadddddd"
PasswordChanged="newpb2_PasswordChanged"
Style="{DynamicResource PasswordBoxStyle}"
TabIndex="2" />

<TextBlock
Name="newmarkText2"
Margin="70,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="20"
Foreground="#88009dff"
IsHitTestVisible="False"
Text="请再次输入新密码"
Visibility="Visible" />

</Grid>

<Grid Grid.Row="4">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<Button
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding ExitCommand}"
Content="取 消"
FontSize="20"
Foreground="White" />

<Button
Grid.Column="1"
Margin="20,10"
Background="#009DFF"
BorderThickness="0"
Command="{Binding LoginCommand}"
Content="确 认"
FontSize="20"
Foreground="White"
TabIndex="3" />

</Grid>

</Grid>
</Grid>

</Border>

</Window>

+ 72
- 0
BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs View File

@@ -0,0 +1,72 @@
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 BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// PasswordChangeView.xaml 的交互逻辑
/// </summary>
public partial class PasswordChangeView : Window
{
public PasswordChangeView()
{
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) =>
{
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
ActionManage.GetInstance.CancelRegister("PasswordChangeViewconfirm");
ActionManage.GetInstance.CancelRegister("PasswordChangeViewCancel");
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "PasswordChangeViewconfirm");
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "PasswordChangeViewCancel");
}

private void newpb2_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.newpb2.Password.Length > 0)
{
this.newmarkText2.Visibility = Visibility.Collapsed;
}
else
{
this.newmarkText2.Visibility = Visibility.Visible;
}
}

private void newpb1_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.newpb1.Password.Length > 0)
{
this.newmarkText1.Visibility = Visibility.Collapsed;
}
else
{
this.newmarkText1.Visibility = Visibility.Visible;
}
}

private void oldpb_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.oldpb.Password.Length > 0)
{
this.oldmarkText.Visibility = Visibility.Collapsed;
}
else
{
this.oldmarkText.Visibility = Visibility.Visible;
}
}
}
}

+ 372
- 0
BPASmartClient.CustomResource/Pages/View/RunLogView.xaml View File

@@ -0,0 +1,372 @@
<UserControl
x:Class="BPASmartClient.CustomResource.Pages.View.RunLogView"
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:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:RunLogViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="DataTextBlockStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontSize" Value="14" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,8"
HorizontalAlignment="Right"
Orientation="Horizontal">

<DatePicker
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding StartDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入开始时间"
Visibility="{Binding IsVisibility}" />

<DatePicker
Margin="20,0,20,0"
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding EndDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入结束时间"
Visibility="{Binding IsVisibility}" />

<Button
Width="140"
Height="30"
Background="#FF19B7EC"
Command="{Binding ControlCommand}"
Content="{Binding ControlButText}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}"
Visibility="{Binding IsVisibility}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

<Button
Width="140"
Height="30"
Margin="20,0,0,0"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="{Binding ButContent}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="日期" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="时间" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="消息日志" />

<!--<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警信息" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>-->

<!--<TextBlock
Grid.Column="4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警值" />

<Grid Grid.Column="5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="报警等级" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>-->
</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">

<Grid>
<!--#region 实时报警信息-->
<ItemsControl ItemsSource="{Binding Log}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

<!--<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>-->

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->

<!--#region 历史报警信息-->
<ItemsControl ItemsSource="{Binding HistoryRunLog}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

<!--<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Info}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="4"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Value}" />

<Grid Grid.Column="5">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>-->

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->
</Grid>
</ScrollViewer>
<!--#endregion-->


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs View File

@@ -0,0 +1,28 @@
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 BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// RunLogView.xaml 的交互逻辑
/// </summary>
public partial class RunLogView : UserControl
{
public RunLogView()
{
InitializeComponent();
}
}
}

+ 335
- 0
BPASmartClient.CustomResource/Pages/View/UserLogView.xaml View File

@@ -0,0 +1,335 @@
<UserControl
x:Class="BPASmartClient.CustomResource.Pages.View.UserLogView"
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:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:UserLogViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="DataTextBlockStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontSize" Value="14" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<ContentControl
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,8"
HorizontalAlignment="Right"
Orientation="Horizontal">

<DatePicker
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding StartDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入开始时间"
Visibility="{Binding IsVisibility}" />

<DatePicker
Margin="20,0,20,0"
Background="Transparent"
BorderBrush="#aa3aa7f3"
BorderThickness="2"
SelectedDate="{Binding EndDateTime}"
Style="{StaticResource PickerStyle}"
Text="请输入结束时间"
Visibility="{Binding IsVisibility}" />

<Button
Width="140"
Height="30"
Background="#FF19B7EC"
Command="{Binding ControlCommand}"
Content="{Binding ControlButText}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}"
Visibility="{Binding IsVisibility}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

<Button
Width="140"
Height="30"
Margin="20,0,0,0"
Background="#FF19B7EC"
Command="{Binding SwitchCommand}"
Content="{Binding ButContent}"
FontFamily="楷体"
FontSize="18"
Template="{StaticResource ButTemplate}">
<Button.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Button.Foreground>
</Button>

</StackPanel>

<!--#region 表格标题栏设置-->
<Grid Grid.Row="1" Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="日期" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="时间" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="操作权限" />

<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="消息日志" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">

<Grid>
<!--#region 实时报警信息-->
<ItemsControl ItemsSource="{Binding UserLogs}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Permission}" />

<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding LogInfo}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->

<!--#region 历史报警信息-->
<ItemsControl ItemsSource="{Binding HistoryUserLog}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Permission}" />

<Grid Grid.Column="3">
<TextBlock
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding LogInfo}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->
</Grid>
</ScrollViewer>
<!--#endregion-->


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs View File

@@ -0,0 +1,28 @@
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 BPASmartClient.CustomResource.Pages.View
{
/// <summary>
/// UserLogView.xaml 的交互逻辑
/// </summary>
public partial class UserLogView : UserControl
{
public UserLogView()
{
InitializeComponent();
}
}
}

+ 2
- 0
BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs View File

@@ -137,4 +137,6 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

}



}

+ 60
- 0
BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs View File

@@ -3,6 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

@@ -12,7 +15,64 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public LoginViewModel()
{
LoginCommand = new RelayCommand(() =>
{
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == UserName && p.Password == Password);
if (res != null)
{
Global.userInfo.permission = res.permission;
Global.userInfo.UserName = res.UserName;
Global.userInfo.Password = res.Password;
for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible;
else
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null)
MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;

for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
{
if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission))
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible;
else
MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;
}
}
ActionManage.GetInstance.Send("LoginOk");
}
else
{
ErrorInfo = "用户名或密码错误!";
}

});

ExitCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("ExitAction");
});
}

public RelayCommand LoginCommand { get; set; }

public RelayCommand ExitCommand { get; set; }



public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
private string _mErrorInfo;


public string UserName { get { return _mUserName; } set { _mUserName = value; OnPropertyChanged(); } }
private string _mUserName = "admin";


public string Password { get { return _mPassword; } set { _mPassword = value; OnPropertyChanged(); } }
private string _mPassword;


}
}

+ 64
- 0
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs View File

@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.Pages.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class MainViewModel : ObservableObject
{
public MainViewModel()
{
NavChangedCommand = new RelayCommand<object>(DoNavChanged);
menuModels = MenuManage.GetInstance.menuModels;
}
public ObservableCollection<MenuModel> menuModels { get; set; }

private void DoNavChanged(object obj)
{
for (int i = 0; i < menuModels.Count; i++)
{
var res = menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.ToggleWindowPath == obj.ToString());
if (res != null)
{
DisplayName = res.SubMenuName;
var end = res.AssemblyName.Substring(res.AssemblyName.Length - 1);
var start = res.ToggleWindowPath.Substring(0, 1);
bool isAddPoint = end != "." && start != ".";
string point = isAddPoint ? "." : "";
Type type = Assembly.Load(res.AssemblyName)?.GetType($"{res.AssemblyName }{point}{ res.ToggleWindowPath}");
ConstructorInfo cti = type?.GetConstructor(System.Type.EmptyTypes);
if (type?.BaseType.Name == "Window")
{
((Window)cti?.Invoke(null)).ShowDialog();
break;
}
else if (type?.BaseType.Name == "UserControl")
{
//ConstructorInfo cti = type?.GetConstructor(System.Type.EmptyTypes);
MainContent = (FrameworkElement)cti?.Invoke(null);
break;
}
}
}
}

public RelayCommand<object> NavChangedCommand { get; set; }

public FrameworkElement MainContent { get { return _mMainContent; } set { _mMainContent = value; OnPropertyChanged(); } }
private FrameworkElement _mMainContent;

public string DisplayName { get { return _mDisplayName; } set { _mDisplayName = value; OnPropertyChanged(); } }
private string _mDisplayName;



}
}

+ 69
- 0
BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs View File

@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class PasswordChangeViewModel : ObservableObject
{
public PasswordChangeViewModel()
{
LoginCommand = new RelayCommand(() =>
{
if (Global.userInfo.Password == OldPassword)
{
if (NewPassword1 == NewPassword2)
{
Global.userInfo.Password = NewPassword2;
int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.UserName == Global.userInfo.UserName);
if (index >= 0 && index < Global.userManager.userInfos.Count)
Global.userManager.userInfos.ElementAt(index).Password = NewPassword1;
Config.GetInstance.SaveUser();
ActionManage.GetInstance.Send("PasswordChangeViewconfirm");
}
else
{
ErrorInfo = "新密码不匹配";
}
}
else
{
ErrorInfo = "原密码错误";
}
});

ExitCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("PasswordChangeViewCancel");
});
}

public RelayCommand LoginCommand { get; set; }

public RelayCommand ExitCommand { get; set; }



public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
private string _mErrorInfo;

public string OldPassword { get { return _mOldPassword; } set { _mOldPassword = value; OnPropertyChanged(); } }
private string _mOldPassword;


public string NewPassword1 { get { return _mNewPassword1; } set { _mNewPassword1 = value; OnPropertyChanged(); } }
private string _mNewPassword1;


public string NewPassword2 { get { return _mNewPassword2; } set { _mNewPassword2 = value; OnPropertyChanged(); } }
private string _mNewPassword2;


}
}

+ 126
- 0
BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using BPASmartClient.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class RunLogViewModel : ObservableObject
{
public RunLogViewModel()
{
Sqlite<RunLog>.GetInstance.Save();
SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史日志")
{
GetHistoryRunLog();
CurrentDataVis = Visibility.Hidden;
HistoryDataVis = Visibility.Visible;
IsVisibility = Visibility.Visible;
ControlButText = "开始查询";
ButContent = "实时日志";
return;
}

if (ButContent == "实时日志")
{
HistoryDataVis = Visibility.Hidden;
CurrentDataVis = Visibility.Visible;
IsVisibility = Visibility.Hidden;
ButContent = "历史日志";
return;
}

});

ControlCommand = new RelayCommand(() =>
{

if (ControlButText == "报警复位") return;
if (ControlButText == "开始查询")
{
var lists = Sqlite<RunLog>.GetInstance.GetData();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
if (res != null)
{
HistoryRunLog.Clear();
foreach (var item in res)
{
HistoryRunLog.Add(item);
}
}
}

});
}

private void GetHistoryRunLog()
{
var data = Sqlite<RunLog>.GetInstance.GetData();
if (data != null)
{
HistoryRunLog.Clear();
foreach (var item in data)
{
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
if (day == 0)
{
HistoryRunLog.Add(item);
}
}
}
}

public RelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }

public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;

public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } }
private Visibility _mHistoryDataVis = Visibility.Hidden;

/// <summary>
/// 是否显示
/// </summary>
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } }
private Visibility _mIsVisibility = Visibility.Hidden;

/// <summary>
/// 文字显示
/// </summary>
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } }
private string _mButContent = "历史日志";

/// <summary>
/// 控制按钮文本显示
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";

/// <summary>
/// 开始时间
/// </summary>
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } }
private DateTime _mStartDateTime = DateTime.Now;

/// <summary>
/// 结束时间
/// </summary>
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } }
private DateTime _mEndDateTime = DateTime.Now;

public ObservableCollection<RunLog> HistoryRunLog { get; set; } = new ObservableCollection<RunLog>();

public ObservableCollection<RunLog> Log { get; set; } = MessageLog.GetInstance.runLogs;
}
}

+ 126
- 0
BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class UserLogViewModel : ObservableObject
{
public UserLogViewModel()
{
Sqlite<UserLog>.GetInstance.Save();
UserLogs = MessageLog.GetInstance.userLogs;
SwitchCommand = new RelayCommand(() =>
{
if (ButContent == "历史日志")
{
GetHistoryUserLog();
CurrentDataVis = Visibility.Hidden;
HistoryDataVis = Visibility.Visible;
IsVisibility = Visibility.Visible;
ControlButText = "开始查询";
ButContent = "实时日志";
return;
}

if (ButContent == "实时日志")
{
HistoryDataVis = Visibility.Hidden;
CurrentDataVis = Visibility.Visible;
IsVisibility = Visibility.Hidden;
ButContent = "历史日志";
return;
}

});

ControlCommand = new RelayCommand(() =>
{
if (ControlButText == "报警复位") return;
if (ControlButText == "开始查询")
{
var lists = Sqlite<UserLog>.GetInstance.GetData();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
if (res != null)
{
HistoryUserLog.Clear();
foreach (var item in res)
{
HistoryUserLog.Add(item);
}
}
}
});
}

private void GetHistoryUserLog()
{
var data = Sqlite<UserLog>.GetInstance.GetData();
if (data != null)
{
HistoryUserLog.Clear();
foreach (var item in data)
{
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days;
if (day == 0)
{
HistoryUserLog.Add(item);
}
}
}
}

public RelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }

public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;

public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } }
private Visibility _mHistoryDataVis = Visibility.Hidden;

/// <summary>
/// 是否显示
/// </summary>
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } }
private Visibility _mIsVisibility = Visibility.Hidden;

/// <summary>
/// 文字显示
/// </summary>
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } }
private string _mButContent = "历史日志";

/// <summary>
/// 控制按钮文本显示
/// </summary>
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } }
private string _mControlButText = "报警复位";

/// <summary>
/// 开始时间
/// </summary>
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } }
private DateTime _mStartDateTime = DateTime.Now;

/// <summary>
/// 结束时间
/// </summary>
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } }
private DateTime _mEndDateTime = DateTime.Now;

public ObservableCollection<UserLog> HistoryUserLog { get; set; } = new ObservableCollection<UserLog>();

public ObservableCollection<UserLog> UserLogs { get; set; }

}
}

+ 37
- 0
BPASmartClient.ZhuoDian/App.xaml View File

@@ -0,0 +1,37 @@
<Application
x:Class="BPASmartClient.ZhuoDian.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource"
xmlns:local="clr-namespace:BPASmartClient.ZhuoDian">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecCheckBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/GlobalStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecComboBox.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecIcoButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecToggleButton.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/BeveledRadioButtonStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/DatePickeerDictionary.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecButtonStyle.xaml" />

<ResourceDictionary>
<con:ColorConverter x:Key="ColorConverter" />
<con:TextConverter x:Key="TextConverter" />
<con:VisibleTypeConverter x:Key="VisibleTypeConverter" />
<con:StatusConverter x:Key="StatusConverter" />
<con:StringToIconConverter x:Key="StringToIconConverter" />
</ResourceDictionary>

<ResourceDictionary>
<ImageBrush x:Key="hbl" ImageSource="/BPASmartClient.CustomResource;component/Image/HBL.png" />
<ImageBrush x:Key="dbxt" ImageSource="/BPASmartClient.CustomResource;component/Image/顶部线条.png" />
</ResourceDictionary>

</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

+ 173
- 0
BPASmartClient.ZhuoDian/App.xaml.cs View File

@@ -0,0 +1,173 @@
using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.ZhuoDian
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
MenuInit();
DataInit();

MainView mv = new MainView();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
mv.Show();
else
mv.Close();
}

protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
MessageLog.GetInstance.LogSave();
}

private void MenuInit()
{

#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeSettingsView"
});

RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方下发",
SubMenuPermission = new Permission[] { Permission.操作员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeControlView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",
MainMenuName = "配方管理",
Alias = "Recipe Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员 },
subMenumodels = RecipeManage,
});
#endregion

#region 消息日志
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "操作日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "运行日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.RunLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "报警记录",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.AlarmView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe668;",
MainMenuName = "消息日志",
Alias = "Message Log",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = InfoLog,
});
#endregion

#region 硬件设备监控
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "原料设备列表",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.DeviceListView"
});

DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "设备状态",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.HardwareStatusView"
});


MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe603;",
MainMenuName = "设备监控",
Alias = "Device Monitor",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = DeviceMonitor,
});
#endregion

#region 用户管理
ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
UserManager.Add(new SubMenumodel()
{
SubMenuName = "用户登录",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.LoginView"
});

UserManager.Add(new SubMenumodel()
{
SubMenuName = "密码修改",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.PasswordChangeView"
});


MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe66d;",
MainMenuName = "用户管理",
Alias = "User Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = UserManager,
});
#endregion
}

private void DataInit()
{
Config.GetInstance.Init();
}

}
}

+ 10
- 0
BPASmartClient.ZhuoDian/AssemblyInfo.cs View File

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 23
- 0
BPASmartClient.ZhuoDian/BPASmartClient.ZhuoDian.csproj View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<Folder Include="View\" />
<Folder Include="ViewModel\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
</ItemGroup>

</Project>

+ 1
- 0
DosingSystem/App.xaml View File

@@ -23,6 +23,7 @@
<con:TextConverter x:Key="TextConverter" />
<con:VisibleTypeConverter x:Key="VisibleTypeConverter" />
<con:StatusConverter x:Key="StatusConverter" />
<con:StringToIconConverter x:Key="StringToIconConverter" />
</ResourceDictionary>

<ResourceDictionary>


+ 163
- 4
DosingSystem/App.xaml.cs View File

@@ -1,12 +1,17 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.DosingSystem.Model;
using BPASmartClient.DosingSystem.View;
using BPASmartClient.Helper;

namespace BPASmartClient.DosingSystem
{
@@ -15,15 +20,169 @@ namespace BPASmartClient.DosingSystem
/// </summary>
public partial class App : Application
{
MainWindow mw = new MainWindow();

protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
mw.Show();
MenuInit();
DataInit();

MainView mv = new MainView();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
mv.Show();
else
mv.Close();



//MainWindow mw = new MainWindow();
//LoginView lv = new LoginView();
//var res = lv.ShowDialog();
//if (res != null && res == true) mw.Show();
//if (res != null && res == true)
// mw.Show();
//else
// mw.Close();
}

protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
Json<LocaPar>.Save();
MessageLog.GetInstance.LogSave();
}

private void MenuInit()
{

#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeSettingsView"
});

RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方下发",
SubMenuPermission = new Permission[] { Permission.操作员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeControlView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",
MainMenuName = "配方管理",
Alias = "Recipe Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员 },
subMenumodels = RecipeManage,
});
#endregion

#region 消息日志
ObservableCollection<SubMenumodel> InfoLog = new ObservableCollection<SubMenumodel>();
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "操作日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "运行日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.RunLogView"
});

InfoLog.Add(new SubMenumodel()
{
SubMenuName = "报警记录",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.AlarmView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe668;",
MainMenuName = "消息日志",
Alias = "Message Log",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = InfoLog,
});
#endregion

#region 硬件设备监控
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "原料设备列表",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.DeviceListView"
});

DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "设备状态",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.HardwareStatusView"
});


MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe603;",
MainMenuName = "设备监控",
Alias = "Device Monitor",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = DeviceMonitor,
});
#endregion

#region 用户管理
ObservableCollection<SubMenumodel> UserManager = new ObservableCollection<SubMenumodel>();
UserManager.Add(new SubMenumodel()
{
SubMenuName = "用户登录",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.LoginView"
});

UserManager.Add(new SubMenumodel()
{
SubMenuName = "密码修改",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.PasswordChangeView"
});


MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe66d;",
MainMenuName = "用户管理",
Alias = "User Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
subMenumodels = UserManager,
});
#endregion
}

private void DataInit()
{
Config.GetInstance.Init();
Json<LocaPar>.Read();
}

}
}

+ 2
- 2
DosingSystem/Model/ActionMenu.cs View File

@@ -13,8 +13,8 @@ namespace BPASmartClient.DosingSystem.Model
public string CommandParameter { get { return _mCommandParameter; } set { _mCommandParameter = value; OnPropertyChanged(); } }
private string _mCommandParameter;

public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } }
private Permission[] _mpermission;
//public Permission[] permission { get { return _mpermission; } set { _mpermission = value; OnPropertyChanged(); } }
//private Permission[] _mpermission;

public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } }
private string _mMenuName;


+ 1
- 0
DosingSystem/Model/RecipeModel.cs View File

@@ -15,6 +15,7 @@ namespace BPASmartClient.DosingSystem.Model
/// </summary>
public class RecipeModel : ObservableObject
{
[Newtonsoft.Json.JsonIgnore]
public bool IsEnable { get { return _mIsEnable; } set { _mIsEnable = value; OnPropertyChanged(); } }
private bool _mIsEnable = true;



+ 0
- 30
DosingSystem/Model/UserManager.cs View File

@@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.DosingSystem.Model
{
public class UserManager
{
public List<UserInfo> userInfos { get; set; } = new List<UserInfo>();
}

public class UserInfo
{
public Permission permission { get; set; }
public string UserName { get; set; }
public string Password { get; set; }

}

public enum Permission : int
{
管理员 = 1,
操作员 = 2,
观察员 = 3,
技术员 = 4
}

}

+ 0
- 1
DosingSystem/View/DeviceListView.xaml View File

@@ -101,7 +101,6 @@
Foreground="#00BEFA"
Text="{Binding DeviceName}" />


<StackPanel
Grid.Row="1"
Grid.ColumnSpan="2"


+ 1
- 1
DosingSystem/View/RecipeControlView.xaml View File

@@ -46,7 +46,7 @@

<Grid>

<ScrollViewer>
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Recipes}">
<ItemsControl.ItemTemplate>
<DataTemplate>


+ 64
- 64
DosingSystem/ViewModel/MainViewModel.cs View File

@@ -18,28 +18,28 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public class MainViewModel : ObservableObject
{
ObservableCollection<ActionMenu> menus = new ObservableCollection<ActionMenu>();
private Permission _permission;
public Permission permission
{
get { return _permission; }
set
{
var res = menus.Where(p => Array.FindIndex(p.permission, s => s == value) >= 0).ToList();
if (res != null && res.Count > 0)
{
Menus.Clear();
res.ForEach((item) => { Menus.Add(item); });
}
_permission = value;
}
}
//ObservableCollection<ActionMenu> menus = new ObservableCollection<ActionMenu>();
//private Permission _permission;
//public Permission permission
//{
// get { return _permission; }
// set
// {
// var res = menus.Where(p => Array.FindIndex(p.permission, s => s == value) >= 0).ToList();
// if (res != null && res.Count > 0)
// {
// Menus.Clear();
// res.ForEach((item) => { Menus.Add(item); });
// }
// _permission = value;
// }
//}


public MainViewModel()
{
Json<LocaPar>.Read();
//Json<LocaPar>.Read();
TogglePag = new RelayCommand<object>(DoNavChanged);
Login = new RelayCommand(() => { DoNavChanged("BPASmartClient.DosingSystem.View.AdminstratorsView_用户登录"); UserManagement = false; });
PasswordChange = new RelayCommand(() =>
@@ -53,11 +53,11 @@ namespace BPASmartClient.DosingSystem.ViewModel
//DoNavChanged("LoginView.退出登录");
UserManagement = false;
});
Config.GetInstance.Init();
//Config.GetInstance.Init();
LoginRegister();
MenuInit();
permission = Permission.管理员;
if (Menus.Count > 0) DoNavChanged(Menus.ElementAt(0).CommandParameter);
//permission = Permission.管理员;
//if (Menus.Count > 0) DoNavChanged(Menus.ElementAt(0).CommandParameter);
DeviceInquire.GetInstance.Init();

}
@@ -66,55 +66,55 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
ActionManage.GetInstance.Register(new Func<object, object>((o) =>
{
if (o != null && o is string str)
{
var strs = str.Split("-=");
if (strs != null && strs.Length == 3)
{
var us = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == strs[0]);
if (us != null && strs[1] == us.Password && strs[2] == us.permission.ToString())
{
permission = us.permission;
return string.Empty;
}
}
}
//if (o != null && o is string str)
//{
// var strs = str.Split("-=");
// if (strs != null && strs.Length == 3)
// {
// var us = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == strs[0]);
// if (us != null && strs[1] == us.Password && strs[2] == us.permission.ToString())
// {
// permission = us.permission;
// return string.Empty;
// }
// }
//}
return "用户名或密码错误";
}), "LoginBPASmartClient.DosingSystem");
}

private void MenuInit()
{
menus.Add(new ActionMenu()
{
MenuName = "配方设置",
CommandParameter = "BPASmartClient.DosingSystem.View.RecipeSettingsView_配方设置",
permission = new Permission[] { Permission.管理员, Permission.技术员 },
});
menus.Add(new ActionMenu()
{
MenuName = "设备列表",
CommandParameter = "BPASmartClient.DosingSystem.View.DeviceListView_设备列表",
permission = new Permission[] { Permission.管理员, Permission.技术员 },
});
menus.Add(new ActionMenu()
{
MenuName = "硬件状态",
CommandParameter = "BPASmartClient.DosingSystem.View.HardwareStatusView_硬件状态",
permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
});
menus.Add(new ActionMenu()
{
MenuName = "报警记录",
CommandParameter = "BPASmartClient.CustomResource.Pages.View.AlarmView_报警记录",
permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
});
menus.Add(new ActionMenu()
{
MenuName = "配方下发",
CommandParameter = "BPASmartClient.DosingSystem.View.RecipeControlView_配方控制",
permission = new Permission[] { Permission.管理员, Permission.操作员 },
});
//menus.Add(new ActionMenu()
//{
// MenuName = "配方设置",
// CommandParameter = "BPASmartClient.DosingSystem.View.RecipeSettingsView_配方设置",
// permission = new Permission[] { Permission.管理员, Permission.技术员 },
//});
//menus.Add(new ActionMenu()
//{
// MenuName = "设备列表",
// CommandParameter = "BPASmartClient.DosingSystem.View.DeviceListView_设备列表",
// permission = new Permission[] { Permission.管理员, Permission.技术员 },
//});
//menus.Add(new ActionMenu()
//{
// MenuName = "硬件状态",
// CommandParameter = "BPASmartClient.DosingSystem.View.HardwareStatusView_硬件状态",
// permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
//});
//menus.Add(new ActionMenu()
//{
// MenuName = "报警记录",
// CommandParameter = "BPASmartClient.CustomResource.Pages.View.AlarmView_报警记录",
// permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
//});
//menus.Add(new ActionMenu()
//{
// MenuName = "配方下发",
// CommandParameter = "BPASmartClient.DosingSystem.View.RecipeControlView_配方控制",
// permission = new Permission[] { Permission.管理员, Permission.操作员 },
//});
}

public void DoNavChanged(object obj)


+ 2
- 0
DosingSystem/ViewModel/RecipeControlViewModel.cs View File

@@ -11,6 +11,7 @@ using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.DosingSystem.Model;
using System.Threading;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.DosingSystem.ViewModel
{
@@ -37,6 +38,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
//}
}
//}));
MessageLog.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}");
devices.Enqueue(deviceName);
}
});


+ 24
- 1
SmartClient.sln View File

@@ -100,7 +100,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTJuicer"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.AGV", "BPASmartClient.AGV\BPASmartClient.AGV.csproj", "{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkT_Show", "BPASmartClient.MorkT_Show\BPASmartClient.MorkT_Show.csproj", "{3653724D-3683-4722-B978-EB88DD4AE5DB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_Show", "BPASmartClient.MorkT_Show\BPASmartClient.MorkT_Show.csproj", "{3653724D-3683-4722-B978-EB88DD4AE5DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.ZhuoDian", "BPASmartClient.ZhuoDian\BPASmartClient.ZhuoDian.csproj", "{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -936,6 +938,26 @@ Global
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x64.Build.0 = Release|Any CPU
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x86.ActiveCfg = Release|Any CPU
{3653724D-3683-4722-B978-EB88DD4AE5DB}.Release|x86.Build.0 = Release|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Debug|ARM.Build.0 = Debug|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Debug|ARM64.Build.0 = Debug|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Debug|x64.ActiveCfg = Debug|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Debug|x64.Build.0 = Debug|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Debug|x86.ActiveCfg = Debug|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Debug|x86.Build.0 = Debug|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|Any CPU.Build.0 = Release|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|ARM.ActiveCfg = Release|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|ARM.Build.0 = Release|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|ARM64.ActiveCfg = Release|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|ARM64.Build.0 = Release|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|x64.ActiveCfg = Release|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|x64.Build.0 = Release|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|x86.ActiveCfg = Release|Any CPU
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -982,6 +1004,7 @@ Global
{724087A3-E7E7-4494-B844-414FF5CD1D40} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{3653724D-3683-4722-B978-EB88DD4AE5DB} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{C5D53928-34F6-4FA0-A8E6-261BAC1A659C} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


Loading…
Cancel
Save