Click here to Skip to main content
15,896,557 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 79.5K   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.Windows;
using System.Windows.Input;
using GoalBook.Infrastructure;
using GoalBook.Infrastructure.Enums;
using GoalBook.Shell.Properties;
using Microsoft.Practices.Composite.Presentation.Commands;
using InfrastructureConstants = GoalBook.Infrastructure.Constants.MenuConstants;
#endregion

namespace GoalBook.Shell.Commands
{
    public class ApplicationCommands : DependencyObject
    {
        /// <summary>
        /// Reference to SaveCommand.
        /// </summary>
        public DelegateCommand<CommandInfo> SaveCommand
        {
            get { return (DelegateCommand<CommandInfo>)GetValue(SaveCommandProperty); }
            set { SetValue(SaveCommandProperty, value); }
        }
        public static readonly DependencyProperty SaveCommandProperty = DependencyProperty.Register(
            "SaveCommand", typeof(DelegateCommand<CommandInfo>), typeof(ApplicationCommands));
        
        /// <summary>
        /// Reference to ExitCommand.
        /// </summary>
        public DelegateCommand<CommandInfo> ExitCommand
        {
            get { return (DelegateCommand<CommandInfo>)GetValue(ExitCommandProperty); }
            set { SetValue(ExitCommandProperty, value); }
        }
        public static readonly DependencyProperty ExitCommandProperty = DependencyProperty.Register(
            "ExitCommand", typeof(DelegateCommand<CommandInfo>), typeof(ApplicationCommands));

        /// <summary>
        /// Reference to SyncCommand.
        /// </summary>
        public DelegateCommand<CommandInfo> SyncCommand
        {
            get { return (DelegateCommand<CommandInfo>)GetValue(SyncCommandProperty); }
            set { SetValue(SyncCommandProperty, value); }
        }
        public static readonly DependencyProperty SyncCommandProperty = DependencyProperty.Register(
            "SyncCommand", typeof(DelegateCommand<CommandInfo>), typeof(ApplicationCommands));

        /// <summary>
        /// Reference to ConfigureAccountCommand.
        /// </summary>
        public DelegateCommand<CommandInfo> ConfigureAccountCommand
        {
            get { return (DelegateCommand<CommandInfo>)GetValue(ConfigureAccountCommandProperty); }
            set { SetValue(ConfigureAccountCommandProperty, value); }
        }
        public static readonly DependencyProperty ConfigureAccountCommandProperty = DependencyProperty.Register(
            "ConfigureAccountCommand", typeof(DelegateCommand<CommandInfo>), typeof(ApplicationCommands));

        /// <summary>
        /// Reference to ChangeAccountCommand.
        /// </summary>
        public DelegateCommand<CommandInfo> ChangeAccountCommand
        {
            get { return (DelegateCommand<CommandInfo>)GetValue(ChangeAccountCommandProperty); }
            set { SetValue(ChangeAccountCommandProperty, value); }
        }
        public static readonly DependencyProperty ChangeAccountCommandProperty = DependencyProperty.Register(
            "ChangeAccountCommand", typeof(DelegateCommand<CommandInfo>), typeof(ApplicationCommands));
        
        /// <summary>
        /// Reference to ClearDataCommand.
        /// </summary>
        public DelegateCommand<CommandInfo> ClearDataCommand
        {
            get { return (DelegateCommand<CommandInfo>)GetValue(ClearDataCommandProperty); }
            set { SetValue(ClearDataCommandProperty, value); }
        }
        public static readonly DependencyProperty ClearDataCommandProperty = DependencyProperty.Register(
            "ClearDataCommand", typeof(DelegateCommand<CommandInfo>), typeof(ApplicationCommands));

        /// <summary>
        /// Reference to InternetCommand.
        /// </summary>
        public DelegateCommand<CommandInfo> InternetCommand
        {
            get { return (DelegateCommand<CommandInfo>)GetValue(InternetCommandProperty); }
            set { SetValue(InternetCommandProperty, value); }
        }
        public static readonly DependencyProperty InternetCommandProperty = DependencyProperty.Register(
            "InternetCommand", typeof(DelegateCommand<CommandInfo>), typeof(ApplicationCommands));

