Пример #1
0
        public static void RegisterForUpdate(Update update)
        {
            if (update == null) throw new ArgumentNullException("update");
            if (!IsUpdateSupported()) throw new NotSupportedException();

            UnmanagedStructHandle<UPDATE> updateHandle = UnmanagedStructHandle<UPDATE>.Empty;

            try
            {
                UPDATE updateNative;
                update.MarshalToNative(out updateNative);

                updateHandle = new UnmanagedStructHandle<UPDATE>(ref updateNative);
                int result = MirandaContext.Current.CallService(MS_UPDATE_REGISTER, UIntPtr.Zero, updateHandle.IntPtr);

                if (result != 0)
                    throw new MirandaException(String.Format(TextResources.ExceptionMsg_Formatable2_MirandaServiceReturnedFailure, MS_UPDATE_REGISTER, result.ToString()));
            }
            catch (MirandaException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new MirandaException(TextResources.ExceptionMsg_ErrorWhileCallingMirandaService, e);
            }
            finally
            {
                updateHandle.Free();
            }
        }
Пример #2
0
 /// <summary>
 /// Registers Hyphen for updates via Updater.
 /// </summary>
 private static void InitializeUpdater()
 {
     if (UpdaterPlugin.IsUpdateSupported())
     {
         Update update = new Update(MirandaPlugin.Hyphen.Singleton, HyphenUpdateUrl, HyphenVersionUrl, " ");
         UpdaterPlugin.RegisterForUpdate(update);
     }
 }
Пример #3
0
        private void RegisterForUpdates(object sender, EventArgs e)
        {
            Context.ModulesLoaded -= RegisterForUpdates;

            if (!UpdaterPlugin.IsUpdateSupported())
                return;

            Update update = new Update(this, UpdateUrl, VersionUrl, " ");
            UpdaterPlugin.RegisterForUpdate(update);
        }