public static void Return() { string chemin = Chemins.getCheminConfiguration(); RegistryKey Nkey = Registry.CurrentUser; try { Object[] lic = new Object[3]; RegistryKey valKey = Nkey.OpenSubKey(@chemin, true); if (valKey != null) { langue = (string)(valKey.GetValue("langue") != null ? valKey.GetValue("langue") : Constantes.LANGUE_ANGLAIS); template = (string)(valKey.GetValue("nom_template") != null ? valKey.GetValue("nom_template") : "Basique"); back_color_Form = (string)(valKey.GetValue("back_color_form") != null ? valKey.GetValue("back_color_form") : "GradientInactiveCaption"); fore_color_Label = (string)(valKey.GetValue("fore_color_label") != null ? valKey.GetValue("fore_color_label") : "ControlText"); back_color_Text = (string)(valKey.GetValue("back_color_text") != null ? valKey.GetValue("back_color_text") : "Control"); fore_color_Text = (string)(valKey.GetValue("fore_color_text") != null ? valKey.GetValue("fore_color_text") : "WindowText"); police_Label = (string)(valKey.GetValue("police_label") != null ? valKey.GetValue("police_label") : "Microsoft Sans Serif"); police_Text = (string)(valKey.GetValue("police_text") != null ? valKey.GetValue("police_text") : "Microsoft Sans Serif"); taille_Label = float.Parse((string)(valKey.GetValue("taille_label") != null ? valKey.GetValue("taille_label") : "8,25")); taille_Text = float.Parse((string)(valKey.GetValue("taille_text") != null ? valKey.GetValue("taille_text") : "8,25")); } } catch (Exception e) { Messages.Exception(e); } finally { Nkey.Close(); } }
public static void Save() { string chemin = Chemins.getCheminConfiguration(); RegistryKey Nkey = Registry.CurrentUser; try { RegistryKey valKey = Nkey.OpenSubKey(@chemin, true); if (valKey == null) { Nkey.CreateSubKey(@chemin); valKey = Nkey.OpenSubKey(@chemin, true); } valKey.SetValue("langue", langue); valKey.SetValue("nom_template", template); valKey.SetValue("back_color_form", back_color_Form); valKey.SetValue("fore_color_label", fore_color_Label); valKey.SetValue("back_color_text", back_color_Text); valKey.SetValue("fore_color_text", fore_color_Text); valKey.SetValue("police_label", police_Label); valKey.SetValue("police_text", police_Text); valKey.SetValue("taille_label", taille_Label); valKey.SetValue("taille_text", taille_Text); } catch (Exception e) { Messages.Exception(e); } finally { Nkey.Close(); } }