NetSparkle/NetSparkleAppCast.cs fix to retrieve x64 or x86 msi
authorPanagiotis Kanavos <pkanavos@gmail.com>
Mon, 12 Mar 2012 20:46:07 +0000 (22:46 +0200)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Mon, 12 Mar 2012 20:46:07 +0000 (22:46 +0200)
Added status view window
Added notifications to DeleteAgent.cs

trunk/NetSparkle/NetSparkleAppCast.cs
trunk/Pithos.Client.WPF/Pithos.Client.WPF.csproj
trunk/Pithos.Client.WPF/Shell/MiniStatusView.xaml [new file with mode: 0644]
trunk/Pithos.Client.WPF/Shell/MiniStatusView.xaml.cs [new file with mode: 0644]
trunk/Pithos.Client.WPF/Shell/MiniStatusViewModel.cs [new file with mode: 0644]
trunk/Pithos.Client.WPF/Shell/ShellView.xaml
trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs
trunk/Pithos.Core/Agents/DeleteAgent.cs
trunk/Pithos.Core/Agents/NetworkAgent.cs
trunk/Pithos.Core/IStatusNotification.cs

index a1f836c..03c057c 100644 (file)
@@ -72,7 +72,12 @@ namespace AppLimit.NetSparkle
                         case enclosureNode:
                             {
                                 currentItem.Version = reader.GetAttribute(versionAttribute);
-                                currentItem.DownloadLink = reader.GetAttribute(urlAttribute);
+
+                                var downloadLink = reader.GetAttribute(urlAttribute);
+                                downloadLink = Environment.Is64BitOperatingSystem
+                                    ? downloadLink.Replace(".x86.", ".x64.")
+                                    : downloadLink.Replace(".x64.", ".x86.") ;
+                                currentItem.DownloadLink = downloadLink;
                                 currentItem.DSASignature = reader.GetAttribute(dasSignature);
 
                                 break;
index 9205e4c..88a5d6e 100644 (file)
       <DependentUpon>MessageView.xaml</DependentUpon>
     </Compile>
     <Compile Include="NativeMethods.cs" />
+    <Compile Include="Shell\MiniStatusView.xaml.cs">
+      <DependentUpon>MiniStatusView.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Shell\MiniStatusViewModel.cs" />
     <Compile Include="Shell\Notification.cs" />
     <Compile Include="PithosAccount.cs" />
     <Compile Include="Preferences\PreferencesView.xaml.cs">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Shell\MiniStatusView.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Shell\PithosBalloon.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
diff --git a/trunk/Pithos.Client.WPF/Shell/MiniStatusView.xaml b/trunk/Pithos.Client.WPF/Shell/MiniStatusView.xaml
new file mode 100644 (file)
index 0000000..efcf152
--- /dev/null
@@ -0,0 +1,19 @@
+<Window x:Class="Pithos.Client.WPF.Shell.MiniStatusView"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        
+        Title="Pithos Status" Height="100" Width="250" WindowStyle="ToolWindow" Topmost="True" Icon="/Pithos;component/Images/PithosTaskbar.png" WindowStartupLocation="CenterOwner">
+    <Border HorizontalAlignment="Stretch" 
+            VerticalAlignment="Stretch" CornerRadius="2">
+        <Grid>
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="Auto"/>
+                <ColumnDefinition/>
+            </Grid.ColumnDefinitions>
+            <Image Grid.Column="0" Width="48" Height="48" HorizontalAlignment="Right" Margin="0,5,5,0" VerticalAlignment="Top"  Source="/Pithos;component/Images/PithosTaskbar.png" Stretch="Fill" Opacity="0.7" ToolTip="Close Balloon" />
+            <TextBlock TextWrapping="Wrap" x:Name="Status" 
+                   HorizontalAlignment="Stretch"
+                   VerticalAlignment="Stretch" Grid.Column="1" Margin="2,5,2,2"/>
+        </Grid>
+    </Border>
+</Window>
diff --git a/trunk/Pithos.Client.WPF/Shell/MiniStatusView.xaml.cs b/trunk/Pithos.Client.WPF/Shell/MiniStatusView.xaml.cs
new file mode 100644 (file)
index 0000000..de733d4
--- /dev/null
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Pithos.Client.WPF.Shell
+{
+    /// <summary>
+    /// Interaction logic for MiniStatusView.xaml
+    /// </summary>
+    public partial class MiniStatusView : Window
+    {
+        public MiniStatusView()
+        {
+            InitializeComponent();
+
+            this.Top=System.Windows.SystemParameters.WorkArea.Height - this.Height;
+            this.Left = System.Windows.SystemParameters.WorkArea.Width - this.Width;
+        }
+
+        private void imgClose_MouseDown(object sender, MouseButtonEventArgs e)
+        {
+            this.Close();
+        }
+    }
+}
diff --git a/trunk/Pithos.Client.WPF/Shell/MiniStatusViewModel.cs b/trunk/Pithos.Client.WPF/Shell/MiniStatusViewModel.cs
new file mode 100644 (file)
index 0000000..2cb06af
--- /dev/null
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.Composition;
+using System.Linq;
+using System.Text;
+using Caliburn.Micro;
+
+namespace Pithos.Client.WPF.Shell
+{
+    [Export(typeof(MiniStatusViewModel))]
+    public class MiniStatusViewModel:Screen
+    {
+        public override string DisplayName
+        {
+            get
+            {
+                return "Pithos Status";
+            }
+            set
+            {
+                base.DisplayName = value;
+            }
+        }
+        
+        public string Status
+        {
+            get { return Shell.StatusMessage; }
+        }
+
+        private ShellViewModel _shell;
+        public ShellViewModel Shell
+        {
+            get { return _shell; }
+            set
+            {
+                _shell = value;
+                _shell.PropertyChanged += OnParentChanged;
+            }
+        }
+
+        private void OnParentChanged(object sender, PropertyChangedEventArgs e)
+        {
+            if (e.PropertyName=="StatusMessage")
+                NotifyOfPropertyChange(()=>Status);
+        }
+    }
+}
index 485a7f2..4fbb6af 100644 (file)
                         </MenuItem.Icon>
                     </MenuItem>
                     <MenuItem  Header="Check For Upgrade" x:Name="CheckForUpgrade" cal:Message.Attach="CheckForUpgrade"/>
+                    <MenuItem  Header="Show Status Window" x:Name="ShowMiniStatus" cal:Message.Attach="ShowMiniStatus"/>
                     <MenuItem x:Name="GoToSiteRootMenu"  cal:Message.Attach="[Event MouseLeftButtonUp]=[Action GoToSite()]"
                               cal:Action.TargetWithoutContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=MenuItem, AncestorLevel=1}, Path=DataContext}" >
                         <MenuItem.HeaderTemplate>
