public void ClearCache() { ThreadHelper.JoinableTaskFactory .RunAsync( async() => { await _avatarProvider.ClearCacheAsync().ConfigureAwait(true); await UpdateAvatarAsync().ConfigureAwait(false); }) .FileAndForget(); }
public AvatarControl() { InitializeComponent(); InitializeComplete(); clearImagecacheToolStripMenuItem.Click += delegate { ClearCache(); }; foreach (DefaultImageType type in Enum.GetValues(typeof(DefaultImageType))) { var item = new ToolStripMenuItem { CheckOnClick = true, Tag = type, Text = type.ToString() }; item.Click += delegate { AppSettings.GravatarDefaultImageType = type; ClearCache(); }; defaultImageToolStripMenuItem.DropDownItems.Add(item); } return; void ClearCache() { ThreadHelper.JoinableTaskFactory .RunAsync( async() => { await _avatarProvider.ClearCacheAsync().ConfigureAwait(true); await UpdateAvatarAsync().ConfigureAwait(false); }) .FileAndForget(); } }