Giter VIP home page Giter VIP logo

caliburn.light's Introduction

Logo

NuGet Badge

Caliburn.Light

Caliburn.Light is a fork of Caliburn.Micro that

  • is modular/magic-free (does not include conventions)
  • does not switch to UI thread automatically for everything
  • integrates some ideas of Prism and MVVMLight
  • uses weak events (see Weakly)
  • supports ICommand out-of-the-box

Install

Caliburn.Light is available through NuGet:

PM> Install-Package Caliburn.Light.WPF

PM> Install-Package Caliburn.Light.WinUI

Learn

All Caliburn.Light documentation is included.

License

Caliburn.Light is licensed under the MIT license.

caliburn.light's People

Contributors

belyansky avatar tibel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

caliburn.light's Issues

WPF: Activate/Deactivate with Window

The WindowConductor should be extended to handle activate/deactivate from view.

Window:

  • Activatedevent should activate ViewModel
  • Deactivated event should deactivate ViewModel (when Window is closing this should be skipped)

SimpleContainer.GetAllInstances() should return named instances too

object GetInstance(Type service, string key);
TService GetInstance<TService>(string key);

IEnumerable<object> GetAllInstances(Type service);
IEnumerable<TService> GetAllInstances<TService>();

object GetInstanceOrDefault(Type service, string key);
TService GetInstanceOrDefault<TService>(string key);

Add CallMethodAction

Features:

  • calls a method on a specified object when invoked
  • allow to include other parameters using bindings
  • maintains the Enabled state of the target control

Similar to Caliburn.Micro ActionMessage

[Roslyn] Lambda expressions are now compiled as instance methods

A lambda expressen (closure with empty capture) is now an instance method on a compiler generated class. The class is decorated with [CompilerGenerated] and [Serializable]. But there is no guaranty that this will always be the case.

How to distinguis lambdas and closures now?

An instance method or closure cannot be used

After switching from VS 2013 to VS 2015 my WP app begins to throw exceptions during runtime.
Here is a simplified code sample:

public class FooViewModel
{
    private ICommand _barCommand;
    public ICommand BarCommand
    {
        get
        {
            if (_BarCommand == null)
            {
                _barCommand = DelegateCommand
                    .For(this)
                    .Execute(viewModel => viewModel.Bar())
                    .Build();
            }
            return _fooCommand;
        }
    }

    private void Bar()
    {
    }
}

Execute method from the code above throws ArgumentException with the message An instance method or closure cannot be used in process of command building.

How to avoid of this issue?

Close the gap to a complete MVVM framework

The Weakly.MVVM namespace contains some basic classes that are needed when building an MVVM framework. But it is not complete at all.

The most central part missing is:
How to attach some logic in the ViewModel to an event on a View elements (control)?

The Blend SDK includes:

Caliburn.Micro extends the idea of CallMethodAction with its ActionMessage. Similar did MVVM Light for InvokeCommandAction in EventToCommand.

TODO:

  • Add possibility to include information about the origin (source) of the call
  • Supply the event arguments
  • Allow to include other parameters using bindings (like ActionMessage)

Add documentation

put into doc folder

  • remove Caliburn.Micro references
  • remove not supported features
  • update the docs for latest version
  • describe Caliburn.Light specific features

Add InvokeCommandAction

Features:

  • executes a command when invoked
  • maintains the Enabled state of the target control based on the CanExecute method of the command

Similar to what Prism 5.0 does.

Cleanup conditional compilation symbols

Caliburn.Micro

framework symbols
net40 NET
sl5 SILVERLIGHT;SL5
win8 NETFX_CORE;WinRT
net45 NET;NET45
win81 NETFX_CORE;WinRT;WinRT81
wp8 SILVERLIGHT;WINDOWS_PHONE;WP8
wpa81 NETFX_CORE;WinRT;WinRT81;WP81

Standard

framework symbols
net45
win81 NETFX_CORE;WINDOWS_APP
wp8 SILVERLIGHT;WINDOWS_PHONE
wpa81 NETFX_CORE;WINDOWS_PHONE_APP

Find better way for task exception escalation

There has to be a better way than:

private static async void PropagateExceptions(Task task)
{
  await task.ConfigureAwait(false);
}

used in:

  • DelegateCommand
  • EventAggregator
  • CallMethodAction

Exceptions should be handled by the dispatcher instead of relying on ObserveException()

e.g.

/// <summary>
/// Dispatches exceptions to the UI context when the task threw an unhandled exception.
/// </summary>
/// <param name="task">The Task to be monitored.</param>
public static void DispatchExceptions(Task task)
{
    task.ContinueWith(t => t.PropagateExceptionsTo(_synchronizationContext),
        CancellationToken.None,
        TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnFaulted,
        TaskScheduler.Default);
}

Add SpecialValues

like Caliburn.Micro.ActionMessage uses MessageBinder.SpecialValues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.