Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / FileProperties / NewContainerViewModel.cs @ 21141c06

History | View | Annotate | Download (3.1 kB)

1 255f5f86 Panagiotis Kanavos
#region
2 255f5f86 Panagiotis Kanavos
/* -----------------------------------------------------------------------
3 255f5f86 Panagiotis Kanavos
 * <copyright file="NewContainerViewModel.cs" company="GRNet">
4 255f5f86 Panagiotis Kanavos
 * 
5 255f5f86 Panagiotis Kanavos
 * Copyright 2011-2012 GRNET S.A. All rights reserved.
6 255f5f86 Panagiotis Kanavos
 *
7 255f5f86 Panagiotis Kanavos
 * Redistribution and use in source and binary forms, with or
8 255f5f86 Panagiotis Kanavos
 * without modification, are permitted provided that the following
9 255f5f86 Panagiotis Kanavos
 * conditions are met:
10 255f5f86 Panagiotis Kanavos
 *
11 255f5f86 Panagiotis Kanavos
 *   1. Redistributions of source code must retain the above
12 255f5f86 Panagiotis Kanavos
 *      copyright notice, this list of conditions and the following
13 255f5f86 Panagiotis Kanavos
 *      disclaimer.
14 255f5f86 Panagiotis Kanavos
 *
15 255f5f86 Panagiotis Kanavos
 *   2. Redistributions in binary form must reproduce the above
16 255f5f86 Panagiotis Kanavos
 *      copyright notice, this list of conditions and the following
17 255f5f86 Panagiotis Kanavos
 *      disclaimer in the documentation and/or other materials
18 255f5f86 Panagiotis Kanavos
 *      provided with the distribution.
19 255f5f86 Panagiotis Kanavos
 *
20 255f5f86 Panagiotis Kanavos
 *
21 255f5f86 Panagiotis Kanavos
 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
22 255f5f86 Panagiotis Kanavos
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 255f5f86 Panagiotis Kanavos
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 255f5f86 Panagiotis Kanavos
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
25 255f5f86 Panagiotis Kanavos
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 255f5f86 Panagiotis Kanavos
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 255f5f86 Panagiotis Kanavos
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 255f5f86 Panagiotis Kanavos
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 255f5f86 Panagiotis Kanavos
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 255f5f86 Panagiotis Kanavos
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 255f5f86 Panagiotis Kanavos
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 255f5f86 Panagiotis Kanavos
 * POSSIBILITY OF SUCH DAMAGE.
33 255f5f86 Panagiotis Kanavos
 *
34 255f5f86 Panagiotis Kanavos
 * The views and conclusions contained in the software and
35 255f5f86 Panagiotis Kanavos
 * documentation are those of the authors and should not be
36 255f5f86 Panagiotis Kanavos
 * interpreted as representing official policies, either expressed
37 255f5f86 Panagiotis Kanavos
 * or implied, of GRNET S.A.
38 255f5f86 Panagiotis Kanavos
 * </copyright>
39 255f5f86 Panagiotis Kanavos
 * -----------------------------------------------------------------------
40 255f5f86 Panagiotis Kanavos
 */
41 255f5f86 Panagiotis Kanavos
#endregion
42 255f5f86 Panagiotis Kanavos
using System;
43 b12f73e8 Panagiotis Kanavos
using System.Collections.Generic;
44 b12f73e8 Panagiotis Kanavos
using System.ComponentModel.Composition;
45 b12f73e8 Panagiotis Kanavos
using System.Linq;
46 b12f73e8 Panagiotis Kanavos
using System.Text;
47 b12f73e8 Panagiotis Kanavos
using Caliburn.Micro;
48 b12f73e8 Panagiotis Kanavos
using Pithos.Core;
49 b12f73e8 Panagiotis Kanavos
50 b12f73e8 Panagiotis Kanavos
namespace Pithos.Client.WPF.FileProperties
51 b12f73e8 Panagiotis Kanavos
{
52 b12f73e8 Panagiotis Kanavos
    [Export(typeof(NewContainerViewModel))]
53 b12f73e8 Panagiotis Kanavos
    public class NewContainerViewModel:Screen
54 b12f73e8 Panagiotis Kanavos
    {
55 b12f73e8 Panagiotis Kanavos
        public IEnumerable<string> Accounts { get; set; }
56 b12f73e8 Panagiotis Kanavos
57 b12f73e8 Panagiotis Kanavos
        private string _currentAccount;
58 b12f73e8 Panagiotis Kanavos
        public string CurrentAccount
59 b12f73e8 Panagiotis Kanavos
        {
60 b12f73e8 Panagiotis Kanavos
            get { return _currentAccount; }
61 b12f73e8 Panagiotis Kanavos
            set
62 b12f73e8 Panagiotis Kanavos
            {
63 b12f73e8 Panagiotis Kanavos
                _currentAccount = value;
64 b12f73e8 Panagiotis Kanavos
                NotifyOfPropertyChange(()=>CurrentAccount);
65 b12f73e8 Panagiotis Kanavos
            }
66 b12f73e8 Panagiotis Kanavos
        }
67 b12f73e8 Panagiotis Kanavos
68 b12f73e8 Panagiotis Kanavos
        private string _containerName;
69 b12f73e8 Panagiotis Kanavos
        public string ContainerName
70 b12f73e8 Panagiotis Kanavos
        {
71 b12f73e8 Panagiotis Kanavos
            get { return _containerName; }
72 b12f73e8 Panagiotis Kanavos
            set
73 b12f73e8 Panagiotis Kanavos
            {
74 b12f73e8 Panagiotis Kanavos
                _containerName = value;
75 b12f73e8 Panagiotis Kanavos
                NotifyOfPropertyChange(()=>ContainerName);
76 b12f73e8 Panagiotis Kanavos
            }
77 b12f73e8 Panagiotis Kanavos
        }
78 b12f73e8 Panagiotis Kanavos
79 b12f73e8 Panagiotis Kanavos
        public NewContainerViewModel(ShellViewModel shell)
80 b12f73e8 Panagiotis Kanavos
        {
81 b12f73e8 Panagiotis Kanavos
            Accounts=shell.Monitors.Select(pair => pair.Value.UserName);
82 b12f73e8 Panagiotis Kanavos
83 b12f73e8 Panagiotis Kanavos
        }
84 b12f73e8 Panagiotis Kanavos
85 b12f73e8 Panagiotis Kanavos
        public bool CanCreateContainer
86 b12f73e8 Panagiotis Kanavos
        {
87 b12f73e8 Panagiotis Kanavos
            get { return !String.IsNullOrWhiteSpace(CurrentAccount) && !String.IsNullOrWhiteSpace(ContainerName); }
88 b12f73e8 Panagiotis Kanavos
        }
89 b12f73e8 Panagiotis Kanavos
90 b12f73e8 Panagiotis Kanavos
        public void CreateContainer()
91 b12f73e8 Panagiotis Kanavos
        {
92 b12f73e8 Panagiotis Kanavos
            
93 b12f73e8 Panagiotis Kanavos
        }
94 b12f73e8 Panagiotis Kanavos
95 b12f73e8 Panagiotis Kanavos
    }
96 b12f73e8 Panagiotis Kanavos
}