public AppLogic () { // Get the current configuration file. config = ConfigurationManager.OpenExeConfiguration (ConfigurationUserLevel.None); // Look for our settings and add/create them if missing if (config.Sections [config_name] == null) { config_section = new ConfigSection (); config.Sections.Add (config_name, config_section); config_section.SectionInformation.ForceSave = true; config.Save (ConfigurationSaveMode.Full); } config_section = config.GetSection (config_name) as ConfigSection; // Hook up main window events win = new MainWindow (); win.MonitorEvent += show_monitor; win.UploadEvent += do_upload; win.LogEvent += log; win.QuitEvent += at_exit; // restore the last path that we uploaded win.FileName = config_section.lastPath; // restore the last port that we opened win.PortName = config_section.lastPort; // Create the intelhex loader ihex = new IHex (); ihex.LogEvent += log; // And the uploader upl = new Uploader (); upl.LogEvent += log; upl.ProgressEvent += win.set_progress; // Emit some basic help log ("Select a serial port and a .hex file to be uploaded, then hit Upload.\n"); win.Show (); }