+
+
+ public bool HasAccountPath
+ {
+ get { return !String.IsNullOrWhiteSpace(AccountPath); }
+ }
+
+ public bool HasCredentials
+ {
+ get { return !(String.IsNullOrWhiteSpace(AccountName) || String.IsNullOrWhiteSpace(Token) ) ; }
+ }
+
+
+ private bool _isConfirmed;
+
+ public bool IsConfirmed
+ {
+ get { return _isConfirmed; }
+ set
+ {
+ _isConfirmed = value;
+ NotifyOfPropertyChange(() => IsConfirmed);
+ }
+ }
+
+
+ private bool _isAccountActive;
+
+ public bool IsAccountActive
+ {
+ get { return _isAccountActive; }
+ set
+ {
+ _isAccountActive = value;
+ NotifyOfPropertyChange(() => IsAccountActive);
+ }
+ }
+
+ public void SelectAccount()
+ {
+ using (var dlg = new FolderBrowserDialog())
+ {
+ //Ask the user to select a folder
+ //Note: We need a parent window here, which we retrieve with GetView
+ var view = (Window)GetView();
+ if (DialogResult.OK != dlg.ShowDialog(new Wpf32Window(view)))
+ return;
+
+ AccountPath= dlg.SelectedPath;
+ }
+ }
+
+
+ private bool _isRetrieving;
+ public bool IsRetrieving
+ {
+ get { return _isRetrieving; }
+ set
+ {
+ _isRetrieving = value;
+ NotifyOfPropertyChange(() => IsRetrieving);
+ }
+ }
+
+ public async void RetrieveCredentials()
+ {
+ IsRetrieving = true;
+ IsConfirmed = false;
+
+ try
+ {
+ var credentials = await PithosAccount.RetrieveCredentialsAsync(Settings.Default.PithosLoginUrl);
+ AccountName = credentials.UserName;
+ Token = credentials.Password;
+
+ IsConfirmed = true;
+ }
+ catch (Exception exc)
+ {
+ IsConfirmed = false;
+ MessageBox.Show(exc.ToString(), "Error");
+ throw;
+ }
+ IsRetrieving = false;
+
+ }
+
+