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(); } }
/// <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); } }
private void RegisterForUpdates(object sender, EventArgs e) { Context.ModulesLoaded -= RegisterForUpdates; if (!UpdaterPlugin.IsUpdateSupported()) return; Update update = new Update(this, UpdateUrl, VersionUrl, " "); UpdaterPlugin.RegisterForUpdate(update); }