冰箱设置根据配置文件显示
This commit is contained in:
parent
6fd35e569f
commit
17a6ddd0da
|
@ -59,7 +59,7 @@
|
|||
<add key="ScanCodePortPath" value="COM8" />
|
||||
|
||||
|
||||
<!--是否有冰箱抽屉0无1有-->
|
||||
<!--是否有冰箱抽屉0无,1有一个,2两个-->
|
||||
<add key="hasFridge" value="1"/>
|
||||
<!-- 冰箱的串口号 -->
|
||||
<add key="FridgePortPath" value="COM7" />
|
||||
|
|
|
@ -233,8 +233,10 @@ namespace DM_Weight
|
|||
containerRegistry.RegisterForNavigation<DebugWindow, DebugWindowViewModel>();
|
||||
//主设置页面
|
||||
containerRegistry.RegisterForNavigation<SettingMainWindow, SettingMainWindowViewModel>();
|
||||
//冰箱抽屉设置页面
|
||||
//两个冰箱抽屉设置页面
|
||||
containerRegistry.RegisterForNavigation<FridgeWindow, FridgeWindowViewModel>();
|
||||
//只有一个冰箱抽屉设置页面
|
||||
containerRegistry.RegisterForNavigation<FridgeOnlyWindow, FridgeOnlyWindowViewModel>();
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ using PreviewDemo;
|
|||
using System.Runtime.InteropServices;
|
||||
using DM_Weight.Common;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace DM_Weight.Port
|
||||
{
|
||||
|
@ -963,6 +964,37 @@ namespace DM_Weight.Port
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region 药盒操作
|
||||
/// <summary>
|
||||
/// 打开药盒
|
||||
/// </summary>
|
||||
/// <param name="ColNo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task OpenBox(int ColNo)
|
||||
{
|
||||
var vlock = 321;
|
||||
decimal decolNO = (decimal)ColNo;
|
||||
var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(decolNO % 3)).ToString(), 16);
|
||||
byte[] buffer = new byte[] { 0xaa, (byte)channel, 5,(byte)vlock, 0x00,0x00,0x00,0xee};
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(20));
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询药盒状态
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<byte[]> GetBoxLockState(int ColNo)
|
||||
{
|
||||
decimal deColNo = (decimal)ColNo;
|
||||
var channel = Convert.ToInt32((DrawerNo * 10 + Math.Ceiling(deColNo / 3)).ToString(), 16);
|
||||
byte[] buffer = new byte[] {0xaa,(byte)channel,2,0,0,0,0,0xee };
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
return await GetBufferByPort(canBusSerial, 8);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private string trim(string text)
|
||||
{
|
||||
//此处使用了转义字符如:\',\",\\,分别表示单引号,双引号,反斜杠
|
||||
|
@ -1095,6 +1127,18 @@ namespace DM_Weight.Port
|
|||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 标签显示屏
|
||||
//清屏
|
||||
public void ClearContentMethod(int drawerNo,int colNo)
|
||||
{
|
||||
decimal deColNo = colNo;
|
||||
var channel = drawerNo * 10 + Math.Ceiling(deColNo / 3);
|
||||
var colNo2 = 321;
|
||||
byte[] buffer = new byte[] { 0xaa };
|
||||
canBusSerial.Write(buffer, 0, 8);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 回收箱操作
|
||||
|
@ -1314,6 +1358,7 @@ namespace DM_Weight.Port
|
|||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 冰箱使能
|
||||
/// </summary>
|
||||
|
@ -1693,8 +1738,7 @@ namespace DM_Weight.Port
|
|||
}
|
||||
//FridgeOperate = false;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,224 @@
|
|||
using DM_Weight.Common;
|
||||
using DM_Weight.msg;
|
||||
using DM_Weight.Port;
|
||||
using DM_Weight.util;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
public class FridgeOnlyWindowViewModel : BindableBase, IRegionMemberLifetime, INavigationAware
|
||||
{
|
||||
//温度区间
|
||||
private string _temperatureRange = CommonClass.ReadAppSetting("temperatureRange").ToString();
|
||||
public string TemperatureRange
|
||||
{
|
||||
get => _temperatureRange;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _temperatureRange, value);
|
||||
//更新配置文件中冰箱温度区间
|
||||
CommonClass.SaveAppSetting("temperatureRange", _temperatureRange);
|
||||
}
|
||||
}
|
||||
private float defaultValue = Convert.ToSingle(CommonClass.ReadAppSetting("temperatureValue"));
|
||||
//温度值
|
||||
private float _temperatureValue = Convert.ToSingle(CommonClass.ReadAppSetting("temperatureValue"));
|
||||
public float TemperatureValue
|
||||
{
|
||||
get => _temperatureValue;
|
||||
set => SetProperty(ref _temperatureValue, value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据冰箱温度控制保存按钮是否可点击
|
||||
/// </summary>
|
||||
private bool _isInvalid;
|
||||
public bool IsInvalid
|
||||
{
|
||||
get => _isInvalid;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _isInvalid, value);
|
||||
BtnIsEnable = !IsInvalid;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据冰箱温度控制保存按钮是否可用
|
||||
/// </summary>
|
||||
private bool _btnIsEnable = true;
|
||||
public bool BtnIsEnable
|
||||
{
|
||||
get => _btnIsEnable;
|
||||
set => SetProperty(ref _btnIsEnable, value);
|
||||
}
|
||||
//冰箱状态:true关;false开
|
||||
private bool _fridgeState;
|
||||
public bool FridgeState
|
||||
{
|
||||
get => _fridgeState;
|
||||
set => SetProperty(ref _fridgeState, value);
|
||||
}
|
||||
//报警状态:true关;false开
|
||||
private bool _alarmState;
|
||||
public bool AlarmState
|
||||
{
|
||||
get => _alarmState;
|
||||
set => SetProperty(ref _alarmState, value);
|
||||
}
|
||||
|
||||
private int _defaultLoginMode;//1开0关
|
||||
|
||||
private int _defaultAlarmMode;//1开0关
|
||||
|
||||
private float retTemperature = Convert.ToSingle(ConfigurationManager.AppSettings["temperatureValue"]);
|
||||
|
||||
private PortUtil _portUtil;
|
||||
IEventAggregator _eventAggregator;
|
||||
public FridgeOnlyWindowViewModel(PortUtil portUtil, IEventAggregator eventAggregator)
|
||||
{
|
||||
_portUtil = portUtil;
|
||||
_eventAggregator = eventAggregator;
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存按钮
|
||||
/// </summary>
|
||||
public DelegateCommand SaveCommand { get => new DelegateCommand(SaveAction, () => !IsInvalid); }
|
||||
|
||||
public bool KeepAlive => false;
|
||||
|
||||
private async void SaveAction()
|
||||
{
|
||||
try
|
||||
{
|
||||
_portUtil.FridgeOperate = true;
|
||||
|
||||
//设置温度值验证不通过则直接返回不保存
|
||||
//获取冰箱温度
|
||||
//if (_fridgeState != _defaultLoginMode.Equals(1))
|
||||
//{
|
||||
// ConfigurationManager.RefreshSection("FridgeState");
|
||||
//发送冰箱使能/失能指令
|
||||
if (_fridgeState)
|
||||
{
|
||||
await _portUtil.FridgeOff(1);
|
||||
Thread.Sleep(100);
|
||||
CommonClass.SaveAppSetting("FridgeState", "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
await _portUtil.FridegOpen(1);
|
||||
Thread.Sleep(100);
|
||||
CommonClass.SaveAppSetting("FridgeState", "1");
|
||||
}
|
||||
//发送警报使能/失能指令
|
||||
if (_alarmState)
|
||||
{
|
||||
await _portUtil.FridgeAlarmOff(1);
|
||||
Thread.Sleep(100);
|
||||
CommonClass.SaveAppSetting("AlarmState", "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
await _portUtil.FridgeAlarmOn(1);
|
||||
Thread.Sleep(100);
|
||||
CommonClass.SaveAppSetting("AlarmState", "1");
|
||||
}
|
||||
//设定冰箱1温度区间
|
||||
string[] range = ConfigurationManager.AppSettings["temperatureRange"].Split('-');
|
||||
string[] newRange = TemperatureRange.Split('-');
|
||||
if (range.Length >= 2)
|
||||
{
|
||||
bool bMix = float.TryParse(range[0], out float Min);
|
||||
bool bMax = float.TryParse(range[1], out float Max);
|
||||
|
||||
if (bMix && bMax)
|
||||
{
|
||||
if (Min != Convert.ToSingle(newRange[0]))
|
||||
{
|
||||
//设定冰箱温度最小值
|
||||
await _portUtil.FridgeMinSetting(Convert.ToSingle(newRange[0]), 1);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
if (Max != Convert.ToSingle(newRange[1]))
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
//设定冰箱温度最大值
|
||||
await _portUtil.FridgeMaxSetting(Convert.ToSingle(newRange[1]), 1);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_portUtil.FridgeOperate = false;
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = $"保存成功",
|
||||
Type = MsgType.SUCCESS
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
AlertMsg alertMsg = new AlertMsg
|
||||
{
|
||||
Message = $"保存异常{ex.ToString}",
|
||||
Type = MsgType.ERROR
|
||||
};
|
||||
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
||||
_portUtil.FridgeOperate = false;
|
||||
}
|
||||
}
|
||||
//手动实现调用配置的逻辑 规避修改配置文件后不起作用的问题
|
||||
public int ReadAppSetting(string key)
|
||||
{
|
||||
string xPath = "/configuration/appSettings//add[@key='" + key + "']";
|
||||
XmlDocument doc = new XmlDocument();
|
||||
string exeFileName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
|
||||
doc.Load(exeFileName + ".dll.config");
|
||||
XmlNode node = doc.SelectSingleNode(xPath);
|
||||
return Convert.ToInt32(node.Attributes["value"].Value);
|
||||
}
|
||||
|
||||
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
_fridgeState = ReadAppSetting("FridgeState").Equals(0);
|
||||
_defaultLoginMode = ReadAppSetting("FridgeState");
|
||||
_defaultAlarmMode = ReadAppSetting("AlarmState");
|
||||
_alarmState = ReadAppSetting("AlarmState").Equals(0);
|
||||
|
||||
GetTemperature();
|
||||
}
|
||||
|
||||
public bool IsNavigationTarget(NavigationContext navigationContext)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnNavigatedFrom(NavigationContext navigationContext)
|
||||
{
|
||||
|
||||
}
|
||||
//获取冰箱温度值,如有更改则保存更改
|
||||
private async Task GetTemperature()
|
||||
{
|
||||
|
||||
//float retT = await _portUtil.GetFridgeTemperature();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,8 +34,8 @@ namespace DM_Weight.ViewModels
|
|||
private readonly IDialogService _dialogService;
|
||||
private UserList? _userList;
|
||||
private UserList? _userList2;
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 冰箱温度
|
||||
/// </summary>
|
||||
|
@ -46,8 +46,8 @@ namespace DM_Weight.ViewModels
|
|||
/// <summary>
|
||||
/// 是否有冰箱抽屉
|
||||
/// </summary>
|
||||
private string hasFridge= ConfigurationManager.AppSettings["hasFridge"].ToString().Equals("1")? "Visible" : "Collapsed";
|
||||
public string HasFridge { get => hasFridge; set => SetProperty(ref hasFridge,value); }
|
||||
private string hasFridge = ConfigurationManager.AppSettings["hasFridge"].ToString().Equals("1") ? "Visible" : "Collapsed";
|
||||
public string HasFridge { get => hasFridge; set => SetProperty(ref hasFridge, value); }
|
||||
|
||||
private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
|
||||
public bool MultiLogin
|
||||
|
@ -128,6 +128,17 @@ namespace DM_Weight.ViewModels
|
|||
_regionManager.RequestNavigate("ContentRegion", "ReturnDrugWindow");
|
||||
}
|
||||
}
|
||||
else if (value.PremissionPath.Equals("SettingMainWindow") || value.PremissionPath.Equals("SettingWindow"))
|
||||
{
|
||||
if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"])>0)
|
||||
{
|
||||
_regionManager.RequestNavigate("ContentRegion", "SettingMainWindow");
|
||||
}
|
||||
else
|
||||
{
|
||||
_regionManager.RequestNavigate("ContentRegion", "SettingWindow");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_regionManager.RequestNavigate("ContentRegion", value.PremissionPath);
|
||||
|
@ -298,11 +309,15 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
string retStr = string.Empty;
|
||||
byte[] data = null;
|
||||
float retT = await _portUtil.GetFridgeTemperature(1);
|
||||
float retT = await _portUtil.GetFridgeTemperature(1);
|
||||
Thread.Sleep(80);
|
||||
float retTemp = await _portUtil.GetFridgeTemperature(2);
|
||||
Thread.Sleep(80);
|
||||
WD = $"恒温冷藏抽屉当前温度:{Math.Round((retT - 1.5), 2)}℃;{retTemp}℃";
|
||||
WD = $"恒温冷藏抽屉当前温度:{Math.Round((retT - 1.5), 2)}℃;";
|
||||
if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"]) > 1)
|
||||
{
|
||||
float retTemp = await _portUtil.GetFridgeTemperature(2);
|
||||
Thread.Sleep(80);
|
||||
WD += $"{retTemp}℃";
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -443,7 +458,7 @@ namespace DM_Weight.ViewModels
|
|||
{
|
||||
|
||||
//指定时间内无人操作鼠标键盘则停止录像
|
||||
if (!_portUtil.Operate && CheckComputerFreeState.GetLastInputTime() > stopRecord)
|
||||
if (!_portUtil.Operate && CheckComputerFreeState.GetLastInputTime() > stopRecord)
|
||||
{
|
||||
_chkFunction.HIKStopDVRRecord();
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ namespace DM_Weight.ViewModels
|
|||
Id = 27,
|
||||
PremissionName = "请领列表",
|
||||
PremissionPath = "ApplyListWindow",
|
||||
};
|
||||
};
|
||||
PremissionDm jiayao8 = new PremissionDm
|
||||
{
|
||||
Id = 28,
|
||||
|
@ -354,7 +354,7 @@ namespace DM_Weight.ViewModels
|
|||
Id = 44,
|
||||
PremissionName = "药品列表",
|
||||
PremissionPath = "DrugListWindow",
|
||||
};
|
||||
};
|
||||
PremissionDm kuguan5 = new PremissionDm
|
||||
{
|
||||
Id = 45,
|
||||
|
@ -396,18 +396,27 @@ namespace DM_Weight.ViewModels
|
|||
PremissionName = "角色管理",
|
||||
PremissionPath = "RoleManagerWindow",
|
||||
};
|
||||
//PremissionDm sysset3 = new PremissionDm
|
||||
//{
|
||||
// Id = 53,
|
||||
// PremissionName = "设置",
|
||||
// PremissionPath = "SettingWindow",
|
||||
//};
|
||||
PremissionDm sysset3 = new PremissionDm
|
||||
PremissionDm sysset3;
|
||||
if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"]) > 0)
|
||||
{
|
||||
Id = 53,
|
||||
PremissionName = "设置",
|
||||
PremissionPath = "SettingMainWindow",
|
||||
};
|
||||
//有冰箱,需要冰箱设置(两个冰箱)
|
||||
sysset3 = new PremissionDm
|
||||
{
|
||||
Id = 53,
|
||||
PremissionName = "设置",
|
||||
PremissionPath = "SettingMainWindow",
|
||||
};
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sysset3 = new PremissionDm
|
||||
{
|
||||
Id = 53,
|
||||
PremissionName = "设置",
|
||||
PremissionPath = "SettingWindow",
|
||||
};
|
||||
}
|
||||
syssetChild.Add(sysset1);
|
||||
syssetChild.Add(sysset2);
|
||||
syssetChild.Add(sysset3);
|
||||
|
|
|
@ -8,20 +8,21 @@ using Prism.Regions;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DM_Weight.ViewModels
|
||||
{
|
||||
public class SettingMainWindowViewModel : BindableBase, INavigationAware,IRegionMemberLifetime
|
||||
public class SettingMainWindowViewModel : BindableBase, INavigationAware, IRegionMemberLifetime
|
||||
{
|
||||
//设置页面数据集
|
||||
private ObservableCollection<SettingPage> _settingPages;
|
||||
public ObservableCollection<SettingPage> SettingPages
|
||||
{
|
||||
get => _settingPages;
|
||||
set=>SetProperty(ref _settingPages, value);
|
||||
set => SetProperty(ref _settingPages, value);
|
||||
}
|
||||
//默认加载页面
|
||||
string defaultView = string.Empty;
|
||||
|
@ -30,7 +31,7 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
public SettingMainWindowViewModel(IRegionManager regionManager)
|
||||
{
|
||||
this._regionManager=regionManager;
|
||||
this._regionManager = regionManager;
|
||||
}
|
||||
//选中事件
|
||||
public DelegateCommand<string> NavigateCommand { get => new DelegateCommand<string>(navigateAction); }
|
||||
|
@ -39,7 +40,7 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
private void navigateAction(string obj)
|
||||
{
|
||||
if(obj==null||string.IsNullOrWhiteSpace(obj))
|
||||
if (obj == null || string.IsNullOrWhiteSpace(obj))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -57,16 +58,23 @@ namespace DM_Weight.ViewModels
|
|||
|
||||
public void OnNavigatedTo(NavigationContext navigationContext)
|
||||
{
|
||||
if(SettingPages is null|| SettingPages.Count<=0)
|
||||
if (SettingPages is null || SettingPages.Count <= 0)
|
||||
{
|
||||
SettingPages=new ObservableCollection<SettingPage>(SqlSugarHelper.Db.Queryable<SettingPage>().ToList());
|
||||
if(SettingPages.Count>0)
|
||||
if (Convert.ToInt32(ConfigurationManager.AppSettings["hasFridge"]) <= 1)
|
||||
{
|
||||
if(string.IsNullOrEmpty(defaultView))
|
||||
SettingPages = new ObservableCollection<SettingPage>(SqlSugarHelper.Db.Queryable<SettingPage>().Where(p=>p.Id!="2").ToList());
|
||||
}
|
||||
else
|
||||
{
|
||||
SettingPages = new ObservableCollection<SettingPage>(SqlSugarHelper.Db.Queryable<SettingPage>().Where(p => p.Id != "3").ToList());
|
||||
}
|
||||
if (SettingPages.Count > 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(defaultView))
|
||||
{
|
||||
defaultView = SettingPages[0].ViewName;
|
||||
}
|
||||
_regionManager.RequestNavigate(PrismManager.SettingViewRegionName,defaultView);
|
||||
_regionManager.RequestNavigate(PrismManager.SettingViewRegionName, defaultView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<UserControl x:Class="DM_Weight.Views.FridgeOnlyWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:DM_Weight.Views"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:rules="clr-namespace:DM_Weight.Common"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:behavior="clr-namespace:DM_Weight.Commons.ValidatRules;assembly=DM_Weight.Commons"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<i:Interaction.Behaviors>
|
||||
<behavior:ValidationErrorMappingBehavior HasValidationError="{Binding IsInvalid, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</i:Interaction.Behaviors>
|
||||
<Grid Width="400">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="1.2*"/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="2*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Margin="6 0 0 0" Text="冰箱温度区间:" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" />
|
||||
<TextBox Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
materialDesign:HintAssist.Hint="温度区间2-8度以-分隔"
|
||||
Margin="6 0 0 10"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}">
|
||||
<TextBox.Text>
|
||||
<Binding Path="TemperatureRange" Delay="1000" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True">
|
||||
<Binding.ValidationRules>
|
||||
<rules:TemperatureRangeRule/>
|
||||
</Binding.ValidationRules>
|
||||
</Binding>
|
||||
</TextBox.Text>
|
||||
</TextBox>
|
||||
<TextBlock Text="冰箱状态:" Margin="0 18 0 0" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" />
|
||||
<ToggleButton Grid.Row="2" Grid.Column="1" Width="38" Height="38" Margin="6 18 0 0"
|
||||
HorizontalAlignment="Left"
|
||||
x:Name="MaterialDesignFilledTextBoxEnabledComboBox"
|
||||
Style="{StaticResource MaterialDesignActionToggleButton}"
|
||||
IsChecked="{Binding FridgeState}"
|
||||
ToolTip="冰箱状态"
|
||||
Content="打开"
|
||||
materialDesign:ToggleButtonAssist.OnContent="关闭" />
|
||||
<TextBlock Text="报警状态:" Margin="0 18 0 0" Grid.Row="3" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" />
|
||||
<ToggleButton Grid.Row="3" Grid.Column="1" Width="38" Height="38" Margin="6 18 0 0"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource MaterialDesignActionToggleButton}"
|
||||
IsChecked="{Binding AlarmState}"
|
||||
ToolTip="报警状态"
|
||||
Content="打开"
|
||||
materialDesign:ToggleButtonAssist.OnContent="关闭" />
|
||||
|
||||
<Button Grid.Row="4" Grid.ColumnSpan="2" Content="保存" Command="{Binding SaveCommand}" IsEnabled="{Binding BtnIsEnable}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
@ -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 DM_Weight.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// FridgeOnlyWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class FridgeOnlyWindow : UserControl
|
||||
{
|
||||
public FridgeOnlyWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue