Skip to content
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

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

johnyenter-briars
Copy link

@johnyenter-briars johnyenter-briars commented Mar 26, 2024

Dark Mode

Objective

  • The objective of this PR is to stabilize the dark mode feature for XrmToolBox outlined in [Improvement] Dark Theme does not change much #1298
    • Critically, dark mode needs to support the theming of plugins globally
    • Currently only initial plugin support is there - and only a few plugins have been tested.

Notes

  • I have several open questions that I need your confirmation @MscrmTools on.
    • I will update this PR description as discussions evolve

Plugins To Support (I plan to test)

@johnyenter-briars johnyenter-briars marked this pull request as draft March 26, 2024 15:33
Comment on lines 63 to 71
Task.Factory.StartNew(() =>
{
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5));

this.Invoke((MethodInvoker)delegate
{
CustomTheme.Instance.ApplyTheme(this);
});
});
Copy link
Author

@johnyenter-briars johnyenter-briars Mar 26, 2024

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:

image

Copy link
Owner

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)

Copy link
Author

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
Copy link
Author

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?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants