source: extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdBase.cs @ 11905

Last change on this file since 11905 was 11905, checked in by bayral, 13 years ago

firsts steps of wpf client

File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Input;
6using Com.Piwigo.Wpf.Helper;
7using Com.Piwigo.Wpf.DTO;
8
9namespace Com.Piwigo.Wpf.Command
10{
11    public abstract class PwgCmdBase : ICommand
12    {
13       Boolean _isRunning;
14       public Boolean IsRunning {
15           get
16           {
17               return _isRunning;
18           }
19           set
20           {
21               _isRunning = value;
22           }
23       }
24
25       #region ICommand Membres
26        public virtual bool CanExecute(object parameter)
27        {
28             Boolean retVal = false;
29            if ( AppHelper.IsInDesignModeStatic == true)
30            {
31                retVal = false;
32            }
33            else
34            {
35                if (IsRunning)
36                {
37                    retVal = false;
38                }
39                else if (PwgModelManager.Instance.Session != null)
40                {
41                    retVal = !String.IsNullOrWhiteSpace(PwgModelManager.Instance.Session.ServeurName);                   
42                }
43            }
44            return (retVal);
45        }
46
47        public abstract void Execute(object parameter);
48       
49        public event EventHandler CanExecuteChanged
50        {
51           add { CommandManager.RequerySuggested += value; }
52           remove { CommandManager.RequerySuggested -= value; }
53        }
54       #endregion
55    }
56}
Note: See TracBrowser for help on using the repository browser.