信息页面
This commit is contained in:
commit
ac86200576
4 files changed
+52
-40
No files matched your search
+17
-1
@@ -30,6 +30,7 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public static string user_;
|
||||
public static DataTable InfData = new DataTable();
|
||||
public MainWindow()
|
||||
{
|
||||
DataContext = new MainWindowViewModel();
|
||||
@@ -44,7 +45,22 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
||||
AsEnumerable().Select(rowdata => rowdata.Field<string>("Name")).ToList();
|
||||
}
|
||||
user_ = App.USER_Purview;
|
||||
username.Text = user_;
|
||||
username.Text = user_;
|
||||
|
||||
/**添加提示信息栏**/
|
||||
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"));
|
||||
|
||||
InfData.TableNewRow += new DataTableNewRowEventHandler(InfTable());
|
||||
}
|
||||
private void InfTable(object sender, DataTableNewRowEventArgs e)
|
||||
{
|
||||
UserInformation userInformation = new UserInformation();
|
||||
userInformation.Topmost = true;
|
||||
userInformation.Show();
|
||||
userInformation.Activate();
|
||||
}
|
||||
|
||||
private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -67,12 +67,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
dyelot= MainWindowViewModel.dyelot;
|
||||
machin_LOG.Text = MainWindowViewModel.machin_LOG;
|
||||
IsInteractive = false;
|
||||
DATA_view();
|
||||
|
||||
UserInformation userInformation = new UserInformation();
|
||||
userInformation.Topmost = true;
|
||||
userInformation.Show();
|
||||
userInformation.Activate();
|
||||
DATA_view();
|
||||
}
|
||||
|
||||
private string machine;
|
||||
|
||||
@@ -71,7 +71,6 @@ 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]; //定义总览信息卡
|
||||
@@ -103,13 +102,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
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) //权限
|
||||
{
|
||||
@@ -162,18 +154,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
|
||||
public void CountDown()
|
||||
{
|
||||
DispatcherTimer timer1s = new DispatcherTimer(DispatcherPriority.Normal);//初始化循环,每1秒调用一次Tick
|
||||
timer1s.Interval = TimeSpan.FromMilliseconds(950);//秒
|
||||
timer1s.Tick += Tick_Main_1S;
|
||||
timer1s.Start();
|
||||
|
||||
DispatcherTimer dis50ms = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromMilliseconds(10) //毫秒
|
||||
Interval = TimeSpan.FromMilliseconds(50) //毫秒
|
||||
};
|
||||
dis50ms.Tick += new EventHandler(DisTimer_50MS);//每执行的方法
|
||||
dis50ms.Start();//计时开始
|
||||
}//时间周期初始化
|
||||
int Time1 = 0, Time5 = 0, Time60 = 0;
|
||||
void DisTimer_50MS(object sender, EventArgs e)//Tick_Event周期执行事件50MS
|
||||
{
|
||||
if (stringQueue.Count > 0) //信息发送队列
|
||||
@@ -181,9 +169,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
QueueString t = stringQueue.Dequeue();
|
||||
MachiensTcpClient[t.ID].SendAsync(t.DAT);
|
||||
}
|
||||
}
|
||||
|
||||
void Tick_Main_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||
if (Time1 >= 20)
|
||||
{
|
||||
Tick_Main_1S();
|
||||
Time1 = 0;
|
||||
}
|
||||
else { Time1++; }
|
||||
}
|
||||
void Tick_Main_1S()//Tick_Event周期执行事件1S
|
||||
{
|
||||
//下传工单信息
|
||||
SQLiteHelper WorkOrderSQL = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
@@ -310,7 +304,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
}
|
||||
else { Time60++; }
|
||||
}
|
||||
int Time5=0,Time60;
|
||||
void Tick_Event_5S()//Tick_Event周期执行事件5S
|
||||
{
|
||||
for (int i = 0; i < Machinesdata_Count; i++)
|
||||
@@ -363,7 +356,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
|
||||
, Selet_Machines(Machines, "PORT", "ID='" + Convert.ToInt16(dt["ID"]) + "'").ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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;
|
||||
|
||||
@@ -35,14 +35,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
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" });
|
||||
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 = MainWindowViewModel.InfData.DefaultView;
|
||||
Griddata.ItemsSource = MainWindow.InfData.DefaultView;
|
||||
|
||||
synth.Rate = int.Parse( Configini.IniReadvalue("VOICE", "V1"));
|
||||
synth.Volume = int.Parse( Configini.IniReadvalue("VOICE", "V2"));
|
||||
@@ -63,16 +63,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
|
||||
private void Speak()
|
||||
{
|
||||
if (inf_cont < MainWindowViewModel.InfData.Rows.Count)
|
||||
if (inf_cont < MainWindow.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());//播报
|
||||
synth.SpeakAsync(Properties.Resources.Machine + MainWindow.InfData.Rows[inf_cont][0].ToString() +
|
||||
Properties.Resources.Pequest + MainWindow.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());//播报
|
||||
synth.SpeakAsync(Properties.Resources.Machine + MainWindow.InfData.Rows[0][0].ToString() +
|
||||
Properties.Resources.Pequest + MainWindow.InfData.Rows[0][1].ToString());//播报
|
||||
inf_cont = 0;
|
||||
}
|
||||
}
|
||||
@@ -82,12 +82,12 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
||||
var button = sender as Button;
|
||||
DataRowView datarow = (DataRowView)button.Tag;
|
||||
var id= datarow.Row.Field<int>("ID");
|
||||
DataRow erwqer = MainWindowViewModel.InfData.Select("ID='" + id + "'").First();
|
||||
DataRow erwqer = MainWindow.InfData.Select("ID='" + id + "'").First();
|
||||
|
||||
erwqer.Delete();
|
||||
Griddata.ItemsSource = MainWindowViewModel.InfData.DefaultView;
|
||||
Griddata.ItemsSource = MainWindow.InfData.DefaultView;
|
||||
|
||||
if (MainWindowViewModel.InfData.Rows.Count == 0) { this.Close(); }
|
||||
if (MainWindow.InfData.Rows.Count == 0) { this.Close(); }
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
|
||||
Reference in new issue
Block a user