public GmailInterruptionTrigger() : base(TimeSpan.FromMinutes(1)) { _dispatcher = Dispatcher.CurrentDispatcher; // Recover settings, or ask for them if not asked before. _config = ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location); _settings = _config.Sections.Get(GmailSection) as GoogleConfiguration; if (_settings != null) { if (_settings.Password.Length == 0) { return; } byte[] decryptedData = ProtectedData.Unprotect( Convert.FromBase64String(_settings.Password), Entropy, DataProtectionScope.CurrentUser); _password = Encoding.Unicode.GetString(decryptedData).ToSecureString(); } else { _settings = new GoogleConfiguration(); _config.Sections.Add(GmailSection, _settings); AskSettings(); } }
public GmailInterruptionTrigger() : base(TimeSpan.FromMinutes( 1 )) { _dispatcher = Dispatcher.CurrentDispatcher; // Recover settings, or ask for them if not asked before. _config = ConfigurationManager.OpenExeConfiguration( Assembly.GetExecutingAssembly().Location ); _settings = _config.Sections.Get( GmailSection ) as GoogleConfiguration; if ( _settings != null ) { if ( _settings.Password.Length == 0 ) { return; } byte[] decryptedData = ProtectedData.Unprotect( Convert.FromBase64String( _settings.Password ), Entropy, DataProtectionScope.CurrentUser ); _password = Encoding.Unicode.GetString( decryptedData ).ToSecureString(); } else { _settings = new GoogleConfiguration(); _config.Sections.Add( GmailSection, _settings ); AskSettings(); } }