C# Class Nexus.Client.PluginManagement.UI.PluginManagerControl

显示文件 Open project: NexusMods/NexusModManager-4.5 Class Usage Examples

Private Properties

Property Type Description
ActivePlugins_CollectionChanged void
ColumnSizer_Tick void
FormatPluginCountsReport void
GetExportToFileArgs string
GetImportFromFileArgs string
GetSelectedPlugin Plugin
GetSelectedPlugins IList
InitializeComponent void
ManagedPlugins_CollectionChanged void
PluginManagerControl_FormClosing void
PluginManagerControl_Load void
ViewModel_ExportFailed void
ViewModel_ExportSucceeded void
ViewModel_ImportFailed void
ViewModel_ImportPartiallySucceeded void
ViewModel_ImportSucceeded void
ViewModel_ManagingMultiplePlugins void
ViewModel_SortingPlugins void
rlvPlugins_ColumnWidthChanging void
rlvPlugins_ItemCheck void
rlvPlugins_ItemsReordered void
rlvPlugins_ItemsReordering void
rlvPlugins_Resize void
rlvPlugins_SelectedIndexChanged void

Public Methods

Method Description
PluginManagerControl ( ) : System

The default constructor.

SetCommandBackupPlugCStatus ( bool p_booCheck ) : void

Protected Methods

Method Description
AddPluginToList ( Plugin p_plgAdded ) : void

Adds the given plugin to the view's list. If the plugin already exists in the list, it is replaced with the new version.

DisableAllPlugins ( ) : void

Disable all plugins.

Dispose ( bool disposing ) : void

Clean up any resources being used.

EnableAllPlugins ( ) : void

Enable all plugins.

InsertPluginToList ( Int32 p_intIndex, Plugin p_plgAdded ) : void

Inserts the given plugin to the view's list. If the plugin already exists in the list, it is replaced with the new version an moved to the given index.

LoadMetrics ( ) : void

Loads the control's saved metrics.

OnLoad ( EventArgs e ) : void

Raises the UserControl.Load event of the control.

This loads any saved control metrics.

RefreshPluginIndices ( ) : void

Refreshes the displayed indicies of the listed plugins.

SetCommandExecutableStatus ( ) : void

Sets the executable status of the commands.

SetPluginActivationCheck ( ListViewItem p_lviPlugin, bool p_booIsActive ) : void

Sets the checked state of the given list view item.

This sets the flag indicating we are changing the checked state of the list view item (as opposed to the user making the change), thus preventing the execution of commands as a result.

SetPluginActive ( Plugin p_plgActivated, bool p_booIsActive ) : void

Show the given plugin as being either active or inactive in the view.

SizeColumnsToFit ( ) : void

This resizes the columns to fill the list view. The index column is fixed width.

Private Methods

Method Description
ActivePlugins_CollectionChanged ( object sender, NotifyCollectionChangedEventArgs e ) : void

Handles the INotifyCollectionChanged.CollectionChanged event of the view model's active plugin list.

This updates the list of plugins to refelct changes to which plugins are active.

ColumnSizer_Tick ( object sender, EventArgs e ) : void

Handles the Timer.Tick event of the column sizer timer.

We use a timer to autosize the columns in the list view. This is because there is a bug in the control such that if we reszize the columns continuously while the list view is being resized, the item will sometimes disappear. To work around this, the list view resize event continually resets the timer. This means the timer will only fire occasionally during the resize, and avoid the disappearing items issue.

FormatPluginCountsReport ( ImportSucceededEventArgs p_iseEventArgs, System &p_sbMessage, string &p_strDetails ) : void

Formats the text to display when importing a load order succeeds.

GetExportToFileArgs ( ) : string

Returns the full path of the text file to export to.

GetImportFromFileArgs ( ) : string

Returns the full filename specifying the text file to import from.

GetSelectedPlugin ( ) : Plugin

Retruns the plugin that is currently selected in the view.

GetSelectedPlugins ( ) : IList

Retruns the plugins that are currently selected in the view.

InitializeComponent ( ) : void

Required method for Designer support - do not modify the contents of this method with the code editor.

ManagedPlugins_CollectionChanged ( object sender, NotifyCollectionChangedEventArgs e ) : void

Handles the INotifyCollectionChanged.CollectionChanged event of the view model's installed plugin list.

This updates the list of plugins to refelct changes to the installed plugin list.

PluginManagerControl_FormClosing ( object sender, FormClosingEventArgs e ) : void

Handles the Form.Closing event of the parent form.

This save the control's metrics.

PluginManagerControl_Load ( object sender, EventArgs e ) : void

Handles the UserControl.Load event.

This wires up the ListView.ItemCheck event of the plugin list. We need to wire it up after the control has loaded to that plugin activation status isn't superfluously changed as items are first added to the list. A simple boolean flag won't work, as items can be added before the control is loaded, which delays the firing of the ListView.ItemCheck event until after the control is loaded, at which point the flag would have been reset.

ViewModel_ExportFailed ( object sender, ExportFailedEventArgs e ) : void

Handles the PluginManagerVM.ExportFailed event of the view model.

This displays a simple error message.

