/// <summary> /// Constructor /// </summary> /// <param name="items">List of updates to show</param> /// <param name="applicationIcon">The icon</param> /// <param name="separatorTemplate">HTML template for every single note. Use {0} = Version. {1} = Date. {2} = Note Body</param> /// <param name="headAddition">Additional text they will inserted into HTML Head. For Stylesheets.</param> public NetSparkleForm(Sparkle sparkle, NetSparkleAppCastItem[] items, Icon applicationIcon = null, string separatorTemplate = "", string headAddition = "") { _sparkle = sparkle; _updates = items; SeparatorTemplate = !string.IsNullOrEmpty(separatorTemplate) ? separatorTemplate : "<div style=\"border: #ccc 1px solid;\"><div style=\"background: {3}; padding: 5px;\"><span style=\"float: right; display:float;\">{1}</span>{0}</div><div style=\"padding: 5px;\">{2}</div></div><br>"; InitializeComponent(); // init ui try { NetSparkleBrowser.AllowWebBrowserDrop = false; NetSparkleBrowser.AllowNavigation = false; } catch (Exception ex) { Debug.WriteLine("Error in browser init: " + ex.Message); } NetSparkleAppCastItem item = items[0]; lblHeader.Text = lblHeader.Text.Replace("APP", item.AppName); lblInfoText.Text = lblInfoText.Text.Replace("APP", item.AppName + " " + item.Version); lblInfoText.Text = lblInfoText.Text.Replace("OLDVERSION", getVersion(new Version(item.AppVersionInstalled))); if (items.Length == 0) { RemoveReleaseNotesControls(); } else { NetSparkleAppCastItem latestVersion = _updates.OrderByDescending(p => p.Version).FirstOrDefault(); StringBuilder sb = new StringBuilder("<html><head><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'>" + headAddition + "</head><body>"); foreach (NetSparkleAppCastItem castItem in items) { sb.Append(string.Format(SeparatorTemplate, castItem.Version, castItem.PublicationDate.ToString("dd MMM yyyy"), GetReleaseNotes(castItem), latestVersion.Version.Equals(castItem.Version) ? "#ABFF82" : "#AFD7FF")); } sb.Append("</body>"); string releaseNotes = sb.ToString(); NetSparkleBrowser.DocumentText = releaseNotes; } if (applicationIcon != null) { imgAppIcon.Image = new Icon(applicationIcon, new Size(48, 48)).ToBitmap(); Icon = applicationIcon; } TopMost = false; }
public InstanceManager() { InitializeComponent(); if (GlobalPreferences.IsFirstRun) { trayIcon.ShowBalloonTip(2000, Resources.OotdRunning, Resources.RightClickToConfigure, ToolTipIcon.Info); Logger.Debug("First Run"); } _graphics = CreateGraphics(); // setup update checker. if (UnsafeNativeMethods.Is64Bit()) { _sparkle = new Sparkle("http://www.outlookonthedesktop.com/ootdAppcastx64.xml", Resources.AppIcon); } else { _sparkle = new Sparkle("http://www.outlookonthedesktop.com/ootdAppcastx86.xml", Resources.AppIcon); } _sparkle.UpdateDetected += OnSparkleOnUpdateDetectedShowWithToast; _sparkle.UpdateWindowDismissed += OnSparkleOnUpdateWindowDismissed; // check for updates every 20 days, but don't check on first run because we'll have 2 tooltips popup and will likely confuse the user. _sparkle.StartLoop(!GlobalPreferences.IsFirstRun, TimeSpan.FromDays(20)); }
public Form1() { InitializeComponent(); var appcastUrl = "file://" + DirectoryOfTheApplicationExecutable + "../../../Extras/Sample Appcast.xml"; _sparkleUpdateDetector = new Sparkle(appcastUrl, SystemIcons.Application); _sparkleUpdateDetector.CheckOnFirstApplicationIdle(); }
/// <summary> /// Constructor /// </summary> /// <param name="castUrl">the URL of the appcast file</param> /// <param name="config">the current configuration</param> public NetSparkleAppCast(string castUrl, Sparkle sparkle, NetSparkleConfiguration config) { _sparkle = sparkle; _config = config; _castUrl = castUrl; _items = new List<NetSparkleAppCastItem>(); }
public Form1() { InitializeComponent(); var appcastUrl = "https://deadpikle.github.io/NetSparkle/files/sample-app/appcast.xml"; _sparkleUpdateDetector = new Sparkle(appcastUrl, SystemIcons.Application); _sparkleUpdateDetector.CheckOnFirstApplicationIdle(); }
/// <summary> /// Constructor /// </summary> /// <param name="castUrl">the URL of the appcast file</param> /// <param name="sparkle">The <see cref="Sparkle"/> instance to use</param> /// <param name="config">the current configuration</param> public AppCast(string castUrl, Sparkle sparkle, Configuration config) { _sparkle = sparkle; _config = config; _castUrl = castUrl; _items = new List <AppCastItem>(); }
/// <summary> /// Start doing whatever is needed for the supported type of action. /// </summary> public void StartWorking(Dictionary<string, string> commandLineArgs) { #if !MONO using (var sparkle = new Sparkle(@"http://downloads.palaso.org/FlexBridge/Alpha/appcast.xml", CommonResources.chorus32x32)) { sparkle.DoLaunchAfterUpdate = false; sparkle.CheckForUpdatesAtUserRequest(); } #endif }
public Form1() { InitializeComponent(); _sparkle = new Sparkle("https://deadpikle.github.io/NetSparkle/files/sample-app/appcast.xml", SystemIcons.Application) { TrustEverySSLConnection = true, }; _sparkle.UpdateDetected += new UpdateDetected(_sparkle_updateDetected); //_sparkle.EnableSilentMode = true; //_sparkle.HideReleaseNotes = true; _sparkle.StartLoop(true); }
public Shell(Func<WorkspaceView> projectViewFactory, CollectionSettings collectionSettings, LibraryClosing libraryClosingEvent, QueueRenameOfCollection queueRenameOfCollection, Sparkle _sparkle) { queueRenameOfCollection.Subscribe(newName => _nameToChangeCollectionUponClosing = newName.Trim().SanitizeFilename('-')); _collectionSettings = collectionSettings; _libraryClosingEvent = libraryClosingEvent; InitializeComponent(); #if DEBUG WindowState = FormWindowState.Normal; //this.FormBorderStyle = FormBorderStyle.None; //fullscreen Size = new Size(1024,720); #endif _workspaceView = projectViewFactory(); _workspaceView.CloseCurrentProject += ((x, y) => { UserWantsToOpenADifferentProject = true; Close(); }); _sparkle.AboutToExitForInstallerRun += ((x, cancellable) => { cancellable.Cancel = false; QuitForVersionUpdate = true; Close(); }); _workspaceView.ReopenCurrentProject += ((x, y) => { UserWantsToOpeReopenProject = true; Close(); }); SystemEvents.SessionEnding += ((x,y)=> { QuitForSystemShutdown=true; Close(); }); _workspaceView.BackColor = System.Drawing.Color.FromArgb(64,64,64); _workspaceView.Dock = System.Windows.Forms.DockStyle.Fill; this.Controls.Add(this._workspaceView); SetWindowText(); }
public Form1() { InitializeComponent(); _sparkle = new Sparkle("file://" + DirectoryOfTheApplicationExecutable + "../../../../Extras/Sample Appcast.xml", SystemIcons.Application) //_sparkle = new Sparkle("https://update.applimit.com/netsparkle/versioninfo.xml") { TrustEverySSLConnection = true, //EnableSystemProfiling = true, //SystemProfileUrl = new Uri("http://update.applimit.com/netsparkle/stat/profileInfo.php") }; //_sparkle.UpdateDetected += new UpdateDetected(_sparkle_updateDetected); //_sparkle.EnableSilentMode = true; //_sparkle.HideReleaseNotes = true; _sparkle.StartLoop(true); }
public NetSparkleCheckerWaitUI(Icon icon) { // init ui InitializeComponent(); // get cmdline args String[] args = Environment.GetCommandLineArgs(); // init sparkle _sparkle = new Sparkle(args[2], icon, args[1]); // set labels lblRefFileName.Text = args[1]; lblRefUrl.Text = args[2]; imgAppIcon.Image = icon.ToBitmap(); Icon = icon; bckWorker.RunWorkerAsync(); }
/// <summary> /// Create sparkle form implementation /// </summary> /// <param name="updates">Sorted array of updates from latest to previous</param> /// <param name="applicationIcon">Icon</param> /// <returns></returns> public virtual INetSparkleForm CreateSparkleForm(Sparkle sparkle, NetSparkleAppCastItem[] updates, Icon applicationIcon) { return new NetSparkleForm(sparkle, updates, applicationIcon); }
/// <summary> /// Form constructor /// </summary> /// <param name="sparkle">The <see cref="Sparkle"/> instance to use</param> /// <param name="items">List of updates to show</param> /// <param name="applicationIcon">The icon to display</param> /// <param name="isUpdateAlreadyDownloaded">If true, make sure UI text shows that the user is about to install the file instead of download it.</param> /// <param name="separatorTemplate">HTML template for every single note. Use {0} = Version. {1} = Date. {2} = Note Body</param> /// <param name="headAddition">Additional text they will inserted into HTML Head. For Stylesheets.</param> public UpdateAvailableWindow(Sparkle sparkle, AppCastItem[] items, Icon applicationIcon = null, bool isUpdateAlreadyDownloaded = false, string separatorTemplate = "", string headAddition = "") { _sparkle = sparkle; _updates = items; SeparatorTemplate = !string.IsNullOrEmpty(separatorTemplate) ? separatorTemplate : "<div style=\"border: #ccc 1px solid;\"><div style=\"background: {3}; padding: 5px;\"><span style=\"float: right; display:float;\">" + "{1}</span>{0}</div><div style=\"padding: 5px;\">{2}</div></div><br>"; InitializeComponent(); // init ui try { ReleaseNotesBrowser.AllowWebBrowserDrop = false; ReleaseNotesBrowser.AllowNavigation = false; } catch (Exception ex) { _sparkle.LogWriter.PrintMessage("Error in browser init: {0}", ex.Message); } AppCastItem item = items[0]; lblHeader.Text = lblHeader.Text.Replace("APP", item.AppName); lblInfoText.Text = lblInfoText.Text.Replace("APP", item.AppName + " " + item.Version); lblInfoText.Text = lblInfoText.Text.Replace("OLDVERSION", getVersion(new Version(item.AppVersionInstalled))); lblInfoText.Text = lblInfoText.Text.Replace("[DOWNLOAD]", isUpdateAlreadyDownloaded ? "install" : "download"); if (items.Length == 0) { RemoveReleaseNotesControls(); } else { AppCastItem latestVersion = _updates.OrderByDescending(p => p.Version).FirstOrDefault(); StringBuilder sb = new StringBuilder("<html><head><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'>" + headAddition + "</head><body>"); bool isUserMissingCriticalUpdate = false; foreach (AppCastItem castItem in items) { isUserMissingCriticalUpdate = isUserMissingCriticalUpdate | castItem.IsCriticalUpdate; sb.Append(string.Format(SeparatorTemplate, castItem.Version, castItem.PublicationDate.ToString("dd MMM yyyy"), GetReleaseNotes(castItem), latestVersion.Version.Equals(castItem.Version) ? "#ABFF82" : "#AFD7FF")); } sb.Append("</body>"); string releaseNotes = sb.ToString(); ReleaseNotesBrowser.DocumentText = releaseNotes; buttonRemind.Enabled = isUserMissingCriticalUpdate == false; skipButton.Enabled = isUserMissingCriticalUpdate == false; //if (isUserMissingCriticalUpdate) //{ // FormClosing += UpdateAvailableWindow_FormClosing; // no closing a critical update! //} } if (applicationIcon != null) { imgAppIcon.Image = new Icon(applicationIcon, new Size(48, 48)).ToBitmap(); Icon = applicationIcon; } EnsureDialogShown(); }
/// <summary> /// Create sparkle form implementation /// </summary> /// <param name="updates">Sorted array of updates from latest to previous</param> /// <param name="applicationIcon">Icon</param> /// <returns></returns> public virtual INetSparkleForm CreateSparkleForm(Sparkle sparkle, NetSparkleAppCastItem[] updates, Icon applicationIcon) { return(new NetSparkleForm(sparkle, updates, applicationIcon)); }
/// <summary> /// Create sparkle form implementation /// </summary> /// <param name="sparkle">The <see cref="Sparkle"/> instance to use</param> /// <param name="updates">Sorted array of updates from latest to earliest</param> /// <param name="applicationIcon">The icon to display</param> /// <param name="isUpdateAlreadyDownloaded">If true, make sure UI text shows that the user is about to install the file instead of download it.</param> public virtual IUpdateAvailable CreateSparkleForm(Sparkle sparkle, AppCastItem[] updates, Icon applicationIcon, bool isUpdateAlreadyDownloaded = false) { return(new UpdateAvailableWindow(sparkle, updates, applicationIcon, isUpdateAlreadyDownloaded)); }
//autofac uses this public WorkspaceView(WorkspaceModel model, Control libraryView, EditingView.Factory editingViewFactory, PublishView.Factory pdfViewFactory, CollectionSettingsDialog.Factory settingsDialogFactory, EditBookCommand editBookCommand, SendReceiveCommand sendReceiveCommand, SelectedTabAboutToChangeEvent selectedTabAboutToChangeEvent, SelectedTabChangedEvent selectedTabChangedEvent, FeedbackDialog.Factory feedbackDialogFactory, ChorusSystem chorusSystem, Sparkle sparkleApplicationUpdater, LocalizationManager localizationManager ) { _model = model; _settingsDialogFactory = settingsDialogFactory; _selectedTabAboutToChangeEvent = selectedTabAboutToChangeEvent; _selectedTabChangedEvent = selectedTabChangedEvent; _feedbackDialogFactory = feedbackDialogFactory; _chorusSystem = chorusSystem; _sparkleApplicationUpdater = sparkleApplicationUpdater; _localizationManager = localizationManager; _model.UpdateDisplay += new System.EventHandler(OnUpdateDisplay); InitializeComponent(); #if !DEBUG _sparkleApplicationUpdater.CheckOnFirstApplicationIdle(); #endif _toolStrip.Renderer = new NoBorderToolStripRenderer(); //we have a number of buttons which don't make sense for the remote (therefore vulnerable) low-end user //_settingsLauncherHelper.CustomSettingsControl = _toolStrip; _settingsLauncherHelper.ManageComponent(_settingsButton); //NB: the rest of these aren't really settings, but we're using that feature to simplify this menu down to what makes sense for the easily-confused user _settingsLauncherHelper.ManageComponent(_openCreateCollectionButton); _settingsLauncherHelper.ManageComponent(deepBloomPaperToolStripMenuItem); _settingsLauncherHelper.ManageComponent(_makeASuggestionMenuItem); _settingsLauncherHelper.ManageComponent(_webSiteMenuItem); _settingsLauncherHelper.ManageComponent(_showLogMenuItem); _settingsLauncherHelper.ManageComponent(_releaseNotesMenuItem); _settingsLauncherHelper.ManageComponent(_divider2); _settingsLauncherHelper.ManageComponent(_divider3); _settingsLauncherHelper.ManageComponent(_divider4); OnSettingsProtectionChanged(this, null);//initial setup SettingsProtectionSettings.Default.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OnSettingsProtectionChanged); _uiLanguageMenu.Visible = true; _settingsLauncherHelper.ManageComponent(_uiLanguageMenu); editBookCommand.Subscribe(OnEditBook); sendReceiveCommand.Subscribe(OnSendReceive); //Cursor = Cursors.AppStarting; Application.Idle += new EventHandler(Application_Idle); Text = _model.ProjectName; //SetupTabIcons(); // // _collectionView // this._collectionView = (LibraryView) libraryView; this._collectionView.Dock = System.Windows.Forms.DockStyle.Fill; // // _editingView // this._editingView = editingViewFactory(); this._editingView.Dock = System.Windows.Forms.DockStyle.Fill; // // _pdfView // this._publishView = pdfViewFactory(); this._publishView.Dock = System.Windows.Forms.DockStyle.Fill; _collectionTab.Tag = _collectionView; _publishTab.Tag = _publishView; _editTab.Tag = _editingView; this._collectionTab.Text = _collectionView.CollectionTabLabel; SetTabVisibility(_publishTab, false); SetTabVisibility(_editTab, false); // if (Program.StartUpWithFirstOrNewVersionBehavior) // { // _tabStrip.SelectedTab = _infoTab; // SelectPage(_infoView); // } // else // { _tabStrip.SelectedTab = _collectionTab; SelectPage(_collectionView); // } SetupUILanguageMenu(); }
/// <summary> /// Form constructor for showing release notes. /// </summary> /// <param name="sparkle">The <see cref="Sparkle"/> instance to use</param> /// <param name="items">List of updates to show. Should contain at least one item.</param> /// <param name="applicationIcon">The icon to display</param> /// <param name="isUpdateAlreadyDownloaded">If true, make sure UI text shows that the user is about to install the file instead of download it.</param> /// <param name="separatorTemplate">HTML template for every single note. Use {0} = Version. {1} = Date. {2} = Note Body</param> /// <param name="headAddition">Additional text they will inserted into HTML Head. For Stylesheets.</param> public UpdateAvailableWindow(Sparkle sparkle, AppCastItem[] items, Icon applicationIcon = null, bool isUpdateAlreadyDownloaded = false, string separatorTemplate = "", string headAddition = "") { _sparkle = sparkle; _updates = items; _separatorTemplate = !string.IsNullOrEmpty(separatorTemplate) ? separatorTemplate : "<div style=\"border: #ccc 1px solid;\"><div style=\"background: {3}; padding: 5px;\"><span style=\"float: right; display:float;\">" + "{1}</span>{0}</div><div style=\"padding: 5px;\">{2}</div></div><br>"; InitializeComponent(); // init ui try { ReleaseNotesBrowser.AllowWebBrowserDrop = false; ReleaseNotesBrowser.AllowNavigation = false; } catch (Exception ex) { _sparkle.LogWriter.PrintMessage("Error in browser init: {0}", ex.Message); } AppCastItem item = items.FirstOrDefault(); lblHeader.Text = lblHeader.Text.Replace("APP", item != null ? item.AppName : "the application"); if (item != null) { lblInfoText.Text = lblInfoText.Text.Replace("APP", item.AppName + " " + item.Version); var versionString = ""; try { // Use try/catch since Version constructor can throw an exception and we don't want to // die just because the user has a malformed version string Version versionObj = new Version(item.AppVersionInstalled); versionString = Utilities.GetVersionString(versionObj); } catch { versionString = ""; } lblInfoText.Text = lblInfoText.Text.Replace("OLDVERSION", versionString); } else { // TODO: string translations (even though I guess this window should never be called with 0 app cast items...) lblInfoText.Text = "Would you like to [DOWNLOAD] it now?"; } lblInfoText.Text = lblInfoText.Text.Replace("[DOWNLOAD]", isUpdateAlreadyDownloaded ? "install" : "download"); AppCastItem latestVersion = items.OrderByDescending(p => p.Version).FirstOrDefault(); string initialHTML = "<html><head><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'>" + headAddition + "</head><body>"; ReleaseNotesBrowser.DocumentText = initialHTML + "<p><em>Loading release notes...</em></p></body></html>"; bool isUserMissingCriticalUpdate = false; foreach (AppCastItem castItem in items) { isUserMissingCriticalUpdate = isUserMissingCriticalUpdate | castItem.IsCriticalUpdate; } buttonRemind.Enabled = isUserMissingCriticalUpdate == false; skipButton.Enabled = isUserMissingCriticalUpdate == false; //if (isUserMissingCriticalUpdate) //{ // FormClosing += UpdateAvailableWindow_FormClosing; // no closing a critical update! //} if (applicationIcon != null) { imgAppIcon.Image = new Icon(applicationIcon, new Size(48, 48)).ToBitmap(); Icon = applicationIcon; } EnsureDialogShown(); _cancellationTokenSource = new CancellationTokenSource(); _cancellationToken = _cancellationTokenSource.Token; downloadAndDisplayAllReleaseNotes(items, latestVersion, initialHTML); }
public ApplicationContainer() { var builder = new ContainerBuilder(); //builder.RegisterModule<WhiteboxProfilingModule>(); //default to InstancePerDependency, i.e., they it will make a new //one each time someone asks for one builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()); builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly()) .Where(t => t.GetInterfaces().Contains(typeof(ICommand))).InstancePerLifetimeScope(); builder.Register<Sparkle>(c => { var s = new Sparkle(@"http://build.palaso.org/guestAuth/repository/download/bt78/.lastSuccessful/appcast.xml", Resources.Bloom); s.CustomInstallerArguments = "/qb"; s.DoLaunchAfterUpdate = false; return s; }).InstancePerLifetimeScope(); builder.Register(c => LocalizationManager).SingleInstance(); if (Settings.Default.MruProjects==null) { Settings.Default.MruProjects = new MostRecentPathsList(); } builder.RegisterInstance(Settings.Default.MruProjects).SingleInstance(); _container = builder.Build(); }