public AddNewDataForm(string nType, ApplicantList apps, ComboBox appList) { InitializeComponent(); newType = nType; this.apps = apps; this.appList = appList; }
// Include parameter for serialise file handler in Constructor /// <summary> /// Constructor for FormBasedUI /// </summary> /// <param name="app">applicantList object</param> /// <param name="ser">forceSreviceList object</param> /// <param name="trg">text report generator object</param> /// <param name="sfh">text report serialize object</param> public FormBasedUI(ApplicantList app, ForceServiceList ser, TextReportGenerator trg, SerializeFileHandler sfh) { InitializeComponent(); applicantList = app; forceServiceList = ser; // Assign parameter textReport file handler object textReportGenerator = trg; // Assign parameter serilize file handler object serializeFileHandler = sfh; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // instantiate a ApplicantList objects ApplicantList applicantList = new ApplicantList(); // Instantiate a ForceServiceList object ForceServiceList forceServiceList = new ForceServiceList(); // Instantiate a text report generator TextReportGenerator trg = new TextReportGenerator(); // instantiate a SerializeFileHandler object, to make argument to Run() SerializeFileHandler sfh = new SerializeFileHandler(); SplashForm loader = new SplashForm(); loader.ShowDialog(); Application.Run(new FormBasedUI(applicantList, forceServiceList, trg, sfh)); }
/// <summary> /// Load the mf data file /// </summary> public void LoadMFData() { // Make sure the file mf.data has been created and exists // in the bin\debug folder of this project. try { // Instantiate a MF object to hold all data MF mfFile = new MF(); // Deserialize the file into the MF object mfFile = serializeFileHandler.LoadMFFile(AppData.DataFile); // Copy the data back into the two lists applicantList = mfFile.applicantList; forceServiceList = mfFile.fSList; MessageBox.Show("MF data file has been loaded"); } catch (FileNotFoundException ex) { Console.WriteLine(ex.Message); Console.ReadKey(); } }