Click here to Skip to main content
12,747,366 members (36,738 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


Posted 11 Aug 2010

Building OpenPOS: Part 9 – Settings and Notifications

, 12 Aug 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Building OpenPOS – Settings and Notifications

A common topic I see on StackOverflow is how I persist my window location in a WPF-friendly manner?

First things first, let's create some default values.

“The .NET Framework 2.0 allows you to create and access values that are persisted between application execution sessions.” – MSDN

Once we have some defaults, all we have to do is bind to them from our window! Sounds easy, huh?

First include the default namespace…


And then bind to them:

<Window x:Class="OpenPOS.Views.ShellView"
        Height="{Binding Source={x:Static local:Settings.Default}, 
		Path=Height, Mode=TwoWay}" 
        Width="{Binding Source={x:Static local:Settings.Default}, 
		Path=Width, Mode=TwoWay}"
        Left="{Binding Source={x:Static local:Settings.Default}, 
		Path=Left, Mode=TwoWay}" 
        Top="{Binding Source={x:Static local:Settings.Default}, Path=Top, Mode=TwoWay}"
        WindowState="{Binding Source={x:Static local:Settings.Default}, 
		Path=WindowState, Mode=TwoWay}">


And that’s it!

Another common question I see often is how do I handle dialog boxes, etc.? The easy answer to this is just call MessageBox.Show, ShowDialog, etc.! And it will work in simple applications but what happens if you need to test this? Now you depend on a Dialog box that pops up or some user interaction! In OpenPOS, I create services for these kind of interactions! I created a VERY simple NotifyService for sending notifications:

public interface INotifyService
    void Notify(string message);

And this is how the notification looks:

BTW – this uses wpf-notifyicon (And here is a CodeProject article on how to use it).

For more information about OpenPOS

And you can download ALL the source from CodePlex here.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

South Africa South Africa
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170215.1 | Last Updated 12 Aug 2010
Article Copyright 2010 by rudigrobler
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid