Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several things i do not know how to achieve with Squirrel #639

Open
ghost opened this issue Mar 24, 2016 · 4 comments
Open

Several things i do not know how to achieve with Squirrel #639

ghost opened this issue Mar 24, 2016 · 4 comments
Labels
bug:needs-more-information Issues that need more information from the submitter to understand or reproduce the problem

Comments

@ghost
Copy link

ghost commented Mar 24, 2016

Hi,

i like squirrel, did take a while until i managed to get it running in a basic way but it does.
But what i did not figured out is:

  • how do i say that it shall generate and update shortcuts?
  • how do i say that it shall close on update and then reopen, because now the updater throws an exception when the old version opens the new one?
  • how do i make startmenue entrys?

Thanks for every help
Daniel

PS: i am using VS2015 and C#

@dealproc
Copy link

do you possibly have an ability to post your sample project up so that others can take a look and better advise on what you may have done incorrectly?

@ghost
Copy link
Author

ghost commented Mar 24, 2016

okay, some snippets
i did not integrate it in program.cs, because then it opened the app before the update

using Squirrel;

namespace VMFClient
{

    public partial class VMFClient : MetroForm
    {
        UpdateManager updates = new UpdateManager("http://www.example.com/downloads");
        ...
    } 
...
private void Form1_Load(object sender, EventArgs e)
   {
       updates.CheckForUpdate();
       ...
    }

private void Form1_FormClosing(object sender, EventArgs e)
   {
       updates.Dispose();
    }
public class UpdateManager : IDisposable
    {
        private readonly IUpdateManager _updateManager;

        public UpdateManager(string updateURL)
        {
            _updateManager = new Squirrel.UpdateManager(updateURL);
        }

        public event EventHandler VersionUpdatePending;
        public event EventHandler VersionUpdated;

        public void CheckForUpdate()
        {
            InvokeUpdate();
        }

        public void Dispose()
        {
            _updateManager.Dispose();
        }

        protected virtual void OnVersionUpdated()
        {
            if (VersionUpdated != null) VersionUpdated(this, EventArgs.Empty);
        }

        protected virtual void OnVersionUpdatesPending()
        {
            if (VersionUpdatePending != null) VersionUpdatePending(this, EventArgs.Empty);
        }

        private async void InvokeUpdate()
        {
            var updateInfo = await _updateManager.CheckForUpdate();
            if (updateInfo.ReleasesToApply.Any())
            {
                OnVersionUpdatesPending();
            }
            var releaseEntry = await _updateManager.UpdateApp();
            if (releaseEntry != null)
            {
                OnVersionUpdated();
            }
        }
    }

this are all lines that are reffering to squirrel

oh and i forget, how do i say squirrel to delete the old version after update?

@ghost ghost changed the title Several things i do not know how to to with Squirrel Several things i do not know how to achieve with Squirrel Mar 25, 2016
@dealproc
Copy link

how do i say that it shall generate and update shortcuts?

so by default, making your app Squirrel Aware will make a shortcut for its *.exe

how do i say that it shall close on update and then reopen, because now the updater throws an exception when the old version opens the new one?

I'm looking at your UpdateManager class, and you have private async void InvokeUpdate() and public void CheckForUpdate(), but those are all encapsulating tasks. It seems from what I can flow, you may possibly be in the midst of an update, and be trying to restart the new version before the update has completed successfully. You may want to update this to be all task driven.

how do i make start menu entries?

I think this is one that I need to defer to others to assist with. I will be looking into this as well in the coming days. If I have an answer for you here, I will surely post it for you.

HTH

@Thieum
Copy link
Contributor

Thieum commented May 7, 2019

@d0narnbl1tz did the previous comment answered all your questions? If so, you can close this issue.

@shiftkey shiftkey added the bug:needs-more-information Issues that need more information from the submitter to understand or reproduce the problem label May 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:needs-more-information Issues that need more information from the submitter to understand or reproduce the problem
Projects
None yet
Development

No branches or pull requests

3 participants