private void btnGymSettings_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { frmGymData frm = new frmGymData(); addForm(frm); }
private void frmMain_Load(object sender, EventArgs e) { Properties.Settings.Default.FirstDevice = "COM5"; Properties.Settings.Default.SecondDevice = "COM"; Properties.Settings.Default.Save(); if (Properties.Settings.Default.firstTimeUse) { Properties.Settings.Default.setupDate = DateTime.Now.Date; frmLogin frmlgn = new frmLogin(); frmlgn.ShowDialog(); menuUser.Caption = Program.Username; frmGymData Gfrm = new frmGymData(); Gfrm.ShowDialog(); Properties.Settings.Default.firstTimeUse = false; Properties.Settings.Default.Save(); } else { frmLogin frmlgn_ = new frmLogin(); frmlgn_.ShowDialog(); menuUser.Caption = Program.Username; } TimeSpan days = DateTime.Now.Date - Properties.Settings.Default.setupDate; int num = days.Days; if (Properties.Settings.Default.PaidEver) { goto procceed; } else if (num > 14 && !Properties.Settings.Default.PaidYear) { XtraMessageBox.Show("لقد إنتهت المدة التجريبية للبرنامج، برحاء شراء البرنامج", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error); frmActivate frm = new frmActivate(); frm.ShowDialog(); } else if (num > 365 && !Properties.Settings.Default.PaidEver) { XtraMessageBox.Show("لقد إنتهت المدة التجريبية للبرنامج، برحاء شراء البرنامج", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error); frmActivate frm = new frmActivate(); frm.ShowDialog(); } procceed : string[] comPorts = SerialPort.GetPortNames(); foreach (string com in comPorts) { if (Properties.Settings.Default.FirstDevice == com) { sp1.BaudRate = 9600; sp1.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler1); sp1.Open(); sp1.Write("connected"); } if (Properties.Settings.Default.SecondDevice == com) { sp2.BaudRate = 9600; sp2.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler2); sp2.Open(); sp2.Write("connected"); } } chkDayClosing(); checkTraineesProfile(); chkAccess(); fillCharts(); showSharts(true); }