public MainForm() { Instance = this; InitializeComponent(); // Set the XML file's build action to "Embedded Resource" and "Never copy" for this to work. Tx.LoadFromEmbeddedResource("Unclassified.LogSubmit.LogSubmit.txd"); TxDictionaryBinding.AddTextBindings(this); // Initialise views logSelectionView = new LogSelectionView(); // Read configuration file string configFile = Path.Combine( Path.GetDirectoryName(Application.ExecutablePath), "submit.config"); try { ConfigReader config = new ConfigReader(configFile); config.Read(); } catch (Exception ex) { logSelectionView.SetConfigError(ex); } // Initialise more views timeSelectionView = new TimeSelectionView(); notesView = new NotesView(); compressView = new CompressView(); transportView = new TransportView(); transportProgressView = new TransportProgressView(); views.Add(logSelectionView); views.Add(timeSelectionView); views.Add(notesView); views.Add(compressView); views.Add(transportView); views.Add(transportProgressView); // Other initialisation Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); UIPreferences.UpdateFormFont(this, Font, SystemFonts.MessageBoxFont); USizeGrip.AddToForm(this); systemMenu = new SystemMenu(this); systemMenu.AddCommand(Tx.T("menu.about"), OnSysMenuAbout, true); progressPanel = new Panel(); progressPanel.Left = 0; progressPanel.Top = 0; progressPanel.Width = 0; progressPanel.Height = 2; //progressPanel.BackColor = SystemColors.Highlight; progressPanel.BackColor = Color.Gray; Controls.Add(progressPanel); progressPanel.BringToFront(); // Parse command line arguments CommandLineReader cmdLine = new CommandLineReader(); fromErrorDlgOption = cmdLine.RegisterOption("errordlg"); fromShortcutOption = cmdLine.RegisterOption("shortcut"); logPathOption = cmdLine.RegisterOption("logpath", 1); endTimeOption = cmdLine.RegisterOption("endtime", 1); try { cmdLine.Parse(); } catch (Exception ex) { MessageBox.Show( Tx.T("msg.command line error", "msg", ex.Message), Tx.T("msg.title.error"), MessageBoxButtons.OK, MessageBoxIcon.Error); } SharedData.Instance.FromErrorDialog = fromErrorDlgOption.IsSet; SharedData.Instance.FromShortcut = fromShortcutOption.IsSet; if (logPathOption.IsSet) { try { logSelectionView.SetLogBasePath(logPathOption.Value); } catch { MessageBox.Show( Tx.T("msg.logpath parameter invalid", "value", logPathOption.Value), Tx.T("msg.title.error"), MessageBoxButtons.OK, MessageBoxIcon.Error); logSelectionView.ResetLogBasePath(); logSelectionView.FindLogBasePath(); } } else { logSelectionView.FindLogBasePath(); } if (endTimeOption.IsSet) { try { appStartTime = DateTime.Parse(endTimeOption.Value); SharedData.Instance.LastLogUpdateTime = appStartTime; } catch { MessageBox.Show( Tx.T("msg.endtime parameter invalid", "value", endTimeOption.Value), Tx.T("msg.title.error"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Set start view SetView(logSelectionView, true); }