Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | using System.Windows.Input; |
---|
6 | using Com.Piwigo.Wpf.Helper; |
---|
7 | using Com.Piwigo.Wpf.DTO; |
---|
8 | |
---|
9 | namespace 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.