0 Comments

There’s now a new version of Blazor.Animate available which adds support for running animations manually. The animated component stays hidden until the animation which bring the component into the view is manually executed.

Here’s an example where OnClick-event of a button is used to bring Counter-component into view:

onclickanimation

The new 3.0.0 version is available from NuGet.

Usage

In order to manually run the animation, the following is needed:

  • Use the IsManual-property
  • Capture reference to the component using ref
  • Manually run the animation using Run()-method for example when a button is clicked

Here is a full example of all the steps:

<button class="btn btn-primary" @onclick="RunAnimation">Animate</button>

<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(0.5)" @ref="myAnim" IsManual="true">
    <Counter></Counter>
</Animate>

@code {

    private Animate myAnim;

    private void RunAnimation()
    {
        myAnim.Run();
    }
}

Sample

The Blazor.Animate’s sample has been updated to contain a new “Manual” page which shows how to use the new functionality.

Background

For those not familiar with Blazor.Animate, it’s a Blazor components which allows you to animate how other components are brought into the view. All the animations are powered by AOS.

Here’s a simple example of using the component:

<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(0.5)" >
    <Counter></Counter>
</Animate>

For a more throughout introduction, I recommend you to check out the introduction post or the project home site on GitHub.

Plugin Framework Logo

Plugin Framework is a new MIT-licensed plugin platform for .NET Core applications. It is light-weight and easy way to add a plugin-support into your application. It supports all the major types of .NET Core applications, including ASP.NET Core, Blazor, Console Apps and WPF & WinForms.Plugin Framework has a built-in support for Nuget packages and feeds.

The Plugin Framework version 1.0.0 is now available from Nuget: https://www.nuget.org/packages/Weikio.PluginFramework/. For Blazor and ASP.NET Core applications the recommended package is https://www.nuget.org/packages/Weikio.PluginFramework.AspNetCore

Main features

Plugin Framework follows an "Everything is a plugin" -mentality. It provides out of the box support for sharing plugins using Nuget packages, Roslyn scripts and delegates, in addition to the more common ones like .NET assemblies and folders.

Here’s a short summary of the major features provided by Plugin Framework:

  • Deliver plugins as Nuget-packages, .NET assemblies, Roslyn scripts and more.
  • Easy integration into a new or an existing .NET Core application.
  • Automatic dependency management.
  • MIT-licensed, commercial support available.

Quick start: ASP.NET Core

Install-Package Weikio.PluginFramework.AspNetCore

Using Plugin Framework can be as easy as adding a single new line into ConfigureServices. The following code finds all the plugins (types that implement the custom IOperator-interface) from the myplugins-folder.

services.AddPluginFramework<IOperator>(@".\myplugins");

The plugins can be used in a controller using constructor injection:

public CalculatorController(IEnumerable<IOperator> operator)
{
	_operators = operators;
}

Getting started

Best way to learn more about Plugin Framework is through the project's home page at Github: https://github.com/weikio/PluginFramework. The repository contains multiple different samples at the time of writing this. Here's a list:

Plugin Framework & .NET Console Application
Plugin Framework & ASP.NET Core
Plugin Framework & Blazor
Plugin Framework & WPF App
Nuget & Plugin Framework & ASP.NET Core
Roslyn & Plugin Framework & ASP.NET Core
Delegates & Plugin Framework & ASP.NET Core

How does this work?

When you create your application and add support for Plugin Framework, you usually define two things:

1. The specifications for the plugins. In some applications a plugin can add new functionality into the UI. In other apps, plugins are used to distribute logs into multiple different systems. The application defines what kind of extensions it supports.

2. The locations where the application can find the plugins. Many applications use a specific “plugins”-folder to indicate the location where plugins should exist in the hard drive. In some situations plugins are installed in runtime from Nuget. These plugin locations are called catalogs. As a developer you define what catalogs your application uses.

What makes a plugin?

In the context of the Plugin Framework, plugin is a single .NET Type. For some applications a plugin is a type which implements a specific interface. In some applications a plugin is a type which has a single public method called Run. Attributes are often used to indicate the plugins and that is also supported by Plugin Framework. From the Plugin Framework's point of view anything or everything can be a plugin.

What is a plugin catalog?

Each plugin is part of a catalog. Plugin Framework provides the following officially supported catalogs:

  • Type
  • Assembly
  • Folder
  • Delegate
  • Roslyn script
  • Nuget package
  • Nuget feed

