Skip to content

Commit 6deb978

Browse files
committed
Initialize FileExplorer when UI is ready...
1 parent 6cdbdad commit 6deb978

File tree

2 files changed

+32
-38
lines changed

2 files changed

+32
-38
lines changed

External/Plugins/FileExplorer/PluginMain.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public class PluginMain : IPlugin
2828
private DockContent pluginPanel;
2929
private PluginUI pluginUI;
3030
private Image pluginImage;
31-
3231
private const String explorerAction = "explorer.exe /e,{0}";
3332
private const String cmdAction = "cmd.exe";
3433

@@ -131,6 +130,10 @@ public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
131130
{
132131
switch (e.Type)
133132
{
133+
case EventType.UIStarted:
134+
this.pluginUI.Initialize(null, null);
135+
break;
136+
134137
case EventType.Command:
135138
DataEvent evnt = (DataEvent)e;
136139
switch (evnt.Action)
@@ -272,7 +275,7 @@ public void InitBasics()
272275
/// </summary>
273276
public void AddEventHandlers()
274277
{
275-
EventType eventMask = EventType.Command | EventType.FileOpen;
278+
EventType eventMask = EventType.Command | EventType.FileOpen | EventType.UIStarted;
276279
EventManager.AddEventHandler(this, eventMask, HandlingPriority.Low);
277280
}
278281

External/Plugins/FileExplorer/PluginUI.cs

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,38 @@
1010
using PluginCore.Localization;
1111
using PluginCore.Managers;
1212
using PluginCore.Utilities;
13+
using Ookii.Dialogs;
1314

1415
namespace FileExplorer
1516
{
1617
public class PluginUI : DockPanelControl
1718
{
18-
private System.Windows.Forms.ListViewEx fileView;
19-
private System.Windows.Forms.ToolStrip toolStrip;
20-
private System.Windows.Forms.ContextMenuStrip menu;
21-
private System.Windows.Forms.ToolStripMenuItem runButton;
22-
private System.Windows.Forms.ToolStripMenuItem editButton;
23-
private System.Windows.Forms.ToolStripMenuItem renameButton;
24-
private System.Windows.Forms.ToolStripMenuItem deleteButton;
25-
private System.Windows.Forms.ToolStripMenuItem shellButton;
26-
private System.Windows.Forms.ToolStripMenuItem pasteButton;
27-
private System.Windows.Forms.ToolStripMenuItem copyButton;
28-
private System.Windows.Forms.ToolStripSeparator separator;
29-
private System.Windows.Forms.ToolStripSpringComboBox selectedPath;
30-
private System.Windows.Forms.ToolStripButton browseButton;
31-
private System.Windows.Forms.ToolStripButton syncronizeButton;
32-
private System.Windows.Forms.ColumnHeader fileHeader;
33-
private System.Windows.Forms.ColumnHeader sizeHeader;
34-
private System.Windows.Forms.ColumnHeader typeHeader;
35-
private System.Windows.Forms.ColumnHeader modifiedHeader;
36-
private Ookii.Dialogs.VistaFolderBrowserDialog folderBrowserDialog;
37-
private System.Windows.Forms.ListViewItem highlightedItem;
19+
private ListViewEx fileView;
20+
private ToolStrip toolStrip;
21+
private ContextMenuStrip menu;
22+
private ToolStripMenuItem runButton;
23+
private ToolStripMenuItem editButton;
24+
private ToolStripMenuItem renameButton;
25+
private ToolStripMenuItem deleteButton;
26+
private ToolStripMenuItem shellButton;
27+
private ToolStripMenuItem pasteButton;
28+
private ToolStripMenuItem copyButton;
29+
private ToolStripSeparator separator;
30+
private ToolStripSpringComboBox selectedPath;
31+
private ToolStripButton browseButton;
32+
private ToolStripButton syncronizeButton;
33+
private ColumnHeader fileHeader;
34+
private ColumnHeader sizeHeader;
35+
private ColumnHeader typeHeader;
36+
private ColumnHeader modifiedHeader;
37+
private VistaFolderBrowserDialog folderBrowserDialog;
38+
private ListViewItem highlightedItem;
3839
private ImageListManager imageList;
39-
private System.Boolean updateInProgress;
40-
private System.String previousItemLabel;
41-
private System.String autoSelectItem;
42-
private System.Int64 lastUpdateTimeStamp;
43-
private System.Int32 prevColumnClick;
40+
private Boolean updateInProgress;
41+
private String previousItemLabel;
42+
private String autoSelectItem;
43+
private Int64 lastUpdateTimeStamp;
44+
private Int32 prevColumnClick;
4445
private ListViewSorter listViewSorter;
4546
private FileSystemWatcher watcher;
4647
private PluginMain pluginMain;
@@ -204,16 +205,6 @@ private void InitializeComponent()
204205

205206
#region Methods And Event Handlers
206207

207-
/// <summary>
208-
/// We have to do final initialization here because we might
209-
/// need to have a window handle to pre-populate the file list.
210-
/// </summary>
211-
protected override void OnCreateControl()
212-
{
213-
base.OnCreateControl();
214-
this.Initialize(null, null);
215-
}
216-
217208
/// <summary>
218209
/// Shows the explorer shell menu
219210
/// </summary>
@@ -359,7 +350,7 @@ public void AddToMRU(String path)
359350
/// <summary>
360351
/// List last open path on load
361352
/// </summary>
362-
private void Initialize(Object sender, System.EventArgs e)
353+
public void Initialize(Object sender, System.EventArgs e)
363354
{
364355
String path = PathHelper.AppDir;
365356
String pathToCheck = this.pluginMain.Settings.FilePath;

0 commit comments

Comments
 (0)