Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6413


Ignore:
Timestamp:
06/14/11 18:59:42 (13 years ago)
Author:
gkronber
Message:

#1536 implemented feature that checks for plugin updates on each application start and allows to install plugin updates easily. Removed more advanced plugin management features for all users except if it is manually reenabled in the HeuristicLab.config file.

Location:
trunk/sources/HeuristicLab.PluginInfrastructure/3.3
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/AvailablePluginsView.cs

    r5445 r6413  
    117117    void updateOrInstallPluginsBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) {
    118118      UpdateOrInstallPluginsBackgroundWorkerArgument info = (UpdateOrInstallPluginsBackgroundWorkerArgument)e.Argument;
     119      bool cancelled = false;
    119120      if (info.PluginsToInstall.Count() > 0)
    120         installationManager.Install(info.PluginsToInstall);
     121        installationManager.Install(info.PluginsToInstall, out cancelled);
    121122      if (info.PluginsToUpdate.Count() > 0)
    122         installationManager.Update(info.PluginsToUpdate);
    123 
    124       if (info.PluginsToInstall.Count() > 0 || info.PluginsToUpdate.Count() > 0)
     123        installationManager.Update(info.PluginsToUpdate, out cancelled);
     124
     125      if (!cancelled && (info.PluginsToInstall.Count() > 0 || info.PluginsToUpdate.Count() > 0))
    125126        pluginManager.DiscoverAndCheckPlugins();
    126127    }
     
    176177      var pluginsToInstall = selectedProduct.Plugins.Except(pluginsToUpdate);
    177178
    178       updateOrInstallInfo.PluginsToInstall = 
     179      updateOrInstallInfo.PluginsToInstall =
    179180        pluginsToInstall
    180181        .Cast<IPluginDescription>()
    181182        .ToList();
    182       updateOrInstallInfo.PluginsToUpdate = 
     183      updateOrInstallInfo.PluginsToUpdate =
    183184        pluginsToUpdate
    184185        .Cast<IPluginDescription>()
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/BasicUpdateView.cs

    r5445 r6413  
    7979                            select remotePlugin;
    8080      if (pluginsToUpdate.Count() > 0) {
    81         installationManager.Update(pluginsToUpdate);
    82         pluginManager.DiscoverAndCheckPlugins();
     81        bool cancelled;
     82        installationManager.Update(pluginsToUpdate, out cancelled);
     83        if (!cancelled)
     84          pluginManager.DiscoverAndCheckPlugins();
    8385        e.Cancel = false;
    8486      } else {
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManager.cs

    r5445 r6413  
    9898    /// </summary>
    9999    /// <param name="plugins"></param>
    100     public void Install(IEnumerable<IPluginDescription> plugins) {
     100    public void Install(IEnumerable<IPluginDescription> plugins, out bool cancelled) {
    101101      var args = new PluginInfrastructureCancelEventArgs(plugins);
    102102      OnPreInstall(args);
    103103      if (!args.Cancel) {
     104        cancelled = false;
    104105        var client = DeploymentService.UpdateServiceClientFactory.CreateClient();
    105106        try {
     
    123124          throw new InstallationManagerException("General communication exception in connection to server.", e);
    124125        }
     126      } else {
     127        cancelled = true;
    125128      }
    126129    }
     
    130133    /// </summary>
    131134    /// <param name="plugins"></param>
    132     public void Update(IEnumerable<IPluginDescription> plugins) {
     135    public void Update(IEnumerable<IPluginDescription> plugins, out bool cancelled) {
    133136      PluginInfrastructureCancelEventArgs args = new PluginInfrastructureCancelEventArgs(plugins);
    134137      OnPreUpdate(args);
    135138      if (!args.Cancel) {
     139        cancelled = false;
    136140        var client = DeploymentService.UpdateServiceClientFactory.CreateClient();
    137141        try {
     
    155159          throw new InstallationManagerException("General communication exception in connection to server.", e);
    156160        }
     161      } else {
     162        cancelled = true;
    157163      }
    158164    }
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstalledPluginsView.cs

    r5445 r6413  
    116116                            select remotePlugin;
    117117      if (pluginsToUpdate.Count() > 0) {
    118         installationManager.Update(pluginsToUpdate);
    119       }
    120       pluginManager.DiscoverAndCheckPlugins();
     118        bool cancelled;
     119        installationManager.Update(pluginsToUpdate, out cancelled);
     120        if (!cancelled) pluginManager.DiscoverAndCheckPlugins();
     121      }
    121122    }
    122123
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/Util.cs

    r5445 r6413  
    6666    }
    6767
     68    // compares for two plugins with same major and minor version if plugin1 is newer than plugin2
     69    internal static bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {
     70      // newer: build version is higher, or if build version is the same revision is higher
     71      return plugin1.Version.Build > plugin2.Version.Build ||
     72        (plugin1.Version.Build == plugin2.Version.Build && plugin1.Version.Revision > plugin2.Version.Revision);
     73    }
    6874  }
    6975}
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj

    r6174 r6413  
    144144      <DependentUpon>ConnectionSetupView.cs</DependentUpon>
    145145    </Compile>
     146    <Compile Include="Advanced\PluginUpdaterForm.cs">
     147      <SubType>Form</SubType>
     148    </Compile>
     149    <Compile Include="Advanced\PluginUpdaterForm.Designer.cs">
     150      <DependentUpon>PluginUpdaterForm.cs</DependentUpon>
     151    </Compile>
    146152    <Compile Include="Advanced\DeploymentService\AdminServiceClientFactory.cs" />
    147153    <Compile Include="Advanced\DeploymentService\DeploymentServerCertificateValidator.cs" />
     
    259265    <Compile Include="Properties\AssemblyInfo.cs" />
    260266    <None Include="Advanced\DeploymentService\GenerateServiceClients.cmd" />
    261     <None Include="app.config" />
     267    <None Include="app.config">
     268      <SubType>Designer</SubType>
     269    </None>
    262270    <None Include="HeuristicLab.snk" />
    263271    <None Include="Properties\AssemblyInfo.frame" />
     
    308316    <None Include="Resources\HeuristicLabLogo.png" />
    309317    <None Include="Resources\HeuristicLabBanner.png" />
    310     <None Include="Resources\VS2008ImageLibrary_Actions_Delete.png" />
     318    <Content Include="Resources\UpdateAvailable.ico" />
    311319    <Content Include="Resources\VS2008ImageLibrary_Actions_PublishToWebHS.png" />
    312320    <Content Include="Resources\VS2008ImageLibrary_Actions_RepeatHS.png" />
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Resources.Designer.cs

    r4068 r6413  
    22// <auto-generated>
    33//     This code was generated by a tool.
    4 //     Runtime Version:4.0.30319.1
     4//     Runtime Version:4.0.30319.225
    55//
    66//     Changes to this file may cause incorrect behavior and will be lost if
     
    1010
    1111namespace HeuristicLab.PluginInfrastructure {
    12 
    13 
    14   /// <summary>
    15   ///   A strongly-typed resource class, for looking up localized strings, etc.
    16   /// </summary>
    17   // This class was auto-generated by the StronglyTypedResourceBuilder
    18   // class via a tool like ResGen or Visual Studio.
    19   // To add or remove a member, edit your .ResX file then rerun ResGen
    20   // with the /str option, or rebuild your VS project.
    21   [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    22   [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    23   [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    24   internal class Resources {
    25 
    26     private static global::System.Resources.ResourceManager resourceMan;
    27 
    28     private static global::System.Globalization.CultureInfo resourceCulture;
    29 
    30     [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
    31     internal Resources() {
     12    using System;
     13   
     14   
     15    /// <summary>
     16    ///   A strongly-typed resource class, for looking up localized strings, etc.
     17    /// </summary>
     18    // This class was auto-generated by the StronglyTypedResourceBuilder
     19    // class via a tool like ResGen or Visual Studio.
     20    // To add or remove a member, edit your .ResX file then rerun ResGen
     21    // with the /str option, or rebuild your VS project.
     22    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
     23    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     24    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     25    internal class Resources {
     26       
     27        private static global::System.Resources.ResourceManager resourceMan;
     28       
     29        private static global::System.Globalization.CultureInfo resourceCulture;
     30       
     31        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
     32        internal Resources() {
     33        }
     34       
     35        /// <summary>
     36        ///   Returns the cached ResourceManager instance used by this class.
     37        /// </summary>
     38        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
     39        internal static global::System.Resources.ResourceManager ResourceManager {
     40            get {
     41                if (object.ReferenceEquals(resourceMan, null)) {
     42                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeuristicLab.PluginInfrastructure.Resources", typeof(Resources).Assembly);
     43                    resourceMan = temp;
     44                }
     45                return resourceMan;
     46            }
     47        }
     48       
     49        /// <summary>
     50        ///   Overrides the current thread's CurrentUICulture property for all
     51        ///   resource lookups using this strongly typed resource class.
     52        /// </summary>
     53        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
     54        internal static global::System.Globalization.CultureInfo Culture {
     55            get {
     56                return resourceCulture;
     57            }
     58            set {
     59                resourceCulture = value;
     60            }
     61        }
     62       
     63        internal static System.Drawing.Bitmap Add {
     64            get {
     65                object obj = ResourceManager.GetObject("Add", resourceCulture);
     66                return ((System.Drawing.Bitmap)(obj));
     67            }
     68        }
     69       
     70        internal static System.Drawing.Bitmap ArrowUp {
     71            get {
     72                object obj = ResourceManager.GetObject("ArrowUp", resourceCulture);
     73                return ((System.Drawing.Bitmap)(obj));
     74            }
     75        }
     76       
     77        internal static System.Drawing.Bitmap Assembly {
     78            get {
     79                object obj = ResourceManager.GetObject("Assembly", resourceCulture);
     80                return ((System.Drawing.Bitmap)(obj));
     81            }
     82        }
     83       
     84        internal static System.Drawing.Bitmap Document {
     85            get {
     86                object obj = ResourceManager.GetObject("Document", resourceCulture);
     87                return ((System.Drawing.Bitmap)(obj));
     88            }
     89        }
     90       
     91        internal static System.Drawing.Bitmap Error {
     92            get {
     93                object obj = ResourceManager.GetObject("Error", resourceCulture);
     94                return ((System.Drawing.Bitmap)(obj));
     95            }
     96        }
     97       
     98        internal static System.Drawing.Icon ErrorIcon {
     99            get {
     100                object obj = ResourceManager.GetObject("ErrorIcon", resourceCulture);
     101                return ((System.Drawing.Icon)(obj));
     102            }
     103        }
     104       
     105        internal static System.Drawing.Bitmap File {
     106            get {
     107                object obj = ResourceManager.GetObject("File", resourceCulture);
     108                return ((System.Drawing.Bitmap)(obj));
     109            }
     110        }
     111       
     112        internal static System.Drawing.Icon HeuristicLab {
     113            get {
     114                object obj = ResourceManager.GetObject("HeuristicLab", resourceCulture);
     115                return ((System.Drawing.Icon)(obj));
     116            }
     117        }
     118       
     119        internal static System.Drawing.Bitmap HeuristicLabBanner {
     120            get {
     121                object obj = ResourceManager.GetObject("HeuristicLabBanner", resourceCulture);
     122                return ((System.Drawing.Bitmap)(obj));
     123            }
     124        }
     125       
     126        internal static System.Drawing.Bitmap HeuristicLabLogo {
     127            get {
     128                object obj = ResourceManager.GetObject("HeuristicLabLogo", resourceCulture);
     129                return ((System.Drawing.Bitmap)(obj));
     130            }
     131        }
     132       
     133        internal static System.Drawing.Bitmap Install {
     134            get {
     135                object obj = ResourceManager.GetObject("Install", resourceCulture);
     136                return ((System.Drawing.Bitmap)(obj));
     137            }
     138        }
     139       
     140        internal static System.Drawing.Bitmap Internet {
     141            get {
     142                object obj = ResourceManager.GetObject("Internet", resourceCulture);
     143                return ((System.Drawing.Bitmap)(obj));
     144            }
     145        }
     146       
     147        /// <summary>
     148        ///   Looks up a localized string similar to HeuristicLab is free software: you can redistribute it and/or modify
     149        ///it under the terms of the GNU General Public License as published by
     150        ///the Free Software Foundation, either version 3 of the License, or
     151        ///(at your option) any later version.
     152        ///
     153        ///HeuristicLab is distributed in the hope that it will be useful,
     154        ///but WITHOUT ANY WARRANTY; without even the implied warranty of
     155        ///MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     156        ///GNU General Public License for more details.
     157        ///
     158        ///You should have received a copy of t [rest of string was truncated]&quot;;.
     159        /// </summary>
     160        internal static string LicenseText {
     161            get {
     162                return ResourceManager.GetString("LicenseText", resourceCulture);
     163            }
     164        }
     165       
     166        internal static System.Drawing.Bitmap NetworkConnections {
     167            get {
     168                object obj = ResourceManager.GetObject("NetworkConnections", resourceCulture);
     169                return ((System.Drawing.Bitmap)(obj));
     170            }
     171        }
     172       
     173        internal static System.Drawing.Bitmap Plugin {
     174            get {
     175                object obj = ResourceManager.GetObject("Plugin", resourceCulture);
     176                return ((System.Drawing.Bitmap)(obj));
     177            }
     178        }
     179       
     180        internal static System.Drawing.Bitmap PublishToWeb {
     181            get {
     182                object obj = ResourceManager.GetObject("PublishToWeb", resourceCulture);
     183                return ((System.Drawing.Bitmap)(obj));
     184            }
     185        }
     186       
     187        internal static System.Drawing.Bitmap Remove {
     188            get {
     189                object obj = ResourceManager.GetObject("Remove", resourceCulture);
     190                return ((System.Drawing.Bitmap)(obj));
     191            }
     192        }
     193       
     194        internal static System.Drawing.Bitmap Repeat {
     195            get {
     196                object obj = ResourceManager.GetObject("Repeat", resourceCulture);
     197                return ((System.Drawing.Bitmap)(obj));
     198            }
     199        }
     200       
     201        internal static System.Drawing.Icon Setup_Install {
     202            get {
     203                object obj = ResourceManager.GetObject("Setup_Install", resourceCulture);
     204                return ((System.Drawing.Icon)(obj));
     205            }
     206        }
     207       
     208        internal static System.Drawing.Bitmap ShowDetails {
     209            get {
     210                object obj = ResourceManager.GetObject("ShowDetails", resourceCulture);
     211                return ((System.Drawing.Bitmap)(obj));
     212            }
     213        }
     214       
     215        internal static System.Drawing.Bitmap ShowIcons {
     216            get {
     217                object obj = ResourceManager.GetObject("ShowIcons", resourceCulture);
     218                return ((System.Drawing.Bitmap)(obj));
     219            }
     220        }
     221       
     222        internal static System.Drawing.Icon UpdateAvailable {
     223            get {
     224                object obj = ResourceManager.GetObject("UpdateAvailable", resourceCulture);
     225                return ((System.Drawing.Icon)(obj));
     226            }
     227        }
    32228    }
    33 
    34     /// <summary>
    35     ///   Returns the cached ResourceManager instance used by this class.
    36     /// </summary>
    37     [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
    38     internal static global::System.Resources.ResourceManager ResourceManager {
    39       get {
    40         if (object.ReferenceEquals(resourceMan, null)) {
    41           global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeuristicLab.PluginInfrastructure.Resources", typeof(Resources).Assembly);
    42           resourceMan = temp;
    43         }
    44         return resourceMan;
    45       }
    46     }
    47 
    48     /// <summary>
    49     ///   Overrides the current thread's CurrentUICulture property for all
    50     ///   resource lookups using this strongly typed resource class.
    51     /// </summary>
    52     [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
    53     internal static global::System.Globalization.CultureInfo Culture {
    54       get {
    55         return resourceCulture;
    56       }
    57       set {
    58         resourceCulture = value;
    59       }
    60     }
    61 
    62     internal static System.Drawing.Bitmap Add {
    63       get {
    64         object obj = ResourceManager.GetObject("Add", resourceCulture);
    65         return ((System.Drawing.Bitmap)(obj));
    66       }
    67     }
    68 
    69     internal static System.Drawing.Bitmap ArrowUp {
    70       get {
    71         object obj = ResourceManager.GetObject("ArrowUp", resourceCulture);
    72         return ((System.Drawing.Bitmap)(obj));
    73       }
    74     }
    75 
    76     internal static System.Drawing.Bitmap Assembly {
    77       get {
    78         object obj = ResourceManager.GetObject("Assembly", resourceCulture);
    79         return ((System.Drawing.Bitmap)(obj));
    80       }
    81     }
    82 
    83     internal static System.Drawing.Bitmap Document {
    84       get {
    85         object obj = ResourceManager.GetObject("Document", resourceCulture);
    86         return ((System.Drawing.Bitmap)(obj));
    87       }
    88     }
    89 
    90     internal static System.Drawing.Bitmap Error {
    91       get {
    92         object obj = ResourceManager.GetObject("Error", resourceCulture);
    93         return ((System.Drawing.Bitmap)(obj));
    94       }
    95     }
    96 
    97     internal static System.Drawing.Icon ErrorIcon {
    98       get {
    99         object obj = ResourceManager.GetObject("ErrorIcon", resourceCulture);
    100         return ((System.Drawing.Icon)(obj));
    101       }
    102     }
    103 
    104     internal static System.Drawing.Bitmap File {
    105       get {
    106         object obj = ResourceManager.GetObject("File", resourceCulture);
    107         return ((System.Drawing.Bitmap)(obj));
    108       }
    109     }
    110 
    111     internal static System.Drawing.Icon HeuristicLab {
    112       get {
    113         object obj = ResourceManager.GetObject("HeuristicLab", resourceCulture);
    114         return ((System.Drawing.Icon)(obj));
    115       }
    116     }
    117 
    118     internal static System.Drawing.Bitmap HeuristicLabBanner {
    119       get {
    120         object obj = ResourceManager.GetObject("HeuristicLabBanner", resourceCulture);
    121         return ((System.Drawing.Bitmap)(obj));
    122       }
    123     }
    124 
    125     internal static System.Drawing.Bitmap HeuristicLabLogo {
    126       get {
    127         object obj = ResourceManager.GetObject("HeuristicLabLogo", resourceCulture);
    128         return ((System.Drawing.Bitmap)(obj));
    129       }
    130     }
    131 
    132     internal static System.Drawing.Bitmap Install {
    133       get {
    134         object obj = ResourceManager.GetObject("Install", resourceCulture);
    135         return ((System.Drawing.Bitmap)(obj));
    136       }
    137     }
    138 
    139     internal static System.Drawing.Bitmap Internet {
    140       get {
    141         object obj = ResourceManager.GetObject("Internet", resourceCulture);
    142         return ((System.Drawing.Bitmap)(obj));
    143       }
    144     }
    145 
    146     /// <summary>
    147     ///   Looks up a localized string similar to HeuristicLab is free software: you can redistribute it and/or modify
    148     ///it under the terms of the GNU General Public License as published by
    149     ///the Free Software Foundation, either version 3 of the License, or
    150     ///(at your option) any later version.
    151     ///
    152     ///HeuristicLab is distributed in the hope that it will be useful,
    153     ///but WITHOUT ANY WARRANTY; without even the implied warranty of
    154     ///MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    155     ///GNU General Public License for more details.
    156     ///
    157     ///You should have received a copy of t [rest of string was truncated]&quot;;.
    158     /// </summary>
    159     internal static string LicenseText {
    160       get {
    161         return ResourceManager.GetString("LicenseText", resourceCulture);
    162       }
    163     }
    164 
    165     internal static System.Drawing.Bitmap NetworkConnections {
    166       get {
    167         object obj = ResourceManager.GetObject("NetworkConnections", resourceCulture);
    168         return ((System.Drawing.Bitmap)(obj));
    169       }
    170     }
    171 
    172     internal static System.Drawing.Bitmap Plugin {
    173       get {
    174         object obj = ResourceManager.GetObject("Plugin", resourceCulture);
    175         return ((System.Drawing.Bitmap)(obj));
    176       }
    177     }
    178 
    179     internal static System.Drawing.Bitmap PublishToWeb {
    180       get {
    181         object obj = ResourceManager.GetObject("PublishToWeb", resourceCulture);
    182         return ((System.Drawing.Bitmap)(obj));
    183       }
    184     }
    185 
    186     internal static System.Drawing.Bitmap Remove {
    187       get {
    188         object obj = ResourceManager.GetObject("Remove", resourceCulture);
    189         return ((System.Drawing.Bitmap)(obj));
    190       }
    191     }
    192 
    193     internal static System.Drawing.Bitmap Repeat {
    194       get {
    195         object obj = ResourceManager.GetObject("Repeat", resourceCulture);
    196         return ((System.Drawing.Bitmap)(obj));
    197       }
    198     }
    199 
    200     internal static System.Drawing.Icon Setup_Install {
    201       get {
    202         object obj = ResourceManager.GetObject("Setup_Install", resourceCulture);
    203         return ((System.Drawing.Icon)(obj));
    204       }
    205     }
    206 
    207     internal static System.Drawing.Bitmap ShowDetails {
    208       get {
    209         object obj = ResourceManager.GetObject("ShowDetails", resourceCulture);
    210         return ((System.Drawing.Bitmap)(obj));
    211       }
    212     }
    213 
    214     internal static System.Drawing.Bitmap ShowIcons {
    215       get {
    216         object obj = ResourceManager.GetObject("ShowIcons", resourceCulture);
    217         return ((System.Drawing.Bitmap)(obj));
    218       }
    219     }
    220   }
    221229}
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Resources.resx

    r3831 r6413  
    113113  </resheader>
    114114  <resheader name="reader">
    115     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     115    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    116116  </resheader>
    117117  <resheader name="writer">
    118     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120   <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     120  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    121121  <data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
    122122    <value>Resources\VS2008ImageLibrary_CommonElements_Actions_Add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     
    194194    <value>Resources\show_icons.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    195195  </data>
     196  <data name="UpdateAvailable" type="System.Resources.ResXFileRef, System.Windows.Forms">
     197    <value>resources\updateavailable.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     198  </data>
    196199</root>
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.cs

    r5445 r6413  
    2929using HeuristicLab.PluginInfrastructure.Advanced;
    3030using HeuristicLab.PluginInfrastructure.Manager;
     31using System.Threading.Tasks;
    3132
    3233namespace HeuristicLab.PluginInfrastructure.Starter {
     
    3637  /// </summary>
    3738  public partial class StarterForm : Form {
     39    private const string pluginManagerItemName = "Plugin Manager";
     40    private const string updatePluginsItemName = "Updates Available";
     41
    3842
    3943    private ListViewItem pluginManagerListViewItem;
     
    4145    private PluginManager pluginManager;
    4246    private SplashScreen splashScreen;
     47    private bool updatesAvailable = false;
    4348
    4449    /// <summary>
     
    5055      InitializeComponent();
    5156      largeImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.HeuristicLab.ToBitmap());
     57      largeImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.UpdateAvailable.ToBitmap());
    5258      smallImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.HeuristicLab.ToBitmap());
     59      smallImageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.UpdateAvailable.ToBitmap());
    5360      FileVersionInfo pluginInfrastructureVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location);
    5461      Text = "HeuristicLab " + pluginInfrastructureVersion.FileVersion;
     
    6168      pluginManager.DiscoverAndCheckPlugins();
    6269      UpdateApplicationsList();
     70
     71      CheckUpdatesAvailableAsync(pluginPath);
     72    }
     73
     74    private void CheckUpdatesAvailableAsync(string pluginPath) {
     75      var task = Task.Factory.StartNew<bool>(() => {
     76        var installationManager = new InstallationManager(pluginPath);
     77        IEnumerable<IPluginDescription> installedPlugins = pluginManager.Plugins.OfType<IPluginDescription>();
     78        var remotePlugins = installationManager.GetRemotePluginList();
     79        // if there is a local plugin with same name and same major and minor version then it's an update
     80        var pluginsToUpdate = from remotePlugin in remotePlugins
     81                              let matchingLocalPlugins = from installedPlugin in installedPlugins
     82                                                         where installedPlugin.Name == remotePlugin.Name
     83                                                         where installedPlugin.Version.Major == remotePlugin.Version.Major
     84                                                         where installedPlugin.Version.Minor == remotePlugin.Version.Minor
     85                                                         where Util.IsNewerThan(remotePlugin, installedPlugin)
     86                                                         select installedPlugin
     87                              where matchingLocalPlugins.Count() > 0
     88                              select remotePlugin;
     89        return pluginsToUpdate.Count() > 0;
     90      });
     91      task.ContinueWith(t => {
     92        updatesAvailable = t.Result;
     93        UpdateApplicationsList();
     94      }, TaskContinuationOptions.NotOnFaulted);
    6395    }
    6496
     
    85117      if (applicationsListView.SelectedItems.Count > 0) {
    86118        ListViewItem selected = applicationsListView.SelectedItems[0];
    87         if (selected == pluginManagerListViewItem) {
     119        if (selected.Text == pluginManagerItemName) {
    88120          if (pluginManager.Plugins.Any(x => x.PluginState == PluginState.Loaded)) {
    89121            MessageBox.Show("Installation Manager cannot be started while another HeuristicLab application is active." + Environment.NewLine +
     
    102134            }
    103135          }
     136        } else if (selected.Text == updatePluginsItemName) {
     137          if (pluginManager.Plugins.Any(x => x.PluginState == PluginState.Loaded)) {
     138            MessageBox.Show("Updating is not possible while another HeuristicLab application is active." + Environment.NewLine +
     139              "Please stop all active HeuristicLab applications and try again.", "Update plugins",
     140              MessageBoxButtons.OK, MessageBoxIcon.Information);
     141          } else {
     142            try {
     143              Cursor = Cursors.AppStarting;
     144              using (PluginUpdaterForm form = new PluginUpdaterForm(pluginManager)) {
     145                form.ShowDialog(this);
     146              }
     147              UpdateApplicationsList();
     148            }
     149            finally {
     150              Cursor = Cursors.Arrow;
     151            }
     152          }
    104153        } else {
    105154          ApplicationDescription app = (ApplicationDescription)applicationsListView.SelectedItems[0].Tag;
     
    110159
    111160    private void UpdateApplicationsList() {
    112       applicationsListView.Items.Clear();
    113       FileVersionInfo pluginInfrastructureVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location);
    114       pluginManagerListViewItem = new ListViewItem("Plugin Manager", 0);
    115       pluginManagerListViewItem.Group = applicationsListView.Groups["Plugin Management"];
    116       pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, pluginInfrastructureVersion.FileVersion));
    117       pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, "Install, upgrade or delete plugins"));
    118       pluginManagerListViewItem.ToolTipText = "Install, upgrade or delete plugins";
    119 
    120       applicationsListView.Items.Add(pluginManagerListViewItem);
    121 
    122       foreach (ApplicationDescription info in pluginManager.Applications) {
    123         ListViewItem item = new ListViewItem(info.Name, 0);
    124         item.Tag = info;
    125         item.Group = applicationsListView.Groups["Applications"];
    126         item.SubItems.Add(new ListViewItem.ListViewSubItem(item, info.Version.ToString()));
    127         item.SubItems.Add(new ListViewItem.ListViewSubItem(item, info.Description));
    128         item.ToolTipText = info.Description;
    129         applicationsListView.Items.Add(item);
    130       }
    131       foreach (ColumnHeader column in applicationsListView.Columns) {
    132         if (applicationsListView.Items.Count > 0)
    133           column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    134         else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     161      if (InvokeRequired) Invoke((Action)UpdateApplicationsList);
     162      else {
     163        applicationsListView.Items.Clear();
     164        AddPluginManagerItem();
     165        AddUpdatePluginsItem();
     166
     167        foreach (ApplicationDescription info in pluginManager.Applications) {
     168          ListViewItem item = new ListViewItem(info.Name, 0);
     169          item.Tag = info;
     170          item.Group = applicationsListView.Groups["Applications"];
     171          item.SubItems.Add(new ListViewItem.ListViewSubItem(item, info.Version.ToString()));
     172          item.SubItems.Add(new ListViewItem.ListViewSubItem(item, info.Description));
     173          item.ToolTipText = info.Description;
     174          applicationsListView.Items.Add(item);
     175        }
     176        foreach (ColumnHeader column in applicationsListView.Columns) {
     177          if (applicationsListView.Items.Count > 0)
     178            column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     179          else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     180        }
     181      }
     182    }
     183
     184    private void AddPluginManagerItem() {
     185      if (HeuristicLab.PluginInfrastructure.Properties.Settings.Default.ShowPluginUploadControls) {
     186        FileVersionInfo pluginInfrastructureVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location);
     187        pluginManagerListViewItem = new ListViewItem(pluginManagerItemName, 0);
     188        pluginManagerListViewItem.Group = applicationsListView.Groups["Plugin Management"];
     189        pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, pluginInfrastructureVersion.FileVersion));
     190        pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, "Install, upgrade or delete plugins"));
     191        pluginManagerListViewItem.ToolTipText = "Install, upgrade or delete plugins";
     192
     193        applicationsListView.Items.Add(pluginManagerListViewItem);
     194      }
     195    }
     196
     197    private void AddUpdatePluginsItem() {
     198      if (updatesAvailable) {
     199        var updateListViewItem = new ListViewItem(updatePluginsItemName, 1);
     200        updateListViewItem.Group = applicationsListView.Groups["Plugin Management"];
     201        updateListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(updateListViewItem, ""));
     202        updateListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(updateListViewItem, "Download and install updates"));
     203        updateListViewItem.ToolTipText = "Download and install updates";
     204
     205        applicationsListView.Items.Add(updateListViewItem);
    135206      }
    136207    }
Note: See TracChangeset for help on using the changeset viewer.