From 5b96646f0d9cb3ba51a8511a6d0cf7ca8d2abb03 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com>
Date: Sat, 16 Jul 2022 22:01:51 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BPASmartClient.CustomResource.csproj | 1 +
.../Converters/ToastIconConverter.cs | 76 +++
.../Fonts/iconfont.ttf | Bin 7104 -> 7568 bytes
.../Pages/Model/TextToImage.cs | 27 +
.../Pages/View/LoginView.xaml.cs | 3 +-
.../Pages/View/MainView.xaml.cs | 1 +
.../Themes/Generic.xaml | 2 +-
.../Themes/MyStyle.xaml | 195 ++++---
.../UserControls/Bottle.xaml | 50 +-
.../UserControls/Bottle.xaml.cs | 40 +-
.../UserControls/DosingSystem.xaml | 2 +-
.../UserControls/Enum/ToastIcons.cs | 17 +
.../UserControls/Enum/ToastLocation.cs | 31 ++
.../UserControls/IcoButton.cs | 54 +-
.../UserControls/Model/ToastOptions.cs | 39 ++
.../UserControls/MotorBottle.xaml | 54 +-
.../UserControls/MotorBottle.xaml.cs | 41 ++
.../UserControls/Toast.xaml | 68 +++
.../UserControls/Toast.xaml.cs | 480 ++++++++++++++++++
BPASmartClient/App.config | 8 +-
DosingSystem/App.xaml.cs | 5 +-
DosingSystem/Model/DeviceCurrentStatus.cs | 27 +
DosingSystem/View/DeviceListView.xaml | 8 +
DosingSystem/View/HardwareStatusView.xaml | 92 +++-
DosingSystem/View/NewRecipeView.xaml | 6 +-
DosingSystem/View/RecipeControlView.xaml | 83 ++-
DosingSystem/View/RecipeSettingsView.xaml | 162 +++++-
DosingSystem/View/RecipeSettingsView.xaml.cs | 20 +
.../ViewModel/HardwareStatusViewModel.cs | 16 +
DosingSystem/ViewModel/NewRecipeViewModel.cs | 26 +-
.../ViewModel/RecipeControlViewModel.cs | 4 +-
.../ViewModel/RecipeSettingsViewModel.cs | 17 +-
SmartClient.sln | 1 +
33 files changed, 1466 insertions(+), 190 deletions(-)
create mode 100644 BPASmartClient.CustomResource/Converters/ToastIconConverter.cs
create mode 100644 BPASmartClient.CustomResource/Pages/Model/TextToImage.cs
create mode 100644 BPASmartClient.CustomResource/UserControls/Enum/ToastIcons.cs
create mode 100644 BPASmartClient.CustomResource/UserControls/Enum/ToastLocation.cs
create mode 100644 BPASmartClient.CustomResource/UserControls/Model/ToastOptions.cs
create mode 100644 BPASmartClient.CustomResource/UserControls/Toast.xaml
create mode 100644 BPASmartClient.CustomResource/UserControls/Toast.xaml.cs
create mode 100644 DosingSystem/Model/DeviceCurrentStatus.cs
diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
index 2cc9110e..931bb4fa 100644
--- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
+++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
@@ -292,6 +292,7 @@
+
diff --git a/BPASmartClient.CustomResource/Converters/ToastIconConverter.cs b/BPASmartClient.CustomResource/Converters/ToastIconConverter.cs
new file mode 100644
index 00000000..53a665ab
--- /dev/null
+++ b/BPASmartClient.CustomResource/Converters/ToastIconConverter.cs
@@ -0,0 +1,76 @@
+using BPASmartClient.CustomResource.UserControls.Enum;
+using MahApps.Metro.IconPacks;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+
+namespace BPASmartClient.CustomResource.Converters
+{
+ public class ToastIconConverter : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ object value = values[0];
+ object grid = values[1];
+ object txt = values[2];
+ Grid _grid = grid as Grid;
+ TextBlock _txt = txt as TextBlock;
+
+ void WithoutIcon()
+ {
+ if (_grid != null)
+ {
+ _grid.ColumnDefinitions.RemoveAt(0);
+ }
+
+ if (_txt != null)
+ {
+ _txt.HorizontalAlignment = HorizontalAlignment.Center;
+ }
+ }
+
+ if (value == null)
+ {
+ WithoutIcon();
+ return PackIconFontAwesomeKind.None;
+ }
+
+ ToastIcons _value;
+ try
+ {
+ _value = (ToastIcons)value;
+ }
+ catch
+ {
+ WithoutIcon();
+ return PackIconFontAwesomeKind.None;
+ }
+
+ switch (_value)
+ {
+ case ToastIcons.Information:
+ return PackIconFontAwesomeKind.CheckCircleSolid;
+ case ToastIcons.Error:
+ return PackIconFontAwesomeKind.TimesSolid;
+ case ToastIcons.Warning:
+ return PackIconFontAwesomeKind.ExclamationSolid;
+ case ToastIcons.Busy:
+ return PackIconFontAwesomeKind.ClockSolid;
+ }
+
+ WithoutIcon();
+ return PackIconFontAwesomeKind.None;
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Fonts/iconfont.ttf b/BPASmartClient.CustomResource/Fonts/iconfont.ttf
index cfd9141e198fc70d1d6e98a13fa4c733de2a5db9..9dabe1930020202f3d7714694f21b8829b3df336 100644
GIT binary patch
delta 1250
zcmaiyU1%It6vxlKcRqGDGx^xrOp=ND*iE`kYFd}Lo!yWn#wS4xDij~o)=rz6jbxL6
zdB|GmB86S-Ly0U({dkb3(T75jh{w0T|^&VQJ-fIP*sCOZxv6nO_XoS6P}pO27BgdU!c3p6J}n
zUk2#APBj-+S6+A4rjJ~E8Q_s&N?LjQ=ExI1Fv=zJ*V*PP9r-_?O`{EfpYDJ9-rsYx
z**v9zc$3x<;BuE9`9FVqkPWliE{oJ=c%nSo+5|QTq7_Zh9Hr8upuz8yJ^{lN*(lIP
z7gM+o_hW!lIEROE9t&8+5}wAhcoA>yoV>epFOXsp9%hgKUv}+#K3=Oc?Kq=KlMmkv
z{P!y*S)hYUy?W3AePBbJM8=>8I-v`?!K9uIa7YP*UTA}M(r(m3@u2n_H_LX*i@Y4^
z>685`=v+WDNkSC>$v6qs0u&0WO6n9;A5g9d>I5*Qpq>E76|M94QA|*ufcwjGphcYK
zKp}4krxYXua85yj01qoj8sNNwL;@BRBp0x#AmM-|1z7-iT0v$2o>f5Eq2QuI-ZkD*
z$otvS)~{dkS8lYpK1}GgLO?#z-QW$^?%mCcW-|FN9}w
zXpiv&Y=(P7>|iFC^afZq@I-Ip_E;`A#?v%LT&Ho{ab1U}9rvAB`|h9Zu~<7Z<@isW
zw^;OfBN8>uL#D3Ton6MD>$_gGUzBHaV~yF?arLp>gFCIG>T-ORj_7yYb86bX5%sO7
zbmPNkmw&W)xEpPrT-W3Dn*#IPgzK1=Dq!IT>SCC1$ds9i183Qct
zO|!`?3o>lvAnVCKvp3r#!rkXA+qT$c%W?KxFuTmgmSJ04mcd^#8r3R0Um2`asvUOB
zabh+5=l!N!X_jk2x_IM)&f&_niChobTM#^KZ_rX3EE|
zK1>7F7+??27D_XhqCfV5wsjyj=1=GHsqHT}0Bn)0&xPVVy}PI2yFSPu?1dGrKQv|O>JQ{vJm12QNhGAc64$XwKF5D$|-Tl-~
W?X^PqW4B6FFD5ezwR=fNDf|U^OT-rd
diff --git a/BPASmartClient.CustomResource/Pages/Model/TextToImage.cs b/BPASmartClient.CustomResource/Pages/Model/TextToImage.cs
new file mode 100644
index 00000000..8a68c256
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/TextToImage.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ internal class TextToImage
+ {
+ public Image CreateTextImage(string text, Font font, Color backgroundColor, Color foreColor, int margin = 5, RotateFlipType rotate = RotateFlipType.RotateNoneFlipNone)
+ {
+ SizeF sizeF = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(text, font);
+ Bitmap bitmap = new Bitmap((int)sizeF.Width + margin * 2, (int)sizeF.Height + margin * 2);
+ Graphics g = Graphics.FromImage(bitmap);
+ g = Graphics.FromImage(bitmap);
+ g.SmoothingMode = SmoothingMode.HighQuality;
+ g.FillRegion(new SolidBrush(backgroundColor), g.Clip);
+ g.DrawString(text, font, new SolidBrush(foreColor), margin, margin);
+ g.Dispose();
+ bitmap.RotateFlip(rotate);
+ return bitmap;
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
index 7e6147e7..e98b6cf0 100644
--- a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
+++ b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
@@ -27,7 +27,7 @@ namespace BPASmartClient.CustomResource.Pages.View
{
InitializeComponent();
grid.Visibility = Visibility.Collapsed;
- Username.Focus();
+
Username.SelectionStart = Username.Text.Trim().Length;
this.Loaded += LoginView_Loaded;
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk", true);
@@ -52,6 +52,7 @@ namespace BPASmartClient.CustomResource.Pages.View
private void Player_MediaOpened(object sender, RoutedEventArgs e)
{
grid.Visibility = Visibility.Visible;
+ Username.Focus();
}
private void media_Loaded(object sender, RoutedEventArgs e)
diff --git a/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
index f47c3783..3e516b5e 100644
--- a/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
+++ b/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
@@ -39,5 +39,6 @@ namespace BPASmartClient.CustomResource.Pages.View
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
}
+
}
}
diff --git a/BPASmartClient.CustomResource/Themes/Generic.xaml b/BPASmartClient.CustomResource/Themes/Generic.xaml
index 4bbc2757..edf01d18 100644
--- a/BPASmartClient.CustomResource/Themes/Generic.xaml
+++ b/BPASmartClient.CustomResource/Themes/Generic.xaml
@@ -8,7 +8,7 @@
-
+
-
+
@@ -184,10 +184,10 @@
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
-
-
-