public static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; if (args.Length > 0) { Logger.Info("Starting app with command line arguments: {0}", string.Join(", ", args)); AutoFileSaver <SettingsModel> autoFileSaver = new AutoFileSaver <SettingsModel>("settings.xml", true); AppearanceHandler handler = new AppearanceHandler(autoFileSaver.Model); foreach (string arg in args) { switch (arg) { case "/light": handler.SwitchToLightTheme(); break; case "/dark": handler.SwitchToDarkTheme(); break; case "/update": AutoUpdater autoUpdater = new AutoUpdater(true, true); autoUpdater.CheckForUpdates(true).Wait(); break; case "/clean": TaskSchedulerHandler.DeleteAllTasks(); break; default: Logger.Error("Command line argument is not accepted: {0}", arg); break; } } } else { App app = new App(); app.InitializeComponent(); app.Run(); } }
private void btnValider_Click(object sender, EventArgs e) { if (this.useMode == "Ajout") { try { ValidateData(); BLDiplome.AddNew(getDataFromInterface()); MessageBox.Show("Diplome ajouté avec succès", "Ajout d'un diplome", MessageBoxButtons.OK, MessageBoxIcon.Information); reset(); } catch (DataValidationException exp) { MessageBox.Show(exp.ExceptionMessage, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); AppearanceHandler.SetErrorAppearance(frmErrorCtrls, ToolTipInfo); } } else { BLDiplome.Update(this.D.ID, getDataFromInterface()); MessageBox.Show("Diplome mis à jour avec succès", "Modification d'un diplome", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); } }
private void btnValider_Click(object sender, EventArgs e) { if (this.useMode == "Ajout") { try { ValidateData(); BLInscription.AddNew(getInscriptionFromInterface()); MessageBox.Show("Inscription ajoutée avec succès", "Ajout d'inscription", MessageBoxButtons.OK, MessageBoxIcon.Information); reset(); } catch (DataValidationException Exp) { MessageBox.Show(Exp.ExceptionMessage, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); AppearanceHandler.SetErrorAppearance(ErrorCtrls, ToolTipErrorInfo); } } else { BLInscription.Update(this.I.ID, getInscriptionFromInterface()); MessageBox.Show("Inscription mis à jour avec succès", "Mise à jour d'inscription", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); } }
private void StartDarkThemeButton_Click(object sender, RoutedEventArgs e) { AppearanceHandler handler = new AppearanceHandler(_autoFileSaver.Model); handler.SwitchToDarkTheme(); }