Register for WeblogListChanged event

This commit is contained in:
Scott Lovegrove 2015-12-21 00:03:47 +00:00
parent 8ab8c9b796
commit f670c3a20d
1 changed files with 8 additions and 2 deletions

View File

@ -102,7 +102,7 @@ namespace OpenLiveWriter.PostEditor
_editingManager = editingManager;
_editingManager.BlogChanged += new EventHandler(_editingManager_BlogChanged);
_editingManager.BlogSettingsChanged += new WeblogSettingsChangedHandler(_editingManager_BlogSettingsChanged);
_editingSite = editingSite;
BlogSettings.BlogSettingsDeleted += new BlogSettings.BlogSettingsListener(BlogSettings_BlogSettingsDeleted);
@ -114,6 +114,11 @@ namespace OpenLiveWriter.PostEditor
InitializeUI();
}
private void EditingSiteOnWeblogListChanged(object sender, EventArgs eventArgs)
{
commandSelectBlog?.ReloadAndInvalidate();
}
void BlogSettings_BlogSettingsDeleted(string blogId)
{
commandSelectBlog.ReloadAndInvalidate();
@ -130,6 +135,8 @@ namespace OpenLiveWriter.PostEditor
commandWeblogPicker = new CommandWeblogPicker();
_editingSite.CommandManager.Add(commandWeblogPicker);
_editingSite.WeblogListChanged -= EditingSiteOnWeblogListChanged;
_editingSite.WeblogListChanged += EditingSiteOnWeblogListChanged;
commandAddWeblog = new Command(CommandId.AddWeblog);
commandAddWeblog.Execute += new EventHandler(commandAddWeblog_Execute);
@ -154,7 +161,6 @@ namespace OpenLiveWriter.PostEditor
{
if (WeblogSelected != null)
WeblogSelected(BlogSettings.GetBlogs(true)[commandSelectBlog.SelectedIndex].Id);
}
private void InitializeUI()