예제 #1
0
 private void ClearBellList()
 {
     pnlScheduleContainer.Controls.Clear();
     ScheduleDataManager.BellDataUI.Clear();
     ScheduleDataManager.ResetDirtyFlag();
     this.Invalidate();
 }
예제 #2
0
        private void OpenBellList()
        {
            string filePath              = String.Empty;
            List <ScheduleData> dataUI   = new List <ScheduleData>();
            OpenFileDialog      OFDialog = new OpenFileDialog();

            DialogResult result = OFDialog.ShowDialog(); // Show the dialog.

            OFDialog.DefaultExt = BellConstants.BellCSVExtention;
            if (result == DialogResult.OK && !string.IsNullOrEmpty(OFDialog.FileName))
            {
                filePath = OFDialog.FileName;

                ScheduleDataManager.BellListFilePath = filePath;
                ScheduleDataManager.LoadData();

                dataUI = ScheduleDataManager.BellDataUI;
                pnlScheduleContainer.Controls.Clear();
                for (int i = 0; i < dataUI.Count; i++)
                {
                    ScheduleData      TempDataUi = dataUI[i];
                    ScheduleDataModel SDM        = new ScheduleDataModel();
                    SDM = TempDataUi.scheduleDM;
                    SDM.SerialNumber      = i + 1;
                    TempDataUi.scheduleDM = SDM;
                    TempDataUi.Location   = new Point(0, (i * 38));
                    TempDataUi.Controls["btnDelete"].Click += DeleteScheduleFromList;
                    TempDataUi.MakeDirty += ScheduleDataManager.ActionMakeDirty;
                    pnlScheduleContainer.Controls.Add(TempDataUi);
                }

                ScheduleDataManager.ResetDirtyFlag();
            }
        }