// main method. public CalendarMain() { InitializeComponent(); alarm_onCheck = true; gbox = new ListBox[42]; addForm = new DataAddForm(label_DateTemp, this, false); addForm_today = new TodayDataAddForm(this); // Database setting. dbConnect = new SQLiteConnection("Data Source=" + path + dbFileName + ";Version=3;"); dbConnect2 = new SQLiteConnection("Data Source=" + path + dbFileName2 + ";Version=3;"); addForm.setDbConnect(dbConnect); addForm_today.setDbConnect(dbConnect2); if (!File.Exists(path + dbFileName)) { dbCommand = new SQLiteCommand(QueryList.createTableSQL(), dbConnect); Directory.CreateDirectory(path); SQLiteConnection.CreateFile(path + dbFileName); MessageBox.Show("Created new calendar db."); dbConnect.Open(); dbCommand.ExecuteNonQuery(); dbConnect.Close(); } if (!File.Exists(path + dbFileName2)) { dbCommand2 = new SQLiteCommand(QueryList.createTableSQL_today(), dbConnect2); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } SQLiteConnection.CreateFile(path + dbFileName2); MessageBox.Show("Created new today alarm db."); dbConnect2.Open(); dbCommand2.ExecuteNonQuery(); dbConnect2.Close(); } tManager = new ThreadManager(label_Time, dbConnect, dbConnect2); // Thread setting. dataview = new DataView(dbConnect, this); // DataView setting. // Panel setting. for (int count = 0; count < gbox.Length; count++) { gbox[count] = new ListBox(); } // Current date setting. selectDay = int.Parse(DateTime.Now.ToString("dd")); selectYear = int.Parse(DateTime.Now.ToString("yyyy")); selectMonth = int.Parse(DateTime.Now.ToString("MM")); for (int row = 1, count = 0; row <= 6; row++) { for (int col = 0; col < 7; col++) { panel_MonthList.Controls.Add(gbox[count], col, row); count++; } } label_DateTemp.Text = selectYear.ToString() + "." + selectMonth.ToString() + "." + selectDay.ToString(); label_YearMonth.Text = selectYear.ToString() + "." + selectMonth.ToString("00"); changeCalendar(); todayAlarmListRefresh(); }