source: extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdProvider.cs @ 11935

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

root category handled

File size: 2.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Input;
6
7namespace Com.Piwigo.Wpf.Command
8{
9    public static class PwgCmdProvider
10    {
11        public static AsyncCommand GetByType<T>()
12        {
13            AsyncCommand objICom;
14
15            switch (typeof(T).Name)
16            {
17                case "PwgCmdConnect":
18                    objICom = PwgCmdConnect;
19                    break;
20                case "PwgCmdDisconnect":
21                    objICom = PwgCmdDisconnect;
22                    break;
23                case "PwgCmdGetImageforCategory":
24                    objICom = PwgCmdGetImageforCategory;
25                    break;
26                case "PwgCmdGetSubCategorieforCategory":
27                    objICom = PwgCmdGetSubCategorieforCategory;
28                    break;
29                default:
30                    throw new ArgumentException("AsyncCommand GetByType : Command Type unknow.", "Type");
31            }
32
33            return objICom;
34        }
35
36        public static AsyncCommand _pwgCmdConnect;
37        public static AsyncCommand PwgCmdConnect
38        {
39            get
40            {
41                if (_pwgCmdConnect == null)
42                {
43                    _pwgCmdConnect = new PwgCmdConnect();
44                }
45                return _pwgCmdConnect;
46            }
47        }
48
49        public static AsyncCommand _pwgCmdDisconnect;
50        public static AsyncCommand PwgCmdDisconnect
51        {
52            get
53            {
54                if (_pwgCmdDisconnect == null)
55                {
56                    _pwgCmdDisconnect = new PwgCmdDisconnect();
57                }
58                return _pwgCmdDisconnect;
59            }
60        }
61
62        public static AsyncCommand _pwgCmdGetImageforCategory;
63        public static AsyncCommand PwgCmdGetImageforCategory
64        {
65            get
66            {
67                if (_pwgCmdGetImageforCategory == null)
68                {
69                    _pwgCmdGetImageforCategory = new PwgCmdGetImageforCategory();
70                }
71                return _pwgCmdGetImageforCategory;
72            }
73        }
74
75        public static AsyncCommand _pwgCmdGetSubCategorieforCategory;
76        public static AsyncCommand PwgCmdGetSubCategorieforCategory
77        {
78            get
79            {
80                if (_pwgCmdGetSubCategorieforCategory == null)
81                {
82                    _pwgCmdGetSubCategorieforCategory = new PwgCmdGetSubCategorieforCategory();
83                }
84                return _pwgCmdGetSubCategorieforCategory;
85            }
86        }
87
88    }
89}
Note: See TracBrowser for help on using the repository browser.