Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

GoalBook - A Hybrid Smart Client

, 25 Sep 2009
A WPF hybrid smart client that synchronises your goals with the Toodledo online To-do service.
GoalBook.zip
GoalBook
Dependencies
CAG WPF 2
Microsoft.Practices.Composite.dll
Microsoft.Practices.Composite.Presentation.dll
Microsoft.Practices.Composite.UnityExtensions.dll
Microsoft.Practices.ObjectBuilder2.dll
Microsoft.Practices.ServiceLocation.dll
Microsoft.Practices.Unity.dll
vssver2.scc
CSLA
Csla.dll
Csla.XmlSerializers.dll
vssver2.scc
Infragistics
Infragistics3.Wpf.DataPresenter.v9.1.Express.dll
Infragistics3.Wpf.Editors.v9.1.Express.dll
Infragistics3.Wpf.v9.1.Express.dll
vssver2.scc
WPFToolkit
vssver2.scc
WPFToolkit.dll
GoalBook.Controls
CheckedList
vssver2.scc
Properties
vssver2.scc
vssver2.scc
GoalBook.Goals
GoalBook.Goals.csproj.user
Properties
vssver2.scc
Views
vssver2.scc
vssver2.scc
GoalBook.Infrastructure
Comparers
vssver2.scc
Constants
vssver2.scc
Controls
Converters
vssver2.scc
Enums
vssver2.scc
Events
vssver2.scc
GoalBook.Infrastructure.csproj.user
Helpers
vssver2.scc
Interfaces
vssver2.scc
ObjectModel
vssver2.scc
Printing
vssver2.scc
Properties
vssver2.scc
vssver2.scc
GoalBook.Notes
GoalBook.Notes.csproj.user
Properties
vssver2.scc
Resources
arrow_redo.png
arrow_undo.png
cut.png
page_copy.png
paste_plain.png
text_bold.png
text_indent.png
text_indent_remove.png
text_italic.png
text_list_bullets.png
text_list_numbers.png
vssver2.scc
world_link.png
Views
vssver2.scc
vssver2.scc
GoalBook.Public
Encryption
vssver2.scc
HtmlConverter
vssver2.scc
HtmlParser
vssver2.scc
Misc
vssver2.scc
Properties
vssver2.scc
vssver2.scc
GoalBook.Shell
App.ico
Commands
vssver2.scc
GoalBook.Shell.csproj.user
Journal.ico
Journal48.ico
Misc
vssver2.scc
Modules
vssver2.scc
Properties
licenses.licx
vssver2.scc
Resources
arrow_refresh.png
arrow_undo.png
checked.gif
cross.png
disk.png
email.png
erase.png
error.png
exclamation.png
flag_red.png
group.png
help.png
information.png
magnifier.png
page_red.png
pencil.png
printer.png
user.png
vssver2.scc
Wave.jpg
world.png
world_link.png
Services
vssver2.scc
Splash.png
Views
vssver2.scc
vssver2.scc
Windows
vssver2.scc
GoalBook.snk
GoalBook.Synchronisation
Events
vssver2.scc
Properties
vssver2.scc
ToodleDo
vssver2.scc
vssver2.scc
GoalBook.Tasks
Controls
vssver2.scc
Properties
vssver2.scc
Views
vssver2.scc
vssver2.scc
vssver2.scc
// <copyright file="TasksDialogViewPresenter.cs" company="GoalBook"> 
//    Copyright © 2009 Mark Brownsword. All rights reserved.
//    This source code and supporting files are licensed under The Code Project  
//    Open License (CPOL) as detailed at http://www.codeproject.com/info/cpol10.aspx. 
// </copyright>
namespace GoalBook.Tasks.Views
{
    #region Using Statements
    using System.ComponentModel;
    using GoalBook.Infrastructure.Converters;
    using GoalBook.Infrastructure.Events;
    using GoalBook.Infrastructure.Interfaces;
    using GoalBook.Infrastructure.ObjectModel;
    #endregion

    /// <summary>
    /// Tasks DialogView Presenter class.
    /// </summary>
    public class TasksDialogViewPresenter
    {
        #region Constants and Enums
        #endregion

        #region Inner Classes and Structures
        #endregion

        #region Delegates and Events
        #endregion

        #region Instance and Shared Fields
        /// <summary>
        /// Declaration for IPersistenceService.
        /// </summary>
        private readonly IPersistenceService persistenceService;

        /// <summary>
        /// Declaration for IDialogService.
        /// </summary>
        private readonly IDialogService dialogService;

        /// <summary>
        /// Declaration for XamlToFlowDocumentConverter.
        /// </summary>
        private XamlToFlowDocumentConverter converter;
        #endregion

        #region Constructors
        /// <summary>
        /// Initializes a new instance of the TasksDialogViewPresenter class.
        /// </summary> 
        /// <param name="editTask">Task parameter</param>
        /// <param name="persistenceService">IPersistenceService parameter</param>
        /// <param name="dialogService">IDialogService parameter</param>
        public TasksDialogViewPresenter(Task editTask, IPersistenceService persistenceService, IDialogService dialogService)
        {
            // Reference to PersistenceService.
            this.persistenceService = persistenceService;

            // Reference to DialogService
            this.dialogService = dialogService;

            // Initialise the XamlToFlowDocumentConverter.
            this.converter = new XamlToFlowDocumentConverter();

            // Initialise Model.
            this.Model = new TasksDialogViewPresentationModel();
            this.Model.EditTask = editTask;
            this.Model.EditTask.PropertyChanged += new PropertyChangedEventHandler(this.EditTask_PropertyChanged);

            // Initialise ReferenceData
            this.Model.FolderList = this.persistenceService.FetchFolderList();                              
        }               
        #endregion

        #region Properties
        /// <summary>
        /// Gets Reference to Model.
        /// </summary>
        public TasksDialogViewPresentationModel Model { get; private set; }

        /// <summary>
        /// Gets or sets Reference to View.
        /// </summary>
        public TasksDialogView View { get; set; }
        #endregion

        #region Public and internal Methods
        /// <summary>
        /// Initialise the View.
        /// </summary>
        public void InitView()
        {
            this.View.DataContext = this.Model;
        }
        #endregion

        #region Private and Protected Methods
        /// <summary>
        /// Handle AddGoal_PropertyChanged event.
        /// </summary> 
        /// <param name="sender">sender parameter</param>
        /// <param name="e">PropertyChangedEventArgs parameter</param>
        private void EditTask_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            this.View.RaiseErrorInfoChanged(this.Model.EditTask as IDataErrorInfo);
        }
        
        /// <summary>
        /// Handle View_DueDateChanged event.
        /// </summary>
        /// <param name="e">DueDateChangedEventArgs parameter</param>
        private void View_DueDateChanged(DueDateChangedEventArgs e)
        {
            this.View.RaiseErrorInfoChanged(this.Model.EditTask as IDataErrorInfo);
        }
        #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)

Share

About the Author

Mark Brownsword
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.

| Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 25 Sep 2009
Article Copyright 2009 by Mark Brownsword
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid