Modified the account page of Preferences to display warnings for expired accounts
<ItemGroup>
<Resource Include="Images\Warning.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\SmallWarning.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
var receiveCredentials = ListenForRedirectAsync(port);
var logoutUrl = loginUrl.Replace("login", "im/logout");
- var logoutProcess=Process.Start(logoutUrl);
- TaskEx.Delay(100).Wait();
+ var logoutProcess=Process.Start(logoutUrl);
+ TaskEx.Delay(2000).Wait();
var uriBuilder=new UriBuilder(loginUrl);
uriBuilder.Query="next=" + listenerUrl;
<ResourceDictionary Source="..\PithosStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<Converters:NullToVisibilityConverter x:Key="NullToVisible" />
+ <BooleanToVisibilityConverter x:Key="BoolToVisible" />
</ResourceDictionary>
</Window.Resources>
<!-- <Window.TaskbarItemInfo>
<ListBox Name="Accounts" Grid.Row="0" VerticalAlignment="Stretch" ItemsSource="{Binding Accounts,Mode=OneWay}" SelectedItem="{Binding CurrentAccount,Mode=TwoWay}" >
<ListBox.ItemTemplate>
<DataTemplate>
+ <StackPanel Orientation="Horizontal">
+ <Image Visibility="{Binding Converter={StaticResource BoolToVisible}, Path=IsExpired}" Source="/Pithos.Client.WPF;component/Images/SmallWarning.png" Margin="2,0"/>
<TextBlock Text="{Binding AccountName}" />
+ </StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
using Pithos.Client.WPF.Configuration;
using Pithos.Client.WPF.FileProperties;
using Pithos.Client.WPF.Preferences;
+using Pithos.Client.WPF.Properties;
using Pithos.Client.WPF.SelectiveSynch;
using Pithos.Client.WPF.Services;
using Pithos.Client.WPF.Shell;
public void ShowPreferences()
{
- Settings.Reload();
+ //Settings.Reload();
var preferences = new PreferencesViewModel(_windowManager,_events, this,Settings);
_windowManager.ShowDialog(preferences);
var message = String.Format("API Key Expired for {0}. Starting Renewal",
monitor.UserName);
Log.Error(message, exc);
- TryAuthorize(monitor.UserName, retries).Wait();
+ var account = Settings.Accounts.Find(acc => acc.AccountName == monitor.UserName);
+ account.IsExpired = true;
+ Notify(new ExpirationNotification(account));
+ //TryAuthorize(monitor.UserName, retries).Wait();
break;
case HttpStatusCode.ProxyAuthenticationRequired:
TryAuthenticateProxy(monitor,retries);
var monitor = _monitors[account.AccountName];
account.ApiKey = credentials.Password;
monitor.ApiKey = credentials.Password;
+ account.IsExpired = false;
Settings.Save();
- await TaskEx.Delay(10000);
- StartMonitor(monitor, retries + 1);
+ TaskEx.Delay(10000).ContinueWith(_=>
+ StartMonitor(monitor, retries + 1));
NotifyOfPropertyChange(()=>Accounts);
}
catch (AggregateException exc)
{\r
\r
}\r
+\r
+ public class ExpirationNotification:Notification<AccountSettings>\r
+ {\r
+ public ExpirationNotification(AccountSettings account)\r
+ {\r
+ Data = account;\r
+ Level = TraceLevel.Error;\r
+ Title = "Account key expired";\r
+ Message = string.Format("Please renew the key for the account {0} from the Preferences page", account.AccountName);\r
+ }\r
+ }\r
}
\ No newline at end of file
private StringCollection _selectiveFolders = new StringCollection();
-
+ private bool _isExpired;
+ public bool IsExpired
+ {
+ get { return _isExpired; }
+ set { _isExpired = value; }
+ }
+
public StringCollection SelectiveFolders
{
get { return _selectiveFolders; }