Conversation
XrmToolBox/New/PluginForm.cs
Outdated
| Task.Factory.StartNew(() => | ||
| { | ||
| System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5)); | ||
|
|
||
| this.Invoke((MethodInvoker)delegate | ||
| { | ||
| CustomTheme.Instance.ApplyTheme(this); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
@MscrmTools are you ok with this pattern? When attempting to support rendering plugins in darkmode, I was running to an issue in which we would call CustomTheme.Instance.ApplyTheme(this) before the Plugin had a chance to render. This meant that the main window of plugins wouldn't get themed.
Adding this statement - where we call ApplyTheme after a set amount of time - giving the plugin time to render it's WinForm - allowed the plugin to render in dark mode.
For example, I tested with Sql4CDS and got this result:
There was a problem hiding this comment.
Not sure if waiting a specific amount of time is the best way to handle this (even if I have no other idea for now)
There was a problem hiding this comment.
Yea, I agree it's hacky. The problem is - I don't see any method in the IPlugin interface that is like "PluginFinishedLoading". I think that would be an optimal solution. Each plug-in could load, and only once it's ready let xrm toolbox know. The only problem is adding a new method and then getting all plug-ins to implement the new method would be a nightmare.
| this.checkForUpdateToolStripMenuItem.Text = "Check for update"; | ||
| this.checkForUpdateToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdateToolStripMenuItem_Click); | ||
| // | ||
| // darkMode |
There was a problem hiding this comment.
@MscrmTools - I see you were down this road already, I updated the darkmode button. Do you think this should be the one and only way to trigger darkmode for plugins?


Dark Mode
Objective
Notes
Plugins To Support (I plan to test)