X-Git-Url: https://code.grnet.gr/git/pithos-ms-client/blobdiff_plain/ebc37b0dd4943d8490fc646854932bc75e8be425..e0f698097edf2924a0e6eef53d4f6f117a72d4b5:/trunk/Pithos.Client.WPF/FileProperties/ContainerPropertiesViewModel.cs diff --git a/trunk/Pithos.Client.WPF/FileProperties/ContainerPropertiesViewModel.cs b/trunk/Pithos.Client.WPF/FileProperties/ContainerPropertiesViewModel.cs index 1424a16..8a7ffc5 100644 --- a/trunk/Pithos.Client.WPF/FileProperties/ContainerPropertiesViewModel.cs +++ b/trunk/Pithos.Client.WPF/FileProperties/ContainerPropertiesViewModel.cs @@ -45,6 +45,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel.Composition; using System.Diagnostics.Contracts; +using System.IO; using System.Linq; using System.Net; using System.Text; @@ -283,12 +284,42 @@ namespace Pithos.Client.WPF.FileProperties items.Apply(collection.Add); } + private MetaValue _currentTag; + public MetaValue CurrentTag + { + get { return _currentTag; } + set + { + _currentTag = (value == null) ? new MetaValue() : value.Clone(); + _currentTag.PropertyChanged += (o, e) => NotifyOfPropertyChange(() => CanAddTag); + + NotifyOfPropertyChange(() => CurrentTag); + NotifyOfPropertyChange(() => CanAddTag); + } + } + private readonly ObservableCollection _tags; public ObservableCollection Tags { get { return _tags; } } + public bool CanAddTag + { + get { return !String.IsNullOrWhiteSpace(CurrentTag.Name); } + } + + public void AddTag() + { + var existingTag = Tags.FirstOrDefault(tag => tag.Name == CurrentTag.Name); + if (existingTag == null) + Tags.Add(CurrentTag.Clone()); + else + { + existingTag.Value = CurrentTag.Value; + } + } + /* private readonly ObservableCollection _policies; public ObservableCollection Policies { @@ -333,10 +364,14 @@ namespace Pithos.Client.WPF.FileProperties _tags = new ObservableCollection(); _tags.CollectionChanged += (sender, evt) => { TagsChanged = true; }; + CurrentTag=new MetaValue(); /*_policies = new ObservableCollection(); _policies.CollectionChanged += (sender, evt) => { PoliciesChanged = true; }; */ + var name = Path.GetFileName(localFolderName); + DisplayName = String.Format("{0} Container Properties", name); + Shell = shell; ContainerName = localFolderName; container.ContinueWith(t =>{