License & Source code & Commercial Support & Issue Tracking

As previously mentioned, Plugin Framework is MIT-licensed and its source code is available from GitHub: https://github.com/weikio/PluginFramework. GitHub also contains the issue tracking.

There is also commercial support available for Plugin Framework. That is provided by Adafy https://adafy.com. Though the website is only in Finnish, the support is available both in English and in Finnish.

0 Comments

After some hiatus there’s now a new 2.0.0 version available of Event Aggregator for Blazor. For those who are not familiar with Event Aggregator for Blazor, Event aggregator is used for indirect component to component communication. In the event aggregator pattern you have message/event publishers and subscribers. In the case of Blazor, a component can publish its events and other component(s) can react to those.

Project home: https://github.com/mikoskinen/Blazor.EventAggregator

There’s few changes and additions in this release:

Easier initialization

Event Aggregator for Blazor now contains a ServiceCollectionExtension, making it easier to start using the component. From version 2.0.0 you can use the following initialization code in your ConfigureServices:

public void ConfigureServices(IServiceCollection services)
{
    services.AddEventAggregator();
}

Note: The library has been tested only with the latest server side version of Blazor. It should work with Blazor WebAssembly, but more testing is required. In Blazor WebAssembly you register the library in application’s Main-method.

Auto refresh is disabled by default

Previously, Event Aggregator for Blazor tried always to execute subscriber’s StateHasChanged-method after it had handled a message. This made (and can still make) working with the Event Aggregator easier as it means you don’t have to manually call StateHasChanged in your Handle-method, if you want to update the UI. Unfortunately in some situations the auto refresh can cause performance issues so from version 2.0.0 onwards the auto refresh is disabled by default.

You can enable auto refresh through options:

services.AddEventAggregator(options => options.AutoRefresh = true);

Auto refresh is based on reflection and it assumes that the subscriber inherits from ComponentBase.

Auto refresh now understands component’s SynchronizationContext

Previously, Event Aggregator for Blazor’s auto refresh just executed component’s StateHasChanged-method. In the preview versions of Blazor this worked OK but as Blazor now uses SynchronizationContext to enforce a single logical thread of execution, auto refresh had a habit of crashing the application. This is now fixed.

0 Comments

There’s now a new version 2.0.0 of Adaptive Cards for Blazor available.

This update changes two things:

  • It targets .NET Core 3.1 instead of .NET Core 3.0.
  • It also updated Adaptive Cards SDK to the latest version.

There’s also some internal changes on how the package is created. This makes it easier to use the library with Blazor WebAssembly.

How to learn more about Adaptive Cards for Blazor

As before, the best way to start learning about Adaptive Cards for Blazor is the “Getting Started” –tutorial. There’s also a “Quick start” available.

There’s also more than 40 samples available which show you how to use features like Card Collections and how to handle submit actions in C#.

For the source code and current issues & feature requests, please see GitHub.

0 Comments

Last month I wrote about a new library called Blazor.Animate which aims to make it easier to add animations into Blazor Applications. There’s now a new version 2.0.0 available from NuGet.

blazoranimate

The new version adds couple things:

  • The library now targets .NET Core 3.1, which is a LTS-version of .NET Core.
  • The library now works better with Blazor WebAssembly (thanks to Matthias Gernand)

The project repository now contains a new WebAssembly sample. 

Background

If you’re new to Blazor.Animate, here’s a quick introduction to the library. Blazor.Animate is a Blazor Component which allows you to animate how other components are brought into the view. The library is powered by AOS.

To animate a component, wrap it inside Animate-component and use the Animation-parameter to define the animation:

<Animate Animation="Animations.ZoomIn" Duration="TimeSpan.FromSeconds(0.5)" >
    <Counter></Counter>
</Animate>

The library currently supports the following animations:

  • Fade
  • FadeIn
  • FadeUp
  • FadeDown
  • FadeLeft
  • FadeRight
  • FadeUpRight
  • FadeUpLeft
  • FadeDownRight
  • FadeDownLeft
  • FlipUp
  • FlipDown
  • FlipLeft
  • FlipRight
  • SlideUp
  • SlideDown
  • SlideLeft
  • SlideRight
  • ZoomIn
  • ZoomInUp
  • ZoomInDown
  • ZoomInLeft
  • ZoomInRight
  • ZoomOut
  • ZoomOutUp
  • ZoomOutDown
  • ZoomOutLeft
  • ZoomOutRight