-
-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dark Mode Styling #1325
base: master
Are you sure you want to change the base?
Dark Mode Styling #1325
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -927,6 +929,15 @@ private void InitializeComponent() | |||
this.checkForUpdateToolStripMenuItem.Text = "Check for update"; | |||
this.checkForUpdateToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdateToolStripMenuItem_Click); | |||
// | |||
// darkMode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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)