void timer_Tick(object sender, EventArgs e) { if (flag == 0) { LoadWindow load = new LoadWindow(); load.Show(); Application.Current.Resources.Add("省市表", dbOperation.GetProvinceCity()); UserInfo userInfo = Application.Current.Resources["User"] as UserInfo; this.userName = userInfo.ShowName; //加载标题 this._user.Text = this.userName; //this._date.Text = DateTime.Now.ToLongDateString().ToString() + DateTime.Now.ToString("dddd"); this._date.Text = DateTime.Now.ToLongDateString().ToString(); DataTable table = dbOperation.GetDbHelper().GetDataSet(string.Format("select companyName,phone from t_supplier where supplierId ='{0}'", (Application.Current.Resources["User"] as UserInfo).SupplierId == "" ? "zrd" : (Application.Current.Resources["User"] as UserInfo).SupplierId)).Tables[0]; this._bottom.Text = "版权所有:" + table.Rows[0][0].ToString() + " 软著登字第0814101号 版本号:" + ConfigurationManager.AppSettings["version"] + " 技术服务热线:" + table.Rows[0][1].ToString(); //DataTable dt = dbOperation.GetDbHelper().GetDataSet(string.Format("SELECT title,image from sys_client_sysdept where INFO_CODE ='{0}'", (Application.Current.Resources["User"] as UserInfo).DepartmentID)).Tables[0]; string dept_str = ""; if (deptId.Length >= 3) { dept_str = deptId.Substring(0, 3).ToString(); } else { dept_str = deptId; } DataTable dt = dbOperation.GetDbHelper().GetDataSet(string.Format("SELECT title,image,INFO_NAME from sys_client_sysdept where INFO_CODE ='{0}'", dept_str)).Tables[0]; if (dt.Rows[0][0].ToString() != "") { this._title_dept.Text = dt.Rows[0][0].ToString(); } else if (dt.Rows[0][2].ToString() != "") { this._title_dept.Text = dt.Rows[0][2].ToString(); } if (dt.Rows[0][1].ToString() != null && dt.Rows[0][1].ToString() != "") { byte[] img = (byte[])dt.Rows[0][1]; ShowSelectedIMG(img); //以流的方式显示图片的方法 } this._logo.Visibility = Visibility.Visible; this._title_1.Visibility = Visibility.Visible; //this._title_2.Visibility = Visibility.Visible; //加载父菜单和子菜单和首页 MainMenu_Load(); this.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged); flag = 1; timer.Interval = new TimeSpan(1000); load.Close(); } //header.UpdateTime(); }
private Rect rcnormal;//定义一个全局rect记录还原状态下窗口的位置和大小。 public MainWindow(IDBOperation dbOperation) { //Rect rc = SystemParameters.WorkArea;//获取工作区大小 this.Width = 1366; this.Height = 766; InitializeComponent(); this.dbOperation = dbOperation; UserInfo userInfo = Application.Current.Resources["User"] as UserInfo; this.userName = userInfo.ShowName; Application.Current.Resources.Add("省市表", dbOperation.GetProvinceCity()); //加载标题 this._user.Text = this.userName; //this._date.Text = DateTime.Now.ToLongDateString().ToString() + DateTime.Now.ToString("dddd"); this._date.Text = DateTime.Now.ToLongDateString().ToString(); DataTable table = dbOperation.GetDbHelper().GetDataSet(string.Format("select companyName,phone from t_supplier where supplierId ='{0}'", (Application.Current.Resources["User"] as UserInfo).SupplierId == "" ? "zrd" : (Application.Current.Resources["User"] as UserInfo).SupplierId)).Tables[0]; this._bottom.Text = table.Rows[0][0].ToString() + "版权所有 版本号:" + ConfigurationManager.AppSettings["version"] + " 技术服务热线:" + table.Rows[0][1].ToString(); DataTable dt = dbOperation.GetDbHelper().GetDataSet(string.Format("SELECT INFO_NAME,image from sys_client_sysdept where INFO_CODE ='{0}'", (Application.Current.Resources["User"] as UserInfo).DepartmentID)).Tables[0]; this._title_dept.Text = dt.Rows[0][0].ToString(); if (dt.Rows[0][1].ToString() != null && dt.Rows[0][1].ToString() != "") { byte[] img = (byte[])dt.Rows[0][1]; ShowSelectedIMG(img); //以流的方式显示图片的方法 } MainMenu_Load(); this.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged); //加载主画面 if (mainMenus[0].Flag_Exits == 1) { TabItem temptb = new TabItem(); temptb.Header = "首页"; temptb.Content = new UcMainPage(); _tab.Items.Add(temptb); _tab.SelectedIndex = _tab.Items.Count - 1; } //if (!FullScreenHelper.IsFullscreen(this)) //{ // FullScreenHelper.GoFullscreen(this); //} //this.Loaded += new RoutedEventHandler(MainWindow_Loaded); //this.KeyDown += new KeyEventHandler(MainWindow_KeyDown); //this.StateChanged += new EventHandler(MainWindow_StateChanged); }
private Rect rcnormal;//定义一个全局rect记录还原状态下窗口的位置和大小。 public MainWindow(IDBOperation dbOperation) { //Rect rc = SystemParameters.WorkArea;//获取工作区大小 this.Width = 1366; this.Height = 766; InitializeComponent(); this.dbOperation = dbOperation; UserInfo userInfo = Application.Current.Resources["User"] as UserInfo; this.userName = userInfo.ShowName; Application.Current.Resources.Add("省市表", dbOperation.GetProvinceCity()); //加载标题 this._user.Text = this.userName; //this._date.Text = DateTime.Now.ToLongDateString().ToString() + DateTime.Now.ToString("dddd"); this._date.Text = DateTime.Now.ToLongDateString().ToString(); DataTable table = dbOperation.GetDbHelper().GetDataSet(string.Format("select companyName,phone from t_supplier where supplierId ='{0}'", (Application.Current.Resources["User"] as UserInfo).SupplierId == "" ? "zrd" : (Application.Current.Resources["User"] as UserInfo).SupplierId)).Tables[0]; this._bottom.Text = table.Rows[0][0].ToString() + "版权所有 版本号:" + ConfigurationManager.AppSettings["version"] + " 技术服务热线:" + table.Rows[0][1].ToString(); DataTable dt= dbOperation.GetDbHelper().GetDataSet(string.Format("SELECT INFO_NAME,image from sys_client_sysdept where INFO_CODE ='{0}'", (Application.Current.Resources["User"] as UserInfo).DepartmentID)).Tables[0]; this._title_dept.Text = dt.Rows[0][0].ToString(); if (dt.Rows[0][1].ToString() != null && dt.Rows[0][1].ToString() != "") { byte[] img = (byte[])dt.Rows[0][1]; ShowSelectedIMG(img); //以流的方式显示图片的方法 } MainMenu_Load(); this.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged); //加载主画面 if (mainMenus[0].Flag_Exits == 1) { TabItem temptb = new TabItem(); temptb.Header = "首页"; temptb.Content = new UcMainPage(); _tab.Items.Add(temptb); _tab.SelectedIndex = _tab.Items.Count - 1; } //if (!FullScreenHelper.IsFullscreen(this)) //{ // FullScreenHelper.GoFullscreen(this); //} //this.Loaded += new RoutedEventHandler(MainWindow_Loaded); //this.KeyDown += new KeyEventHandler(MainWindow_KeyDown); //this.StateChanged += new EventHandler(MainWindow_StateChanged); }
public MainWindowTradition(IDBOperation dbOperation) { InitializeComponent(); this.dbOperation = dbOperation; dbHelper = DbHelperMySQL.CreateDbHelper(); //系统标题的显示 string sql = string.Format("select title from sys_client_sysdept where INFO_CODE = '{0}'", (Application.Current.Resources["User"] as UserInfo).DepartmentID); string title = dbOperation.GetDbHelper().GetSingle(sql).ToString(); this.Title = title + " " + "当前登录用户:" + (Application.Current.Resources["User"] as UserInfo).ShowName; Application.Current.Resources.Add("省市表", dbOperation.GetProvinceCity()); MenuRole(); foreach (FatherMenuTitle fatherMenuTitle in menuTitles) { MenuItem fatherMenu = new MenuItem(); fatherMenu.FontSize = 16; fatherMenu.Header = fatherMenuTitle.Name; if (fatherMenuTitle.ChildMenuTitle.Count == 0) { fatherMenu.Click += new RoutedEventHandler(childMenu_Click); } else { foreach (string childMenuTitle in fatherMenuTitle.ChildMenuTitle) { MenuItem childMenu = new MenuItem(); childMenu.FontSize = 16; childMenu.Header = childMenuTitle; childMenu.Click += new RoutedEventHandler(childMenu_Click); fatherMenu.Items.Add(childMenu); } } _menu.Items.Add(fatherMenu); } mainPage = new UcMainPage(); grid_Component.Children.Add(mainPage); this.WindowState = WindowState.Maximized; }
private Rect rcnormal;//定义一个全局rect记录还原状态下窗口的位置和大小。 public MainWindow(IDBOperation dbOperation) { //Rect rc = SystemParameters.WorkArea;//获取工作区大小 this.Width = 1366; this.Height = 768; InitializeComponent(); this.dbOperation = dbOperation; UserInfo userInfo = Application.Current.Resources["User"] as UserInfo; this.userName = userInfo.ShowName; Application.Current.Resources.Add("省市表", dbOperation.GetProvinceCity()); //加载标题 this._user.Text = this.userName; this._date.Text = DateTime.Now.ToLongDateString().ToString() + DateTime.Now.ToString("dddd"); this._title_dept.Text = dbOperation.GetDbHelper().GetSingle(string.Format("SELECT INFO_NAME from sys_client_sysdept where INFO_CODE ='{0}'", (Application.Current.Resources["User"] as UserInfo).DepartmentID)).ToString(); MainMenu_Load(); this.SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged); //加载主画面 //if (mainMenus[0].Flag_Exits == 1) //{ TabItem temptb = new TabItem(); temptb.Header = "首页"; temptb.Content = new UcMainPage(); _tab.Items.Add(temptb); _tab.SelectedIndex = _tab.Items.Count - 1; //} //if (!FullScreenHelper.IsFullscreen(this)) //{ // FullScreenHelper.GoFullscreen(this); //} //this.Loaded += new RoutedEventHandler(MainWindow_Loaded); //this.KeyDown += new KeyEventHandler(MainWindow_KeyDown); //this.StateChanged += new EventHandler(MainWindow_StateChanged); }
public MainWindowTradition(IDBOperation dbOperation) { InitializeComponent(); this.dbOperation = dbOperation; dbHelper = DbHelperMySQL.CreateDbHelper(); //系统标题的显示 string sql = string.Format("select title from sys_client_sysdept where INFO_CODE = '{0}'", (Application.Current.Resources["User"] as UserInfo).DepartmentID); string title = dbOperation.GetDbHelper().GetSingle(sql).ToString(); this.Title = title + " "+"当前登录用户:" + (Application.Current.Resources["User"] as UserInfo).ShowName; Application.Current.Resources.Add("省市表", dbOperation.GetProvinceCity()); MenuRole(); foreach (FatherMenuTitle fatherMenuTitle in menuTitles) { MenuItem fatherMenu = new MenuItem(); fatherMenu.FontSize = 16; fatherMenu.Header = fatherMenuTitle.Name; if (fatherMenuTitle.ChildMenuTitle.Count == 0) { fatherMenu.Click += new RoutedEventHandler(childMenu_Click); } else { foreach (string childMenuTitle in fatherMenuTitle.ChildMenuTitle) { MenuItem childMenu = new MenuItem(); childMenu.FontSize = 16; childMenu.Header = childMenuTitle; childMenu.Click += new RoutedEventHandler(childMenu_Click); fatherMenu.Items.Add(childMenu); } } _menu.Items.Add(fatherMenu); } mainPage = new UcMainPage(); grid_Component.Children.Add(mainPage); this.WindowState = WindowState.Maximized; }