void Command_WeblogForm() { WeblogFormCommand = new CommandBase((parameter, command) => { var action = parameter as string; if (string.IsNullOrEmpty(action)) { return; } if (action == "openweblogfolder") { ShellUtils.OpenFileInExplorer(WeblogModel.Configuration.PostsFolder); return; } // actions that require form to be open var form = new WeblogForm(WeblogModel) { Owner = Model.Window }; form.Model.AppModel = Model; form.Show(); switch (action) { case "posttoweblog": form.TabControl.SelectedIndex = 0; break; case "newweblogpost": form.TabControl.SelectedIndex = 1; break; case "downloadweblogpost": form.TabControl.SelectedIndex = 2; break; case "configureweblog": form.TabControl.SelectedIndex = 3; break; } }, (p, c) => { var action = p as string; if (string.IsNullOrEmpty(action)) { return(true); } if (action == "posttoweblog") { return(Model.ActiveEditor != null); } return(true); }); }
public override void OnNotifyAddin(string command, object parameter) { if (command == "newweblogpost") { var form = new WeblogForm(WeblogModel) { Owner = Model.Window }; form.Model.AppModel = Model; form.Show(); form.TabControl.SelectedIndex = 1; } }
void Command_WeblogForm() { WeblogFormCommand = new CommandBase((parameter, command) => { var action = parameter as string; if (string.IsNullOrEmpty(action)) { return; } var form = new WeblogForm(WeblogModel) { Owner = Model.Window }; form.Model.AppModel = Model; form.Show(); switch (action) { case "posttoweblog": form.TabControl.SelectedIndex = 0; break; case "newweblogpost": form.TabControl.SelectedIndex = 1; break; case "downloadweblogpost": form.TabControl.SelectedIndex = 2; break; case "configureweblog": form.TabControl.SelectedIndex = 3; break; } }, (p, c) => { var action = p as string; if (string.IsNullOrEmpty(action)) { return(true); } if (action == "posttoweblog") { return(Model.ActiveEditor != null); } return(true); }); }
public override void OnExecute(object sender) { // read settings on startup WeblogAddinConfiguration.Current.Read(); WeblogForm?.Close(); WeblogForm = new WeblogForm(WeblogModel) { Owner = Model.Window }; WeblogModel.AppModel = Model; WeblogForm.Show(); }