Contents tagged with Caliburn

  • Fast switching between ViewModels in Caliburn.Micro

    You can see demo here. I have asked several questions (StackOverflow, C.M forum, Silverlight forum). Found no solution but at least a hint that the problem is in adding the view to visual tree. My idea was to create a custom ContentControl that would cache all views so that it can quickly switch between them. After few minutes, I came up with this: public class ContentHost : ContentControl { private Grid _contentGrid; private UIElement _currentView; public ContentHost() { … more

  • Coproject - a RIA Caliburn.Micro demo, part 14

    by Augustin Šulc

    In the last part, we created LazyScreen class so that we can load our view models into memory only when they are requested and not right after the application start. In this part, I want to create LazyConductor – a conductor that will support closing of child LazyScreens and then opening new ones instead of removing them from its Items collection. Please note that this is just a simple demo of an idea I had about lazy screens/conductors and using it in production might need additional … more

  • Coproject - a RIA Caliburn.Micro demo, part 13

    by Augustin Šulc

    By now, you are probably using Caliburn.Micro for your applications and hopefully Coproject helped you to learn it. But if you are creating large business applications as we do, you have probably realized that you need to tweak and extend C.M a little bit. That’s why I would like to continue on this Coproject series while focusing on these advanced features. As you probably know, ordinary ViewModels hierarchy and thus whole application structure is loaded on the application startup. This … more

  • Coproject - a RIA Caliburn.Micro demo, part 12

    by Augustin Šulc

    In this part, I would like to use RIA Services a little more and then show you how to customize Caliburn.Micro conventions. Remember to visit Coproject Codeplex site for latest news. Display metadata If you remember Part 2, RIA Services use metadata to describe what data should be transferred to the client. But that is not all – you can add things like label text or validation. So, open Coproject.Web/Services/CoprojectService.metadata.cs. Let’s say we want to change labels in … more

  • Coproject - a RIA Caliburn.Micro demo, part 10.5

    by Augustin Šulc

    If you watched CPU usage after implementing BusyIndicator, you might notice major increase in CPU usage on To do module after the list is loaded for the first time. High CPU usage with BusyIndicator and ProgressBar It is a common issue with BusyIndicator: Silverlight forum, Silverlight toolkit issue, Appsolo blog but the solution is not obvious or easy to find. So I’ve spent some time and figured out that the excessive CPU usage is caused by ProgressBar that is present in … more

  • Coproject - a RIA Caliburn.Micro demo, part 11

    by Augustin Šulc

    In this part, we will synchronize list after saving data and add some icons. You may continue on your work from older parts, or download updated code from Coproject site. Event aggregator Usually, if you want a component of your application to notify other components about an event that occurred, you use standard .NET events. The problem with events is that you always need to access the publisher of an event from the subscriber. What’s more, you also need to unsubscribe from the event. … more

  • Coproject - a RIA Caliburn.Micro demo, part 10

    by Augustin Šulc

    In this part, we will add a busy indicator. As you know, communication with server takes some time. Even in our small project loading might take several seconds so it would be a good idea to notify the user that something is happening in background. So, open your solution from part 9 or grab source codes from Coproject site and let’s start. BusyIndicator First of all, add a BusyIndicator control to ToDoListsView. So, add this namespace using: … more

  • Coproject - a RIA Caliburn.Micro demo, part 9

    by Augustin Šulc

    In this part, we will add a toolbar and handle data saving. Toolbar It is a typical scenario that screens have toolbars. These are usually shown somewhere else in the application than their respective view model’s views. In this case, we will benefit from Caliburn.Micro’s feature of having more than one view attached to a view model. You can describe what view you want to show by setting ‘context’ of the view. So, open the Coproject solution where we finished the last … more

  • Coproject - a RIA Caliburn.Micro demo, part 8

    by Augustin Šulc

    In this part, we will create ToDoItem detail. Context lifetime The main question when considering lists and details is whether to share context among all screens or create a new context per screen. Both ways have their pros and cons and you will probably have to choose depending on the situation. But most likely, you will use both of them depending on the scope of entities. Shared context In this case, you would probably create a service in the application and all screens would access it to get … more

  • Coproject - a RIA Caliburn.Micro demo, part 7

    by Augustin Šulc

    In this part, we will add filtering to ToDo list and create several useful extension methods. Extension methods In the client project root, create a new static class called Extensions and put following functions into it: public static bool IsNullOrWhiteSpace(this string value) { return string.IsNullOrWhiteSpace(value); } public static string FormatWith(this string formatString, params object[] args) { return string.Format(formatString, args); } public static IResult ToSequential(this … more