GithubHelp home page GithubHelp logo

kfrancis / abp-wpf Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 4.0 489 KB

An abp.io with a more complete wpf example including mvvm source generators.

License: MIT License

C# 94.08% HTML 4.46% CSS 0.01% JavaScript 1.45%

abp-wpf's Introduction

abp-wpf

An abp.io BookStore sample including a more complete wpf example using mvvm source generators and a slick UI 😍

🎩 Features

💻 Screenshot

example

Interesting Bits

Source Generators

This app utilizes the CommunityToolkit.Mvvm source generators details.

This makes it so we can cut loads of boilerplate out like this:

In BookIndexViewModel.cs

[RelayCommand]
public async Task InitialAsync()
{
    await LoadDataAsync();
}

In BookIndex.xaml

<Behaviors:InvokeCommandAction Command="{Binding InitialCommand}"/>

The source generators take care of generating the command property and setting it up (what you would normally do in the constructor).

You can even handle the CanExecute simply:

public bool GetIsNotBusy() => IsNotBusy;

[RelayCommand(CanExecute = "GetIsNotBusy", AllowConcurrentExecutions = true)]
public async Task InitialAsync()
{
    await LoadDataAsync();
}

Note: As of right now, the CanExecute of the source generator can't seem to see the base property of IsNotBusy so this is a simple workaround.

Abp Localization in the XAML

AppViewModel exposes the Abp l18n via L so you can use it in the xaml like this:

<wpfui:NavigationItem
    Content="{Binding Path=L[Books]}" />

Where Books is the l18n key:

{
  "culture": "en",
  "texts": {
    "Menu:Home": "Home",
    "Welcome": "Welcome",
    "LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io.",
    "Books": "BoOkS"
  }
}

WPF Test Project

Check out the project Acme.BookStore.Wpf.Tests which is an adaptation of the Web tests specifically for testing the view models.

BookStore Sample

abp-wpf's People

Contributors

kfrancis avatar

Stargazers

Xin.Pu avatar .li avatar deng avatar  avatar  avatar Nita avatar XiangYang avatar den210789 avatar Eva Williams avatar  avatar Zetao Shao avatar  avatar  avatar danil avatar mengliwei avatar  avatar  avatar  avatar Starkov Vladislav avatar Alby avatar OCEAN avatar  avatar  avatar LambertWu avatar  avatar Berin Iwlew avatar O0oo0O avatar Jin.Xu avatar pidan avatar tkezyo avatar Anto Subash avatar Halil İbrahim Kalkan avatar

Watchers

 avatar  avatar  avatar

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.