How to add a ResourceDictionary to MergedDictionaries of the MainWindow in Caliburn.Micro - caliburn.micro

I am using MEF Bootstrapper. One of the plugins I have wants to add a ResourceDictionary to MergedDictionaries of the MainWindow
I have tried this.
Exported IMainWindowView through MEF and imported it into that plugin. Turned out the one Imported through MEF is separate instance, not the one Application is using.
How do I achieve this ?
Thanks

Related

Gluon Client Maven Plugin: Which type of classes should be specified under 'reflectionList' configuration

In the official documentation of Gluon Client maven plugin, the 'reflectionList' section is explained as
List of additional full qualified classes that will be added to the default reflection list, that already includes most of the JavaFX classes.
Tbh, it doesn't clearly explain what type of classes should be added in 'reflectionList'. In a pom.xml file of a gluon sample some of the classes in that project are not specified.
So, what kind of classes do we have to specify in 'reflectionList'?
You only have to add classes which are loaded via reflection. This happens for example when you are using FXML. It's mostly a try and error game unless you are following a more systematic approach and use the GraalVM native-image agent.
In most cases, controllers for FXML views created in Scene Builder. In the FXML file you specify what class should be a controller for a view generated from this file, and in that controller class you put fields and methods which are linked to elements in FXML. Sometimes, unfortunately, if you use a certain JavaFX widget in FXML you will also have to specify it on the reflection list (happened to me with javafx.scene.control.TitledPane).
There is way to make it more fine-grained and specify certain methods instead of all classes, but I wouldn't recomment it. Please take a look here for details: How to solve fxml loading exceptions in compiled JavaFX project using GluonHQ client, Native Image and GraalVM?
My solution is to keep FXML simple and enrich it with additional styles, register methods on actions (unless they are straightforward, like onClick), etc., in the code, so that I don't have to deal much with reflection.

How can I see custom components in QtDesigner?

I am developing a Qt Quick 2 Application using QML to define my components.
I would like to create a folder in the project where to put common components (such as customized buttons or labels), and specifically I would like to see this components in the Qt Designer view, in order to be able to drag-drop those elements while designing new views.
I see that the Qt Designer view only shows to you the components located at the same path of the qml that you are currently developing, but I haven't found a way to display components located in other paths.
The project tree should be something like this:
RootFolder
CommonComponents
Views
where the qmls developed in the Views folder will use components defined in the CommonComponents folder.
Does anyone know how to configure the project or the QtDesigner in order to achieve this goal?
Thanks

Unable to use playn JSON classes in Eclipse

I'm not able to access the playn.core.json.* classes inside eclipse even though everything else works in general. I have used this http://code.google.com/p/playn/wiki/GettingStarted in setting up my eclipse project.
However the following classes are visible -
JsonImpl
JsonParserException
JsonSink
JsonTypedArray
JsonWriterException
When I go to the referenced libraries in Eclipse, I can see playn.core.json and
can see all classes inside it. I'm just not able to use them inside my
code.
Thanks!
Just saw the samples.
You're supposed to use the interface Json.Object/Json.Array.
Use PlayN.json().createObject() to create a new Json.Object instance, and PlayN.json().createArray() to create a new Json.Array instance.
Make sure you have statically imported playn.core.PlayN.*

How to create a QT plugin that customizes UI?

We would want the users to be able to optionally customize our QT applications. So if they would want to create their own theme for our applications, all they have to do is load their own CSS file.
Do we really need to create a plugin to be able to do that? If yes, could somebody give me the basic steps/ or a jump start on how to do it? If no, are there features in QT that I need to know to be able to do that without creating a plugin?
I have a Jabber instant messenger which is plugin based and written in Qt. It includes a style plugin that does exactly what you describe. The source for that plugin is here:
https://github.com/sje397/saje/tree/master/plugins/styles/
(Note: this is a plugin for my application - not a 'Qt style plugin')
Basically all you need to do is load a style sheet and call QApplication::setStyleSheet:
QFile f("filename");
if(f.open(QIODevice::ReadOnly)) {
qApp->setStyleSheet(f.readAll());
}
An example of a valid style sheet is here. Note that it is for my app, so includes some of my own class names etc.

Converting a Flex custom component to a module

How to take an existing custom component in Flex and convert it into a module?
EDIT: What should be done in the mxml where this custom component is used? Should it be replaced with a to load the module? If yes, how to deal with code that uses instances of the components?
Change the root mxml tag to <mx:Module... then in the properties of the project click on the "Flex Modules" button and add it in there.
Edit: This is assuming your modules are in the same project. I prefer to create new projects per module as it makes development easier with multiple developers. So what I do is create a new project, change the root to <mx:Module..., in the properties of the module project I disable it from creating the html wrapper, then in my main project I just load up the module swf's based on what menu item was clicked
You would need to place a ModuleLoader in place of the custom component like
<mx:ModuleLoader id="moduleLoader" width="100%" height="100%"/>
And load the Module using the url.
moduleLoader.unloadModule();
moduleLoader.url = "path\to\module.swf";
moduleLoader.loadModule();
You can keep the above code in a function and load modules.
If your module will be used in the same project only, you can create a new MXML Module that can be optimized for the project from FlexBuilder

Resources