public FormMain() { InitializeComponent(); administrator.Id = "1"; user1.Id = "2"; user2.Id = "3"; user3.Id = "4"; if (currentClient == null) { this.signOutButton.Visible = false; this.signOutButton.Enabled = false; } if (ClientService.AllClients().Count == 0) { ClientService.AddAdministrator(administrator); ClientService.AddAdministrator(user1); ClientService.AddAdministrator(user2); ClientService.AddAdministrator(user3); } this.managePictureBox.Visible = false; this.managePictureBox.Enabled = false; this.manageLabel.Visible = false; this.manageLabel.Enabled = false; if (BookShelfService.AllBooks().Count == 0)//设置初始值 { Test.Test1(); Test.Test2(); } //MessageBox.Show("1"); Year = DateTime.Now.Year; Month = DateTime.Now.Month; String time = DateTime.Now.ToLongDateString().ToString(); int m = time.IndexOf("月"); int d = time.IndexOf("日"); Day = DateTime.Now.Day; BookShelfService.Check(Year, Month, Day); Books = BookShelfService.AllBooks(); booksBindingSource.DataSource = Books; Query(1); //MessageBox.Show(Year+"年"+Month+"月"+Day+"日"); }