Site: http://www.paulstovell.com/ Link: http://feeds.feedburner.com/PaulStovell
by Paul Stovell via Paul Stovell on 2/20/2010 6:42:47 AM
The latest CodePlex Magellan build includes a couple of changes that are worth noting: The new Forms controls No need to import the Magellan namespaces Various bug fixes That second item is worth focusing on. In previous builds, to use any of the Magellan classes in XAML, you had to write: <Page ... xmlns:magellan="http://xamlforge.com/magellan" > <magellan:Layout... I wrote before about an idea to move them to the default XAML namespace, and while a ...
[ read more ]
by Paul Stovell via Paul Stovell on 2/20/2010 6:31:11 AM
Back to: Magellan Home Data entry forms are common in line of business WPF applications, and they can become repetitive to write. Magellan includes a new set of controls that you can use to rapidly throw data entry forms together. The goals of Magellan Forms are: Minimal XAML Abstract presentation concerns Use conventions to infer as much information as possible Flexible and extensible Getting Started To illustrate, take a form declared like this: <Form> < ...
by Paul Stovell via Paul Stovell on 1/26/2010 7:04:16 AM
I have migrated the Magellan source code and releases to CodePlex. http://magellan.codeplex.com A few benefits to using CodePlex are: I use TeamCity to publish releases for each check in (thanks to the MSBuild Deployment Tools project). The releases are hidden at first (in case they have problems) and once I have tested them they become public. You can use the RSS feed to stay up to date. You can use the Issue Tracker to report bugs. You can use the online source code b ...
by Paul Stovell via Paul Stovell on 1/15/2010 6:18:52 AM
It seems that every WPF developer has written a Model-View-ViewModel library, and I was starting to feel left out. Having written an MVC and MVP framework, I figured I may as well write an MVVM library. But I want it to be different - I want the ViewModels to be as small as possible. That's how MicroModels was born. MicroModels is inspired by Fluent NHibernate and uses TypeDescriptors to dynamically define properties, collections and commands. In the example below, the view ...
by Paul Stovell via Paul Stovell on 1/14/2010 9:33:02 AM
I have seen some confusion around the naming of the major UI presentation patterns, often with code being described as one pattern when actually it uses a different one. This usually happens because the goals behind each pattern are similar and the descriptions are a little too theoretical. I want this page to serve as a practical description of each pattern and to provide some concrete examples of what differentiates the patterns in the wild. The Three Major UI Patterns The ...
by Paul Stovell via Paul Stovell on 1/11/2010 10:09:41 AM
I have owned a copy of Sams Teach Yourself WPF in 24 Hours for about a year, and I still find it an interesting book. One thing I like about this book is that doesn't just show off WPF features - it shows how to use the Model-View-Presenter pattern in doing so. The book was written by Rob Eisenberg and Christopher Bennage from BlueSpire, who are also the guys behind the Caliburn WPF framework, so they know a thing or two about the Model-View-Presenter pattern. Like the Model- ...
by Paul Stovell via Paul Stovell on 12/30/2009 5:15:03 AM
Back to: Magellan Home Magellan 1.1 brings support for asynchronous controllers. First we'll look at what it enables, then I will show some ways to configure it. The controller action below makes a WCF call to load a list of customers, which are used as the model for the view. This service call could take some time to evaluate: public class CustomerController : Controller { public ActionResult List() { Model = CustomerService.GetCustomers(); return P ...
by Paul Stovell via Paul Stovell on 12/22/2009 1:09:19 AM
Back to: Magellan Home Magellan does not natively support Windows Forms, but adding support is as easy as writing your own View Engine. As described in the documentation on View Engines, there are two classes we need to write. The first is an object that implements IViewEngine, which is responsible for finding the view. The second is an object inheriting from ViewEngineResult, which contains logic for rendering the form (i.e., calling Form.Show()). There are also a couple ...
by Paul Stovell via Paul Stovell on 12/21/2009 2:21:54 PM
Back to: Magellan Home Magellan is all about navigation, an important part of which is showing views. In Magellan, a view can be a Window, Dialog or Page. With the Composite WPF extension, a view can also be any user control that can be added to a Region. The system is also extensible - see the page on Windows Forms support for an example on writing your own view engine. View Results As described previously, controller actions return an Action Results. These contain the logi ...
by Paul Stovell via Paul Stovell on 12/14/2009 4:05:33 AM
Back to: Magellan Home Because the Magellan framework handles many parts of the navigation lifecycle, there are a number of things that can go wrong. I want to dedicate this page to explaining the common exceptions that are thrown by Magellan, and look at techniques for handling them. Exceptions thrown by Magellan Where logical, Magellan throws standard .NET exceptions such as ArgumentNullException and InvalidOperationException. However, Magellan also has it's own set of cu ...
by Paul Stovell via Paul Stovell on 12/12/2009 11:24:08 AM
Back to: Magellan Home Action Results are a concept from ASP.NET MVC and other MVC frameworks, and they are also supported by Magellan. They provide a powerful mechanism for decoupling the controller from UI specific concerns. Before discussing how they work, we should discuss why they exist. Why Action Results? Suppose you weren't using Magellan and you had an action like this: public void Login(string username, string password) { var window = IsValidLogin(username, p ...
by Paul Stovell via Paul Stovell on 12/12/2009 10:08:02 AM
Back to: Magellan Home When navigating between pages, transitional animation can provide a powerful means of communicating context with the user. The Transitionals library from Microsoft is a popular way to set up transitions when content changes, and comes with a number of out of the box transitions such as 3D cube, blinds, dissolve and star wipe. When it comes to page navigation, we often want transitions to relate to the navigation we are performing. For example, if we cl ...
by Paul Stovell via Paul Stovell on 12/7/2009 1:44:07 PM
I just added a page on Magellan Action Filters. One of the reasons I'm excited about this is that action filters and view filters will allow me to handle a common and complicated issue - re-activating an existing view. Take a controller action like this: public ActionResult Show(int customerId) { var customer = Customers.Find(customerId); Model = new CustomerDetailsModel(customer); return Window("CustomerDetails"); } If you clicked a pair of customers in a ...
by Paul Stovell via Paul Stovell on 12/7/2009 1:33:21 PM
Back to: Magellan Home Action Filters are typically attributes that you can apply to a Magellan controller or controller action in order to intercept the call and provide an alternative way of handling the request. They provide a poor man's Aspect Oriented Programming mechanism for controllers. Action Filters The sample below shows how an Action Filter might be used. The Log attribute can be applied to either methods or classes: public class MyController : Controller { ...
by Paul Stovell via Paul Stovell on 11/26/2009 2:57:34 PM
Progress on Magellan has been a little slow this week as I have been experimenting with some ways to optimize memory usage when dealing with WPF pages. A lot of it comes down to issues with WPF's navigation system and some of the limitations it has. The major problem we encounter when using WPF Page objects is that if you were to do something like this: NavigationService.Navigate(new MyPage()); You just got yourself an object that will never be garbage collected. This ha ...
by Paul Stovell via Paul Stovell on 11/15/2009 9:40:50 AM
Back to: Magellan Home Magellan now comes with a Visual Studio Project Template that you can use to get started with quickly. You will need Visual Studio 2008. Magellan-Setup.msi Setup The installer will guide you through the installation process. During installation it will also register the Visual Studio project templates. If Visual Studio is already running, your will be prompted to close it at this time. Once the installer finishes, your installation directory wil ...
by Paul Stovell via Paul Stovell on 11/13/2009 7:13:39 AM
Back to: Magellan Home The MVVM Light Toolkit is an MVVM framework by WPF MVP Laurent Bugnion, the author of Silverlight 2 Unleashed. It works well alongside Magellan and makes it easy to put behaviors behind views. The integration model with Magellan is quite similar to using the Microsoft MVVM toolkit. One difference is that the MVVM Light Toolkit typically uses resources to refer to the ViewModel, limiting the amount of code behind that is required. Since Magellan control ...
by Paul Stovell via Paul Stovell on 11/12/2009 10:11:38 AM
Back to: Magellan Home As an MVC framework, controllers are the most prominent object in Magellan. At their simplest, controllers are implemented as classes, and actions are implemented as methods on the class. Actions on a controller must be public methods, and must return ActionResult objects. Here is an example: public class CustomerController : Controller { public ActionResult Index() { Model = Customers.GetAll(); return Page(); } public A ...
by Paul Stovell via Paul Stovell on 11/11/2009 6:38:49 AM
Back to: Magellan Home Magellan's MVC framework is designed to handle navigation between views. However, the views themselves, and how they are implemented, is outside of Magellan's concern. Views can be simple XAML pages, or they can be driven by an MVVM or MVP pattern, or any other way you might like. Microsoft provide a Visual Studio project template known as the MVVM Toolkit, which makes it easy to get started using the MVVM pattern. To use Magellan with the MVVM toolk ...
by Paul Stovell via Paul Stovell on 11/10/2009 1:07:43 PM
Back to: Magellan Home Magellan was designed to work with Composite WPF from day one. Composite WPF provides support for multiple modules, loosely coupled pub/sub eventing, and regions for sub-dividing zones in the UI. However, Composite WPF does not enforce any particular UI pattern - MVVM, MVP and MVC could all work. Magellan and Composite WPF can work well together to create a composite navigation-oriented application using the MVC pattern. Here are some examples: Compo ...
by Paul Stovell via Paul Stovell on 11/9/2009 10:40:32 AM
Back to: Magellan Home Magellan was designed to work without an Inversion of Control or Dependency Injection container, to keep it simple and accessible. However, as applications become more complicated, modern WPF applications can benefit immensely from IOC containers. Magellan's extensibility points make using a container easy. Magellan resolves and instantiates two main types of objects - controllers and views. The out of the box implementation uses conventions, but they c ...
by Paul Stovell via Paul Stovell on 11/9/2009 3:07:35 AM
Back to: Magellan Home This guide will walk you through getting started with Magellan. You will need a copy of Visual Studio 2008 with Service Pack 1. Project Setup Download the Magellan library. Unzip it to a known location. Create a new WPF Application project using Visual Studio 2008. Add references to Magellan.dll and System.Windows.Interactivity.dll from the ZIP file that you downloaded. Create the following folder structure: Create a model In the Views/Home fol ...
by Paul Stovell via Paul Stovell on 11/8/2009 3:16:01 PM
Back to: Magellan Home Magellan is a lightweight framework that makes it easy to build WPF navigation applications. It is inspired by the ASP.NET MVC framework. The main features are: Model-View-Controller support Action filters for cross-cutting concerns such as authorization and redirection Blend behaviors to make navigation easy Transitions between pages Magellan was drawn from a number of samples I had put together early this year and some work done on a client project ...
by Paul Stovell via Paul Stovell on 11/8/2009 2:39:23 AM
Magellan is a lightweight framework that makes it easy to build WPF navigation applications. It is inspired by the ASP.NET MVC framework. The main features are: Model-View-Controller support Action filters for cross-cutting concerns such as authorization and redirection Blend behaviors to make navigation easy Transitions between pages Magellan was drawn from a number of samples I had put together early this year and some work done on a client project. Download the librar ...
by Paul Stovell via Paul Stovell on 10/25/2009 1:39:56 PM
by Paul Stovell via Paul Stovell on 10/9/2009 1:02:24 PM
Enterprise applications typically deal with many categories of strings. Human names, reference codes, SKU identifiers, email addresses - the list is huge. There are subtle rules that apply to many of them: Whitespace at the start and end of many strings should probably be ignored Human names probably shouldn't contain newlines, tab characters, the percentage symbol, or 27 dashes in a row For some strings, casing makes no difference when deciding equality, and sometimes it do ...
by Paul Stovell via Paul Stovell on 10/7/2009 12:16:53 PM
Sheldon is a WPF command line control, and code to integrate it with IronPython. It's designed as a sample that demonstrates how a WPF application might be made scriptable: This sample was created to pitch an idea to a client about enabling a macro system in their application. Users might be able to make use of functions like OpenAccount("ACME"), ExecuteJob("SalesForecast2009"), and so on. Using the Command Pattern, commands could be written to an Output window in the applic ...
by via Paul Stovell on 6/12/2008 9:21:15 AM
The ASP.NET MVC team developed a URL routing engine, similar to the engine in Rails, which has made it’s way into the rest of ASP.NET. ScottGu has covered it a few times in the past, and this post has some good examples of it. Here’s a quick example: routes.MapRoute("ShowProductByCategory", "Products/Show/{Category}/{id}", new { controller [...] ...
by Paul Stovell via Paul Stovell on 6/11/2008 2:47:20 AM
Snapshot enumerators are part of Bindable LINQ’s internal implementation which make editing collections while enumerating them possible. When you first started with .NET, you undoubtedly wrote code that looks like this: foreach (string item in strings) { if (item.StartsWith("H")) { strings.Remove(item); [...] ...
by Paul Stovell via Paul Stovell on 6/10/2008 2:19:56 AM
As with other LINQ operations, Bindable LINQ allows you to execute aggregates over values that can change over time. In the general sense, a Bindable LINQ aggregate is an operation that turns a series of values into a single value, and is not necessarily limited to numeric operations. Examples of such aggregates are classics such [...] ...
by Paul Stovell via Paul Stovell on 6/3/2008 8:53:36 AM
One of the upcoming additions in .NET 3.5 SP1 is a StringFormat parameter you can pass along with your bindings. Sacha Barber has an example of how to use it: <TextBlock Text="{Binding Path=AccountBalance, StringFormat='You have {0:c} in your bank account.'}" /> However, if you can’t install the service pack or you [...] ...
by Paul Stovell via Paul Stovell on 5/21/2008 8:31:30 AM
Last night at the QMSDNUG someone asked whether it was possible to implement INotifyPropertyChanged without hard-coding property names as strings inside code. For example, you would normally write: public string FirstName { get { return _firstName; } set { _firstName = [...] ...
by Paul Stovell via Paul Stovell on 2/28/2008 12:07:41 PM
Omar blogged a method to extract the selected values in an enumeration: http://blog.omarbesiso.net/index.php/2008/02/13/c-multi-valued-enumerators-flags/ Suppose you had an flags enumeration called Option. You could use his method to write the following code: Options options = Options.ReadOnly | Options.Archive; Console.WriteLine("You selected:"); foreach (Options option in EnumHelper.GetSelectedEnumValues<Options>(options)) { Console.WriteLine(option); } While a generic ...
by Paul Stovell via Paul Stovell on 2/21/2008 9:31:35 AM
Early this year Mitch suggested a string formatting syntax for C# vNext. His suggestion was that string.Format could be replaced with syntax like this: throw new Exception( @("{0} {1} {2}"|a|b|c) ); I think it’s a great suggestion and I too would like to see it. In the mean time, I’ve been making use of the following extension [...] ...
by Paul Stovell via Paul Stovell on 12/4/2007 3:06:18 AM
There’s a good thread on the ALT.NET mailing list about the use of extension methods over interface methods. Having used extension methods heavily in SyncLINQ, there’s something I wanted to highlight when it comes to choosing between regular methods and extension methods. Combining extension methods with interfaces can be very powerful. The IEnumerable interface is [...] ...
by Paul Stovell via Paul Stovell on 10/4/2007 12:31:30 PM
Often when creating classes, we add a number of constructors to the class that are usually just there for convenience’s sake; that is, to make life easier for the developers using the class. Take the following code: public class Contact { private string _firstName; private string _lastName; private [...] ...
by Paul Stovell via Paul Stovell on 7/25/2007 4:28:22 AM
One advantage functional programming has over imperative programming is that in most functional languages, many of the operations performed are stateless - you pass values in, you get values back, but they never rely on external resources (global variables, static variables, the file system, the registry, etc.). This allows the runtimes of these languages to [...] ...
by Paul Stovell via Paul Stovell on 7/6/2007 3:28:01 AM
Last night I gave my talk on Binding Oriented Programming at the Sydney .NET User Group. The agenda looked something like this: What is data binding? We looked at a number of important interfaces: INotifyPropertyChanged IDataErrorInfo IBindingList, BindingList<T>, INotifyCollectionChanged I also talked about a few advanced binding topics - check out my webcasts for more details: Binding to DataSets Binding to Objects [...] ...
by Paul Stovell via Paul Stovell on 7/3/2007 7:10:09 AM
An interesting bug that I stumbled across when building the Scenario Coverage Analyser for TFS is that when reflecting on a type, Type.GetCustomAttributes will often not return some of the attributes I expected. You can find more details on the bug here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1578987&SiteID=1 The basic issue seems to come down to loading from a server share or [...] ...
by Paul Stovell via Paul Stovell on 5/24/2007 3:02:12 AM
Yesterday I posted a short walkthrough that demonstrated how to make changes to the TFS cube. Today, I want to show how the same change could have been applied using SQL Server Analysis Management Objects. According to MSDN, when we want to deploy changes to an Analysis Services database, there are five ways in which [...] ...
by Paul Stovell via Paul Stovell on 5/23/2007 6:40:54 AM
In this post I’ll walk through opening the Team Foundation Server OLAP Cube in Visual Studio, and adding a custom field to a dimension. Recall from my previous post that there are three main types of things in a cube: MeasuresMeasures are the numbers. These will often appear as the values in the report, and are the quantitative [...] ...
by Paul Stovell via Paul Stovell on 5/23/2007 5:01:12 AM
Forget LINQ, .NET 3.0, WPF and Silverlight. Analysis Services is truly the most wondrous thing to have been released this decade. I’ve spent this morning getting intimate with the TFS Cube, as I have some custom data that I would like to inject into some reports, and since I’ve never used Analysis Services it’s been [...] ...
by Paul Stovell via Paul Stovell on 5/21/2007 2:41:36 PM
Seven seconds That’s how long it takes to split a piece of code into a base class. Five seconds That’s how long it takes to add an XML-doc comment to a method. Developers have a strange psychology when it comes to code quality. If you’re familiar with Maslow’s hierarchy of needs, the equivalent for most developers might be: [...] ...
by Paul Stovell via Paul Stovell on 5/21/2007 12:43:11 PM
Binding Oriented Programming (BOP) is something that I’ve been championing to a number of Readify colleagues. In my original post, I gave an example of how the BOP approach could be applied in a Windows Presentation Foundation application. Then in a post about the SecurityManager, I showed an example that used Windows Forms and followed [...] ...
The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.