private void btnExt_Click(object sender, RoutedEventArgs e) { this.lblUser.Content = "用户名:"; this.lblRight.Content = "权 限:"; setDialog(); LoginWindow loginWindow = new LoginWindow(); loginWindow.loginSys = new LoginWindow.LoginSysFunc(loginSys); loginWindow.ShowDialog(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { Process.Start("垃圾楼.exe"); BaseOperate.label = this.lblMessage; //读取站信息 XmlDocument xdoc = new XmlDocument(); string stationID = ""; try { xdoc.Load("station.cfg"); XmlNodeList xNode = xdoc.SelectSingleNode("station").ChildNodes; stationID = xNode[0].InnerText; BaseData.stationAddress = xNode[1].InnerText; } catch(Exception ex) { MessageBox.Show("配置文件出错,程序将退出!"); this.Close(); return; } //从数据库中读取清洁站信息 string sql = "Select * from [dbo.Station] WHERE StationID = " + stationID; DataSet ds = operate.getds(sql, "[dbo.Station]"); if (ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0) { MessageBox.Show("读取清洁站信息失败!"); this.Close(); return; } BaseData.stationID = int.Parse(stationID); BaseData.stationName = ds.Tables[0].Rows[0]["Name"].ToString(); setDialog(); this.lblTitle.Content = BaseData.stationName.Replace(" ","") + "清洁站清运监管信息系统"; LoginWindow loginWindow = new LoginWindow(); loginWindow.loginSys = new LoginWindow.LoginSysFunc(loginSys); loginWindow.ShowDialog(); backWork.DoWork += loadData; backWork.RunWorkerCompleted += loadDataComplete; backWork.RunWorkerAsync(); DispatcherTimer timer = new DispatcherTimer(); timer.Tick += timer_Tick; timer.Interval = new TimeSpan(0,1,0); timer.Start(); }