// <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.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)