        /// <summary>
        /// Reference to FeedbackCommand.
        /// </summary>
        public DelegateCommand<CommandInfo> FeedbackCommand
        {
            get { return (DelegateCommand<CommandInfo>)GetValue(FeedbackCommandProperty); }
            set { SetValue(FeedbackCommandProperty, value); }
        }
        public static readonly DependencyProperty FeedbackCommandProperty = DependencyProperty.Register(
            "FeedbackCommand", typeof(DelegateCommand<CommandInfo>), typeof(ApplicationCommands));

        /// <summary>
        /// Reference to AboutCommand.
        /// </summary>
        public DelegateCommand<CommandInfo> AboutCommand
        {
            get { return (DelegateCommand<CommandInfo>)GetValue(AboutCommandProperty); }
            set { SetValue(AboutCommandProperty, value); }
        }
        public static readonly DependencyProperty AboutCommandProperty = DependencyProperty.Register(
            "AboutCommand", typeof(DelegateCommand<CommandInfo>), typeof(ApplicationCommands));
    }

    public static class ApplicationCommandsInfo
    {
        /// <summary>
        /// Reference to SaveCommandInfo.
        /// </summary>
        public static CommandInfo SaveCommandInfo = new CommandInfo(
            Resources.MenuSaveText,
            2,
            ParentMenuType.Module,
            new Uri(InfrastructureConstants.MENU_SAVE_IMAGE_URI),
            new KeyGesture(Key.S, ModifierKeys.Control, Resources.MenuSaveInputGestureText));
        
        /// <summary>
        /// Reference to SyncCommandInfo.
        /// </summary>
        public static CommandInfo SyncCommandInfo = new CommandInfo(
            Resources.MenuSynchronisationText,
            0,
            ParentMenuType.Tools,
            new Uri(InfrastructureConstants.MENU_SYNCHRONISE_IMAGE_URI),
            new KeyGesture(Key.F9, ModifierKeys.None, Resources.MenuSyncInputGestureText));

        /// <summary>
        /// Reference to ConfigureAccountCommandInfo.
        /// </summary>
        public static CommandInfo ConfigureAccountCommandInfo = new CommandInfo(
            Resources.MenuConfigureAccountText,
            0,
            ParentMenuType.Tools,
            new Uri(InfrastructureConstants.MENU_ACCOUNT_IMAGE_URI),
            null);

        /// <summary>
        /// Reference to ChangeAccountCommandInfo.
        /// </summary>
        public static CommandInfo ChangeAccountCommandInfo = new CommandInfo(
            Resources.MenuChangeAccountText,
            0,
            ParentMenuType.Tools,
            new Uri(InfrastructureConstants.MENU_ACCOUNT_CHANGE_IMAGE_URI),
            null);

        
        /// <summary>
        /// Reference to ClearDataCommandInfo.
        /// </summary>
        public static CommandInfo ClearDataCommandInfo = new CommandInfo(
            Resources.MenuClearDataText,
            2,
            ParentMenuType.ToodledoAccount,
            null,
            null);

        /// <summary>
        /// Reference to InternetCommandInfo.
        /// </summary>
        public static CommandInfo InternetCommandInfo = new CommandInfo(
            Resources.MenuInternetText,
            3,
            ParentMenuType.Tools,
            new Uri(InfrastructureConstants.MENU_INTERNET_IMAGE_URI),
            null);

        /// <summary>
        /// Reference to ExitCommandInfo.
        /// </summary>
        public static CommandInfo ExitCommandInfo = new CommandInfo(
            Resources.MenuExitText,
            1,
            ParentMenuType.Module,
            null,
            new KeyGesture(Key.F4, ModifierKeys.Alt, Resources.MenuExitInputGestureText));

        /// <summary>
        /// Reference to FeedbackCommandInfo.
        /// </summary>
        public static CommandInfo FeedbackCommandInfo = new CommandInfo(
            Resources.MenuFeedbackText,
            0,
            ParentMenuType.Help,
            new Uri(InfrastructureConstants.MENU_FEEDBACK_IMAGE_URI),
            null);

        /// <summary>
        /// Reference to AboutCommandInfo.
        /// </summary>
        public static CommandInfo AboutCommandInfo = new CommandInfo(
            Resources.MenuAboutText,
            2,
            ParentMenuType.Help,
            null,
            null);
    }
}

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