index 54089af..b814371 100644 (file)
@@ -434,6 +434,13 @@ namespace Pithos.Client.WPF {
                    Process.Start(uri);
                }
 
+        public void ShowMiniStatus()
+        {
+            var model=IoC.Get<MiniStatusViewModel>();
+            model.Shell = this;
+            _windowManager.ShowWindow(model);
+        }
+
            /// <summary>
         /// Open an explorer window to the target path's directory
         /// and select the file
@@ -880,6 +887,13 @@ namespace Pithos.Client.WPF {
                                notification.Message = "Start Synchronisation";
                        }
 
+                   var deleteNotification = notification as CloudDeleteNotification;
+            if (deleteNotification != null)
+            {
+                StatusMessage = String.Format("Deleted {0}", deleteNotification.Data.Name);
+                return;
+            }
+
                    var progress = notification as ProgressNotification;
                    if (progress != null)
                    {
index c02eb2f..6659b8a 100644 (file)
@@ -65,6 +65,8 @@ namespace Pithos.Core.Agents
 
         [Import]
         public IStatusKeeper StatusKeeper { get; set; }
+        
+        public IStatusNotification StatusNotification { get; set; }
 
         //A separate agent is used to execute delete actions immediatelly;
         private readonly ActionBlock<CloudDeleteAction> _deleteAgent;
@@ -227,6 +229,7 @@ namespace Pithos.Core.Agents
                 client.DeleteObject(account, container, cloudFile.Name);
 
                 StatusKeeper.ClearFileStatus(fullPath);
+                StatusNotification.Notify(new CloudNotification{Data=cloudFile});
             }
         }
 
index 9522521..3328730 100644 (file)
@@ -65,12 +65,21 @@ namespace Pithos.Core.Agents
         private Agent<CloudAction> _agent;
 
         [System.ComponentModel.Composition.Import]
-        private DeleteAgent _deleteAgent=new DeleteAgent();
+        private DeleteAgent _deleteAgent { get; set; }
 
         [System.ComponentModel.Composition.Import]
         public IStatusKeeper StatusKeeper { get; set; }
-        
-        public IStatusNotification StatusNotification { get; set; }
+
+        private IStatusNotification _statusNotification;
+        public IStatusNotification StatusNotification
+        {
+            get { return _statusNotification; }
+            set
+            {
+                _statusNotification = value;
+                _deleteAgent.StatusNotification = value;
+            }
+        }
 
 
         [System.ComponentModel.Composition.Import]
index 201d37d..e4ba992 100644 (file)
@@ -122,6 +122,10 @@ namespace Pithos.Core
     {\r
         \r
     }\r
+    public class CloudDeleteNotification:CloudNotification\r
+    {\r
+        \r
+    }\r
 \r
     public class ExpirationNotification:Notification<AccountSettings>\r
     {\r