Revision c92e02f3
b/trunk/Pithos.Client.WPF/App.xaml.cs | ||
---|---|---|
32 | 32 |
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; |
33 | 33 |
TaskScheduler.UnobservedTaskException += OnUnobservedException; |
34 | 34 |
|
35 |
/* |
|
35 | 36 |
var appPatth = Assembly.GetExecutingAssembly().Location; |
36 | 37 |
Registry.LocalMachine.SetValue(@"Software\Pithos\AppPath",appPatth ); |
38 |
*/ |
|
37 | 39 |
InitializeComponent(); |
38 | 40 |
//Application.Current.ApplyTheme("BureauBlue"); |
39 | 41 |
} |
b/trunk/Pithos.Client.WPF/AppBootstrapper.cs | ||
---|---|---|
29 | 29 |
{ |
30 | 30 |
LogManager.GetLog = type => new log4netLogger(type); |
31 | 31 |
UpgradeSettings(); |
32 |
|
|
32 | 33 |
} |
33 | 34 |
|
34 | 35 |
private void UpgradeSettings() |
b/trunk/Pithos.Client.WPF/FileProperties/ContainerPolicy.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using Caliburn.Micro; |
|
6 |
|
|
7 |
namespace Pithos.Client.WPF.FileProperties |
|
8 |
{ |
|
9 |
public enum Versioning |
|
10 |
{ |
|
11 |
manual, |
|
12 |
auto, |
|
13 |
none |
|
14 |
} |
|
15 |
|
|
16 |
public class ContainerPolicy : PropertyChangedBase |
|
17 |
{ |
|
18 |
private int _quota; |
|
19 |
public int Quota |
|
20 |
{ |
|
21 |
get { return _quota; } |
|
22 |
set |
|
23 |
{ |
|
24 |
if (value < 0) |
|
25 |
throw new ArgumentOutOfRangeException("Quota"); |
|
26 |
|
|
27 |
_quota = value; |
|
28 |
NotifyOfPropertyChange(()=>Quota); |
|
29 |
} |
|
30 |
} |
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
private Versioning _versioning; |
|
35 |
public Versioning Versioning |
|
36 |
{ |
|
37 |
get { return _versioning; } |
|
38 |
set |
|
39 |
{ |
|
40 |
_versioning = value; |
|
41 |
NotifyOfPropertyChange(()=>Versioning); |
|
42 |
} |
|
43 |
} |
|
44 |
} |
|
45 |
} |
b/trunk/Pithos.Client.WPF/FileProperties/ContainerPropertiesView.xaml | ||
---|---|---|
1 | 1 |
<Window x:Class="Pithos.Client.WPF.FileProperties.ContainerPropertiesView" |
2 | 2 |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
3 | 3 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cal="http://www.caliburnproject.org" |
4 |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
|
4 | 5 |
Title="ContainerPropertiesView" Height="500" Width="300" |
5 | 6 |
Icon="/Pithos.Client.WPF;component/Images/PithosTaskbar.png" |
6 | 7 |
Background="{StaticResource {x:Static SystemColors.ControlBrushKey}}"> |
... | ... | |
11 | 12 |
</ResourceDictionary.MergedDictionaries> |
12 | 13 |
</ResourceDictionary> |
13 | 14 |
</Window.Resources> |
15 |
<extToolkit:BusyIndicator IsBusy="{Binding IsBusy}" BusyContent="Loading Container Info ..." > |
|
14 | 16 |
<Grid> |
15 | 17 |
<Grid.RowDefinitions> |
16 | 18 |
<RowDefinition Height="Auto"/> |
17 |
<RowDefinition Height="Auto"/> |
|
18 |
<RowDefinition Height="*"/> |
|
19 | 19 |
<RowDefinition Height="*"/> |
20 | 20 |
<RowDefinition Height="Auto"/> |
21 | 21 |
</Grid.RowDefinitions> |
... | ... | |
29 | 29 |
<TextBlock x:Name="ContainerName" Margin="5" Grid.Column="1" Text="Container Name" FontSize="16" FontWeight="Bold"/> |
30 | 30 |
<TextBlock x:Name="ShortSize" Margin="5" Text="345 KB" FontWeight="Bold" FontSize="14" Grid.Column="2" /> |
31 | 31 |
</Grid> |
32 |
<GroupBox Header="General" Grid.Row="1" Margin="5"> |
|
32 |
<TabControl Grid.Row="1"> |
|
33 |
<TabItem Header="General"> |
|
34 |
|
|
33 | 35 |
<Grid> |
34 | 36 |
<Grid.Resources> |
35 | 37 |
<Style x:Key="NameColumnStyle" TargetType="TextBlock"> |
36 | 38 |
<Setter Property="HorizontalAlignment" Value="Right"/> |
37 |
<Setter Property="Margin" Value="5,2"/> |
|
39 |
<Setter Property="VerticalAlignment" Value="Top"/> |
|
40 |
<Setter Property="Margin" Value="5,2"/> |
|
38 | 41 |
</Style> |
39 | 42 |
<Style x:Key="ValueColumnStyle" TargetType="TextBlock"> |
40 | 43 |
<Setter Property="HorizontalAlignment" Value="Left"/> |
41 |
<Setter Property="Margin" Value="5,2"/> |
|
44 |
<Setter Property="VerticalAlignment" Value="Top"/> |
|
45 |
<Setter Property="Margin" Value="5,2"/> |
|
42 | 46 |
</Style> |
43 | 47 |
</Grid.Resources> |
44 | 48 |
<Grid.ColumnDefinitions> |
... | ... | |
46 | 50 |
<ColumnDefinition Width="*"/> |
47 | 51 |
</Grid.ColumnDefinitions> |
48 | 52 |
<Grid.RowDefinitions> |
49 |
<RowDefinition/> |
|
50 |
<RowDefinition/>
|
|
51 |
<RowDefinition/>
|
|
52 |
<RowDefinition/>
|
|
53 |
<RowDefinition/>
|
|
54 |
<RowDefinition/>
|
|
53 |
<RowDefinition Height="Auto"/>
|
|
54 |
<RowDefinition Height="Auto"/>
|
|
55 |
<RowDefinition Height="Auto"/>
|
|
56 |
<RowDefinition Height="Auto"/>
|
|
57 |
<RowDefinition Height="Auto"/>
|
|
58 |
<RowDefinition Height="Auto"/>
|
|
55 | 59 |
</Grid.RowDefinitions> |
56 | 60 |
<TextBlock Text="Count :" Grid.Row="0" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
57 | 61 |
<TextBlock Text="Size :" Grid.Row="1" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
... | ... | |
64 | 68 |
<TextBlock x:Name="BlockSize" Text="4012354486" Grid.Row="4" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
65 | 69 |
<TextBlock x:Name="BlockHash" Text="2345456" Grid.Row="5" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
66 | 70 |
</Grid> |
67 |
</GroupBox> |
|
68 |
<GroupBox Header="Metadata" Grid.Row="2" > |
|
69 |
<DataGrid ItemsSource="{Binding Tags}" |
|
70 |
AutoGenerateColumns="False" CanUserAddRows="True" > |
|
71 |
<DataGrid.Columns> |
|
72 |
<DataGridTextColumn Binding="{Binding Name}" Header="Name" /> |
|
73 |
<DataGridTextColumn Binding="{Binding Value}" Header="Value" /> |
|
74 |
</DataGrid.Columns> |
|
75 |
</DataGrid> |
|
76 |
</GroupBox> |
|
77 |
<GroupBox Header="Policies" Grid.Row="3" > |
|
78 |
<DataGrid ItemsSource="{Binding Policies}" |
|
71 |
|
|
72 |
</TabItem> |
|
73 |
<TabItem Header="Metadata"> |
|
74 |
<DataGrid ItemsSource="{Binding Tags}" x:Name="Tags" |
|
79 | 75 |
AutoGenerateColumns="False" CanUserAddRows="True" > |
80 |
<DataGrid.Columns> |
|
81 |
<DataGridTextColumn Binding="{Binding Name}" Header="Name" /> |
|
82 |
<DataGridTextColumn Binding="{Binding Value}" Header="Value" /> |
|
83 |
</DataGrid.Columns> |
|
84 |
</DataGrid> |
|
85 |
</GroupBox> |
|
76 |
<DataGrid.Columns> |
|
77 |
<DataGridTemplateColumn > |
|
78 |
<DataGridTemplateColumn.CellTemplate> |
|
79 |
<DataTemplate> |
|
80 |
<Button Content=" - " Command="DataGrid.DeleteCommand"/> |
|
81 |
</DataTemplate> |
|
82 |
</DataGridTemplateColumn.CellTemplate> |
|
83 |
</DataGridTemplateColumn> |
|
84 |
<DataGridTextColumn Binding="{Binding Name}" Header="Key" /> |
|
85 |
<DataGridTextColumn Binding="{Binding Value}" Header="Value" /> |
|
86 |
</DataGrid.Columns> |
|
87 |
</DataGrid> |
|
88 |
</TabItem> |
|
89 |
<TabItem Header="Policies"> |
|
90 |
|
|
91 |
|
|
92 |
<Grid> |
|
93 |
<Grid.Resources> |
|
94 |
<Style x:Key="NameColumnStyle" TargetType="TextBlock"> |
|
95 |
<Setter Property="HorizontalAlignment" Value="Right"/> |
|
96 |
<Setter Property="VerticalAlignment" Value="Top"/> |
|
97 |
<Setter Property="Margin" Value="5,2"/> |
|
98 |
</Style> |
|
99 |
<Style x:Key="ValueColumnStyle" TargetType="TextBlock"> |
|
100 |
<Setter Property="HorizontalAlignment" Value="Left"/> |
|
101 |
<Setter Property="VerticalAlignment" Value="Top"/> |
|
102 |
<Setter Property="Margin" Value="5,2"/> |
|
103 |
</Style> |
|
104 |
</Grid.Resources> |
|
105 |
<Grid.ColumnDefinitions> |
|
106 |
<ColumnDefinition Width="Auto" /> |
|
107 |
<ColumnDefinition Width="*"/> |
|
108 |
</Grid.ColumnDefinitions> |
|
109 |
<Grid.RowDefinitions> |
|
110 |
<RowDefinition Height="Auto"/> |
|
111 |
<RowDefinition Height="Auto"/> |
|
112 |
<RowDefinition Height="Auto"/> |
|
113 |
<RowDefinition Height="Auto"/> |
|
114 |
<RowDefinition Height="Auto"/> |
|
115 |
<RowDefinition Height="Auto"/> |
|
116 |
</Grid.RowDefinitions> |
|
117 |
<TextBlock Text="Quota :" Grid.Row="0" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
118 |
<TextBlock Text="Versioning :" Grid.Row="1" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
119 |
|
|
120 |
<TextBox x:Name="Quota" Text="123" Grid.Row="0" Grid.Column="1" /> |
|
121 |
<ComboBox x:Name="Versions" Text="345 KB (345,332 bytes)" Grid.Row="1" Grid.Column="1" /> |
|
122 |
</Grid> |
|
123 |
|
|
86 | 124 |
|
87 |
<StackPanel Orientation="Horizontal" Grid.Row="4" HorizontalAlignment="Right"> |
|
125 |
</TabItem> |
|
126 |
</TabControl> |
|
127 |
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right"> |
|
88 | 128 |
<Button Name="SaveChanges" Content="OK" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}"/> |
89 | 129 |
<Button Name="RejectChanges" Content="Cancel" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}"/> |
90 | 130 |
<Button Name="ApplyChanges" Content="Apply" Style="{StaticResource ButtonStyle}" /> |
91 | 131 |
</StackPanel> |
92 | 132 |
|
93 | 133 |
</Grid> |
134 |
</extToolkit:BusyIndicator> |
|
94 | 135 |
</Window> |
b/trunk/Pithos.Client.WPF/FileProperties/ContainerPropertiesViewModel.cs | ||
---|---|---|
5 | 5 |
using System.ComponentModel.Composition; |
6 | 6 |
using System.Diagnostics.Contracts; |
7 | 7 |
using System.Linq; |
8 |
using System.Net; |
|
8 | 9 |
using System.Text; |
10 |
using System.Threading.Tasks; |
|
11 |
using System.Windows; |
|
9 | 12 |
using Caliburn.Micro; |
10 | 13 |
using Pithos.Network; |
11 | 14 |
|
... | ... | |
14 | 17 |
[Export(typeof(ContainerPropertiesViewModel))] |
15 | 18 |
public class ContainerPropertiesViewModel:Screen |
16 | 19 |
{ |
20 |
private string _containerName; |
|
21 |
|
|
17 | 22 |
/// <summary> |
18 | 23 |
/// Name of the displayed container |
19 | 24 |
/// </summary> |
20 |
public string ContainerName { get; set; } |
|
25 |
public string ContainerName |
|
26 |
{ |
|
27 |
get { return _containerName; } |
|
28 |
set |
|
29 |
{ |
|
30 |
_containerName = value; |
|
31 |
NotifyOfPropertyChange(()=>ContainerName); |
|
32 |
} |
|
33 |
} |
|
34 |
|
|
35 |
private string _title; |
|
21 | 36 |
/// <summary> |
22 | 37 |
/// Window title |
23 | 38 |
/// </summary> |
24 |
public string Title { get; set; } |
|
39 |
public string Title |
|
40 |
{ |
|
41 |
get { return _title; } |
|
42 |
set |
|
43 |
{ |
|
44 |
_title = value; |
|
45 |
NotifyOfPropertyChange(() => Title); |
|
46 |
} |
|
47 |
} |
|
48 |
|
|
49 |
private long _count; |
|
25 | 50 |
|
26 | 51 |
/// <summary> |
27 | 52 |
/// Count of files in the container |
28 | 53 |
/// </summary> |
29 |
public long Count { get; set; } |
|
54 |
public long Count |
|
55 |
{ |
|
56 |
get { return _count; } |
|
57 |
set |
|
58 |
{ |
|
59 |
_count = value; |
|
60 |
NotifyOfPropertyChange(() => Count); |
|
61 |
} |
|
62 |
} |
|
63 |
|
|
64 |
private DateTime _modified; |
|
30 | 65 |
|
31 | 66 |
/// <summary> |
32 | 67 |
/// Date of last modification |
33 | 68 |
/// </summary> |
34 |
public DateTime Modified { get; set; } |
|
35 |
|
|
69 |
public DateTime Modified |
|
70 |
{ |
|
71 |
get { return _modified; } |
|
72 |
set |
|
73 |
{ |
|
74 |
_modified = value; |
|
75 |
NotifyOfPropertyChange(() => Modified); |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
private string _size; |
|
80 |
|
|
36 | 81 |
/// <summary> |
37 | 82 |
/// Total size of the container in bytes |
38 | 83 |
/// </summary> |
39 |
public string Size { get; set; } |
|
84 |
public string Size |
|
85 |
{ |
|
86 |
get { return _size; } |
|
87 |
set |
|
88 |
{ |
|
89 |
_size = value; |
|
90 |
NotifyOfPropertyChange(() => Size); |
|
91 |
} |
|
92 |
} |
|
93 |
|
|
94 |
private string _shortSize; |
|
40 | 95 |
|
41 | 96 |
/// <summary> |
42 | 97 |
/// Total size of the container formatted in KB,MB etc |
43 | 98 |
/// </summary> |
44 |
public string ShortSize { get; set; } |
|
99 |
public string ShortSize |
|
100 |
{ |
|
101 |
get { return _shortSize; } |
|
102 |
set |
|
103 |
{ |
|
104 |
_shortSize = value; |
|
105 |
NotifyOfPropertyChange(() => ShortSize); |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
109 |
private int _blockSize; |
|
45 | 110 |
|
46 | 111 |
/// <summary> |
47 | 112 |
/// Block size used by the container |
48 | 113 |
/// </summary> |
49 |
public int BlockSize { get; set; } |
|
114 |
public int BlockSize |
|
115 |
{ |
|
116 |
get { return _blockSize; } |
|
117 |
set |
|
118 |
{ |
|
119 |
_blockSize = value; |
|
120 |
NotifyOfPropertyChange(() => BlockSize); |
|
121 |
} |
|
122 |
} |
|
123 |
|
|
124 |
private string _blockHash; |
|
50 | 125 |
|
51 | 126 |
/// <summary> |
52 | 127 |
/// Hash algorithm used to calculate block hashes |
53 | 128 |
/// </summary> |
54 |
public string BlockHash { get; set; } |
|
129 |
public string BlockHash |
|
130 |
{ |
|
131 |
get { return _blockHash; } |
|
132 |
set |
|
133 |
{ |
|
134 |
_blockHash = value; |
|
135 |
NotifyOfPropertyChange(() => BlockHash); |
|
136 |
} |
|
137 |
} |
|
138 |
|
|
139 |
private ShellViewModel _shell; |
|
55 | 140 |
|
56 | 141 |
/// <summary> |
57 | 142 |
/// Reference to the parent Shell |
58 | 143 |
/// </summary> |
59 |
protected ShellViewModel Shell { get; set; } |
|
144 |
protected ShellViewModel Shell |
|
145 |
{ |
|
146 |
get { return _shell; } |
|
147 |
set |
|
148 |
{ |
|
149 |
_shell = value; |
|
150 |
NotifyOfPropertyChange(() => Shell); |
|
151 |
} |
|
152 |
} |
|
60 | 153 |
|
61 | 154 |
private ContainerInfo _container; |
62 | 155 |
/// <summary> |
... | ... | |
69 | 162 |
{ |
70 | 163 |
_container = value; |
71 | 164 |
|
72 |
Tags.Clear(); |
|
73 |
var tags = from tag in value.Tags |
|
74 |
select new Tag(tag.Key, tag.Value); |
|
75 |
tags.Apply(tag => Tags.Add(tag)); |
|
165 |
|
|
76 | 166 |
|
167 |
LoadFromDictionary(Tags, value.Tags); |
|
168 |
TagsChanged = false; |
|
169 |
//LoadFromDictionary(Policies, value.Policies); |
|
77 | 170 |
|
171 |
if (value.Policies.ContainsKey("Versioning")) |
|
172 |
{ |
|
173 |
Versioning version; |
|
174 |
if (Enum.TryParse(value.Policies["Versioning"], out version)) |
|
175 |
{ |
|
176 |
SelectedVersion = version; |
|
177 |
} |
|
178 |
} |
|
179 |
|
|
180 |
if (value.Policies.ContainsKey("Quota")) |
|
181 |
{ |
|
182 |
int quota; |
|
183 |
if (int.TryParse(value.Policies["Quota"], out quota)) |
|
184 |
{ |
|
185 |
Quota=quota; |
|
186 |
} |
|
187 |
} |
|
188 |
|
|
189 |
Title = String.Format("{0} Properties", _container.Name); |
|
78 | 190 |
Count = value.Count; |
79 | 191 |
ShortSize = value.Bytes.ToByteSize(); |
80 | 192 |
Size = String.Format("{0} ({1:N0} bytes)", ShortSize, value.Bytes); |
... | ... | |
84 | 196 |
ContainerName = Uri.UnescapeDataString(value.Name.Split('/').Last()); |
85 | 197 |
|
86 | 198 |
NotifyOfPropertyChange(() => Container); |
199 |
IsBusy = false; |
|
200 |
} |
|
201 |
} |
|
202 |
|
|
203 |
private int _quota; |
|
204 |
public int Quota |
|
205 |
{ |
|
206 |
get { return _quota; } |
|
207 |
set |
|
208 |
{ |
|
209 |
if (value < 0) |
|
210 |
throw new ArgumentOutOfRangeException("Quota"); |
|
211 |
|
|
212 |
_quota = value; |
|
213 |
NotifyOfPropertyChange(() => Quota); |
|
87 | 214 |
} |
88 | 215 |
} |
89 | 216 |
|
90 | 217 |
|
91 |
private readonly ObservableCollection<Tag> _tags = new ObservableCollection<Tag>(); |
|
92 |
public ObservableCollection<Tag> Tags |
|
218 |
|
|
219 |
private Versioning[] _versions={Versioning.manual,Versioning.auto,Versioning.none}; |
|
220 |
public Versioning[] Versions |
|
221 |
{ |
|
222 |
get { return _versions; } |
|
223 |
} |
|
224 |
|
|
225 |
|
|
226 |
private Versioning _selectedVersion; |
|
227 |
public Versioning SelectedVersion |
|
228 |
{ |
|
229 |
get { return _selectedVersion; } |
|
230 |
set { |
|
231 |
_selectedVersion = value; |
|
232 |
NotifyOfPropertyChange(()=>SelectedVersion); |
|
233 |
} |
|
234 |
} |
|
235 |
|
|
236 |
private void LoadFromDictionary(ICollection<MetaValue> collection,Dictionary<string,string> source ) |
|
237 |
{ |
|
238 |
collection.Clear(); |
|
239 |
var items = from item in source |
|
240 |
select new MetaValue(item.Key, item.Value); |
|
241 |
|
|
242 |
items.Apply(collection.Add); |
|
243 |
} |
|
244 |
|
|
245 |
private readonly ObservableCollection<MetaValue> _tags; |
|
246 |
public ObservableCollection<MetaValue> Tags |
|
93 | 247 |
{ |
94 | 248 |
get { return _tags; } |
95 | 249 |
} |
96 | 250 |
|
251 |
/* private readonly ObservableCollection<MetaValue> _policies; |
|
252 |
public ObservableCollection<MetaValue> Policies |
|
253 |
{ |
|
254 |
get { return _policies; } |
|
255 |
}*/ |
|
256 |
|
|
257 |
private bool _tagsChanged; |
|
258 |
public bool TagsChanged |
|
259 |
{ |
|
260 |
get { return _tagsChanged; } |
|
261 |
private set |
|
262 |
{ |
|
263 |
_tagsChanged = value; |
|
264 |
NotifyOfPropertyChange(()=>TagsChanged); |
|
265 |
NotifyOfPropertyChange(() => CanApplyChanges); |
|
266 |
} |
|
267 |
} |
|
268 |
|
|
269 |
//public bool PoliciesChanged { get; private set; } |
|
270 |
|
|
271 |
private bool _isBusy=true; |
|
272 |
public bool IsBusy |
|
273 |
{ |
|
274 |
get { return _isBusy; } |
|
275 |
set |
|
276 |
{ |
|
277 |
_isBusy = value; |
|
278 |
NotifyOfPropertyChange(()=>IsBusy); |
|
279 |
} |
|
280 |
} |
|
97 | 281 |
|
98 |
public ContainerPropertiesViewModel(ShellViewModel shell, ContainerInfo container, string localFolderName)
|
|
282 |
public ContainerPropertiesViewModel(ShellViewModel shell, Task<ContainerInfo> container, string localFolderName)
|
|
99 | 283 |
{ |
100 | 284 |
if (shell==null) |
101 | 285 |
throw new ArgumentNullException("shell"); |
... | ... | |
104 | 288 |
if (String.IsNullOrWhiteSpace(localFolderName)) |
105 | 289 |
throw new ArgumentNullException("localFolderName"); |
106 | 290 |
Contract.EndContractBlock(); |
291 |
|
|
292 |
_tags = new ObservableCollection<MetaValue>(); |
|
293 |
_tags.CollectionChanged += (sender, evt) => { TagsChanged = true; }; |
|
294 |
|
|
295 |
/*_policies = new ObservableCollection<MetaValue>(); |
|
296 |
_policies.CollectionChanged += (sender, evt) => { PoliciesChanged = true; }; |
|
297 |
*/ |
|
107 | 298 |
|
108 | 299 |
Shell = shell; |
109 | 300 |
ContainerName = localFolderName; |
110 |
Container = container; |
|
111 |
Title = String.Format("{0} Properties", container.Name); |
|
112 |
|
|
113 |
} |
|
301 |
container.ContinueWith(t =>{ |
|
302 |
if (t.IsFaulted) |
|
303 |
{ |
|
304 |
IsBusy = false; |
|
305 |
Execute.OnUIThread(() => ShowError(t.Exception)); |
|
306 |
this.TryClose(); |
|
114 | 307 |
|
308 |
} |
|
309 |
else |
|
310 |
Execute.OnUIThread(()=>Container = t.Result); |
|
311 |
}); |
|
312 |
} |
|
115 | 313 |
|
314 |
private void ShowError(AggregateException exception) |
|
315 |
{ |
|
316 |
MessageView view=null; |
|
317 |
if (exception.InnerException is RetryException) |
|
318 |
view=new MessageView(exception.InnerException as RetryException); |
|
319 |
else if (exception.InnerException is WebException) |
|
320 |
view = new MessageView(exception.InnerException as WebException); |
|
321 |
else |
|
322 |
view = new MessageView(exception.InnerException); |
|
323 |
view.ShowDialog(); |
|
324 |
} |
|
116 | 325 |
|
117 | 326 |
public void Reload() |
118 | 327 |
{ |
... | ... | |
140 | 349 |
DoSave(); |
141 | 350 |
} |
142 | 351 |
|
352 |
public bool CanApplyChanges |
|
353 |
{ |
|
354 |
get { return TagsChanged; } |
|
355 |
} |
|
356 |
|
|
143 | 357 |
private void DoSave() |
144 | 358 |
{ |
359 |
|
|
360 |
if (TagsChanged) |
|
361 |
{ |
|
362 |
Container.Tags = this.Tags.ToDictionary(tag => tag.Name, tag => tag.Value); |
|
363 |
var monitor = Shell.Monitors[Container.Account]; |
|
364 |
monitor.CloudClient.UpdateMetadata(Container); |
|
365 |
} |
|
366 |
|
|
367 |
//Container.Policies["Quota"] = Quota.ToString(); |
|
368 |
//Container.Policies["Versioning"] = Enum.GetName(typeof (Versioning), SelectedVersion); |
|
369 |
|
|
370 |
/* |
|
371 |
if (PoliciesChanged) |
|
372 |
{ |
|
373 |
Container.Policies = this.Policies.ToDictionary(policy=> policy.Name, tag => tag.Value); |
|
374 |
} |
|
375 |
*/ |
|
376 |
|
|
145 | 377 |
|
146 | 378 |
} |
147 | 379 |
|
148 | 380 |
} |
381 |
|
|
382 |
|
|
149 | 383 |
} |
b/trunk/Pithos.Client.WPF/FileProperties/FilePropertiesView.xaml | ||
---|---|---|
3 | 3 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
4 | 4 |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
5 | 5 |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="http://www.caliburnproject.org" |
6 |
mc:Ignorable="d" |
|
6 |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" mc:Ignorable="d"
|
|
7 | 7 |
d:DesignHeight="300" d:DesignWidth="400" Width="400" |
8 | 8 |
Height="400" Icon="/Pithos.Client.WPF;component/Images/PithosTaskbar.png" |
9 | 9 |
Background="{StaticResource {x:Static SystemColors.ControlBrushKey}}" WindowStartupLocation="CenterScreen" Topmost="False"> |
... | ... | |
15 | 15 |
<BooleanToVisibilityConverter x:Key="BoolToVisible" /> |
16 | 16 |
</ResourceDictionary> |
17 | 17 |
</Window.Resources> |
18 |
<Grid> |
|
19 |
<Grid.RowDefinitions> |
|
20 |
<RowDefinition Height="Auto"/> |
|
21 |
<RowDefinition Height="*"/> |
|
22 |
<RowDefinition Height="Auto"/> |
|
23 |
</Grid.RowDefinitions> |
|
18 |
<extToolkit:BusyIndicator IsBusy="{Binding IsBusy}" BusyContent="Loading Object Info ..." > |
|
19 |
<Grid> |
|
20 |
<Grid.RowDefinitions> |
|
21 |
<RowDefinition Height="Auto"/> |
|
22 |
<RowDefinition Height="*"/> |
|
23 |
<RowDefinition Height="Auto"/> |
|
24 |
</Grid.RowDefinitions> |
|
24 | 25 |
|
25 |
<Grid Grid.Row="0"> |
|
26 |
<Grid.ColumnDefinitions> |
|
27 |
<ColumnDefinition Width="Auto"/> |
|
28 |
<ColumnDefinition Width="*"/> |
|
29 |
<ColumnDefinition Width="Auto"/> |
|
30 |
</Grid.ColumnDefinitions> |
|
31 |
<Image x:Name="FileIcon" Width="48" Height="48" Margin="5" Grid.Column="0" Stretch="None"/> |
|
32 |
<StackPanel Margin="5" Grid.Column="1"> |
|
33 |
<TextBlock x:Name="FileName" Grid.Row="0" Text="File Name" FontSize="16" FontWeight="Bold"/> |
|
34 |
<StackPanel Orientation="Horizontal" Grid.Row="1"> |
|
35 |
<TextBlock Text="Container: " /> |
|
36 |
<TextBlock x:Name="Container" Text="Container" /> |
|
26 |
<Grid Grid.Row="0"> |
|
27 |
<Grid.ColumnDefinitions> |
|
28 |
<ColumnDefinition Width="Auto"/> |
|
29 |
<ColumnDefinition Width="*"/> |
|
30 |
<ColumnDefinition Width="Auto"/> |
|
31 |
</Grid.ColumnDefinitions> |
|
32 |
<Image x:Name="FileIcon" Width="48" Height="48" Margin="5" Grid.Column="0" Stretch="None"/> |
|
33 |
<StackPanel Margin="5" Grid.Column="1"> |
|
34 |
<TextBlock x:Name="FileName" Grid.Row="0" Text="File Name" FontSize="16" FontWeight="Bold"/> |
|
35 |
<StackPanel Orientation="Horizontal" Grid.Row="1"> |
|
36 |
<TextBlock Text="Container: " /> |
|
37 |
<TextBlock x:Name="Container" Text="Container" /> |
|
38 |
</StackPanel> |
|
37 | 39 |
</StackPanel> |
38 |
</StackPanel> |
|
39 |
<TextBlock x:Name="ShortSize" Text="345 KB" FontWeight="Bold" FontSize="14" Grid.Column="2" HorizontalAlignment="Left" Margin="5"/> |
|
40 |
</Grid> |
|
41 |
<TabControl Grid.Row="1"> |
|
42 |
<TabItem Header="General"> |
|
43 |
<Grid> |
|
44 |
<Grid.Resources> |
|
45 |
<Style x:Key="NameColumnStyle" TargetType="TextBlock"> |
|
46 |
<Setter Property="HorizontalAlignment" Value="Right"/> |
|
47 |
<Setter Property="Margin" Value="5,2"/> |
|
48 |
</Style> |
|
49 |
<Style x:Key="ValueColumnStyle" TargetType="TextBlock"> |
|
50 |
<Setter Property="HorizontalAlignment" Value="Left"/> |
|
51 |
<Setter Property="Margin" Value="5,2"/> |
|
52 |
</Style> |
|
53 |
</Grid.Resources> |
|
54 |
<Grid.ColumnDefinitions> |
|
55 |
<ColumnDefinition Width="Auto" /> |
|
56 |
<ColumnDefinition Width="*"/> |
|
57 |
</Grid.ColumnDefinitions> |
|
58 |
<Grid.RowDefinitions> |
|
59 |
<RowDefinition Height="Auto"/> |
|
60 |
<RowDefinition Height="Auto"/> |
|
61 |
<RowDefinition Height="Auto"/> |
|
62 |
<RowDefinition Height="Auto"/> |
|
63 |
<RowDefinition Height="Auto"/> |
|
64 |
<RowDefinition Height="Auto"/> |
|
65 |
</Grid.RowDefinitions> |
|
66 |
<TextBlock Text="Kind :" Grid.Row="0" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
67 |
<TextBlock Text="Size :" Grid.Row="1" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
68 |
<TextBlock Text="Where :" Grid.Row="2" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
69 |
<TextBlock Text="Modified :" Grid.Row="3" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
70 |
<TextBlock Text="Modified By :" Grid.Row="4" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
71 |
<TextBlock Text="Version :" Grid.Row="5" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
72 |
<TextBlock x:Name="Kind" Text="application/pdf" Grid.Row="0" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
73 |
<TextBlock x:Name="Size" Text="345 KB (345,332 bytes)" Grid.Row="1" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
74 |
<TextBlock x:Name="Where" Text="pithos/somefile.pdf" Grid.Row="2" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
75 |
<TextBlock x:Name="Modified" Text="28/10/2011 11:34 AM" Grid.Row="3" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
76 |
<TextBlock x:Name="ModifiedBy" Text="SomeUser" Grid.Row="4" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
77 |
<TextBlock x:Name="Version" Text="2345456" Grid.Row="5" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
78 |
</Grid> |
|
79 |
</TabItem> |
|
80 |
<TabItem Header="Metadata"> |
|
40 |
<TextBlock x:Name="ShortSize" Text="345 KB" FontWeight="Bold" FontSize="14" Grid.Column="2" HorizontalAlignment="Left" Margin="5"/> |
|
41 |
</Grid> |
|
42 |
<TabControl Grid.Row="1"> |
|
43 |
<TabItem Header="General"> |
|
44 |
<Grid> |
|
45 |
<Grid.Resources> |
|
46 |
<Style x:Key="NameColumnStyle" TargetType="TextBlock"> |
|
47 |
<Setter Property="HorizontalAlignment" Value="Right"/> |
|
48 |
<Setter Property="Margin" Value="5,2"/> |
|
49 |
</Style> |
|
50 |
<Style x:Key="ValueColumnStyle" TargetType="TextBlock"> |
|
51 |
<Setter Property="HorizontalAlignment" Value="Left"/> |
|
52 |
<Setter Property="Margin" Value="5,2"/> |
|
53 |
</Style> |
|
54 |
</Grid.Resources> |
|
55 |
<Grid.ColumnDefinitions> |
|
56 |
<ColumnDefinition Width="Auto" /> |
|
57 |
<ColumnDefinition Width="*"/> |
|
58 |
</Grid.ColumnDefinitions> |
|
59 |
<Grid.RowDefinitions> |
|
60 |
<RowDefinition Height="Auto"/> |
|
61 |
<RowDefinition Height="Auto"/> |
|
62 |
<RowDefinition Height="Auto"/> |
|
63 |
<RowDefinition Height="Auto"/> |
|
64 |
<RowDefinition Height="Auto"/> |
|
65 |
<RowDefinition Height="Auto"/> |
|
66 |
</Grid.RowDefinitions> |
|
67 |
<TextBlock Text="Kind :" Grid.Row="0" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
68 |
<TextBlock Text="Size :" Grid.Row="1" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
69 |
<TextBlock Text="Where :" Grid.Row="2" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
70 |
<TextBlock Text="Modified :" Grid.Row="3" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
71 |
<TextBlock Text="Modified By :" Grid.Row="4" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
72 |
<TextBlock Text="Version :" Grid.Row="5" Grid.Column="0" Style="{StaticResource ResourceKey=NameColumnStyle}"/> |
|
73 |
<TextBlock x:Name="Kind" Text="application/pdf" Grid.Row="0" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
74 |
<TextBlock x:Name="Size" Text="345 KB (345,332 bytes)" Grid.Row="1" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
75 |
<TextBlock x:Name="Where" Text="pithos/somefile.pdf" Grid.Row="2" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
76 |
<TextBlock x:Name="Modified" Text="28/10/2011 11:34 AM" Grid.Row="3" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
77 |
<TextBlock x:Name="ModifiedBy" Text="SomeUser" Grid.Row="4" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
78 |
<TextBlock x:Name="Version" Text="2345456" Grid.Row="5" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
|
79 |
</Grid> |
|
80 |
</TabItem> |
|
81 |
<TabItem Header="Metadata"> |
|
81 | 82 |
<DataGrid ItemsSource="{Binding Tags}" x:Name="Tags" |
82 | 83 |
AutoGenerateColumns="False" CanUserAddRows="True" > |
83 | 84 |
<DataGrid.Columns> |
... | ... | |
92 | 93 |
<DataGridTextColumn Binding="{Binding Value}" Header="Value" /> |
93 | 94 |
</DataGrid.Columns> |
94 | 95 |
</DataGrid> |
95 |
</TabItem> |
|
96 |
<TabItem Header="Permissions"> |
|
97 |
<StackPanel> |
|
98 |
<TextBlock Margin="5" Visibility="{Binding Path=IsPublic,FallbackValue=false, Converter={StaticResource BoolToVisible}}"> |
|
96 |
</TabItem>
|
|
97 |
<TabItem Header="Permissions">
|
|
98 |
<StackPanel>
|
|
99 |
<TextBlock Margin="5" Visibility="{Binding Path=IsPublic,FallbackValue=false, Converter={StaticResource BoolToVisible}}">
|
|
99 | 100 |
<Run Text="Public URL:" /> |
100 | 101 |
<Run Text="{Binding PublicUrl,FallbackValue='http://someurl'}" /> |
101 |
</TextBlock> |
|
102 |
<CheckBox x:Name="IsPublic" Content="Public" Margin="5"/> |
|
103 |
<DataGrid ItemsSource="{Binding Permissions}" |
|
102 |
</TextBlock>
|
|
103 |
<CheckBox x:Name="IsPublic" Content="Public" Margin="5"/>
|
|
104 |
<DataGrid ItemsSource="{Binding Permissions}"
|
|
104 | 105 |
AutoGenerateColumns="False" CanUserAddRows="True"> |
105 |
<DataGrid.Columns> |
|
106 |
<DataGridTemplateColumn > |
|
107 |
<DataGridTemplateColumn.CellTemplate> |
|
108 |
<DataTemplate> |
|
109 |
<Button Content=" - " Command="DataGrid.DeleteCommand"/> |
|
110 |
</DataTemplate> |
|
111 |
</DataGridTemplateColumn.CellTemplate> |
|
112 |
</DataGridTemplateColumn> |
|
113 |
<DataGridTextColumn Binding="{Binding UserName}" Header="Name" /> |
|
114 |
<DataGridCheckBoxColumn Binding="{Binding Read}" Header="Read"/> |
|
115 |
<DataGridCheckBoxColumn Binding="{Binding Write}" Header="Write"/> |
|
116 |
</DataGrid.Columns> |
|
117 |
</DataGrid> |
|
118 |
</StackPanel> |
|
119 |
</TabItem> |
|
120 |
<TabItem Header="Other"> |
|
106 |
<DataGrid.Columns>
|
|
107 |
<DataGridTemplateColumn >
|
|
108 |
<DataGridTemplateColumn.CellTemplate>
|
|
109 |
<DataTemplate>
|
|
110 |
<Button Content=" - " Command="DataGrid.DeleteCommand"/>
|
|
111 |
</DataTemplate>
|
|
112 |
</DataGridTemplateColumn.CellTemplate>
|
|
113 |
</DataGridTemplateColumn>
|
|
114 |
<DataGridTextColumn Binding="{Binding UserName}" Header="Name" />
|
|
115 |
<DataGridCheckBoxColumn Binding="{Binding Read}" Header="Read"/>
|
|
116 |
<DataGridCheckBoxColumn Binding="{Binding Write}" Header="Write"/>
|
|
117 |
</DataGrid.Columns>
|
|
118 |
</DataGrid>
|
|
119 |
</StackPanel>
|
|
120 |
</TabItem>
|
|
121 |
<TabItem Header="Other">
|
|
121 | 122 |
<Grid> |
122 | 123 |
<Grid.Resources> |
123 | 124 |
<Style x:Key="NameColumnStyle" TargetType="TextBlock"> |
... | ... | |
146 | 147 |
<TextBox x:Name="ContentDisposition" Grid.Row="1" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
147 | 148 |
<TextBox x:Name="Manifest" Grid.Row="2" Grid.Column="1" Style="{StaticResource ResourceKey=ValueColumnStyle}"/> |
148 | 149 |
</Grid> |
149 |
</TabItem> |
|
150 |
</TabControl> |
|
151 |
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right"> |
|
152 |
<Button Name="SaveChanges" Content="OK" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}" IsDefault="False" /> |
|
153 |
<Button Name="RejectChanges" Content="Cancel" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}" IsCancel="True" /> |
|
154 |
<Button Name="ApplyChanges" Content="Apply" Style="{StaticResource ButtonStyle}" /> |
|
155 |
</StackPanel> |
|
150 |
</TabItem>
|
|
151 |
</TabControl>
|
|
152 |
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right">
|
|
153 |
<Button Name="SaveChanges" Content="OK" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}" IsDefault="False" />
|
|
154 |
<Button Name="RejectChanges" Content="Cancel" Margin="5,5,10,5" Style="{StaticResource ButtonStyle}" IsCancel="True" />
|
|
155 |
<Button Name="ApplyChanges" Content="Apply" Style="{StaticResource ButtonStyle}" />
|
|
156 |
</StackPanel>
|
|
156 | 157 |
|
157 |
</Grid> |
|
158 |
</Grid> |
|
159 |
</extToolkit:BusyIndicator> |
|
158 | 160 |
</Window> |
b/trunk/Pithos.Client.WPF/FileProperties/FilePropertiesViewModel.cs | ||
---|---|---|
12 | 12 |
using System.Diagnostics; |
13 | 13 |
using System.Diagnostics.Contracts; |
14 | 14 |
using System.Drawing; |
15 |
using System.Net; |
|
16 |
using System.Threading.Tasks; |
|
15 | 17 |
using System.Windows; |
16 | 18 |
using System.Windows.Interop; |
17 | 19 |
using System.Windows.Media.Imaging; |
... | ... | |
91 | 93 |
} |
92 | 94 |
} |
93 | 95 |
|
94 |
public string Kind { get; set; } |
|
95 |
public string Size { get; set; } |
|
96 |
public string ShortSize { get; set; } |
|
97 |
public string Where { get; set; } |
|
98 |
public DateTime Modified { get; set; } |
|
99 |
public string ModifiedBy { get; set; } |
|
100 |
public long Version { get; set; } |
|
101 |
protected string LocalFileName { get; set; } |
|
102 |
public BitmapSource FileIcon { get; set; } |
|
103 |
public string PublicUrl { get; set; } |
|
96 |
private string _kind; |
|
97 |
public string Kind |
|
98 |
{ |
|
99 |
get { return _kind; } |
|
100 |
set |
|
101 |
{ |
|
102 |
_kind = value; |
|
103 |
NotifyOfPropertyChange(() => Kind); |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
107 |
private string _size; |
|
108 |
public string Size |
|
109 |
{ |
|
110 |
get { return _size; } |
|
111 |
set |
|
112 |
{ |
|
113 |
_size = value; |
|
114 |
NotifyOfPropertyChange(() => Size); |
|
115 |
} |
|
116 |
} |
|
104 | 117 |
|
105 |
public string FileName { get; set; } |
|
106 |
public string Container { get; set; } |
|
118 |
private string _shortSize; |
|
119 |
public string ShortSize |
|
120 |
{ |
|
121 |
get { return _shortSize; } |
|
122 |
set |
|
123 |
{ |
|
124 |
_shortSize = value; |
|
125 |
NotifyOfPropertyChange(() => ShortSize); |
|
126 |
} |
|
127 |
} |
|
128 |
|
|
129 |
private string _where; |
|
130 |
public string Where |
|
131 |
{ |
|
132 |
get { return _where; } |
|
133 |
set |
|
134 |
{ |
|
135 |
_where = value; |
|
136 |
NotifyOfPropertyChange(() => Where); |
|
137 |
} |
|
138 |
} |
|
139 |
|
|
140 |
private DateTime _modified; |
|
141 |
public DateTime Modified |
|
142 |
{ |
|
143 |
get { return _modified; } |
|
144 |
set |
|
145 |
{ |
|
146 |
_modified = value; |
|
147 |
NotifyOfPropertyChange(() => Modified); |
|
148 |
} |
|
149 |
} |
|
150 |
|
|
151 |
private string _modifiedBy; |
|
152 |
public string ModifiedBy |
|
153 |
{ |
|
154 |
get { return _modifiedBy; } |
|
155 |
set |
|
156 |
{ |
|
157 |
_modifiedBy = value; |
|
158 |
NotifyOfPropertyChange(() => ModifiedBy); |
|
159 |
} |
|
160 |
} |
|
161 |
|
|
162 |
private long _version; |
|
163 |
public long Version |
|
164 |
{ |
|
165 |
get { return _version; } |
|
166 |
set |
|
167 |
{ |
|
168 |
_version = value; |
|
169 |
NotifyOfPropertyChange(() => Version); |
|
170 |
} |
|
171 |
} |
|
172 |
|
|
173 |
private string _localFileName; |
|
174 |
protected string LocalFileName |
|
175 |
{ |
|
176 |
get { return _localFileName; } |
|
177 |
set |
|
178 |
{ |
|
179 |
_localFileName = value; |
|
180 |
NotifyOfPropertyChange(() => LocalFileName); |
|
181 |
} |
|
182 |
} |
|
183 |
|
|
184 |
private BitmapSource _fileIcon; |
|
185 |
public BitmapSource FileIcon |
|
186 |
{ |
|
187 |
get { return _fileIcon; } |
|
188 |
set |
|
189 |
{ |
|
190 |
_fileIcon = value; |
|
191 |
NotifyOfPropertyChange(() => FileIcon); |
|
192 |
} |
|
193 |
} |
|
194 |
|
|
195 |
private string _publicUrl; |
|
196 |
public string PublicUrl |
|
197 |
{ |
|
198 |
get { return _publicUrl; } |
|
199 |
set |
|
200 |
{ |
|
201 |
_publicUrl = value; |
|
202 |
NotifyOfPropertyChange(() => PublicUrl); |
|
203 |
} |
|
204 |
} |
|
205 |
|
|
206 |
private string _fileName; |
|
207 |
public string FileName |
|
208 |
{ |
|
209 |
get { return _fileName; } |
|
210 |
set |
|
211 |
{ |
|
212 |
_fileName = value; |
|
213 |
NotifyOfPropertyChange(() => FileName); |
|
214 |
} |
|
215 |
} |
|
216 |
|
|
217 |
private string _container; |
|
218 |
public string Container |
|
219 |
{ |
|
220 |
get { return _container; } |
|
221 |
set |
|
222 |
{ |
|
223 |
_container = value; |
|
224 |
NotifyOfPropertyChange(() => Container); |
|
225 |
} |
|
226 |
} |
|
107 | 227 |
|
108 | 228 |
public bool TagsChanged { get; private set; } |
109 | 229 |
public bool PermissionsChanged { get; private set; } |
110 | 230 |
|
111 |
public FilePropertiesViewModel(ShellViewModel shell,ObjectInfo pithosFile,string localFileName) |
|
231 |
private bool _isBusy = true; |
|
232 |
public bool IsBusy |
|
233 |
{ |
|
234 |
get { return _isBusy; } |
|
235 |
set |
|
236 |
{ |
|
237 |
_isBusy = value; |
|
238 |
NotifyOfPropertyChange(() => IsBusy); |
|
239 |
} |
|
240 |
} |
|
241 |
|
|
242 |
|
|
243 |
public FilePropertiesViewModel(ShellViewModel shell,Task<ObjectInfo> pithosFile,string localFileName) |
|
112 | 244 |
{ |
113 | 245 |
if (shell==null) |
114 | 246 |
throw new ArgumentNullException("shell"); |
... | ... | |
119 | 251 |
Contract.EndContractBlock(); |
120 | 252 |
|
121 | 253 |
|
122 |
_tags = new ObservableCollection<Tag>();
|
|
254 |
_tags = new ObservableCollection<MetaValue>();
|
|
123 | 255 |
_tags.CollectionChanged += (sender, evt) => { TagsChanged = true; }; |
124 | 256 |
_permissions = new ObservableCollection<Permission>(); |
125 | 257 |
_permissions.CollectionChanged += (sender, evt) => { PermissionsChanged = true; }; |
126 | 258 |
|
127 | 259 |
Shell = shell; |
128 | 260 |
LocalFileName = localFileName; |
129 |
PithosFile = pithosFile; |
|
130 |
Title = String.Format("{0} Properties", pithosFile.Name); |
|
261 |
pithosFile.ContinueWith(t => |
|
262 |
{ |
|
263 |
if (t.IsFaulted) |
|
264 |
{ |
|
265 |
IsBusy = false; |
|
266 |
Execute.OnUIThread(()=>ShowError(t.Exception)); |
|
267 |
this.TryClose(); |
|
268 |
|
|
269 |
} |
|
270 |
else |
|
271 |
Execute.OnUIThread(() => PithosFile = t.Result); |
|
272 |
}); |
|
273 |
} |
|
274 |
|
|
275 |
private void ShowError(AggregateException exception) |
|
276 |
{ |
|
277 |
MessageView view = null; |
|
278 |
if (exception.InnerException is RetryException) |
|
279 |
view = new MessageView(exception.InnerException as RetryException); |
|
280 |
else if (exception.InnerException is WebException) |
|
281 |
view = new MessageView(exception.InnerException as WebException); |
|
282 |
else |
|
283 |
view = new MessageView(exception.InnerException); |
|
284 |
view.ShowDialog(); |
|
131 | 285 |
} |
132 | 286 |
|
133 |
|
|
134 | 287 |
|
135 | 288 |
protected ShellViewModel Shell { get; set; } |
136 | 289 |
|
... | ... | |
150 | 303 |
perms.Apply(perm=>Permissions.Add(perm)); |
151 | 304 |
|
152 | 305 |
var tags=from tag in value.Tags |
153 |
select new Tag(tag.Key, tag.Value);
|
|
154 |
tags.Apply(tag=>Tags.Add(tag));
|
|
306 |
select new MetaValue(tag.Key, tag.Value);
|
|
307 |
tags.Apply(tag=>Tags.Add(tag)); |
|
155 | 308 |
|
309 |
Title = String.Format("{0} Properties", value.Name); |
|
156 | 310 |
Kind=value.Content_Type; |
157 | 311 |
ShortSize = value.Bytes.ToByteSize(); |
158 | 312 |
Size = String.Format("{0} ({1:N0} bytes)", ShortSize, value.Bytes); |
... | ... | |
176 | 330 |
BitmapSizeOptions.FromEmptyOptions()); |
177 | 331 |
} |
178 | 332 |
NotifyOfPropertyChange(()=>PithosFile); |
333 |
IsBusy = false; |
|
179 | 334 |
} |
180 | 335 |
} |
181 | 336 |
|
182 | 337 |
|
183 |
private readonly ObservableCollection<Tag> _tags ;
|
|
184 |
public ObservableCollection<Tag> Tags
|
|
338 |
private readonly ObservableCollection<MetaValue> _tags ;
|
|
339 |
public ObservableCollection<MetaValue> Tags
|
|
185 | 340 |
{ |
186 | 341 |
get { return _tags;} |
187 | 342 |
} |
b/trunk/Pithos.Client.WPF/FileProperties/MetaValue.cs | ||
---|---|---|
1 |
using Caliburn.Micro; |
|
2 |
|
|
3 |
namespace Pithos.Client.WPF |
|
4 |
{ |
|
5 |
public class MetaValue:PropertyChangedBase |
|
6 |
{ |
|
7 |
private string _name; |
|
8 |
public string Name |
|
9 |
{ |
|
10 |
get { return _name; } |
|
11 |
set |
|
12 |
{ |
|
13 |
_name = value; |
|
14 |
NotifyOfPropertyChange(()=>Name); |
|
15 |
} |
|
16 |
} |
|
17 |
|
|
18 |
private string _value; |
|
19 |
public string Value |
|
20 |
{ |
|
21 |
get { return _value; } |
|
22 |
set |
|
23 |
{ |
|
24 |
_value = value; |
|
25 |
NotifyOfPropertyChange(()=>Value); |
|
26 |
} |
|
27 |
} |
|
28 |
|
|
29 |
public MetaValue(string name, string value) |
|
30 |
{ |
|
31 |
Name = name; |
|
32 |
Value = value; |
|
33 |
} |
|
34 |
|
|
35 |
public MetaValue() |
|
36 |
{ |
|
37 |
|
|
38 |
} |
|
39 |
|
|
40 |
|
|
41 |
} |
|
42 |
} |
/dev/null | ||
---|---|---|
1 |
using Caliburn.Micro; |
|
2 |
|
|
3 |
namespace Pithos.Client.WPF |
|
4 |
{ |
|
5 |
public class Tag:PropertyChangedBase |
|
6 |
{ |
|
7 |
private string _name; |
|
8 |
public string Name |
|
9 |
{ |
|
10 |
get { return _name; } |
|
11 |
set |
|
12 |
{ |
|
13 |
_name = value; |
|
14 |
NotifyOfPropertyChange(()=>Name); |
|
15 |
} |
|
16 |
} |
|
17 |
|
|
18 |
private string _value; |
|
19 |
public string Value |
|
20 |
{ |
|
21 |
get { return _value; } |
|
22 |
set |
|
23 |
{ |
|
24 |
_value = value; |
|
25 |
NotifyOfPropertyChange(()=>Value); |
|
26 |
} |
|
27 |
} |
|
28 |
|
|
29 |
public Tag(string name, string value) |
|
30 |
{ |
|
31 |
Name = name; |
|
32 |
Value = value; |
|
33 |
} |
|
34 |
|
|
35 |
public Tag() |
|
36 |
{ |
|
37 |
|
|
38 |
} |
|
39 |
|
|
40 |
|
|
41 |
} |
|
42 |
} |
b/trunk/Pithos.Client.WPF/Pithos.Client.WPF.csproj | ||
---|---|---|
250 | 250 |
<SubType>Designer</SubType> |
251 | 251 |
</ApplicationDefinition> |
252 | 252 |
<Compile Include="Converters\EmptyToVisibilityConverter.cs" /> |
253 |
<Compile Include="FileProperties\ContainerPolicy.cs" /> |
|
253 | 254 |
<Compile Include="Shell\AboutView.xaml.cs"> |
254 | 255 |
<DependentUpon>AboutView.xaml</DependentUpon> |
255 | 256 |
</Compile> |
... | ... | |
267 | 268 |
<Compile Include="FileProperties\FilePropertiesViewModel.cs" /> |
268 | 269 |
<Compile Include="FileProperties\Permission.cs" /> |
269 | 270 |
<Compile Include="FileProperties\SizeExtensions.cs" /> |
270 |
<Compile Include="FileProperties\Tag.cs" />
|
|
271 |
<Compile Include="FileProperties\MetaValue.cs" />
|
|
271 | 272 |
<Compile Include="Shell\AboutViewModel.cs" /> |
272 | 273 |
<Compile Include="Shell\FeedbackView.xaml.cs"> |
273 | 274 |
<DependentUpon>FeedbackView.xaml</DependentUpon> |
b/trunk/Pithos.Client.WPF/Services/StatusService.cs | ||
---|---|---|
81 | 81 |
}; |
82 | 82 |
service.Description.Behaviors.Add(smb); |
83 | 83 |
|
84 |
|
|
84 |
service.Faulted+=OnError; |
|
85 | 85 |
service.Open(); |
86 | 86 |
return service; |
87 | 87 |
} |
88 | 88 |
|
89 |
private static void OnError(object sender, EventArgs e) |
|
90 |
{ |
|
91 |
|
|
92 |
} |
|
93 |
|
|
89 | 94 |
public static void Stop(ServiceHost statusService) |
90 | 95 |
{ |
91 | 96 |
if (statusService == null) |
b/trunk/Pithos.Client.WPF/Shell/MessageView.xaml.cs | ||
---|---|---|
5 | 5 |
using System.ComponentModel.Composition; |
6 | 6 |
using System.Linq; |
7 | 7 |
using System.Linq.Expressions; |
8 |
using System.Net; |
|
8 | 9 |
using System.Net.Mail; |
9 | 10 |
using System.Text; |
10 | 11 |
using System.Windows; |
... | ... | |
17 | 18 |
using System.Windows.Shapes; |
18 | 19 |
using Caliburn.Micro; |
19 | 20 |
using Pithos.Client.WPF.Shell; |
21 |
using Pithos.Network; |
|
20 | 22 |
|
21 | 23 |
namespace Pithos.Client.WPF |
22 | 24 |
{ |
... | ... | |
49 | 51 |
InitializeComponent(); |
50 | 52 |
} |
51 | 53 |
|
54 |
|
|
55 |
|
|
56 |
public MessageView(WebException exception) |
|
57 |
{ |
|
58 |
DataContext = this; |
|
59 |
InitializeComponent(); |
|
60 |
|
|
61 |
var messages = new List<UserMessage>(); |
|
62 |
|
|
63 |
if ((exception.Response as HttpWebResponse).StatusCode == HttpStatusCode.Unauthorized) |
|
64 |
{ |
|
65 |
Message = "Your authorization token has expired. Please renew the token and try again "; |
|
66 |
Title = "Authorization expired"; |
|
67 |
} |
|
68 |
else |
|
69 |
{ |
|
70 |
messages.Add(new UserMessage |
|
71 |
{ |
|
72 |
Message = exception.InnerException.Message, |
|
73 |
Details = exception.InnerException.ToString(), |
|
74 |
Severity = Severity.Warn |
|
75 |
}); |
|
76 |
Message = "There was an error while retrieving the item's information"; |
|
77 |
Title = "Error"; |
|
78 |
} |
|
79 |
UserMessages = new ObservableCollection<UserMessage>(messages); |
|
80 |
} |
|
81 |
|
|
82 |
public MessageView(RetryException exception) |
|
83 |
{ |
|
84 |
DataContext = this; |
|
85 |
InitializeComponent(); |
|
86 |
|
|
87 |
var messages = new List<UserMessage>{ |
|
88 |
new UserMessage{ |
|
89 |
Message = exception.InnerException.Message, |
|
90 |
Details = exception.InnerException.ToString(), |
|
91 |
Severity = Severity.Warn |
|
92 |
} |
|
93 |
}; |
|
94 |
|
|
95 |
Title = "Network error"; |
|
96 |
Message = "The connection to the server timed out. Please check your network connection and try again later"; |
|
97 |
|
|
98 |
UserMessages = new ObservableCollection<UserMessage>(messages); |
|
99 |
} |
|
100 |
|
|
101 |
public MessageView(Exception exception) |
|
102 |
{ |
|
103 |
DataContext = this; |
|
104 |
InitializeComponent(); |
|
105 |
|
|
106 |
var messages = new List<UserMessage>{ |
|
107 |
new UserMessage{ |
|
108 |
Message = exception.InnerException.Message, |
|
109 |
Details = exception.InnerException.ToString(), |
|
110 |
Severity = Severity.Warn |
|
111 |
} |
|
112 |
}; |
|
113 |
|
|
114 |
Title = "Unexpected error"; |
|
115 |
Message = "An unexpected error has occured"; |
|
116 |
|
|
117 |
UserMessages = new ObservableCollection<UserMessage>(messages); |
|
118 |
} |
|
119 |
|
|
52 | 120 |
/// <summary> |
53 | 121 |
/// Copies the messages to the clipboard |
54 | 122 |
/// </summary> |
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs | ||
---|---|---|
338 | 338 |
if (accountMonitor == null) |
339 | 339 |
return; |
340 | 340 |
|
341 |
ObjectInfo info = accountMonitor.GetObjectInfo(filePath);
|
|
341 |
var infoTask=Task.Factory.StartNew(()=>accountMonitor.GetObjectInfo(filePath));
|
|
342 | 342 |
|
343 | 343 |
|
344 | 344 |
|
345 |
var fileProperties = new FilePropertiesViewModel(this, info,filePath); |
|
345 |
var fileProperties = new FilePropertiesViewModel(this, infoTask,filePath);
|
|
346 | 346 |
_windowManager.ShowWindow(fileProperties); |
347 | 347 |
} |
348 | 348 |
|
... | ... | |
369 | 369 |
select monitor).FirstOrDefault(); |
370 | 370 |
var account = pair.Key; |
371 | 371 |
var accountMonitor = pair.Value; |
372 |
ContainerInfo info = accountMonitor.GetContainerInfo(filePath);
|
|
372 |
var info = accountMonitor.GetContainerInfo(filePath);
|
|
373 | 373 |
|
374 | 374 |
|
375 | 375 |
|
... | ... | |
530 | 530 |
Settings.Save(); |
531 | 531 |
await TaskEx.Delay(10000); |
532 | 532 |
StartMonitor(monitor, retries + 1); |
533 |
NotifyOfPropertyChange(()=>Accounts); |
|
533 | 534 |
} |
534 | 535 |
catch (AggregateException exc) |
535 | 536 |
{ |
b/trunk/Pithos.Core/IStatusService.cs | ||
---|---|---|
33 | 33 |
[ServiceContract(Namespace = "http://PITHOS.Client.Commands")] |
34 | 34 |
public interface ICommandsService |
35 | 35 |
{ |
36 |
[OperationContract] |
|
36 |
[OperationContract(IsOneWay=true)]
|
|
37 | 37 |
void ShowProperties(string fileName); |
38 | 38 |
} |
39 | 39 |
} |
b/trunk/Pithos.Core/PithosMonitor.cs | ||
---|---|---|
51 | 51 |
public NetworkAgent NetworkAgent { get; set; } |
52 | 52 |
|
53 | 53 |
public string UserName { get; set; } |
54 |
public string ApiKey { get; set; } |
|
54 |
private string _apiKey; |
|
55 |
public string ApiKey |
|
56 |
{ |
|
57 |
get { return _apiKey; } |
|
58 |
set |
|
59 |
{ |
|
60 |
_apiKey = value; |
|
61 |
if (_accountInfo != null) |
|
62 |
_accountInfo.Token = value; |
|
63 |
} |
|
64 |
} |
|
55 | 65 |
|
56 | 66 |
private AccountInfo _accountInfo; |
57 | 67 |
|
... | ... | |
118 | 128 |
return; |
119 | 129 |
} |
120 | 130 |
_cancellationSource = new CancellationTokenSource(); |
121 |
_started = true; |
|
131 |
|
|
122 | 132 |
|
123 | 133 |
CloudClient=new CloudFilesClient(UserName,ApiKey); |
124 | 134 |
var proxyUri = ProxyFromSettings(); |
... | ... | |
151 | 161 |
StartNetworkAgent(); |
152 | 162 |
|
153 | 163 |
StartWorkflowAgent(); |
154 |
WorkflowAgent.RestartInterruptedFiles(_accountInfo); |
|
164 |
WorkflowAgent.RestartInterruptedFiles(_accountInfo); |
|
165 |
_started = true; |
|
155 | 166 |
} |
156 | 167 |
|
157 | 168 |
private void EnsurePithosContainers() |
... | ... | |
466 | 477 |
return objectInfo; |
467 | 478 |
} |
468 | 479 |
|
469 |
public ContainerInfo GetContainerInfo(string filePath)
|
|
480 |
public Task<ContainerInfo> GetContainerInfo(string filePath)
|
|
470 | 481 |
{ |
471 | 482 |
if (String.IsNullOrWhiteSpace(filePath)) |
472 | 483 |
throw new ArgumentNullException("filePath"); |
... | ... | |
505 | 516 |
accountName = UserName; |
506 | 517 |
container = parts[0]; |
507 | 518 |
} |
508 |
|
|
509 |
var client = new CloudFilesClient(accountInfo); |
|
510 |
var containerInfo=client.GetContainerInfo(accountName, container); |
|
511 |
return containerInfo; |
|
519 |
|
|
520 |
return Task.Factory.StartNew(() => |
|
521 |
{ |
|
522 |
var client = new CloudFilesClient(accountInfo); |
|
523 |
var containerInfo = client.GetContainerInfo(accountName, container); |
|
524 |
return containerInfo; |
|
525 |
}); |
|
512 | 526 |
} |
513 | 527 |
} |
514 | 528 |
|
b/trunk/Pithos.Interfaces/ObjectInfo.cs | ||
---|---|---|
217 | 217 |
|
218 | 218 |
public void SetPermissions(string permissions) |
219 | 219 |
{ |
220 |
if (String.IsNullOrWhiteSpace(permissions)) |
|
221 |
return; |
|
222 |
|
|
220 | 223 |
var permDict=new Dictionary<string, string>(); |
221 | 224 |
var perms=permissions.Split(';'); |
222 | 225 |
foreach (var perm in perms) |
b/trunk/Pithos.Network/AccountInfo.cs | ||
---|---|---|
1 | 1 |
using System; |
2 |
using System.Collections.Generic; |
|
2 | 3 |
|
3 | 4 |
namespace Pithos.Network |
4 | 5 |
{ |
... | ... | |
36 | 37 |
} |
37 | 38 |
|
38 | 39 |
public string SiteUri { get; set; } |
40 |
|
|
41 |
public List<Group> Groups { get; set; } |
|
42 |
} |
|
43 |
|
|
44 |
public class Group |
|
45 |
{ |
|
46 |
public string Name { get; set; } |
|
47 |
|
|
48 |
public List<string> Users { get; set; } |
|
49 |
|
|
50 |
public Group() |
|
51 |
{ |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
public Group(string name,string users) |
|
56 |
{ |
|
57 |
Name = name; |
|
58 |
|
|
59 |
if (String.IsNullOrWhiteSpace(users)) |
|
60 |
return; |
|
61 |
Users=new List<string>(users.Split(',')); |
|
62 |
} |
|
39 | 63 |
} |
40 | 64 |
} |
Also available in: Unified diff