Skip to content

Conversation

@jjw24
Copy link
Member

@jjw24 jjw24 commented Jul 27, 2021

Repro:
Going to any context menu other than pm install and select open website will get the exception pop up

Fix:

  • Added handling when the object can not be cast as UserPlugins. This means the selected result was not provided the plugins list from the manifest, as a result we bypass creating menu items for them.
  • Added context menu for pm update

Tested:

  • pm install and pm update all can use the context menu
  • all other context menus will go to the default items with out those options available in install and update

@jjw24 jjw24 added the bug Something isn't working label Jul 27, 2021
@jjw24 jjw24 added this to the 1.8.1 milestone Jul 27, 2021
@jjw24 jjw24 self-assigned this Jul 27, 2021
@jjw24 jjw24 enabled auto-merge July 27, 2021 10:38
Copy link
Member

@taooceros taooceros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add the contextdata in RequestUninstall

var results = Context.API
.GetAllPlugins()
.Select(x =>
new Result
{
Title = $"{x.Metadata.Name} by {x.Metadata.Author}",
SubTitle = x.Metadata.Description,
IcoPath = x.Metadata.IcoPath,
Action = e =>
{
string message = string.Format(
Context.API.GetTranslation("plugin_pluginsmanager_uninstall_prompt"),
x.Metadata.Name, x.Metadata.Author,
Environment.NewLine, Environment.NewLine);
if (MessageBox.Show(message,
Context.API.GetTranslation("plugin_pluginsmanager_uninstall_title"),
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
Application.Current.MainWindow.Hide();
Uninstall(x.Metadata);
Context.API.RestartApp();
return true;
}
return false;
}
});

@jjw24
Copy link
Member Author

jjw24 commented Jul 27, 2021

Could you also add the contextdata in RequestUninstall

var results = Context.API
.GetAllPlugins()
.Select(x =>
new Result
{
Title = $"{x.Metadata.Name} by {x.Metadata.Author}",
SubTitle = x.Metadata.Description,
IcoPath = x.Metadata.IcoPath,
Action = e =>
{
string message = string.Format(
Context.API.GetTranslation("plugin_pluginsmanager_uninstall_prompt"),
x.Metadata.Name, x.Metadata.Author,
Environment.NewLine, Environment.NewLine);
if (MessageBox.Show(message,
Context.API.GetTranslation("plugin_pluginsmanager_uninstall_title"),
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
Application.Current.MainWindow.Hide();
Uninstall(x.Metadata);
Context.API.RestartApp();
return true;
}
return false;
}
});

Because we are not creating results from UserPlugins object, it's going to require a whole lot of extra code to match up, bare in mind default plugins are not in the manifest list so it's not in the UserPlugins object.

Just thought this is not so necessary to implement unless you feel otherwise.

Co-authored-by: Kevin Zhang <[email protected]>
@taooceros
Copy link
Member

Because we are not creating results from UserPlugins object, it's going to require a whole lot of extra code to match up, bare in mind default plugins are not in the manifest list so it's not in the UserPlugins object.

Just thought this is not so necessary to implement unless you feel otherwise.

Yeah probably not that easy to do so. Leave it in the future if needed.

@jjw24 jjw24 requested a review from taooceros July 27, 2021 11:31
@jjw24 jjw24 merged commit 8f5848f into dev Jul 27, 2021
@jjw24 jjw24 deleted the fix_pluginsmanager_contextmenu branch July 27, 2021 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants