Added action to the PithosBalloon
authorPanagiotis Kanavos <pkanavos@gmail.com>
Wed, 29 Feb 2012 10:04:11 +0000 (12:04 +0200)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Wed, 29 Feb 2012 10:04:11 +0000 (12:04 +0200)
ExpiredNotifications now add an action to the balloon that opens the account preferences when clicked

trunk/Pithos.Client.WPF/Pithos.Client.WPF.csproj
trunk/Pithos.Client.WPF/Preferences/PreferencesView.xaml
trunk/Pithos.Client.WPF/Preferences/PreferencesViewModel.cs
trunk/Pithos.Client.WPF/Shell/PithosBalloon.xaml
trunk/Pithos.Client.WPF/Shell/PithosBalloon.xaml.cs
trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs

index 2d995e3..c2b1c9b 100644 (file)
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <WarningLevel>4</WarningLevel>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>0.7.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     <PlatformTarget>x86</PlatformTarget>
   <ItemGroup>
     <Resource Include="Images\SmallWarning.png" />
   </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </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.
index 8399d68..fbd9760 100644 (file)
@@ -36,8 +36,8 @@
         </Grid.RowDefinitions>
 
        
-        <TabControl Grid.Row="0">  
-            <TabItem VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
+        <TabControl Grid.Row="0" x:Name="Tabs" >  
+            <TabItem VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" x:Name="GeneralTab">
                 <TabItem.Header>
                     <StackPanel>
                         <Image Source="/Pithos.Client.WPF;component/Images/General.png" Stretch="Uniform" Height="32"/>
@@ -51,7 +51,7 @@
                     </StackPanel>
                 </GroupBox>
             </TabItem>
-            <TabItem VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
+            <TabItem VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" x:Name="AccountTab" IsSelected="{Binding AccountTabSelected,Mode=OneWay}">
                 <TabItem.Header>
                     <StackPanel>
                         <Image Source="/Pithos.Client.WPF;component/Images/Accounts.png" Stretch="Uniform" Height="32"/>
                     
                 </Grid>
             </TabItem>
-            <TabItem VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" Visibility="Collapsed">
+            <TabItem VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" Visibility="Collapsed" x:Name="RateTab">
                 <TabItem.Header>
                     <StackPanel>
                         <Image Source="/Pithos.Client.WPF;component/Images/Bandwidth.png" Stretch="Uniform" Height="32"/>
                     </GroupBox>
                 </StackPanel>
             </TabItem>
-            <TabItem VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
+            <TabItem VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" x:Name="ProxyTab">
                 <TabItem.Header>
                     <StackPanel>
                         <Image Source="/Pithos.Client.WPF;component/Images/Network.png" Stretch="Uniform" Height="32"/>
                         </GroupBox>
                     </Grid>
             </TabItem>
-            <TabItem VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
+            <TabItem VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" x:Name="AdvancedTab">
                 <TabItem.Header>
                     <StackPanel>
                         <Image Source="/Pithos.Client.WPF;component/Images/Advanced.png" Stretch="Uniform" Height="32"/>
index da83649..8ece12c 100644 (file)
@@ -97,14 +97,14 @@ namespace Pithos.Client.WPF.Preferences
         public ShellViewModel Shell { get;  set; }
         //ShellExtensionController _extensionController=new ShellExtensionController();
 
-        public PreferencesViewModel(IWindowManager windowManager, IEventAggregator events, ShellViewModel shell, PithosSettings settings)
+        public PreferencesViewModel(IWindowManager windowManager, IEventAggregator events, ShellViewModel shell, PithosSettings settings, string currentTab)
         {
             _windowManager = windowManager;
             _events = events;
 
             DisplayName = "Pithos Preferences";
             Shell = shell;
-
+            
             Settings=settings;
             Accounts = new ObservableConcurrentCollection<AccountSettings>();
             if (settings.Accounts == null)
@@ -120,9 +120,26 @@ namespace Pithos.Client.WPF.Preferences
 
             StartOnSystemStartup = File.Exists(_shortcutPath);
 
+            SelectedTab = currentTab;
+        }
+
+        private string _selectedTab="General";
+        public string SelectedTab
+        {
+            get { return _selectedTab; }
+            set
+            {
+                _selectedTab = value??"General";
+                NotifyOfPropertyChange(()=>SelectedTab);
+                NotifyOfPropertyChange(() => AccountTabSelected);
+            }
         }
 
 
