Example #1
0
        private async void CheckUpdates()
        {
            try
            {
                var cancel  = new CancellationTokenSource();
                var release = await GitHubRest.GetLatestRelease(cancel);

                if (release == null)
                {
                    return;
                }

                string version = release.tag_name.Replace("v", "");

                if (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.CompareTo(Version.Parse(version)) < 0 && release.assets.Any())
                {
                    var dialog = new NewVersion();
                    dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    dialog.Description.Text      = release.name + " has been released on " + release.published_at.ToLongDateString() + "\ndo you want to check it out now?";
                    //dialog.NewFeatures.Text = document.Element("Bcfier").Element("Changelog").Element("NewFeatures").Value;
                    //dialog.BugFixes.Text = document.Element("Bcfier").Element("Changelog").Element("BugFixes").Value;
                    //dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    dialog.ShowDialog();
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        Process.Start(release.assets.First().browser_download_url);
                    }
                }
            }
            catch (System.Exception ex1)
            {
                //warning suppressed
                Console.WriteLine("exception: " + ex1);
            }
        }
Example #2
0
        //Could be serialized to a class that binds to the UI
        //Could use a json instad than XML
        private void DownloadUpdateComplete(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                if (e.Error == null)
                {
                    var    document = XDocument.Parse(e.Result);
                    string version  = document.Element("Bcfier").Element("Version").Value;

                    if (System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.CompareTo(Version.Parse(version)) < 0)
                    {
                        var dialog = new NewVersion();
                        dialog.Description.Text      = "Version " + version + " is available,\ndo you want to check it out now?";
                        dialog.NewFeatures.Text      = document.Element("Bcfier").Element("Changelog").Element("NewFeatures").Value;
                        dialog.BugFixes.Text         = document.Element("Bcfier").Element("Changelog").Element("BugFixes").Value;
                        dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                        dialog.ShowDialog();
                        if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                        {
                            Process.Start(document.Element("Bcfier").Element("URL").Value);
                        }
                    }
                }
            }
            catch (System.Exception ex1)
            {
                //warning suppressed
                Console.WriteLine("exception: " + ex1);
            }
        }
Example #3
0
        private void BtnEdit_Click(object sender, RoutedEventArgs e)
        {
            Models.Version selectedVersion = Project.Versions.Single(version => version.Id == selectedVersionId);
            NewVersion     dialog          = new NewVersion(provider.GetDefaultVersionSettings(), selectedVersion);

            if (dialog.ShowDialog().Value)
            {
                Project.Versions[Project.Versions.IndexOf(selectedVersion)] = dialog.Version;
                LoadVersions();
            }
        }