Пример #1
0
        async void Loaded(object sender, EventArgs e)
        {
            Position = new PixelPoint(Position.X, Math.Max(0, Position.Y));

            State.Text = "Downloading...";

            WebClient downloader = new WebClient();

            downloader.DownloadProgressChanged += Progress;
            downloader.DownloadDataCompleted   += Downloaded;
            downloader.DownloadDataAsync(new Uri((await Github.LatestDownload()).BrowserDownloadUrl));
        }
Пример #2
0
        async void CheckUpdate()
        {
            if (await Github.ShouldUpdate())
            {
                while (App.Windows.OfType <MessageWindow>().Where(i => !i.Completed.Task.IsCompleted).FirstOrDefault() is MessageWindow window)
                {
                    await window.Completed.Task;
                }

                Dispatcher.UIThread.Post(async() => {
                    UpdateButton.Enable($"Updates are available for Apollo Studio ({(await Github.LatestRelease()).Name} - {(await Github.LatestDownload()).Size.Bytes().Humanize("#.##")}).");
                    MinHeight = MaxHeight += 30;
                }, DispatcherPriority.MinValue);
            }
        }
Пример #3
0
 async void CheckUpdate()
 {
     if (await Github.ShouldUpdate())
     {
         UpdateButton.Enable($"Updates are available for Apollo Studio ({(await Github.LatestRelease()).Name} - {(await Github.LatestDownload()).Size.Bytes().Humanize("#.##")}).");
     }
 }
Пример #4
0
        async void Update()
        {
            if (IsVisible && !openDialog && await MessageWindow.Create(
                    $"A new version of Apollo Studio is available ({(await Github.LatestRelease()).Name} - {(await Github.LatestDownload()).Size.Bytes().Humanize("#.##")}).\n\n" +
                    "Do you want to update to the latest version?",
                    new string[] { "Yes", "No" }, null
                    ) == "Yes")
            {
                foreach (Window window in App.Windows)
                {
                    if (window.GetType() != typeof(MessageWindow))
                    {
                        window.Close();
                    }
                }

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    Program.LaunchAdmin = true;
                }
                else
                {
                    UpdateWindow.Create(this);
                }
            }
        }