+        public bool AccountTabSelected
+        {
+            get { return _selectedTab == "AccountTab"; }
+        }
         #region Preferences Properties
 
         private bool _noProxy;
index c322881..e05be8e 100644 (file)
@@ -60,7 +60,7 @@
             <BeginStoryboard Storyboard="{StaticResource FadeOut}" x:Name="FadeOut_BeginStoryboard"/>\r
         </EventTrigger>\r
     </UserControl.Triggers>\r
-    <Grid x:Name="grid" MouseEnter="grid_MouseEnter">\r
+    <Grid x:Name="grid" MouseEnter="grid_MouseEnter" >\r
         <Grid.ColumnDefinitions>\r
             <ColumnDefinition Width="Auto"/>\r
             <ColumnDefinition Width="*"/>\r
                     Foreground="Black" \r
                     TextWrapping="Wrap" \r
                    Text="{Binding Message,FallbackValue='This is  a  message'}"                    \r
-                   Width="Auto"   Grid.RowSpan="2">\r
+                   Width="Auto"   Grid.RowSpan="2" MouseDown="TextBlock_MouseDown"\r
+                   >\r
         </TextBlock>\r
 \r
         <Path Grid.Column="1" Fill="#FFFFFFFF"\r
index e030863..2b5a7ce 100644 (file)
@@ -133,12 +133,17 @@ namespace Pithos.Client.WPF.Shell
       /// </summary>\r
       private void imgClose_MouseDown(object sender, MouseButtonEventArgs e)\r
       {\r
-        //the tray icon assigned this attached property to simplify access\r
-        TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);\r
-        taskbarIcon.CloseBalloon();\r
+          //the tray icon assigned this attached property to simplify access\r
+          CloseBalloon();\r
       }\r
-  \r
-      /// <summary>\r
+\r
+        private void CloseBalloon()\r
+        {\r
+            TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this);\r
+            taskbarIcon.CloseBalloon();\r
+        }\r
+\r
+        /// <summary>\r
       /// If the users hovers over the balloon, we don't close it.\r
       /// </summary>\r
       private void grid_MouseEnter(object sender, MouseEventArgs e)\r
@@ -163,5 +168,17 @@ namespace Pithos.Client.WPF.Shell
         Popup pp = (Popup)Parent;\r
         pp.IsOpen = false;\r
       }\r
+\r
+      private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)\r
+      {\r
+          CloseBalloon();\r
+          if (ClickAction!= null)\r
+          {\r
+              ClickAction();\r
+          }          \r
+          \r
+      }\r
+\r
+      public Action ClickAction { get; set; }\r
    }\r
 }\r
index 5f008df..fc02d07 100644 (file)
@@ -348,11 +348,16 @@ namespace Pithos.Client.WPF {
 
                #region Commands
 
-               public void ShowPreferences()
+        public void ShowPreferences()
+        {
+            ShowPreferences(null);
+        }
+
+               public void ShowPreferences(string currentTab)
                {
                        //Settings.Reload();
-                       var preferences = new PreferencesViewModel(_windowManager,_events, this,Settings);            
-                       _windowManager.ShowDialog(preferences);
+                   var preferences = new PreferencesViewModel(_windowManager, _events, this, Settings,currentTab);
+                   _windowManager.ShowDialog(preferences);
                        
                }
 
@@ -861,8 +866,13 @@ namespace Pithos.Client.WPF {
                        
                        if (Settings.ShowDesktopNotifications)
                        {
-                               var tv = (ShellView) GetView();                
-                               var balloon=new PithosBalloon{Title=notification.Title,Message=notification.Message,Icon=icon};
+                               var tv = (ShellView) GetView();
+                           System.Action clickAction = null;
+                if (notification is ExpirationNotification)
+                {
+                    clickAction = ()=>ShowPreferences("AccountTab");
+                }
+                               var balloon=new PithosBalloon{Title=notification.Title,Message=notification.Message,Icon=icon,ClickAction=clickAction};
                                tv.TaskbarView.ShowCustomBalloon(balloon,PopupAnimation.Fade,4000);
 //                             tv.TaskbarView.ShowBalloonTip(notification.Title, notification.Message, icon);
                        }