Skip to content

Getting started

mrousavy edited this page Aug 21, 2018 · 9 revisions

Jellyfish Wiki

Jellyfish aims at being a very simplistic yet powerful MVVM backbone.

This guide should get you started with Jellyfish in little to no time.

1. Install

Jellyfish is on NuGet:

PM> Install-Package Jellyfish

2. Follow the MVVM pattern

For each View (Window, Control, ..), create the corresponding Model, View and ViewModel:

Model
class UserListModel : Model
{ ... }
View
<Window ...>
    <ListView ItemsSource="{Binding Users}" />
</Window>
ViewModel
class UserListViewModel : ViewModel
{
    private ObservableCollection<User> _users;
    public ObservableCollection<User> Users
    {
        get => _users;
        set => Set(ref _users, value);
    }
}

See Models πŸ“– and View Models πŸ“–

3. Additional Observable Objects

Every object with properties that need to be observed for changes needs to implement the ObservableObject class:

class User : ObservableObject
{ ... }

See Observable Objects πŸ“–

4. Commands

The RelayCommand is an ICommand implementation.

ICommand LoginCommand = new RelayCommand(LoginAction);
// ...
void LoginAction(object parameter)
{ ... }

See Commands πŸ“–

5. Message Feeds

The IFeed<T> allows notifying any subscribers in this feed about sudden changes within the application domain in realtime.

class CustomViewModel : INode<NotifyReason>
{
    public CustomViewModel
    {
        this.Register();
    }

    public void MessageReceived(NotifyReason reason)
    { ... }
}

Feed.Notify(NotifyReason.RefreshView);

See Feeds πŸ“–

Clone this wiki locally