Cinch V2 : Question For The Reader

As some of you may know I have written a fairly popular MVVM framework called Cinch I continue to listen to peoples feedback/requests etc etc. I like to make these changes when enough requests have come through to warrant pushing out new codebase.

Unless there is of course a serious bug, in which case I will try and fix that straight away.

Question is, are you readers happy with this approach, or would you prefer to have updates as soon as possible?

They are enhancements really, and there is nothing wrong with the current codebase, but from time to time a good suggestion comes along that I like to include. Question is are you lot happy to wait for these to creep into the framework, or do you want them like now, and just have to download code again?

Could you let me know your thoughts

PS: I will not be answering these forum entries, as I just want to hear from you lot.

About these ads

35 thoughts on “Cinch V2 : Question For The Reader

  1. Huseyn Guliyev says:

    Hi,
    Irony is, while Sacha writes excellent articles popularising technologies, his own framework is not well documented. I couldn’t understand what is cinch from codeplex website. Maybe there are some articles on codeproject, but the project website needs to be the main source of information.
    The questions will be good to cover:
    What is Cinch?
    What is Cinch 1 and what is Cinch2?
    How it different from Prism, Calcium? Maybe to have comparison chart Cinch1 vs cinch2 vs Calcium vs xx

    Advantages, disadvantages?

    it looks like very neat framework. Need to raise more awareness.

    • sacha says:

      Huseyn

      Don’t take this the wrong way, I can see that your words are meant to be constructive.

      Are you for real when you say its not well documented. Did you even check out those links I link to. Man they are massive articles (took literally months to write them). there are 12 of them, and they are more thorough than anything I have ever written, or seen on any codeplex site I feel.

      Cinch started as a codeproject series, and people asked me to move it codeplex, for the patching etc etc, but
      Codeproject is and always be the best source of information for Cinch, as it has far bigger target audience than just banging up a codeplex project.

      Like I say I appreciate what you are saying, I just feel it is very well documented, and the information is already there, just a click away

  2. Roberto says:

    Hello Sacha,

    In general, I could wait for the enhacements; if the enhacement is really cool I would love to have it right away, but I will know it’s not something I urgently require (like an ugly bug).

    Regarding Huseyn’s comment, it seems like he forgot about the main question of the post; anyways, I haven’t been into the whole framework doc therefore I can’t state like he did, but came to my mind if you really have documented the differences between your framework and Prism, Ocean and/or any other. If so just let me know and I’ll take a deeper look into the doc. Thanks.

  3. Well, documentation is a bit different than the humongous articles you wrote :) I actually am a WPF newbie and I wanted to work “the best way” and among the first things I found were your articles, but only recently I actually had the time to read them. To tell you the truth, this helped, since as a total beginner I couldn’t have understood the concepts there.

    I created my own set of WPF tools, rather than using Cinch (I know, “not made by me” syndrome), and I found some things that I could improve, some things I didn’t need and some things I didn’t understand :). But since this is a comment, I can barely discuss it all here. I wrote a complete DOCument and a test project, if you are interested.

    • sacha says:

      Siderite

      So are you saying you think codeplex site needs documentation as well as the very very indepth articles

  4. Gavin says:

    Hi Sacha.
    Personally I wouldn’t want to keep downloading cinch too often just because it’s been updated. Unless it’s a serious bug fix or an enhancement that I feel I have to have. So if you do decide to start pushing it out more often that’s okay as you just state what that the new build covers then the user can decide to either implement immediately or delay until later. Especially if the fix / enhancement may potentially break existing code. For me, given the choice of 5 builds over 6 months I would probably patch once every six months rather than on every release. But that’s just me. – G – PS thanks for CINCH :)

    • sacha says:

      Gavin

      I think that is what I prefer to do to. As for Cinch you is welcome. I have just finished some new code that shows how easy it is to use Cinch with PRISM 4.0, to get regions/modules etc etc

  5. I loved your articles, don’t get me wrong. It’s just that I see a documentation as something that can be used as a reference, with a summary that is understandable at a glance. More like the difference between a dictionary and a novel, like the answer to the annoying but necessary “how do I …” questions.

    I personally think Cinch was great as comments go and the documentation is pretty much easy to create from that with Xml comments and SandCastle, so… rock on! :)

    • sacha says:

      Siderite

      Problem is codeplex uses special markup. Are you volunteering to help with documentation?

  6. Oh, and as to answer the actual question (ahem) I think that the ReSharper model is actually perfect: have the official stable release somewhere and the nightly builds somewhere else. The user can just choose.

  7. ben wintringham says:

    Hi Sacha
    I would prefer updates not to be to frequent (except bugs of course). As for the comments about documentation, one of the reasons I chose Cinch was because of your great articles. Your framework has by far the most in depth documentation of any MVVM framwork. As for them being on Codeproject, thats really no problem, as it’s no difficulty to have a few tabs open in modern browsers.
    Keep up the excellent work, as it’s a great framework.
    Ben

  8. Roy says:

    The law of Diminishing returns:

    Are there that many developers using Cinch?
    A handful I think.

    I’ve used Cinch at home and I like it, but professionally i.e. at work, it’s a non-starter. Why, simply because of the lack of support/knowledge base.

    Now you seem to be trying to clone Prism.

    Just how many WPF/Silverlight MVVM frameworks do we need ?

    I’d leave Cinch as it is, take the applauds etc, enjoy the 5’s and MVP status and move on

    Another point is, as a contractor (same as you I think) I don’t see job roles advertised for WPF/Silverlight with Cinch, but I see plenty with Prism, enough said.

    As I said the law of Diminishing returns.

  9. Roy

    From that comment it is totally clear to me that you have not read any of what Cinch does at all. Its does so much different stuff from PRISM. PRISM offers

    – Modules
    – Regions
    – Event Aggregator

    But Cinch offers a whole bunch of really useful helper UI services, better ViewModels with editability etc, threading helpers, better event to command, binding helpets etc etc

    None of these are in PRISM

    I know the chap that wrote PRISM and even he likes what I did with Cinch.

    And sure you will see more jobs for PRISM as its written by Microsoft, but the ideas from Cinch and other MVVM frameworks are what really count, PRISM (especially V4 MEf based) is dead easy to use, Kudos to Kark Shifflett, and P&P team, but there are still loads of areas where PRISM is not great, and that is where things like Cinch are.

    So I think on this occasion we will have to agree to differ

  10. Roy says:

    Hi Sacha

    I know Prism doesn’t do, services, threading etc. We wrote our own layer to do this (coming from a SCSF CAB win forms legacy stuff) Prisms commands are ok as is the Prism Interactivity. Binding is simple using Prism, one of “their” examples has a neat way of binding, nice little collection of base classes.

    OK, I know Unity has nothing to do with Prism as such. But I find the combination of the two appealing. Especially as we use Unity for DI within ASP.NET.MVC.

    I do like Cinch, don’t get me wrong, and as I said I’ve used it at home, but it’s a bit thin on the ground professionally. I don’t know anyone else who is using it. Obviously your company will be, but other than that….

    I really do think you’d be best employing your time in other techie pursuits

    When I get my web site up and running, I’ll post you the URL so you can “hammer” me :-)

    As usual, you’ll be getting a 5 from me for your codeproject postings, they are always enjoyable, as sad as that sounds.

  11. Roy

    Even if you don’t take to Cinch, the key thing is that Sacha solves a lot of problems so that you don’t have to. PRISM is not an MVVM framework, and Cinch is – this gives you the opportunity to use Cinch where you need to do MVVM.

    At the moment, apart from Laurent and Josh’s efforts, MVVM frameworks are relatively little known, so companies don’t advertise for people who know MVVM frameworks. Does this stop you using Cinch? That depends entirely on whether your company allows you to use Open Source or not, but I would certainly recommend investigating using it.

  12. Roy says:

    Pete

    Prism lends itself to MVVM very easily, cal:command in the view, ICommand in the VM.
    Been doing this for over 18months now

    • sacha says:

      Roy I have an article coming up that will show you PRISM/Cinch can work so well together now PRISM is all MEF based. So you can use PRISM for modules/regions etc etc and Cinch for ViewModels/Services match made in heaven

  13. Tony Juricic says:

    I am using Cinch V2 in production and am quite happy with it. Excluding the bugs, when they are found, a comprehensive update every 6 or more months would be just fine, thank you.

  14. Stefan says:

    I’ve been following your MVVM articles since the beginning, and I’m amazed at how quickly you churn these articles out. My largest hurdle has be trying to tease out the advanced features/embellishments of your examples in order to create a stripped-down exemplar for me to study and completely understand. I realize I probably represent a minority, but I need simpler examples in order to use this framework in it’s entirety. This probably doesn’t have much appeal, but I imagine it could increase Cinch’s popularity.

    • sacha says:

      Problem is that if I do simple exemplar article, people would not know about the other stuff. But you will be pleased to know I have 2 very trimmed demos con=ming up showing CinchV2 with PRISM4. Code all done just needs writing up

  15. Roy says:

    Hi Sacha

    I look forward to reading it.
    I am about to move to another contract end of Jan. If I get the chance I will use Cinch.
    As I mentioned I’ve used it at home (simply) but not “professionally”.

    You know, I think I might start doing some Cinch articles, ground up so to speak.
    I intend to get my website up and running and comment on there, I’ll keep you posted

  16. Serhat says:

    Hi,
    I was using your Cinch V1 at my WPF Projects.But i stopped writing wpf for 5-6 months to wrote at MS Dynamics with X++.And now nightmare ended we decide to wrote Our pwf screen with CinchV2 witch i advice to my team.
    Yesterday i try to understand new concepts especially MEF.Yes man this is it.Extensibility is too easy and too generic way and MVVM support!!.
    But suddenly i realize we have to make our viewmodels with Default constructor way otherwise it wont be MEF’s best practice.You found a way to pass parameters with WorkSpaceContextualData .Its good but i dont like this way.And I started to think about passing parameters.I found a way but as i am new at MEF i am a bit nervous.So i decide toı ask my way.
    What if we pass parameters via MEF services Like IConstructor Singleton Service.

    public interface IConstructorService
    {
    Dictionary VVMParameterPairs;

    void AddConsParam(string ViewKey,object DataContextParam);
    object GetConsParam(string ViewKey);

    }
    This MEF class adds VM key as param and DataContextParam as constructor parameter.

    For Example At your ImageLoaderExample , MainViewModel after we create WorkspaceData Like:

    WorkspaceData workspaceImages = new WorkspaceData(@”/CinchV2DemoWPF;component/Images/imageIcon.png”,
    “ImageLoaderView”, “Image View”,true);

    We Simply Add IConstructorService.AddConsParam(“ImageLoaderView”imagePath);

    At ImageLoadViewModel :

    public ImageLoaderViewModel(
    IConstructorService myConstructorService

    ….
    )
    {

    DirectoryName= myConstructorService.GetConsParam(“ImageLoaderView”);
    ….
    ….
    }

    we simply take our views Data From Constructor service.
    So my question is :Is this way suitable for MVVM and without using DP WorkSpaceContextualData can we handle all demands with this MEF Service Way.Sorry for my english:)
    Thanks..
    PS:could you send an information about your reply to my email

    • sacha says:

      Serhat (not from Lab49 are you?)

      Your idea is sound, unfortunately I do not think it will work for multiple instance of the same ViewModel type. As you are using the string for View there may multiple instance of the same View (as least in most apps this is possible) so MEF will resolve the same service instance for each view with the same name, and they will all get same parameters.

      Its a neat idea, but I do not think it will work out for you in the long run, try and create multiple instances of a particular view (like the demos ImageView) and make sure you can pass different constructor parameters (like Directory name) to each instance of the ImageView (say).

      If it can do that, yes you can do it.

      As I say I am not sure your idea will work in that scenario

      Also the demos that come with constructors for the ViewModel that specify what services the VM wants/needs. I think this is best practice as the VM would NOT work without these services. Default constructor sounds like a very very bad idea to me, as it allows VM to be created in invalid state

  17. Serhat says:

    Thanks for your quick reply really i was refreshing 1 minute the page:)
    I am not as Lab49 i am silent senior soft. eng.:)

    I thought about that scenerio
    But we will update Dictionary every View Creation :

    void AddConsParam(string ViewKey,object DataContextParam)
    {
    If(VVMParameterPairs.containsKey(viewKey)
    {
    VmmParamersPairs[viewkey]=DataContextParam;
    }else
    {
    VmmParamersPairs.Add(viewKey,DataContextParam);
    }
    }

    Its just a parameter passing and we wont use this data later so after every ViewModel creation (before adding as Workspace) we just simply update Views DataContext
    At ViewModel’s constructor and we get latest value.
    Suppose

    I have Mediator at mainViewModel
    Mymediator(object data)
    {
    WorkspaceData workspaceImages = new WorkspaceData(@”/CinchV2DemoWPF;component/Images/imageIcon.png”,
    “ImageLoaderView”, “Image View”,true);

    myConstructorService.AddConsParam(data);

    views.Add(workspaceImages )

    }
    So there will be No Problem Every viewModel will Get Latest value.I think it will be only problem at parallel view creation scenerio may be at thread creates viewMdoels same time.

    But I think we can achieve this.there comes 2nd way At WorkspaceData class if we assign a GUID to everyinsance of workspacedata we will modify Workspace cons like this

    public WorkspaceData(string imagePath,string viewLookupKey, object dataValue, string displayText, bool isCloseable)
    {
    this.GuID=GuID.newGuid().TOString(‘D’);
    myConstructorService.AddConsParam(GuID,dataValue);(myConstructorService Imported Local or passed bu Cons Parameter )

    }

    The Only Thing left to tell ViewModel to reach ViewModel’s parent WorkspaceData
    and it will be like this

    ImageLoaderViewModel(
    IConstructorService myConstructorService
    ..
    )
    {
    myConstructorService.GetConsParam(this.WorkspaceData.GUID);

    }
    OR

    At viewModelBase Class

    object GetConstructorParam(IConstructorService service)
    {
    return service.GetConsParam(return this.WorkspaceData.GUID);
    }
    AND

    ImageLoaderViewModel(
    IConstructorService myConstructorService
    ..
    )
    {
    object mydate= GetConstructorParam(myConstructorService);

    }
    ı didnt deeply looked at your new classes but there must be a way to reach ViewModel’s WorkspaceData if not this scenerio fails i think .
    So we assign every instance a Guid and its Cons parameter.

    Thanks again..

    • sacha says:

      Oh ok as long as you know you should trash that context each time you should be ok.

      The latest Cinch code actually tells the WorkSpaceData about the View. But if you want to use your own idea, you would have to tackle this yourself.

  18. Serhat says:

    By the way i am quickly writing to get answer quickly :)and my sentences will be unreadible sorry for this.

  19. Serhat says:

    Hello Sacha ,
    If you can help I have an question for you.How can we bind a command to the ScrollViewer.ScrollChanged event on a control like DataGrid?DataGrid doesn’t implement this event.I tried to pass ScrollViewer.ScrollChanged as a string to the your CinchV1 EventHooker and also Microsoft’s Interaction Triggers Cinch v2 but both couldn’t resolve:(
    I faced another problem with Microsoft.Expresion dll which inside CinchV2 when i refer To Cinch v2 at XAML The intellisense didn’t work also all Windows and UserControls gave an exception at VS2010.I read at codeproject that also another user asked that issue.Did you found a solution ?
    I will be very appreciate if you you can help.
    Thanks.

  20. For the scrollviewer thing, I imagine only way to solve that one would be to get right into the Grid ControlTemplate until you find ScrollViewer and then attach EventToCommand trigger in there. Painful but only way to do it I feel.

    Or have some weird attached property on Grid row or something, that walks Visual Tree (use one of the many VisualTree helper out there) walking up until you find ScrollViewer and then hook up its ScrollChanged to fire some command in this attached DP.

    As for the other issue you mention, I have never seen that in my code when working with Blend, and only you and 1 other have reported it, so I am not that worried about it, sorry to say.

  21. Serhat says:

    Thanks for your help i will try that.
    You are doing great job to help people about WPF.i want Cinch to be improved.And also i added some improvements to Cinch.I want to share with you as you share with people.
    As you know wpf doesn’t have notify Icon but at Enterprise Applications developers may need it.So i wrote a service which perfectly fits with MVVM.
    I used Phillip Sumi ‘s nice Notify Icon http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx
    and i made a service

    public interface INotifierService
    {
    void Register(string key, Type dialogView);

    bool Unregister(string key);

    void ChangeIcon(string iconPath);

    void ShowCustomBallon(string key, object DataContext, int? timeout);

    void ShowToolTip(string title, string message, BalloonIcon symbol);

    void CloseBalloon();

    void ResetToolTip();

    void SetContextMenu(ObservableCollection menus);

    }
    So every ViewModel can reach this notify Icon
    And also At CustomBallon method we can show any Databound View as notification.And also it supports your wpfmenuitem class.
    Thanks

    • sacha says:

      Can you send me the code, I could possibly look to include it inside on Cinch. You can send it to sacha[dot]barber[at]gmail[dot]com

  22. Sacha,

    Are you still monitoring this? I am using your framework for a work project (I am not a programmer by trade) and have run in to something I don’t understand.

    If you have time, I would like to know how/where I could ask my question.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s