public AccountManager() { InitializeComponent(); this.Title = CIV.strings.AccountManager_Title; this.DataContext = this; _settings = ProgramSettings.Load(); RefreshInternetAccess(); ClientList = new ObservableCollection <CIVAccount>(); // Chargement de la liste des modèles de courriel MailTemplateList = new ObservableCollection <string>(); MailFactory mailFactory = new MailFactory(); for (int i = 0; i < mailFactory.MailTemplates.Count; i++) { MailTemplateList.Add(mailFactory.MailTemplates[i].Name); } foreach (CIVAccount account in _settings.Accounts) { ClientList.Add(account); } InitializeBinding(txtUsername, txtUsername.GetBindingExpression(TextBox.TextProperty).ParentBinding, "IsEnabled"); InitializeBinding(txtQuotaQuantity, txtQuotaQuantity.GetBindingExpression(TextBox.TextProperty).ParentBinding, "IsEnabled"); InitializeBinding(txtMailRecipients, txtMailRecipients.GetBindingExpression(TextBox.TextProperty).ParentBinding, "IsEnabled"); chkSendMail.IsEnabled = _settings.EmailSMTP.Active; }
//ListBox dragSource = null; public GeneralSettings() { InitializeComponent(); this.Title = CIV.strings.GeneralSettings_Title; _settings = ProgramSettings.Load(); defaultLanguage = _settings.UserLanguage; DisplayInfoList = new ObservableCollection <DisplayInfoTypes>(); DisplayInfoListSystray = new ObservableCollection <DisplayInfoTypes>(); lbDisplayList.DataContext = DisplayInfoList; lbDisplayListSystray.DataContext = DisplayInfoListSystray; GenerateDisplayList(); GenerateDisplaySystrayList(); try { RegistryKey rkAutorun = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"); if (rkAutorun != null) { _settings.LaunchAtStartup = rkAutorun.GetValueNames().Contains("CIV"); rkAutorun.Close(); } else { _settings.LaunchAtStartup = false; } } catch (Exception e) { LogFactory.LogEngine.Instance.Add(e); } _launchAtStartup = _settings.LaunchAtStartup; this.DataContext = _settings; // Windows XP et moins if (Environment.OSVersion.Version.Major < 6) { tabSystray.Visibility = System.Windows.Visibility.Collapsed; } }