Revision 3ddbb7b8
b/trunk/Pithos.Client.WPF/Converters/NullToVisibilityConverter.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Globalization; |
|
3 |
using System.Windows; |
|
4 |
using System.Windows.Data; |
|
5 |
|
|
6 |
namespace Pithos.Client.WPF.Converters |
|
7 |
{ |
|
8 |
/// <summary> |
|
9 |
/// Returns Visible if the value is not null, Collapsed otherwise |
|
10 |
/// </summary> |
|
11 |
public class NullToVisibilityConverter:IValueConverter |
|
12 |
{ |
|
13 |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|
14 |
{ |
|
15 |
bool invert = (parameter != null); |
|
16 |
if (value==null) |
|
17 |
return invert?Visibility.Visible:Visibility.Collapsed; |
|
18 |
return invert?Visibility.Collapsed:Visibility.Visible; |
|
19 |
} |
|
20 |
|
|
21 |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|
22 |
{ |
|
23 |
throw new NotImplementedException(); |
|
24 |
} |
|
25 |
} |
|
26 |
} |
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="Converters\NullToVisibilityConverter.cs" /> |
|
253 | 254 |
<Compile Include="FileProperties\ContainerPolicy.cs" /> |
254 | 255 |
<Compile Include="FileProperties\NewContainerView.xaml.cs"> |
255 | 256 |
<DependentUpon>NewContainerView.xaml</DependentUpon> |
... | ... | |
259 | 260 |
<DependentUpon>AddAccountView.xaml</DependentUpon> |
260 | 261 |
</Compile> |
261 | 262 |
<Compile Include="Preferences\AddAccountViewModel.cs" /> |
263 |
<Compile Include="Preferences\FileExistsRule.cs" /> |
|
262 | 264 |
<Compile Include="Shell\AboutView.xaml.cs"> |
263 | 265 |
<DependentUpon>AboutView.xaml</DependentUpon> |
264 | 266 |
</Compile> |
... | ... | |
452 | 454 |
<ItemGroup> |
453 | 455 |
<Resource Include="Images\SmallLogo.png" /> |
454 | 456 |
</ItemGroup> |
457 |
<ItemGroup> |
|
458 |
<Resource Include="Images\logo.png" /> |
|
459 |
</ItemGroup> |
|
455 | 460 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
456 | 461 |
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
457 | 462 |
Other similar extension points exist, see Microsoft.Common.targets. |
b/trunk/Pithos.Client.WPF/Preferences/AddAccountView.xaml | ||
---|---|---|
1 | 1 |
<Window x:Class="Pithos.Client.WPF.Preferences.AddAccountView" |
2 | 2 |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
3 | 3 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
4 |
xmlns:cal="http://www.caliburnproject.org" |
|
4 | 5 |
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" |
5 |
Title="AddAccountView" Height="300" Width="467"> |
|
6 |
<extToolkit:Wizard FinishButtonClosesWindow="True"> |
|
6 |
Title="AddAccountView" Height="300" Width="467" xmlns:my="clr-namespace:Microsoft.Windows.Controls.Core.Converters;assembly=WPFToolkit.Extended" |
|
7 |
xmlns:Preferences="clr-namespace:Pithos.Client.WPF.Preferences"> |
|
8 |
<Window.Resources> |
|
9 |
<my:InverseBoolConverter x:Key="InverseBool" /> |
|
10 |
<BooleanToVisibilityConverter x:Key="BoolToVisible" /> |
|
11 |
</Window.Resources> |
|
12 |
<extToolkit:Wizard FinishButtonClosesWindow="True" Name="AccountWizard" PageChanged="AccountWizard_PageChanged"> |
|
7 | 13 |
<extToolkit:WizardPage x:Name="IntroPage" |
8 | 14 |
Title="Add new Pithos Account" |
9 | 15 |
Description="This Wizard will walk you through adding a new Pithos account and retrieving an authentication token" /> |
10 | 16 |
<extToolkit:WizardPage x:Name="ChooseMethodPage" PageType="Interior" |
11 | 17 |
Title="How do you want to add the account?" |
12 |
Description="You can add an account either by logging in the Pithos Web Site or by entering your username and password manually" |
|
13 |
NextPage="{Binding ElementName=ManualAccountPage}" |
|
14 |
PreviousPage="{Binding ElementName=IntroPage}"> |
|
18 |
Description="You can add an account either by logging in the Pithos Web Site or by entering your username and password manually" |
|
19 |
CanSelectNextPage="False"> |
|
15 | 20 |
<StackPanel > |
16 |
<RadioButton x:Name="Automatic" Content="By logging to Pithos" IsChecked="True"/>
|
|
17 |
<RadioButton x:Name="Manually" Content="Manually"/> |
|
21 |
<RadioButton x:Name="Automatic" Content="By logging to Pithos" Checked="Automatic_Checked" Margin="5"/>
|
|
22 |
<RadioButton x:Name="Manually" Content="Manually" Checked="Manually_Checked" Margin="5"/>
|
|
18 | 23 |
</StackPanel> |
19 | 24 |
</extToolkit:WizardPage> |
20 | 25 |
<extToolkit:WizardPage x:Name="ManualAccountPage" PageType="Interior" |
21 | 26 |
Title="Add an account manually" |
22 | 27 |
Description="This is the second page in the process" |
23 |
NextPage="{Binding ElementName=AccountPathPage}" |
|
28 |
NextPage="{Binding ElementName=AccountPathPage}" |
|
29 |
CanSelectNextPage="{Binding HasCredentials}" |
|
24 | 30 |
> |
25 | 31 |
<Grid> |
26 | 32 |
<Grid.ColumnDefinitions> |
... | ... | |
39 | 45 |
</Grid> |
40 | 46 |
</extToolkit:WizardPage> |
41 | 47 |
<extToolkit:WizardPage x:Name="AutoAccountPage" PageType="Interior" |
42 |
Title="Add an account manually" |
|
43 |
Description="This is the second page in the process" |
|
44 |
NextPage="{Binding ElementName=AutoConfirmedPage}" |
|
45 |
/> |
|
46 |
<extToolkit:WizardPage x:Name="AutoConfirmedPage" PageType="Interior" |
|
47 |
Title="Token Received" |
|
48 |
Description="The authentication token was received" |
|
49 |
NextPage="{Binding ElementName=AccountPathPage}" |
|
48 |
Title="Add an account automatically" |
|
49 |
Description="By clicking on the button below you will be taken to the Pithos web site where you can login with your username and password." |
|
50 |
NextPage="{Binding ElementName=AutoConfirmedPage}" |
|
51 |
CanSelectNextPage="{Binding IsConfirmed}" |
|
52 |
cal:Message.Attach="[Event GotFocus] = [Action RetrieveCredentials()]" |
|
50 | 53 |
> |
51 |
<Grid> |
|
52 |
<Grid.RowDefinitions> |
|
53 |
<RowDefinition /> |
|
54 |
<RowDefinition /> |
|
55 |
</Grid.RowDefinitions> |
|
56 |
<Grid.ColumnDefinitions> |
|
57 |
<ColumnDefinition Width="Auto"/> |
|
58 |
<ColumnDefinition/> |
|
59 |
</Grid.ColumnDefinitions> |
|
60 |
<TextBlock Text="Account" Grid.Row="0" Grid.Column="0"/> |
|
61 |
<TextBlock Text="Token" Grid.Row="1" Grid.Column="0"/> |
|
62 |
<TextBlock x:Name="FinalAccountName" Grid.Row="0" Grid.Column="1"/> |
|
63 |
<TextBlock x:Name="FinalToken" Grid.Row="1" Grid.Column="1"/> |
|
64 |
</Grid> |
|
54 |
<extToolkit:BusyIndicator IsBusy="{Binding IsRetrieving}"> |
|
55 |
<extToolkit:BusyIndicator.BusyContent> |
|
56 |
<TextBlock TextWrapping="Wrap"> |
|
57 |
<TextBlock HorizontalAlignment="Center">Waiting for credentials. </TextBlock> |
|
58 |
<TextBlock HorizontalAlignment="Center" TextWrapping="Wrap">Please enter your credentials in the Pithos logon page</TextBlock> |
|
59 |
</TextBlock> |
|
60 |
</extToolkit:BusyIndicator.BusyContent> |
|
61 |
<extToolkit:BusyIndicator.Content> |
|
62 |
<StackPanel VerticalAlignment="Center" > |
|
63 |
<Button Margin="5" Name="RetrieveCredentials" Content="Retrieve Credentials" Width="150"/> |
|
64 |
|
|
65 |
<TextBlock Text="Credentials Retrieved Succesfully" Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=HasCredentials}" Margin="10" HorizontalAlignment="Center"/> |
|
66 |
</StackPanel> |
|
67 |
</extToolkit:BusyIndicator.Content> |
|
68 |
</extToolkit:BusyIndicator> |
|
65 | 69 |
</extToolkit:WizardPage> |
66 | 70 |
<extToolkit:WizardPage x:Name="AccountPathPage" PageType="Interior" |
67 | 71 |
Title="Select Account Path" |
68 | 72 |
Description="Please select the roor path for your account" |
69 | 73 |
NextPage="{Binding ElementName=LastPage}" |
74 |
CanSelectNextPage="{Binding HasAccountPath}" |
|
70 | 75 |
> |
71 | 76 |
<StackPanel> |
72 |
<TextBlock Text="Path:"/> |
|
73 |
<StackPanel Orientation="Horizontal"> |
|
74 |
<TextBox x:Name="AccountPath" Width="150" /> |
|
75 |
<Button x:Name="SelectAccount" Content="Select ..."/> |
|
76 |
</StackPanel> |
|
77 |
<Label Content="Path:" Target="{Binding ElementName=AccountPath}"/> |
|
78 |
<Grid HorizontalAlignment="Stretch"> |
|
79 |
<Grid.ColumnDefinitions> |
|
80 |
<ColumnDefinition /> |
|
81 |
<ColumnDefinition Width="Auto" /> |
|
82 |
</Grid.ColumnDefinitions> |
|
83 |
<TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" > |
|
84 |
<TextBox.Text> |
|
85 |
<Binding Path="AccountPath" Mode="TwoWay"> |
|
86 |
<Binding.ValidationRules> |
|
87 |
<Preferences:DirectoryExistsRule/> |
|
88 |
</Binding.ValidationRules> |
|
89 |
</Binding> |
|
90 |
</TextBox.Text> |
|
91 |
<Validation.ErrorTemplate> |
|
92 |
<ControlTemplate> |
|
93 |
<StackPanel> |
|
94 |
<AdornedElementPlaceholder /> |
|
95 |
<TextBlock Foreground="Red" >Invalid Path</TextBlock> |
|
96 |
</StackPanel> |
|
97 |
</ControlTemplate> |
|
98 |
</Validation.ErrorTemplate> |
|
99 |
</TextBox> |
|
100 |
<Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1"/> |
|
101 |
</Grid> |
|
77 | 102 |
</StackPanel> |
78 | 103 |
</extToolkit:WizardPage> |
79 | 104 |
<extToolkit:WizardPage x:Name="LastPage" PageType="Interior" |
80 | 105 |
Title="Finish" |
81 | 106 |
Description="Press finish to create the account" |
82 | 107 |
CanFinish="True"> |
83 |
<CheckBox x:Name="IsActive" Content="Start using the account immediatelly"/> |
|
108 |
<Grid> |
|
109 |
<Grid.RowDefinitions> |
|
110 |
<RowDefinition Height="Auto"/> |
|
111 |
<RowDefinition Height="Auto"/> |
|
112 |
<RowDefinition Height="Auto"/> |
|
113 |
<RowDefinition /> |
|
114 |
</Grid.RowDefinitions> |
|
115 |
<Grid.ColumnDefinitions> |
|
116 |
<ColumnDefinition Width="Auto"/> |
|
117 |
<ColumnDefinition /> |
|
118 |
</Grid.ColumnDefinitions> |
|
119 |
<TextBlock Text="Account Name:" Grid.Column="0" Grid.Row="0" Margin="5,2"/> |
|
120 |
<TextBlock Text="{Binding AccountName}" Grid.Column="1" Grid.Row="0" Margin="5,2"/> |
|
121 |
<TextBlock Text="Token:" Grid.Column="0" Grid.Row="1" Margin="5,2"/> |
|
122 |
<TextBlock Text="{Binding Token}" Grid.Column="1" Grid.Row="1" Margin="5,2"/> |
|
123 |
<TextBlock Text="Account Path:" Grid.Column="0" Grid.Row="2" Margin="5,2"/> |
|
124 |
<TextBlock Text="{Binding AccountPath}" Grid.Column="1" Grid.Row="2" Margin="5,2"/> |
|
125 |
|
|
126 |
<CheckBox x:Name="IsAccountActive" Content="Start using the account immediatelly" Grid.ColumnSpan="2" Grid.Row="3" Margin="5"/> |
|
127 |
</Grid> |
|
84 | 128 |
</extToolkit:WizardPage> |
85 | 129 |
</extToolkit:Wizard> |
86 | 130 |
|
b/trunk/Pithos.Client.WPF/Preferences/AddAccountView.xaml.cs | ||
---|---|---|
10 | 10 |
using System.Windows.Media; |
11 | 11 |
using System.Windows.Media.Imaging; |
12 | 12 |
using System.Windows.Shapes; |
13 |
using Microsoft.Windows.Controls; |
|
13 | 14 |
|
14 | 15 |
namespace Pithos.Client.WPF.Preferences |
15 | 16 |
{ |
... | ... | |
20 | 21 |
{ |
21 | 22 |
public AddAccountView() |
22 | 23 |
{ |
23 |
InitializeComponent(); |
|
24 |
InitializeComponent(); |
|
25 |
} |
|
26 |
|
|
27 |
private void Automatic_Checked(object sender, RoutedEventArgs e) |
|
28 |
{ |
|
29 |
ChooseMethodPage.NextPage = AutoAccountPage; |
|
30 |
ChooseMethodPage.CanSelectNextPage = true; |
|
31 |
} |
|
32 |
|
|
33 |
private void Manually_Checked(object sender, RoutedEventArgs e) |
|
34 |
{ |
|
35 |
ChooseMethodPage.NextPage = ManualAccountPage; |
|
36 |
ChooseMethodPage.CanSelectNextPage = true; |
|
37 |
} |
|
38 |
|
|
39 |
|
|
40 |
Stack<WizardPage> _history=new Stack<WizardPage>(); |
|
41 |
|
|
42 |
private void AccountWizard_PageChanged(object sender, RoutedEventArgs e) |
|
43 |
{ |
|
44 |
WizardPage lastPage=null; |
|
45 |
if (_history.Count>1 && _history.ElementAt(1) == AccountWizard.CurrentPage) |
|
46 |
{ |
|
47 |
_history.Pop(); |
|
48 |
_history.Pop(); |
|
49 |
} |
|
50 |
if (_history.Count > 0) |
|
51 |
lastPage = _history.Peek(); |
|
52 |
|
|
53 |
if (lastPage != null) |
|
54 |
AccountWizard.CurrentPage.PreviousPage = lastPage; |
|
55 |
|
|
56 |
_history.Push(AccountWizard.CurrentPage); |
|
57 |
|
|
24 | 58 |
} |
25 | 59 |
} |
26 | 60 |
} |
b/trunk/Pithos.Client.WPF/Preferences/AddAccountViewModel.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Collections.Generic; |
3 |
using System.ComponentModel; |
|
3 | 4 |
using System.ComponentModel.Composition; |
5 |
using System.IO; |
|
4 | 6 |
using System.Linq; |
5 | 7 |
using System.Text; |
6 |
using Caliburn.Micro; |
|
8 |
using System.Windows; |
|
9 |
using System.Windows.Controls; |
|
10 |
using System.Windows.Forms; |
|
11 |
using Pithos.Client.WPF.Properties; |
|
12 |
using Pithos.Core; |
|
13 |
using MessageBox = System.Windows.MessageBox; |
|
14 |
using Screen = Caliburn.Micro.Screen; |
|
7 | 15 |
|
8 | 16 |
namespace Pithos.Client.WPF.Preferences |
9 | 17 |
{ |
... | ... | |
18 | 26 |
{ |
19 | 27 |
_accountName = value; |
20 | 28 |
NotifyOfPropertyChange(()=>AccountName); |
29 |
NotifyOfPropertyChange(() => HasCredentials); |
|
21 | 30 |
} |
22 | 31 |
} |
23 | 32 |
|
... | ... | |
29 | 38 |
{ |
30 | 39 |
_token = value; |
31 | 40 |
NotifyOfPropertyChange(()=>Token); |
41 |
NotifyOfPropertyChange(() => HasCredentials); |
|
32 | 42 |
} |
33 | 43 |
} |
34 | 44 |
|
... | ... | |
39 | 49 |
set |
40 | 50 |
{ |
41 | 51 |
_accountPath = value; |
42 |
NotifyOfPropertyChange(()=>AccountPath); |
|
52 |
NotifyOfPropertyChange(() => AccountPath); |
|
53 |
NotifyOfPropertyChange(() => HasAccountPath); |
|
43 | 54 |
} |
44 | 55 |
} |
56 |
|
|
57 |
|
|
58 |
public bool HasAccountPath |
|
59 |
{ |
|
60 |
get { return !String.IsNullOrWhiteSpace(AccountPath); } |
|
61 |
} |
|
62 |
|
|
63 |
public bool HasCredentials |
|
64 |
{ |
|
65 |
get { return !(String.IsNullOrWhiteSpace(AccountName) || String.IsNullOrWhiteSpace(Token) ) ; } |
|
66 |
} |
|
67 |
|
|
68 |
|
|
69 |
private bool _isConfirmed; |
|
70 |
|
|
71 |
public bool IsConfirmed |
|
72 |
{ |
|
73 |
get { return _isConfirmed; } |
|
74 |
set |
|
75 |
{ |
|
76 |
_isConfirmed = value; |
|
77 |
NotifyOfPropertyChange(() => IsConfirmed); |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
|
|
82 |
private bool _isAccountActive; |
|
83 |
|
|
84 |
public bool IsAccountActive |
|
85 |
{ |
|
86 |
get { return _isAccountActive; } |
|
87 |
set |
|
88 |
{ |
|
89 |
_isAccountActive = value; |
|
90 |
NotifyOfPropertyChange(() => IsAccountActive); |
|
91 |
} |
|
92 |
} |
|
93 |
|
|
94 |
public void SelectAccount() |
|
95 |
{ |
|
96 |
using (var dlg = new FolderBrowserDialog()) |
|
97 |
{ |
|
98 |
//Ask the user to select a folder |
|
99 |
//Note: We need a parent window here, which we retrieve with GetView |
|
100 |
var view = (Window)GetView(); |
|
101 |
if (DialogResult.OK != dlg.ShowDialog(new Wpf32Window(view))) |
|
102 |
return; |
|
103 |
|
|
104 |
AccountPath= dlg.SelectedPath; |
|
105 |
} |
|
106 |
} |
|
107 |
|
|
108 |
|
|
109 |
private bool _isRetrieving; |
|
110 |
public bool IsRetrieving |
|
111 |
{ |
|
112 |
get { return _isRetrieving; } |
|
113 |
set |
|
114 |
{ |
|
115 |
_isRetrieving = value; |
|
116 |
NotifyOfPropertyChange(() => IsRetrieving); |
|
117 |
} |
|
118 |
} |
|
119 |
|
|
120 |
public async void RetrieveCredentials() |
|
121 |
{ |
|
122 |
IsRetrieving = true; |
|
123 |
IsConfirmed = false; |
|
124 |
|
|
125 |
try |
|
126 |
{ |
|
127 |
var credentials = await PithosAccount.RetrieveCredentialsAsync(Settings.Default.PithosLoginUrl); |
|
128 |
AccountName = credentials.UserName; |
|
129 |
Token = credentials.Password; |
|
130 |
|
|
131 |
IsConfirmed = true; |
|
132 |
} |
|
133 |
catch (Exception exc) |
|
134 |
{ |
|
135 |
IsConfirmed = false; |
|
136 |
MessageBox.Show(exc.ToString(), "Error"); |
|
137 |
throw; |
|
138 |
} |
|
139 |
IsRetrieving = false; |
|
140 |
|
|
141 |
} |
|
142 |
|
|
143 |
|
|
45 | 144 |
} |
46 | 145 |
} |
b/trunk/Pithos.Client.WPF/Preferences/FileExistsRule.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Globalization; |
|
4 |
using System.IO; |
|
5 |
using System.Linq; |
|
6 |
using System.Text; |
|
7 |
using System.Windows.Controls; |
|
8 |
|
|
9 |
namespace Pithos.Client.WPF.Preferences |
|
10 |
{ |
|
11 |
public class DirectoryExistsRule : ValidationRule |
|
12 |
{ |
|
13 |
public override ValidationResult Validate(object value, CultureInfo cultureInfo) |
|
14 |
{ |
|
15 |
|
|
16 |
if (!(value is string)) |
|
17 |
return new ValidationResult(false,"Value is not a path"); |
|
18 |
|
|
19 |
if (Directory.Exists(value as string)) |
|
20 |
return ValidationResult.ValidResult; |
|
21 |
|
|
22 |
return new ValidationResult(false,String.Format("Path {0} does not exist or is not a directory",value)); |
|
23 |
|
|
24 |
} |
|
25 |
} |
|
26 |
|
|
27 |
|
|
28 |
} |
b/trunk/Pithos.Client.WPF/Preferences/PreferencesViewModel.cs | ||
---|---|---|
234 | 234 |
AccountName = wizard.AccountName, |
235 | 235 |
ApiKey=wizard.Token, |
236 | 236 |
RootPath=wizard.AccountPath, |
237 |
IsActive=wizard.IsActive, |
|
237 |
IsActive=wizard.IsAccountActive,
|
|
238 | 238 |
UsePithos=true |
239 | 239 |
}; |
240 | 240 |
Settings.Accounts.Add(newAccount); |
b/trunk/Pithos.Client.WPF/Shell/AboutView.xaml | ||
---|---|---|
25 | 25 |
<Run>Visit the </Run> |
26 | 26 |
<Hyperlink NavigateUri="http://code.grnet.gr/projects/pithos-ms-client" >Development Web Site</Hyperlink> |
27 | 27 |
</TextBlock> |
28 |
<Button x:Name="Close" Content="OK" Grid.Row="4" HorizontalAlignment="Center" Width="75" Margin="5" /> |
|
28 |
<Button x:Name="CloseAbout" Content="OK" Grid.Row="4" HorizontalAlignment="Center" Width="75" Margin="5" />
|
|
29 | 29 |
</Grid> |
30 | 30 |
</Window> |
b/trunk/Pithos.Client.WPF/Shell/AboutViewModel.cs | ||
---|---|---|
44 | 44 |
Bits = Environment.Is64BitProcess ? "64 bit" : "32 bit"; |
45 | 45 |
} |
46 | 46 |
|
47 |
public void Close() |
|
47 |
public void CloseAbout()
|
|
48 | 48 |
{ |
49 | 49 |
this.TryClose(); |
50 | 50 |
} |
b/trunk/Pithos.Client.WPF/Shell/ShellView.xaml | ||
---|---|---|
77 | 77 |
</ContextMenu> |
78 | 78 |
</tb:TaskbarIcon.ContextMenu> |
79 | 79 |
</tb:TaskbarIcon> |
80 |
<Image Source="/Pithos.Client.WPF;component/Images/logo.png"/> |
|
80 | 81 |
</Grid> |
81 | 82 |
</Window> |
b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs | ||
---|---|---|
31 | 31 |
namespace Pithos.Client.WPF { |
32 | 32 |
using System.ComponentModel.Composition; |
33 | 33 |
|
34 |
[Export(typeof(IShell))] |
|
34 |
|
|
35 | 35 |
///<summary> |
36 | 36 |
/// The "shell" of the Pithos application displays the taskbar icon, menu and notifications. |
37 | 37 |
/// The shell also hosts the status service called by shell extensions to retrieve file info |
... | ... | |
44 | 44 |
/// * ShowFilePropertiesEvent: Raised when a shell command requests the display of the file/container properties dialog |
45 | 45 |
///</remarks> |
46 | 46 |
//TODO: CODE SMELL Why does the shell handle the SelectiveSynchChanges? |
47 |
[Export(typeof(IShell))] |
|
47 | 48 |
public class ShellViewModel : Screen, IStatusNotification, IShell, |
48 | 49 |
IHandle<Notification>, IHandle<SelectiveSynchChanges>, IHandle<ShowFilePropertiesEvent> |
49 | 50 |
{ |
b/trunk/Pithos.Interfaces/ObjectInfo.cs | ||
---|---|---|
6 | 6 |
using System.IO; |
7 | 7 |
using System.Linq; |
8 | 8 |
using System.Text; |
9 |
using System.Text.RegularExpressions; |
|
10 | 9 |
using Newtonsoft.Json; |
11 | 10 |
|
12 | 11 |
namespace Pithos.Interfaces |
... | ... | |
87 | 86 |
|
88 | 87 |
public string Manifest { get; set; } |
89 | 88 |
|
90 |
private bool _isPublic; |
|
91 | 89 |
public bool IsPublic |
92 | 90 |
{ |
93 | 91 |
get { return !String.IsNullOrWhiteSpace(PublicUrl); } |
... | ... | |
129 | 127 |
|
130 | 128 |
private string GetString(string name) |
131 | 129 |
{ |
132 |
var value=String.Empty;
|
|
130 |
string value;
|
|
133 | 131 |
_extensions.TryGetValue(name, out value); |
134 | 132 |
return value ; |
135 | 133 |
} |
... | ... | |
205 | 203 |
|
206 | 204 |
public string GetPermissionString() |
207 | 205 |
{ |
206 |
if (Permissions==null) |
|
207 |
throw new InvalidOperationException(); |
|
208 |
Contract.EndContractBlock(); |
|
209 |
|
|
208 | 210 |
var permissionBuilder = new StringBuilder(); |
209 | 211 |
var groupings = Permissions.GroupBy(pair => pair.Value, pair => pair.Key); |
210 | 212 |
foreach (var grouping in groupings) |
b/trunk/Pithos.ShellExtensions/PithosHost.cs | ||
---|---|---|
4 | 4 |
// </copyright> |
5 | 5 |
// ----------------------------------------------------------------------- |
6 | 6 |
|
7 |
using System.Diagnostics; |
|
8 |
using System.IO; |
|
9 | 7 |
using System.ServiceModel; |
10 |
using Microsoft.Win32; |
|
11 | 8 |
using Pithos.ShellExtensions.PithosService; |
12 | 9 |
|
13 | 10 |
namespace Pithos.ShellExtensions |
14 | 11 |
{ |
15 |
using System; |
|
16 |
using System.Collections.Generic; |
|
17 |
using System.Linq; |
|
18 |
using System.Text; |
|
19 |
|
|
20 | 12 |
/// <summary> |
21 |
/// TODO: Update summary.
|
|
13 |
/// Returns the status service clients
|
|
22 | 14 |
/// </summary> |
23 | 15 |
public static class PithosHost |
24 | 16 |
{ |
25 |
public static void EnsureHost() |
|
26 |
{ |
|
27 |
return; |
|
28 |
if (Process.GetProcessesByName("Pithos.Client.WPF").Length == 0 && |
|
29 |
Process.GetProcessesByName("Pithos.Client.WPF.vshost").Length == 0) |
|
30 |
{ |
|
31 |
var fileName = (string)Registry.LocalMachine.GetValue(@"Software\Pithos\AppPath"); |
|
32 |
var workingDirectory = Path.GetDirectoryName(fileName); |
|
33 |
var info = new ProcessStartInfo {FileName = fileName, WorkingDirectory = workingDirectory}; |
|
34 |
Process.Start(info); |
|
35 |
} |
|
36 |
} |
|
37 |
|
|
17 |
/// <summary> |
|
18 |
/// Provides a client for retrieving file status from the Pithos App |
|
19 |
/// </summary> |
|
20 |
/// <returns></returns> |
|
38 | 21 |
public static StatusServiceClient GetStatusClient() |
39 | 22 |
{ |
40 |
EnsureHost(); |
|
41 |
|
|
42 | 23 |
var binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None); |
43 | 24 |
var remoteAddress = new EndpointAddress("net.pipe://localhost/pithos/statuscache"); |
44 | 25 |
|
45 | 26 |
return new StatusServiceClient(binding, remoteAddress); |
46 | 27 |
} |
47 | 28 |
|
29 |
/// <summary> |
|
30 |
/// Provides a client for retrieving settings from the Pithos App |
|
31 |
/// </summary> |
|
32 |
/// <returns></returns> |
|
48 | 33 |
public static SettingsServiceClient GetSettingsClient() |
49 | 34 |
{ |
50 |
EnsureHost(); |
|
51 |
|
|
52 | 35 |
var binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None); |
53 | 36 |
var remoteAddress = new EndpointAddress("net.pipe://localhost/pithos/settings"); |
54 | 37 |
|
55 | 38 |
return new SettingsServiceClient(binding, remoteAddress); |
56 | 39 |
} |
57 | 40 |
|
41 |
|
|
42 |
/// <summary> |
|
43 |
/// Provides a client for sending commands to the Pithos Client |
|
44 |
/// </summary> |
|
45 |
/// <returns></returns> |
|
58 | 46 |
public static CommandsServiceClient GetCommandsClient() |
59 | 47 |
{ |
60 |
EnsureHost(); |
|
61 |
|
|
62 | 48 |
var binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None); |
63 | 49 |
var remoteAddress = new EndpointAddress("net.pipe://localhost/pithos/commands"); |
64 | 50 |
|
Also available in: Unified diff