Revision 1e4f1775 trunk/Pithos.Client.WPF/FileProperties/ContainerPropertiesViewModel.cs
b/trunk/Pithos.Client.WPF/FileProperties/ContainerPropertiesViewModel.cs | ||
---|---|---|
283 | 283 |
items.Apply(collection.Add); |
284 | 284 |
} |
285 | 285 |
|
286 |
private MetaValue _currentTag; |
|
287 |
public MetaValue CurrentTag |
|
288 |
{ |
|
289 |
get { return _currentTag; } |
|
290 |
set |
|
291 |
{ |
|
292 |
_currentTag = (value == null) ? new MetaValue() : value.Clone(); |
|
293 |
_currentTag.PropertyChanged += (o, e) => NotifyOfPropertyChange(() => CanAddTag); |
|
294 |
|
|
295 |
NotifyOfPropertyChange(() => CurrentTag); |
|
296 |
NotifyOfPropertyChange(() => CanAddTag); |
|
297 |
} |
|
298 |
} |
|
299 |
|
|
286 | 300 |
private readonly ObservableCollection<MetaValue> _tags; |
287 | 301 |
public ObservableCollection<MetaValue> Tags |
288 | 302 |
{ |
289 | 303 |
get { return _tags; } |
290 | 304 |
} |
291 | 305 |
|
306 |
public bool CanAddTag |
|
307 |
{ |
|
308 |
get { return !String.IsNullOrWhiteSpace(CurrentTag.Name); } |
|
309 |
} |
|
310 |
|
|
311 |
public void AddTag() |
|
312 |
{ |
|
313 |
var existingTag = Tags.FirstOrDefault(tag => tag.Name == CurrentTag.Name); |
|
314 |
if (existingTag == null) |
|
315 |
Tags.Add(CurrentTag.Clone()); |
|
316 |
else |
|
317 |
{ |
|
318 |
existingTag.Value = CurrentTag.Value; |
|
319 |
} |
|
320 |
} |
|
321 |
|
|
292 | 322 |
/* private readonly ObservableCollection<MetaValue> _policies; |
293 | 323 |
public ObservableCollection<MetaValue> Policies |
294 | 324 |
{ |
Also available in: Unified diff