开发者

Can someone suggest a good workflow for working with WPF and PRISM?

I've worked with PRISM on one major project before so I'm pretty familiar with the concepts involved but I'm about to embark on a self managed project and was wondering if anyone has any pearls of 开发者_运维知识库wisdom about how to go about implementing an appropriate architecture for a straight forward LOB/Forms over data app. I'll want to leverage as much of PRISM and Unity as possible.

Obviously most people start with the bootstrapper, shell and regions but if you've got a reasonably simple but large app to build, with tight timescales ( like always :-) how I can I save some time in my workflow? Where should I go from there?


It's not much, but I started writing snippets to help with the bigger, repetitive parts of Prism, like creating a new command. Ideally you could have templates for adding a View or ViewModel and things like that also. I also have a quite decent ViewModelBase class and ViewController class for swopping out views in different regions. That way swopping a view comes down to a 1 liner most of the times.

Not much but it does save time.

I'd paste the snippet here but it doesnt format properly, suppose it is because it is XML?

<?xml version="1.0" encoding="utf-8" ?>

Prism Command pcom Code snippet for creating a new Prism Command wilmarvh PublicPrism Name of the command ie. EditUserCommand ExampleAction string PrivatePrism Name of the command ie. editUserCommand exampleAction string

    public ICommand $PublicPrism$Command
    {
        get
        {
            if ($PrivatePrism$Command == null)
            {
                $PrivatePrism$Command = new DelegateCommand(Execute$PublicPrism$Command, CanExecute$PublicPrism$Command);
            }
            return $PrivatePrism$Command;
        }
    }

    public void Execute$PublicPrism$Command()
    {
        // do whatever here
        throw new NotImplementedException();
    }

    private bool CanExecute$PublicPrism$Command()
    {
        // add executing criteria and checks here
        return true;
    }
    #endregion

$end$ ]]>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