播报信息页面逻辑
This commit is contained in:
commit
9bcffdc6df
9 files changed
+105
-46
No files matched your search
Generated
+9
@@ -1698,6 +1698,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Pequest 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Pequest {
|
||||
get {
|
||||
return ResourceManager.GetString("Pequest", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Permit 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -1068,4 +1068,7 @@
|
||||
<data name="Vol" xml:space="preserve">
|
||||
<value>Vol</value>
|
||||
</data>
|
||||
<data name="Pequest" xml:space="preserve">
|
||||
<value>Pequest</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1068,4 +1068,7 @@
|
||||
<data name="Vol" xml:space="preserve">
|
||||
<value>Vol</value>
|
||||
</data>
|
||||
<data name="Pequest" xml:space="preserve">
|
||||
<value>Pequest</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1068,4 +1068,7 @@
|
||||
<data name="Vol" xml:space="preserve">
|
||||
<value>音量</value>
|
||||
</data>
|
||||
<data name="Pequest" xml:space="preserve">
|
||||
<value>请求</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1068,4 +1068,7 @@
|
||||
<data name="Vol" xml:space="preserve">
|
||||
<value>音量</value>
|
||||
</data>
|
||||
<data name="Pequest" xml:space="preserve">
|
||||
<value />
|
||||
</data>
|
||||
</root>
|
||||
@@ -70,7 +70,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
DATA_view();
|
||||
|
||||
UserInformation userInformation = new UserInformation();
|
||||
userInformation.Topmost = true;
|
||||
userInformation.Show();
|
||||
userInformation.Activate();
|
||||
}
|
||||
|
||||
private string machine;
|
||||
|
||||
@@ -71,12 +71,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
||||
public static DataTable Machines = new DataTable(); //设备表缓存
|
||||
public static DataTable InfData = new DataTable();
|
||||
// public static DataRow MachinesROW;
|
||||
public static DataTable USER_data = new DataTable();
|
||||
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
|
||||
public static int ERR_c = 0;//错误计数器
|
||||
public static bool[] USER_Capacity { set; get; } = new bool[99];
|
||||
// private SpeechSynthesizer synth = new SpeechSynthesizer();//语音
|
||||
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
@@ -90,10 +90,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
SN_ID = Configini.IniReadvalue("SN", "SN2");
|
||||
SN_KEY = Configini.IniReadvalue("SN", "SN1");
|
||||
DyelotsDispenser = Convert.ToBoolean(Configini.IniReadvalue("SYS", "DyelotsDispenser"));
|
||||
|
||||
// synth.Rate = int.Parse( Configini.IniReadvalue("VOICE", "V1"));
|
||||
// synth.Volume = int.Parse( Configini.IniReadvalue("VOICE", "V2"));
|
||||
|
||||
}
|
||||
catch (Exception ex) { LogGing.ERRDATA(ex); }
|
||||
|
||||
@@ -103,13 +99,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
USER_data = SQLiteHelpers.ExecuteDataSet("select * from USER order by Name desc", null).Tables[0];
|
||||
SQLiteHelpers.Close();
|
||||
|
||||
// MachinesROW = Machines.NewRow();
|
||||
|
||||
USERCapacity(App.USER_Purview);//App.USER_Purview);
|
||||
CountDown();
|
||||
TcpClientNEW();
|
||||
SQL_LINK();
|
||||
|
||||
/**添加提示信息栏**/
|
||||
InfData.Columns.Add("Machine", Type.GetType("System.String"));
|
||||
InfData.Columns.Add("Information", Type.GetType("System.String"));
|
||||
InfData.Columns.Add("Code", Type.GetType("System.String"));
|
||||
InfData.Columns.Add("ID", Type.GetType("System.Int32"));
|
||||
|
||||
}
|
||||
public static void USERCapacity(string user) //权限
|
||||
{
|
||||
|
||||
@@ -6,26 +6,20 @@
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_"
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
mc:Ignorable="d"
|
||||
Closing="Window_Closing"
|
||||
Title="UserInformation" Height="450" Width="800">
|
||||
<Grid>
|
||||
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True"
|
||||
d:ItemsSource="{d:SampleData ItemCount=30}" AutoGenerateColumns="False" MinColumnWidth="30"
|
||||
Background="White" GridLinesVisibility="All" ColumnHeaderHeight="40" HorizontalContentAlignment="Right"
|
||||
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||
CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True" >
|
||||
<DataGrid x:Name="Griddata" AlternationCount="2" IsReadOnly="True" d:ItemsSource="{d:SampleData ItemCount=99}"
|
||||
AutoGenerateColumns="False" MinColumnWidth="30" Background="White" GridLinesVisibility="All"
|
||||
ColumnHeaderHeight="50" HorizontalContentAlignment="Right" CanUserReorderColumns="False"
|
||||
CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
|
||||
CanUserDeleteRows="False" SelectionMode="Single" FontSize="25" Focusable="True" >
|
||||
<DataGrid.RowStyle >
|
||||
<Style TargetType="{x:Type DataGridRow}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="FontSize" Value="25" />
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||
<Setter Property="Background" Value="#FFFFFFFF" />
|
||||
</Trigger>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||
<Setter Property="Background" Value="#FFF0F0F0" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Height" Value="60" />
|
||||
<Setter Property="FontSize" Value="50" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
<DataGrid.CellStyle>
|
||||
@@ -51,16 +45,16 @@ CanUserDeleteRows="False" SelectionMode="Single" FontSize="15" Focusable="True"
|
||||
</Style>
|
||||
<DataTemplate x:Key="btnCell">
|
||||
<!--注意此处的设置方式-->
|
||||
<Button Content="{x:Static lang:Resources.Confirm}" Click="Button_Click" Tag="{Binding}"/>
|
||||
<Button Content="{x:Static lang:Resources.Confirm}" Click="Button_Click" Tag="{Binding}" FontSize="20"/>
|
||||
</DataTemplate>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Machine}" Width="150" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Information}" Binding="{Binding Code}" MaxWidth="0" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Information}" Binding="{Binding ID}" MaxWidth="0" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Information}" Binding="{Binding inf}" Width="*" IsReadOnly="True"/>
|
||||
<DataGridTemplateColumn Width="100" CellTemplate="{StaticResource btnCell}" />
|
||||
<DataGridTextColumn Binding="{Binding Code}" MaxWidth="0" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Binding="{Binding ID}" MaxWidth="0" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Information}" Binding="{Binding Information}" Width="*" IsReadOnly="True"/>
|
||||
<DataGridTemplateColumn Width="100" CellTemplate="{StaticResource btnCell}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using ScottPlot.Colormaps;
|
||||
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
|
||||
using System.Linq;
|
||||
using System.Speech.Synthesis;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@@ -13,6 +16,8 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using static SunlightCentralizedControlManagement_SCCM_.ViewModel.MainWindowViewModel;
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
{
|
||||
@@ -21,37 +26,74 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
/// </summary>
|
||||
public partial class UserInformation : Window
|
||||
{
|
||||
DataTable dataTable = new DataTable();
|
||||
private static UserClass.IniFile.IniFiles Configini =
|
||||
new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
||||
DispatcherTimer timers = new DispatcherTimer(DispatcherPriority.Normal);//初始化循环,调用一次Tick
|
||||
private SpeechSynthesizer synth = new SpeechSynthesizer();//语音
|
||||
int inf_cont = 0;
|
||||
public UserInformation()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
//DataTable dataTable = new DataTable();
|
||||
dataTable.Columns.Add("Machine",Type.GetType("System.String"));
|
||||
dataTable.Columns.Add("Information", Type.GetType("System.String"));
|
||||
dataTable.Columns.Add("Code", Type.GetType("System.String"));
|
||||
dataTable.Columns.Add("ID", Type.GetType("System.Int32"));
|
||||
dataTable.Rows.Add(new object[] { "1", "a","423","12"});
|
||||
dataTable.Rows.Add(new object[] { "2", "b" ,"345","122"});
|
||||
dataTable.Rows.Add(new object[] { "3", "c" ,"345","32"});
|
||||
dataTable.Rows.Add(new object[] { "1", "a", "423", "1232" });
|
||||
dataTable.Rows.Add(new object[] { "2", "b", "345", "1222" });
|
||||
dataTable.Rows.Add(new object[] { "3", "c", "345", "325" });
|
||||
MainWindowViewModel.InfData.Rows.Add(new object[] { "1", "a","423","12"});
|
||||
MainWindowViewModel.InfData.Rows.Add(new object[] { "2", "b" ,"345","122"});
|
||||
MainWindowViewModel.InfData.Rows.Add(new object[] { "3", "c" ,"345","32"});
|
||||
MainWindowViewModel.InfData.Rows.Add(new object[] { "1", "a", "423", "1232" });
|
||||
MainWindowViewModel.InfData.Rows.Add(new object[] { "2", "b", "345", "1222" });
|
||||
MainWindowViewModel.InfData.Rows.Add(new object[] { "3", "c", "345", "325" });
|
||||
|
||||
Griddata.ItemsSource = dataTable.DefaultView;
|
||||
Griddata.ItemsSource = MainWindowViewModel.InfData.DefaultView;
|
||||
|
||||
synth.Rate = int.Parse( Configini.IniReadvalue("VOICE", "V1"));
|
||||
synth.Volume = int.Parse( Configini.IniReadvalue("VOICE", "V2"));
|
||||
|
||||
Speak();
|
||||
CountDown();
|
||||
}
|
||||
public void CountDown()
|
||||
{
|
||||
timers.Interval = TimeSpan.FromSeconds(10);//秒
|
||||
timers.Tick += DisTimer_S;
|
||||
timers.Start();
|
||||
}//时间周期初始化
|
||||
void DisTimer_S(object sender, EventArgs e)//Tick_Event周期执行事件50MS
|
||||
{
|
||||
Speak();
|
||||
}
|
||||
|
||||
private void Speak()
|
||||
{
|
||||
if (inf_cont < MainWindowViewModel.InfData.Rows.Count)
|
||||
{
|
||||
synth.SpeakAsync(Properties.Resources.Machine + MainWindowViewModel.InfData.Rows[inf_cont][0].ToString() +
|
||||
Properties.Resources.Pequest + MainWindowViewModel.InfData.Rows[inf_cont][1].ToString());//播报
|
||||
inf_cont++;
|
||||
}
|
||||
else
|
||||
{
|
||||
synth.SpeakAsync(Properties.Resources.Machine + MainWindowViewModel.InfData.Rows[0][0].ToString() +
|
||||
Properties.Resources.Pequest + MainWindowViewModel.InfData.Rows[0][1].ToString());//播报
|
||||
inf_cont = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
DataRowView datarow = (DataRowView)button.Tag;
|
||||
var y= datarow.Row.Field<int>("ID");
|
||||
DataRow erwqer = dataTable.Select("ID='" + y + "'").First();
|
||||
var id= datarow.Row.Field<int>("ID");
|
||||
DataRow erwqer = MainWindowViewModel.InfData.Select("ID='" + id + "'").First();
|
||||
|
||||
erwqer.Delete();
|
||||
Griddata.ItemsSource = dataTable.DefaultView;
|
||||
Griddata.ItemsSource = MainWindowViewModel.InfData.DefaultView;
|
||||
|
||||
if (dataTable.Rows.Count == 0) { this.Close(); }
|
||||
if (MainWindowViewModel.InfData.Rows.Count == 0) { this.Close(); }
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
synth.Dispose();
|
||||
timers.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user