[12256] | 1 | using System; |
---|
| 2 | using System.Collections.Generic; |
---|
| 3 | using System.Text; |
---|
| 4 | using System.ComponentModel; |
---|
| 5 | using Com.Piwigo.Lib.DTO; |
---|
| 6 | |
---|
| 7 | namespace Com.Piwigo.Uploader.DTO |
---|
| 8 | { |
---|
| 9 | public sealed class ModelManager |
---|
| 10 | { |
---|
| 11 | static readonly ModelManagerBase _instance = new ModelManagerBase(); |
---|
| 12 | |
---|
| 13 | // Explicit static constructor to tell C# compiler |
---|
| 14 | // not to mark type as beforefieldinit |
---|
| 15 | static ModelManager() |
---|
| 16 | { |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | public static ModelManagerBase Instance |
---|
| 20 | { |
---|
| 21 | get |
---|
| 22 | { |
---|
| 23 | return _instance; |
---|
| 24 | } |
---|
| 25 | } |
---|
| 26 | |
---|
[12407] | 27 | public class ModelManagerBase : INotifyPropertyChanged |
---|
[12256] | 28 | { |
---|
[12407] | 29 | private PwgSession _sess; |
---|
| 30 | public PwgSession sess { |
---|
| 31 | get { |
---|
| 32 | return _sess; |
---|
| 33 | } |
---|
| 34 | set { |
---|
| 35 | _sess = value; |
---|
| 36 | OnPropertyChanged("sess"); |
---|
| 37 | } |
---|
| 38 | } |
---|
[12262] | 39 | |
---|
[12407] | 40 | private SelectedPwgAlbumList _lstCat; |
---|
| 41 | public SelectedPwgAlbumList lstCat { |
---|
| 42 | get { |
---|
| 43 | return _lstCat; |
---|
| 44 | } |
---|
| 45 | set { |
---|
| 46 | _lstCat = value; |
---|
| 47 | OnPropertyChanged("lstCat"); |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | private Int32 _PwgAlbumIdSelected; |
---|
| 52 | public Int32 PwgAlbumIdSelected { |
---|
| 53 | get |
---|
| 54 | { |
---|
| 55 | return _PwgAlbumIdSelected; |
---|
| 56 | } |
---|
| 57 | set { |
---|
| 58 | _PwgAlbumIdSelected = value; |
---|
| 59 | OnPropertyChanged("PwgAlbumIdSelected"); |
---|
| 60 | } |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | private LocalAlbumList _lstAlbumLocaux; |
---|
| 64 | public LocalAlbumList lstAlbumLocaux { |
---|
| 65 | get{ |
---|
| 66 | return _lstAlbumLocaux; |
---|
| 67 | } |
---|
| 68 | set { |
---|
| 69 | _lstAlbumLocaux = value; |
---|
| 70 | OnPropertyChanged("lstAlbumLocaux"); |
---|
| 71 | } |
---|
| 72 | } |
---|
| 73 | |
---|
[13520] | 74 | public System.Windows.Forms.TreeNode SelectedNode { get; set; } |
---|
| 75 | |
---|
[12407] | 76 | private LocalAlbum _AlbumEdited; |
---|
| 77 | public LocalAlbum AlbumEdited { |
---|
| 78 | get { |
---|
| 79 | return _AlbumEdited; |
---|
| 80 | } |
---|
| 81 | set { |
---|
| 82 | _AlbumEdited = value; |
---|
| 83 | OnPropertyChanged("AlbumEdited"); |
---|
| 84 | } |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | private LocalImage _ImageEdited; |
---|
| 88 | public LocalImage ImageEdited { |
---|
| 89 | get{ |
---|
| 90 | return _ImageEdited; |
---|
| 91 | } |
---|
| 92 | set { |
---|
| 93 | _ImageEdited = value; |
---|
| 94 | OnPropertyChanged("ImageEdited"); |
---|
| 95 | } |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | private Boolean _isConnected; |
---|
| 99 | public Boolean isConnected { |
---|
| 100 | get { |
---|
| 101 | return _isConnected; |
---|
| 102 | } |
---|
| 103 | set { |
---|
| 104 | _isConnected = value; |
---|
| 105 | OnPropertyChanged("isConnected"); |
---|
| 106 | } |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | private String _directoryName; |
---|
| 110 | public String directoryName { |
---|
| 111 | get{ |
---|
| 112 | return _directoryName; |
---|
| 113 | } |
---|
| 114 | set { |
---|
| 115 | _directoryName = value; |
---|
| 116 | OnPropertyChanged("directoryName"); |
---|
| 117 | } |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | private Uri _serveurName; |
---|
| 121 | public Uri serveurName { |
---|
| 122 | get{ |
---|
| 123 | return _serveurName; |
---|
| 124 | } |
---|
| 125 | set { |
---|
| 126 | _serveurName = value; |
---|
| 127 | OnPropertyChanged("serveurName"); |
---|
| 128 | } |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | private String _userName; |
---|
| 132 | public String userName { |
---|
| 133 | get{ |
---|
| 134 | return _userName; |
---|
| 135 | } |
---|
| 136 | set { |
---|
| 137 | _userName = value; |
---|
| 138 | OnPropertyChanged("userName"); |
---|
| 139 | } |
---|
| 140 | } |
---|
| 141 | |
---|
| 142 | private String _password; |
---|
| 143 | public String password { |
---|
| 144 | get { |
---|
| 145 | return _password; |
---|
| 146 | } |
---|
| 147 | set { |
---|
| 148 | _password = value; |
---|
| 149 | OnPropertyChanged("password"); |
---|
| 150 | } |
---|
| 151 | } |
---|
| 152 | |
---|
[13520] | 153 | private PwgUploadOption _uploadOption; |
---|
| 154 | public PwgUploadOption UploadOption |
---|
| 155 | { |
---|
| 156 | get { |
---|
| 157 | return _uploadOption; |
---|
| 158 | } |
---|
| 159 | set { |
---|
| 160 | _uploadOption = value; |
---|
| 161 | OnPropertyChanged("UploadOption"); |
---|
| 162 | } |
---|
| 163 | } |
---|
| 164 | |
---|
| 165 | private List<KeyValuePair<PwgConfidentLevelEnum, String>> _lstConfidentLevel; |
---|
| 166 | public List<KeyValuePair<PwgConfidentLevelEnum, String>> LstConfidentLevel |
---|
| 167 | { |
---|
| 168 | get |
---|
| 169 | { |
---|
| 170 | return _lstConfidentLevel; |
---|
| 171 | } |
---|
| 172 | set |
---|
| 173 | { |
---|
| 174 | _lstConfidentLevel = value; |
---|
| 175 | OnPropertyChanged("LstConfidentLevel"); |
---|
| 176 | } |
---|
| 177 | } |
---|
| 178 | |
---|
| 179 | |
---|
[12262] | 180 | public ModelManagerBase() |
---|
| 181 | { |
---|
[12336] | 182 | lstCat = new SelectedPwgAlbumList(); |
---|
[12262] | 183 | lstAlbumLocaux = new LocalAlbumList(); |
---|
| 184 | isConnected = false; |
---|
[12407] | 185 | |
---|
| 186 | AlbumEdited = new LocalAlbum(); |
---|
| 187 | ImageEdited = new LocalImage(); |
---|
[13520] | 188 | UploadOption = new PwgUploadOption(); |
---|
| 189 | |
---|
| 190 | LstConfidentLevel = Com.Piwigo.Lib.DTO.Helper.PwgEnumHelper<PwgConfidentLevelEnum>.buildChoiceList(); |
---|
[12262] | 191 | } |
---|
| 192 | |
---|
| 193 | internal void resetLstCat() |
---|
| 194 | { |
---|
| 195 | if (lstCat == null) |
---|
| 196 | { |
---|
[12336] | 197 | lstCat = new SelectedPwgAlbumList(); |
---|
[12262] | 198 | } |
---|
| 199 | else |
---|
| 200 | { |
---|
| 201 | lstCat.Clear(); |
---|
| 202 | } |
---|
[12336] | 203 | lstCat.Add(new SelectedAlbumListItem() { Id = PwgAlbum.RootAlbumId, ShowedValue = "Root album", Data=null, isSelected=true }); |
---|
[12262] | 204 | } |
---|
[12407] | 205 | |
---|
| 206 | public event PropertyChangedEventHandler PropertyChanged; |
---|
| 207 | protected void OnPropertyChanged(String info) |
---|
| 208 | { |
---|
| 209 | if (PropertyChanged != null) |
---|
| 210 | PropertyChanged(this, new PropertyChangedEventArgs(info)); |
---|
| 211 | } |
---|
[13520] | 212 | |
---|
[12256] | 213 | } |
---|
| 214 | } |
---|
| 215 | } |
---|