How to install and use Lottie/JSON animation code for WPF - wpf

This is my first time programming for windows platforms and I'm trying to do a UI/UX fluent and modern app. So, I've heard that the best over-platform way to do it is with vector animation and therefor with bodymotion and lottie, because the good design, soft movement and I could get the animations from a professional designer.
The problem is that I tried to install multiple times the nuget package for lottie animations in my WPF project as I read in the official web: https://learn.microsoft.com/en-au/windows/communitytoolkit/animations/lottie-scenarios/getting_started_json and I only obtained errors related to the framework version:
Could not install package 'Microsoft.Toolkit.Uwp.UI.Lottie'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.8', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Initially I thought that the problem was the .NET framework so I migrate the project to .NET Core. And then I've tried again and got:
Package Microsoft.Toolkit.Uwp.UI.Lottie 7.0.0-preview4 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Toolkit.Uwp.UI.Lottie 7.0.0-preview4 supports: uap10.0.16299 (UAP,Version=v10.0.16299)
Microsoft.UI.Xaml nuget package requires TargetPlatformMinVersion >= 10.0.15063.0 (current project is -1)
Investigating I understood that the packages were created for UWP and not for WPF. Consequently I investigate about XAML Islands, that brings UWP functions to WPF, but they only work with xaml map, I could't use to install nuget packages.
I don't find more information and don't know what I'm doing wrong.
I wonder:
What alternatives I have to add some soft and good looking animated buttons? Preferably with a complete documentation
There is a way to use lottie in WPF? Or it is unnecessarily complicate?
Which is the traditional way to animate and work with natively in WP?

Related

Robot Framework IDE Automate WPF

I'm trying to automate an application I developed in C# (WPF) using Robot Framework.
I already explored a bunch of alternatives:
White Library
https://github.com/Omenia/robotframework-whitelibrary
https://github.com/TestStack/White
Doesn't seem to be working.
AutoItLibrary:
https://pypi.org/project/robotframework-autoitlibrary/
https://github.com/HW71/AutoItLibrary
https://github.com/qitaos/robotframework-autoitlibrary
Doesn't work for WPF C# applications - Doesn't detect components
Sikuli
https://github.com/rainmanwy/robotframework-SikuliLibrary
http://rainmanwy.github.io/robotframework-SikuliLibrary/
Image detection doesn't work very well in WPF C# applications.
Has anyone been able to automate WPF C# applications using Robot Framework IDE?
Regards
We just released first stable version of WhiteLibrary. It should do the job.
https://github.com/Omenia/robotframework-whitelibrary
pip install --upgrade robotframework-whitelibrary
Unfortunately, WhiteLibrary is build on the White automation framework which has been deprecated since December 11, 2019. While WhiteLibrary itself is not officially deprecated, the last release is also from 2019.
There appears to be a newer framework called FlaUI, which is wrapped by RobotFramework-FlaUI. This project is still under active development currently and likely a more future-proof choice than WhiteLibrary.

Why MVVM Light copies system assemblies to application folder?

Adding MVVM Light reference to a WPF projects adds a large number of system assemblies to the list of dependencies in the accompanying MSI Setup project. These assemblies (50+ in number) are then copied to the application folder when the app is installed. Why is it so? Why can't it reference it from GAC directly?
Note: Copy Local option is set to True for MVVMLight.dll. I obviously can't set it to False.
Reproducing it is extremely simple. I'm using VS2015 Community.
Create a new WPF Application project.
Add NuGet reference to MVVM Light (or the Lib-only version; doesn't matter).
Add an MSI Setup project to the solution (must have the extension installed).
Add Primary Project Output of WPF application to the setup project.
There you go. A long list of System.X.Y will be added to the list. If you build and install the setup project, you'll see all these DLLs in Program Files folder.
Why? And how to fix it?
Update
The problem does not appear if WPF application targets .NET Framework 4.0 and you add NuGet reference AFTER that. But if you target .NET 4.5, 4.5.1 or 4.6, the long list of dependencies appears again. Think MVVM Light (or NuGet) is having trouble finding the correct package sub-folder.
I don't know why it happens but I can offer a workaround. Just open the project's Detected Dependencies folder, select all of the System dlls, right-click and select Exclude.
Overly agressive dependency scanning is one of the many reasons I don't use Visual Studio Deployment Projects. Instead I use WiX / IsWiX. Both open source and the later written by myself.
For more information see:
http://www.github.com/iswix-llc/iswix-tutorials

ReactiveUI + Portable Class Library?

I'm porting a WPF app over to Windows Store app. I have some view models that I would like to put into a Portable Class Library. That code uses reactiveui framework. I created the library and I use nuget package manager to add reactiveui to the project. I get this:
Could not install package 'reactiveui-platforms 5.4.0'. You are trying to install this package into a project that targets 'portable-net45+wp80+win', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Is this really an unsupported configuration or am I doing it wrong?
ReactiveUI-Platforms is specifically only the platform-specific code. You need to just reference ReactiveUI-Core in your PCL and reference ReactiveUI-Platforms in your WPF and Windows Store apps, and everything should work.

How To Resolve MVVM Light NuGet Silverlight 5 Conflict With Microsoft.Practices.ServiceLocation DLL

We have a Silverlight 5 project and we currently have a folder of shared library DLL's. We are in the process of changing to use NuGet for these libraries wherever possible.
One of the NuGet packages we want to use is MVVMLight, to replace the MVVM Light SL4 DLL's we are currently using, which were never upgraded when we moved from SL4 to SL5.
However, when we installed the NuGet package containing the SL5 DLL's it automatically changed our existing references to the Microsoft.Practices.ServiceLocation DLL file to one which came with the MVVM Light package, which has the same version number, but a different public key.
This has caused a conflict with some of our other code which is using the Prism library, which uses the Microsoft.Practices.ServiceLocation DLL, but, signed with the original public key.
Obviously we cannot use the same named DLL twice in the same folder, so, any suggestion on how to resolve this issue, whilst keeping both Prism and MVVM Light packages installed from NuGet.
Thanks very much,
Martyn.
I have exactly the same problem with Microsoft.Practices.ServiceLocation.dll. In my case, this could be resolve if the nuget package of MvvmLight was dependent of CommonServiceLocator as I suggested here : http://mvvmlight.codeplex.com/discussions/429311
So far, no news about that.
Edit : Laurent just push a version of MVVM Light using the CommonServiceLocator from Nuget.
The Portable.CommonServiceLocator NuGet package contains the existing signed CSL binaries as well as the PCL one that supports windows 8, .net 4.5 and others. Still waiting on Microsoft to include the PCL in their official package, but the binaries are the same in the one I mentioned.
You can also try using Portable.MvvmLightLibs, which is a PCL version. That one supports all of the frameworks (WP7.5+, .NET 4.5, Store, SL4+) and uses the official Microsoft-signed CSL libraries.

How to make an setup just like Devexpress installation (v11.1.8)?

I want to pack my file in to a single executable file "setup.exe", my application is written in c# and WPF, I know that there are a lot of applications out in the store for creating a installation pack, but the point is which one would help me to build my installation pack just like Devexpress dose ?
For an UI similar to DevExpress you will need a setup authoring tool which offers an external UI and rich graphics.
Advanced Installer and InstallShield have some great UI themes which can get you started. You can also find a list of setup tools here:
http://en.wikipedia.org/wiki/List_of_installation_software
You'll probably have to roll a custom solution for this one. I expect nothing less of the Devexpress team then creating their own installer.
If you're application is not heavily bound into the registry and all kind of windows folders it should not be that hard to create an application that extracts some files into a directory and create some great UI while copying.

Resources