//TODO:Force logout here to take care of existing cookies
- var listenerUrl = String.Format("http://127.0.0.1:{0}/", port);
+ var listenerUrl = String.Format("http://127.0.0.1:{0}", port);
var logoutProcess=Process.Start(logoutUrl);
TaskEx.Delay(2000).Wait();
var uriBuilder=new UriBuilder(loginUrl);
- uriBuilder.Query="next=" + listenerUrl;
+ uriBuilder.Query=String.Format("next={0}&force=", listenerUrl);
var retrieveUri = uriBuilder.Uri;
Log.InfoFormat("[RETRIEVE] Open Browser at {0}", retrieveUri);
Title="Add new Pithos Account"
Description="This Wizard will walk you through adding a new Pithos account and retrieving an authentication token"
BackButtonVisibility="Collapsed"
- FinishButtonVisibility="Collapsed"/>
+ FinishButtonVisibility="Collapsed"
+ />
<extToolkit:WizardPage x:Name="ChooseServer" PageType="Interior"
Title="Where do you want to connect?"
Description="You can connect to the production or development server, or enter your own server URL"
FinishButtonVisibility="Collapsed"
CanSelectNextPage="{Binding IsValidServer}"
+
>
<StackPanel >
<Label Content="Pithos Server" Target="{Binding ElementName=Servers}" />
Title="How do you want to add the account?"
Description="You can add an account either by logging in the Pithos Web Site or by entering your username and password manually"
FinishButtonVisibility="Collapsed"
- CanSelectNextPage="False">
+ CanSelectNextPage="False"
+ >
<StackPanel >
<RadioButton x:Name="Automatic" Content="By logging to Pithos" Checked="Automatic_Checked" Margin="5"/>
<RadioButton x:Name="Manually" Content="Manually" Checked="Manually_Checked" Margin="5"/>
FinishButtonVisibility="Collapsed"
CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=True}"
TargetUpdated="OnTargetUpdated"
+
>
<extToolkit:BusyIndicator x:Name="ManualBusyIndicator" IsBusy="{Binding IsWorking,NotifyOnSourceUpdated=true}" DisplayAfter="0" >
<extToolkit:BusyIndicator.BusyContent>
FinishButtonVisibility="Collapsed"
CanSelectNextPage="{Binding HasValidCredentials,NotifyOnTargetUpdated=true}"
TargetUpdated="OnTargetUpdated"
+
>
<extToolkit:BusyIndicator x:Name="AutoBusyIndicator" IsBusy="{Binding IsWorking}" DisplayAfter="0">
<extToolkit:BusyIndicator.BusyContent>
<StackPanel>
<Label Content="Path:" Target="{Binding ElementName=AccountPath}"/>
<Grid HorizontalAlignment="Stretch">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition/>
+ </Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
- <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" >
+ <TextBox x:Name="AccountPath" HorizontalAlignment="Stretch" Grid.Column="0" Grid.Row="0">
<TextBox.Text>
<Binding Path="AccountPath" Mode="TwoWay">
<Binding.ValidationRules>
</ControlTemplate>
</Validation.ErrorTemplate>
</TextBox>
- <Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1"/>
+ <Button x:Name="SelectAccount" Content="Select ..." HorizontalAlignment="Right" Grid.Column="1" Grid.Row="0"/>
+ <CheckBox x:Name="ShouldCreateOkeanosFolder" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" >
+ <CheckBox.Content>
+ <TextBlock TextWrapping="Wrap">
+ Create an Okeanos folder below the selected folder
+ <LineBreak/>
+ Clear this setting to use the currently selected folder and synchronize its contents
+ </TextBlock>
+ </CheckBox.Content>
+ </CheckBox>
</Grid>
</StackPanel>
</extToolkit:WizardPage>
<extToolkit:WizardPage x:Name="LastPage" PageType="Interior"
Title="Finish"
Description="Press finish to create the account"
- CanFinish="True">
+ CanFinish="True"
+ >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
+using System.IO;
+using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
}
}
+
+ private bool _shouldCreateOkeanosFolder;
+ public bool ShouldCreateOkeanosFolder
+ {
+ get { return _shouldCreateOkeanosFolder; }
+ set
+ {
+ _shouldCreateOkeanosFolder = value;
+ NotifyOfPropertyChange(()=>ShouldCreateOkeanosFolder);
+ }
+ }
+
public void SelectAccount()
{
using (var dlg = new FolderBrowserDialog{Description=Resources.AddAccountViewModel_SelectAccount_Please_select_a_folder})
return;
AccountPath= dlg.SelectedPath;
+
+ ShouldCreateOkeanosFolder=Directory.EnumerateFileSystemEntries(AccountPath).Any();
}
}
foreach (var account in _accountsToRemove)
{
Shell.RemoveMonitor(account.AccountName);
+ Shell.RemoveAccountFromDatabase(account);
}
foreach (var account in Settings.Accounts)
if (_windowManager.ShowDialog(wizard) == true)
{
string selectedPath = wizard.AccountPath;
- var initialRootPath = Path.Combine(selectedPath, "Okeanos");
+ var initialRootPath = wizard.ShouldCreateOkeanosFolder?
+ Path.Combine(selectedPath, "Okeanos")
+ :selectedPath;
var actualRootPath= initialRootPath;
- int attempt = 1;
- while (Directory.Exists(actualRootPath) || File.Exists(actualRootPath))
+ if (wizard.ShouldCreateOkeanosFolder)
{
- actualRootPath = String.Format("{0} {1}", initialRootPath,attempt++);
+ int attempt = 1;
+ while (Directory.Exists(actualRootPath) || File.Exists(actualRootPath))
+ {
+ actualRootPath = String.Format("{0} {1}", initialRootPath, attempt++);
+ }
}
var newAccount = new AccountSettings