Click here to Skip to main content
15,885,244 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;
using System.ComponentModel;
using System.Windows;
using GoalBook.Infrastructure;
#endregion

namespace GoalBook.Shell.Views
{
    public class AccountDialogViewPresenter
    {
        #region Constants and Enums
        #endregion

        #region Inner Classes and Structures
        #endregion

        #region Delegates and Events
        #endregion

        #region Instance and Shared Fields
        /// <summary>
        /// Declaration for informationMessage.
        /// </summary>
        private string informationMessage;
        #endregion

        #region Constructors
        /// <summary>
        /// Constructor.
        /// </summary>
        public AccountDialogViewPresenter(Credentials credentials, string informationMessage)
        {
            this.informationMessage = informationMessage;

            // Initialise Model.
            Model = new AccountDialogViewPresentationModel();
            Model.ConnectInfo = credentials;
            Model.ConnectInfo.PropertyChanged += new PropertyChangedEventHandler(ConnectInfo_PropertyChanged);            
        }
        #endregion

        #region Properties
        /// <summary>
        /// Reference to Model.
        /// </summary>
        public AccountDialogViewPresentationModel Model { get; set; }
        /// <summary>
        /// Reference to View.
        /// </summary>
        public AccountDialogView View { get; set; }        
        #endregion

        #region Private and Protected Methods
        #endregion

        #region Public and internal Methods
        /// <summary>
        /// Initialise the View.
        /// </summary>
        public void InitView()
        {
            View.textBoxEmail.IsEnabled = string.IsNullOrEmpty(Model.ConnectInfo.UserID);
            View.textBlockInformation.Text = informationMessage;                        
            View.DataContext = Model;            
        }        
        #endregion

        #region Event Handlers
        /// <summary>
        /// Handle ConnectInfo_PropertyChanged event. Raise event to the Dialog Window
        /// so the OK button is enabled when data is valid.
        /// </summary>        
        private void ConnectInfo_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {            
            View.RaiseErrorInfoChanged(Model.ConnectInfo as IDataErrorInfo);
        }        
        #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