Click here to Skip to main content
15,881,687 members
Articles / Desktop Programming / WPF

GoalBook - A Hybrid Smart Client

Rate me:
Please Sign up or sign in to vote.
4.86/5 (24 votes)
25 Sep 2009CPOL10 min read 79K   834   69  
A WPF hybrid smart client that synchronises your goals with the Toodledo online To-do service.
//===============================================================================
// Goal Book.
// Copyright © 2009 Mark Brownsword. 
//===============================================================================

#region Using Statements
using System.Windows;
using System.Windows.Threading;
using GoalBook.Shell.Services;
using Microsoft.Practices.Composite.Logging;
#endregion

namespace GoalBook.Shell
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        #region Constants and Enums
        #endregion

        #region Inner Classes and Structures
        #endregion

        #region Delegates and Events
        #endregion

        #region Instance and Shared Fields
        private ApplicationSettings _applicationSettings;
        private EventLogging _eventLogging;
        private Bootstrapper _bootStrapper;
        #endregion

        #region Constructors
        /// <summary>
        /// Constructor.
        /// </summary>
        public App()
        {
            //Initialise SecuritySettings.
            SecuritySettings.InitialiseSecuritySettings();

            //Initialisation.
            _applicationSettings = new ApplicationSettings();
            _eventLogging = new EventLogging(_applicationSettings.LoggingLevel);
            _bootStrapper = new Bootstrapper(_applicationSettings, _eventLogging);
        }
        #endregion

        #region Properties
        #endregion

        #region Private and Protected Methods
        /// <summary>
        /// Handle Application_Startup event.
        /// </summary>        
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            _bootStrapper.Run();
            _bootStrapper.ShowShell(); 
        }
        /// <summary>
        /// Handle Application_Exit event.
        /// </summary>        
        /// <remarks>
        /// Settings file is saved to users app data path
        /// e.g. C:\Users\YourLogon\AppData\Local\GoalBook.
        /// </remarks>
        private void Application_Exit(object sender, ExitEventArgs e)
        {
            _applicationSettings.Save();
        }
        /// <summary>
        /// Handle Application_Exception event.
        /// </summary>                
        private void Application_Exception(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            //Show Exception Message.
            MessageBox.Show(e.Exception.Message, 
                GoalBook.Shell.Properties.Resources.UnhandledException, 
                MessageBoxButton.OK, MessageBoxImage.Error);

            //Log Exception to System EventLog.
            _eventLogging.Log(_eventLogging.GetExceptionMessage(e.Exception), 
                Category.Exception, Priority.High);

            e.Handled = true;
        }
        #endregion

        #region Public and internal Methods
        #endregion

        #region Event Handlers
        #endregion

        #region Base Class Overrides
        #endregion
    } 
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer (Senior)
Australia Australia
I've been working as a software developer since 2000 and hold a Bachelor of Business degree from The Open Polytechnic of New Zealand. Computers are for people and I aim to build applications for people that they would want to use.

Comments and Discussions