source: extensions/PiwigoLib/PiwigoUpload/DTO/ModelManager.cs @ 12407

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

editing local data v0

File size: 5.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.ComponentModel;
5using Com.Piwigo.Lib.DTO;
6
7namespace 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
27        public class ModelManagerBase : INotifyPropertyChanged
28        {
29            private PwgSession _sess;
30            public PwgSession sess {
31                get {
32                    return _sess;
33                }
34                set {
35                    _sess = value;
36                    OnPropertyChanged("sess");
37                }
38            }
39
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
74            private LocalAlbum _AlbumEdited;
75            public LocalAlbum AlbumEdited { 
76                get {
77                    return _AlbumEdited;
78                }
79                set {
80                    _AlbumEdited = value;
81                    OnPropertyChanged("AlbumEdited");
82                } 
83            }
84
85            private LocalImage _ImageEdited;
86            public LocalImage ImageEdited { 
87                get{
88                    return _ImageEdited;
89                }
90                set {
91                    _ImageEdited = value;
92                    OnPropertyChanged("ImageEdited"); 
93                } 
94            }
95
96            private Boolean _isConnected;
97            public Boolean isConnected {
98                get {
99                    return _isConnected;
100                }
101                set {
102                    _isConnected = value;
103                    OnPropertyChanged("isConnected"); 
104                } 
105            }
106
107            private String _directoryName;
108            public String directoryName {
109                get{
110                    return _directoryName;
111                }
112                set {
113                    _directoryName = value;
114                    OnPropertyChanged("directoryName"); 
115                } 
116            }
117
118            private Uri _serveurName;
119            public Uri serveurName {
120                get{
121                    return _serveurName;
122                }
123                set {
124                    _serveurName = value;
125                    OnPropertyChanged("serveurName"); 
126                } 
127            }
128
129            private String _userName;
130            public String userName { 
131                get{
132                    return _userName;
133                }
134                set {
135                    _userName = value;
136                    OnPropertyChanged("userName"); 
137                } 
138            }
139
140            private String _password;
141            public String password { 
142                get {
143                    return _password;
144                }
145                set {
146                    _password = value;
147                    OnPropertyChanged("password"); 
148                } 
149            }
150
151            public ModelManagerBase()
152            {
153                lstCat = new SelectedPwgAlbumList();
154                lstAlbumLocaux = new LocalAlbumList();
155                isConnected = false;
156
157                AlbumEdited = new LocalAlbum();
158                ImageEdited = new LocalImage();
159            }
160
161            internal void resetLstCat()
162            {
163                if (lstCat == null)
164                {
165                    lstCat = new SelectedPwgAlbumList();
166                }
167                else
168                {
169                    lstCat.Clear();
170                }
171                lstCat.Add(new SelectedAlbumListItem() { Id = PwgAlbum.RootAlbumId, ShowedValue = "Root album", Data=null, isSelected=true }); 
172            }
173
174            public event PropertyChangedEventHandler PropertyChanged;
175            protected void OnPropertyChanged(String info)
176            {
177                if (PropertyChanged != null)
178                    PropertyChanged(this, new PropertyChangedEventArgs(info));
179            }
180        }
181    }
182}
Note: See TracBrowser for help on using the repository browser.