ViewModel_ExportSucceeded ( object sender, ExportSucceededEventArgs e ) : void

Handles the PluginManagerVM.ExportSucceeded event of the view model.

This displays a simple success message.

ViewModel_ImportFailed ( object sender, ImportFailedEventArgs e ) : void

Handles the PluginManagerVM.ImportFailed event of the view model.

This displays a simple error message.

ViewModel_ImportPartiallySucceeded ( object sender, ImportSucceededEventArgs e ) : void

Handles the PluginManagerVM.ImportPartiallySucceeded event of the view model.

This displays a message indicating partial success and detailing the total, imported and not imported plugin counts.

ViewModel_ImportSucceeded ( object sender, ImportSucceededEventArgs e ) : void

Handles the PluginManagerVM.ImportSucceeded event of the view model.

This displays a simple success message.

ViewModel_ManagingMultiplePlugins ( object sender, EventArgs e ) : void

Handles the PluginManagerVM.ManagingMultiplePlugins event of the view model.

This displays the progress dialog.

ViewModel_SortingPlugins ( object sender, EventArgs e ) : void

Handles the PluginManagerVM.SortingPlugins event of the view model.

This displays the progress dialog.

rlvPlugins_ColumnWidthChanging ( object sender, ColumnWidthChangingEventArgs e ) : void

Handles the ListView.ColumnWidthChanging event of the plugin list.

This resizes the column next to the column being resized to resize as well, so that the columns keep the list view filled.

rlvPlugins_ItemCheck ( object sender, ItemCheckEventArgs e ) : void

Handles the ListView.ItemCheck event of the plugin list.

This toggles activation of the selected plugin. This event is used instead of ListView.ItemChecked so that we can make sure the checked state only changes if the activation/deactivation was successful; if it wasn't, we keep the state the same.

rlvPlugins_ItemsReordered ( object sender, ReorderedItemsEventArgs e ) : void

Handles the ReorderableListView.ItemsReordered event of the plugin list.

This reorders the moved plugins.

rlvPlugins_ItemsReordering ( object sender, ReorderingItemsEventArgs e ) : void

Handles the ReorderableListView.ItemsReordering event of the plugin list.

This makes sure the new order is going to be valid. If not, the reordering event is stopped.

rlvPlugins_Resize ( object sender, EventArgs e ) : void

Handles the Control.Resize event of the plugin list.

This resizes the columns to fill the list view. The index column is fixed width.

rlvPlugins_SelectedIndexChanged ( object sender, EventArgs e ) : void

Handles the ListView.SelectedIndexChanged event of the plugin list.

This displays the picture and description of the selected plugin.

Method Details

AddPluginToList() protected method

Adds the given plugin to the view's list. If the plugin already exists in the list, it is replaced with the new version.
protected AddPluginToList ( Plugin p_plgAdded ) : void
p_plgAdded Plugin The plugin to add to the view's list.
return void

DisableAllPlugins() protected method

Disable all plugins.
protected DisableAllPlugins ( ) : void
return void

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void

EnableAllPlugins() protected method

Enable all plugins.
protected EnableAllPlugins ( ) : void
return void

InsertPluginToList() protected method

Inserts the given plugin to the view's list. If the plugin already exists in the list, it is replaced with the new version an moved to the given index.
protected InsertPluginToList ( Int32 p_intIndex, Plugin p_plgAdded ) : void
p_intIndex Int32 The index at which to insert the plugin.
p_plgAdded Plugin The plugin to add to the view's list.
return void

LoadMetrics() protected method

Loads the control's saved metrics.
protected LoadMetrics ( ) : void
return void

OnLoad() protected method

Raises the UserControl.Load event of the control.
This loads any saved control metrics.
protected OnLoad ( EventArgs e ) : void
e EventArgs An describing the event arguments.
return void

PluginManagerControl() public method

The default constructor.
public PluginManagerControl ( ) : System
return System

RefreshPluginIndices() protected method

Refreshes the displayed indicies of the listed plugins.
protected RefreshPluginIndices ( ) : void
return void

SetCommandBackupPlugCStatus() public method

public SetCommandBackupPlugCStatus ( bool p_booCheck ) : void
p_booCheck bool
return void

SetCommandExecutableStatus() protected method

Sets the executable status of the commands.
protected SetCommandExecutableStatus ( ) : void
return void

SetPluginActivationCheck() protected method

Sets the checked state of the given list view item.
This sets the flag indicating we are changing the checked state of the list view item (as opposed to the user making the change), thus preventing the execution of commands as a result.
protected SetPluginActivationCheck ( ListViewItem p_lviPlugin, bool p_booIsActive ) : void
p_lviPlugin ListViewItem The list view item whose checked state is to be changed.
p_booIsActive bool Whether the item should be active.
return void

SetPluginActive() protected method

Show the given plugin as being either active or inactive in the view.
protected SetPluginActive ( Plugin p_plgActivated, bool p_booIsActive ) : void
p_plgActivated Plugin The plugin whose active status has changed.
p_booIsActive bool Whether the given plugin is active.
return void

SizeColumnsToFit() protected method

This resizes the columns to fill the list view. The index column is fixed width.
protected SizeColumnsToFit ( ) : void
return void