private static bool ApplyBootConfiguration(StartupDialog dlg, bool handled) { MirandaBootConfiguration bootConfig = MirandaBootConfiguration.Load(); if (bootConfig != null && bootConfig.IsValid) { switch (bootConfig.StartupOption) { case StartupOption.DownloadDatabase: dlg.DownloadExistingRBTN.Checked = true; dlg.PublicComputerCHBOX.Checked = bootConfig.PublicPc; dlg.RoamRemoteOnExitCHBOX.Checked = !bootConfig.SandboxMode; break; case StartupOption.UseLocalDatabase: dlg.UseLocalRBTN.Checked = true; dlg.RoamLocalOnExitCHBOX.Checked = !bootConfig.SandboxMode; break; } Trace.WriteLineIf(RoamiePlugin.TraceSwitch.TraceInfo, "MirandaBoot.ini contains Roamie default settings => using these settings...", RoamiePlugin.TraceCategory); handled = dlg.ProcessSelection(bootConfig.Profile); } else Trace.WriteLineIf(RoamiePlugin.TraceSwitch.TraceInfo, "MirandaBoot.ini contains invalid Roamie settings.", RoamiePlugin.TraceCategory); return handled; }
public static void PresentModal(bool firstTime) { using (StartupDialog dlg = new StartupDialog(firstTime)) { bool handled = false; if (!firstTime) handled = ApplyBootConfiguration(dlg, false); else Trace.WriteLineIf(RoamiePlugin.TraceSwitch.TraceInfo, "MirandaBoot.ini contains no Roamie default settings.", RoamiePlugin.TraceCategory); if (!handled) dlg.ShowDialog(); } }