Last change
on this file since 25886 was
12262,
checked in by bayral, 13 years ago
|
piwigo.upload retrieve data, and ready to upload
|
File size:
2.3 KB
|
Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | |
---|
6 | namespace Com.Piwigo.Uploader.Service |
---|
7 | { |
---|
8 | static class ServiceFactory |
---|
9 | { |
---|
10 | public static IService GetByType<T>() |
---|
11 | { |
---|
12 | IService objICom; |
---|
13 | |
---|
14 | switch (typeof(T).Name) |
---|
15 | { |
---|
16 | case "Connect": |
---|
17 | objICom = aConnect; |
---|
18 | break; |
---|
19 | case "Disconnect": |
---|
20 | objICom = aDisconnect; |
---|
21 | break; |
---|
22 | case "LoadFromDirectory": |
---|
23 | objICom = aLoadFromDirectory; |
---|
24 | break; |
---|
25 | case "UploadToPiwigo": |
---|
26 | objICom = aUploadToPiwigo; |
---|
27 | break; |
---|
28 | default: |
---|
29 | throw new ArgumentException("ServiceFactory GetByType : IService Type unknow.", "Type"); |
---|
30 | } |
---|
31 | |
---|
32 | return objICom; |
---|
33 | } |
---|
34 | |
---|
35 | private static IService _aConnect; |
---|
36 | private static IService aConnect |
---|
37 | { |
---|
38 | get |
---|
39 | { |
---|
40 | if (_aConnect == null) |
---|
41 | { |
---|
42 | _aConnect = new Connect(); |
---|
43 | } |
---|
44 | return _aConnect; |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | private static IService _aDisconnect; |
---|
49 | private static IService aDisconnect |
---|
50 | { |
---|
51 | get |
---|
52 | { |
---|
53 | if (_aDisconnect == null) |
---|
54 | { |
---|
55 | _aDisconnect = new Disconnect(); |
---|
56 | } |
---|
57 | return _aDisconnect; |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | private static IService _aLoadFromDirectory; |
---|
62 | private static IService aLoadFromDirectory |
---|
63 | { |
---|
64 | get |
---|
65 | { |
---|
66 | if (_aLoadFromDirectory == null) |
---|
67 | { |
---|
68 | _aLoadFromDirectory = new LoadFromDirectory(); |
---|
69 | } |
---|
70 | return _aLoadFromDirectory; |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | private static IService _aUploadToPiwigo; |
---|
75 | private static IService aUploadToPiwigo |
---|
76 | { |
---|
77 | get |
---|
78 | { |
---|
79 | if (_aUploadToPiwigo == null) |
---|
80 | { |
---|
81 | _aUploadToPiwigo = new UploadToPiwigo(); |
---|
82 | } |
---|
83 | return _aUploadToPiwigo; |
---|
84 | } |
---|
85 | } |
---|
86 | } |
---|
87 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.