private void UpdateProvider() { var setup = UserConfigManager.Config.EmailSetup; switch (setup?.ProviderType) { case EmailProviderType.Gmail: lblProvider.Text = SettingsResources.EmailProviderType_Gmail + '\n' + setup.GmailUser; break; case EmailProviderType.OutlookWeb: lblProvider.Text = SettingsResources.EmailProviderType_OutlookWeb + '\n' + setup.OutlookWebUser; break; case EmailProviderType.CustomSmtp: lblProvider.Text = setup.SmtpHost + '\n' + setup.SmtpUser; break; case EmailProviderType.System: lblProvider.Text = setup.SystemProviderName ?? systemEmailClients.GetDefaultName(); break; default: lblProvider.Text = SettingsResources.EmailProvider_NotSelected; break; } }
private void FEmailProvider_Load(object sender, EventArgs e) { providerWidgets = new List <EmailProviderWidget>(); systemClientNames = systemEmailClients.GetNames(); defaultSystemClientName = systemEmailClients.GetDefaultName(); foreach (var clientName in systemClientNames.OrderBy(x => x == defaultSystemClientName ? 0 : 1)) { providerWidgets.Add(new EmailProviderWidget { ProviderType = EmailProviderType.System, ProviderIcon = systemEmailClients.GetIcon(clientName) ?? Icons.mail_yellow, ProviderName = clientName, ClickAction = () => ChooseSystem(clientName) }); } if (gmailOauthProvider.HasClientCreds) { providerWidgets.Add(new EmailProviderWidget { ProviderType = EmailProviderType.Gmail, ProviderIcon = Icons.gmail, ProviderName = EmailProviderType.Gmail.Description(), ClickAction = () => ChooseOauth(gmailOauthProvider) }); } if (outlookWebOauthProvider.HasClientCreds) { providerWidgets.Add(new EmailProviderWidget { ProviderType = EmailProviderType.OutlookWeb, ProviderIcon = Icons.outlookweb, ProviderName = EmailProviderType.OutlookWeb.Description(), ClickAction = () => ChooseOauth(outlookWebOauthProvider) }); } //providerWidgets.Add(new EmailProviderWidget //{ // ProviderType = EmailProviderType.CustomSmtp, // ProviderIcon = Icons.email_setting, // ProviderName = EmailProviderType.CustomSmtp.Description(), // ClickAction = ChooseCustomSmtp //}); // Put the configured provider at the top var defaultWidget = GetDefaultWidget(); if (defaultWidget != null) { providerWidgets.Remove(defaultWidget); providerWidgets.Insert(0, defaultWidget); } ShowWidgets(); }