信息播报页面添加
This commit is contained in:
commit
cdc7b896d9
4 files changed
+37
-45
No files matched your search
+13
-3
@@ -31,6 +31,8 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
{
|
||||
public static string user_;
|
||||
public static DataTable InfData = new DataTable();
|
||||
public UserInformation userInformation;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
DataContext = new MainWindowViewModel();
|
||||
@@ -53,15 +55,23 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
InfData.Columns.Add("Code", Type.GetType("System.String"));
|
||||
InfData.Columns.Add("ID", Type.GetType("System.Int32"));
|
||||
|
||||
InfData.TableNewRow += new DataTableNewRowEventHandler(InfTable());
|
||||
InfData.RowChanged += new DataRowChangeEventHandler(InfTable);//
|
||||
}
|
||||
private void InfTable(object sender, DataTableNewRowEventArgs e)
|
||||
private void InfTable(object sender, DataRowChangeEventArgs e)//触发行改变事件
|
||||
{
|
||||
UserInformation userInformation = new UserInformation();
|
||||
if (userInformation == null || !userInformation.IsLoaded)//窗口不存在及创建
|
||||
{
|
||||
userInformation = new UserInformation();
|
||||
userInformation.Topmost = true;
|
||||
userInformation.Show();
|
||||
userInformation.Activate();
|
||||
}
|
||||
else
|
||||
{//窗口纯在及置顶
|
||||
userInformation.Activate();
|
||||
if (userInformation.WindowState == WindowState.Minimized) userInformation.WindowState = WindowState.Normal;
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
@@ -154,14 +154,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
|
||||
public void CountDown()
|
||||
{
|
||||
DispatcherTimer dis1s = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(1) //秒
|
||||
};
|
||||
dis1s.Tick += new EventHandler(Tick_Main_1S);//每执行的方法
|
||||
dis1s.Start();//计时开始
|
||||
DispatcherTimer dis50ms = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(50) //毫秒
|
||||
Interval = TimeSpan.FromMilliseconds(20) //毫秒
|
||||
};
|
||||
dis50ms.Tick += new EventHandler(DisTimer_50MS);//每执行的方法
|
||||
dis50ms.Start();//计时开始
|
||||
}//时间周期初始化
|
||||
int Time1 = 0, Time5 = 0, Time60 = 0;
|
||||
int Time5 = 0, Time60 = 0;
|
||||
void DisTimer_50MS(object sender, EventArgs e)//Tick_Event周期执行事件50MS
|
||||
{
|
||||
if (stringQueue.Count > 0) //信息发送队列
|
||||
@@ -169,15 +175,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
QueueString t = stringQueue.Dequeue();
|
||||
MachiensTcpClient[t.ID].SendAsync(t.DAT);
|
||||
}
|
||||
|
||||
if (Time1 >= 20)
|
||||
{
|
||||
Tick_Main_1S();
|
||||
Time1 = 0;
|
||||
}
|
||||
else { Time1++; }
|
||||
}
|
||||
void Tick_Main_1S()//Tick_Event周期执行事件1S
|
||||
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||
{
|
||||
//下传工单信息
|
||||
SQLiteHelper WorkOrderSQL = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
@@ -290,7 +289,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
});//信息插入队列
|
||||
}
|
||||
}
|
||||
|
||||
if (Time5 > 5)
|
||||
{
|
||||
Tick_Event_5S();
|
||||
@@ -317,6 +315,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
});//信息插入队列
|
||||
}
|
||||
}//发送800指令
|
||||
|
||||
|
||||
|
||||
MainWindow.InfData.Rows.Add(new object[] { "1", Properties.Resources.Pequest+"a", "423", "12" });
|
||||
|
||||
|
||||
}
|
||||
void Tick_Event_60S()
|
||||
{
|
||||
@@ -357,14 +361,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/* public static void Inf_Data()
|
||||
{
|
||||
UserInformation userInformation = new UserInformation();
|
||||
userInformation.Topmost = true;
|
||||
userInformation.Show();
|
||||
userInformation.Activate();
|
||||
}*/
|
||||
|
||||
public static string SYS_WorkNumder; //工单号
|
||||
public static int SYS_AT1; //附缸1-3
|
||||
public static int SYS_AT2;
|
||||
|
||||
@@ -7,21 +7,15 @@
|
||||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||
mc:Ignorable="d"
|
||||
Closing="Window_Closing"
|
||||
Title="UserInformation" Height="450" Width="800">
|
||||
ResizeMode="NoResize"
|
||||
WindowStyle="SingleBorderWindow"
|
||||
Title="SUNLIGHT" Height="450" Width="800">
|
||||
<Grid>
|
||||
<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"
|
||||
ColumnHeaderHeight="60" 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="60" />
|
||||
<Setter Property="FontSize" Value="50" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
CanUserDeleteRows="False" SelectionMode="Single" FontSize="30" Focusable="True" >
|
||||
<DataGrid.CellStyle>
|
||||
<Style TargetType="DataGridCell">
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
@@ -50,13 +44,12 @@
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<!--列信息绑定-->
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Machine}" Width="150" IsReadOnly="True"/>
|
||||
<DataGridTextColumn Header="{x:Static lang:Resources.Machine}" Binding="{Binding Machine}" Width="200" IsReadOnly="True"/>
|
||||
<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>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -35,13 +35,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
MainWindow.InfData.Rows.Add(new object[] { "1", "a","423","12"});
|
||||
MainWindow.InfData.Rows.Add(new object[] { "2", "b" ,"345","122"});
|
||||
MainWindow.InfData.Rows.Add(new object[] { "3", "c" ,"345","32"});
|
||||
MainWindow.InfData.Rows.Add(new object[] { "1", "a", "423", "1232" });
|
||||
MainWindow.InfData.Rows.Add(new object[] { "2", "b", "345", "1222" });
|
||||
MainWindow.InfData.Rows.Add(new object[] { "3", "c", "345", "325" });
|
||||
|
||||
Griddata.ItemsSource = MainWindow.InfData.DefaultView;
|
||||
|
||||
synth.Rate = int.Parse( Configini.IniReadvalue("VOICE", "V1"));
|
||||
@@ -61,18 +54,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
Speak();
|
||||
}
|
||||
|
||||
private void Speak()
|
||||
private void Speak()//语音
|
||||
{
|
||||
if (inf_cont < MainWindow.InfData.Rows.Count)
|
||||
{
|
||||
synth.SpeakAsync(Properties.Resources.Machine + MainWindow.InfData.Rows[inf_cont][0].ToString() +
|
||||
Properties.Resources.Pequest + MainWindow.InfData.Rows[inf_cont][1].ToString());//播报
|
||||
MainWindow.InfData.Rows[inf_cont][1].ToString());//播报
|
||||
inf_cont++;
|
||||
}
|
||||
else
|
||||
{
|
||||
synth.SpeakAsync(Properties.Resources.Machine + MainWindow.InfData.Rows[0][0].ToString() +
|
||||
Properties.Resources.Pequest + MainWindow.InfData.Rows[0][1].ToString());//播报
|
||||
MainWindow.InfData.Rows[0][1].ToString());//播报
|
||||
inf_cont = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user