private async Task DownloadPackage(IGitHubEntry entry, bool forceDepDownload)
        {
            VKGithubEntry.DownloadProgressChanged += VoukoderEntry_DownloadProgressChanged;
            var t = await((VKGithubEntry)entry).StartPackageDownloadWithDependencies(forceDepDownload);

            t.InstallPackageWithDepenencies(_entry);
            VKGithubEntry.DownloadProgressChanged -= VoukoderEntry_DownloadProgressChanged;
        }
        private void CreateUpdateInfo(IGitHubEntry update)
        {
            var dockPanelUpdate = new DockPanel();

            dockPanelUpdate.SetValue(Grid.RowProperty, 1);

            dockPanelUpdate.SetValue(VerticalAlignmentProperty, VerticalAlignment.Bottom);
            dockPanelUpdate.SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Left);

            var icon = new PackIcon {
                Kind = PackIconKind.Information
            };

            icon.Foreground = new SolidColorBrush(Colors.CornflowerBlue);

            var labelBlockHeadline = new Label
            {
                Content = "Update available"
            };

            DockPanel.SetDock(labelBlockHeadline, Dock.Bottom);

            var labelUpdateVersion = new Label();

            if (update.ComponentType == ProgramType.VoukoderCore)
            {
                labelUpdateVersion.Content = "Core: " + update.Version.PackageVersion;
            }
            else
            {
                labelUpdateVersion.Content = "Connector: " + update.Version.PackageVersion;
            }
            DockPanel.SetDock(labelUpdateVersion, Dock.Bottom);

            var buttonChangelog = new Button
            {
                Content             = "View Details",
                Foreground          = new SolidColorBrush(Colors.CornflowerBlue),
                Background          = new SolidColorBrush(Colors.Transparent),
                BorderThickness     = new Thickness(0),
                HorizontalAlignment = HorizontalAlignment.Left,
                DataContext         = update
            };

            buttonChangelog.Click += ButtonChangelog_Click;
            DockPanel.SetDock(buttonChangelog, Dock.Bottom);

            dockPanelUpdate.Children.Add(icon);
            dockPanelUpdate.Children.Add(buttonChangelog);
            dockPanelUpdate.Children.Add(labelUpdateVersion);

            dockPanelUpdate.Children.Add(labelBlockHeadline);
            _panelUpdates.Children.Add(dockPanelUpdate);
            _scrollUpdates.Visibility = Visibility.Visible;
        }
        private void CheckSelfUpdate()
        {
            PackageManager m = new PackageManager();

            _selfUpdate = m.GetManagerUpdate(new Core.Models.Version(Assembly.GetExecutingAssembly().GetName().Version.ToString()));
            if (_selfUpdate != null)
            {
                menuItem_update.Visibility = Visibility.Visible;
                NotifyService.Notify(new Notification("Update", "There is a update for VoukoderManager. Click to install it"), DoSelfUpdate);
            }
        }
Esempio n. 4
0
 private List <IGitHubEntry> GetContent(ProgramType type, string owner, string repo, string filepath, int results, bool includeCore)
 {
     try
     {
         IGitHubEntry corepkg = null;
         var          content = _client.Repository.Content.GetAllContents(owner, repo, filepath).Result;
         if (includeCore)
         {
             corepkg = GetLatestDownloadableCorePackage();
         }
         OnRequest(this, new ApiRequestEventArgs(_client.GetLastApiInfo()));
         var    re      = _client.GetLastApiInfo();
         var    lst     = new List <IGitHubEntry>();
         int    entries = content.Count;
         string changelog;
         using (WebClient client = new WebClient())
         {
             changelog = client.DownloadString(content[0].DownloadUrl);
         }
         while (results > 0)
         {
             var v = content[entries - 1];
             if (v.Name.Contains("connector"))
             {
                 var version = v.Name.Where(Char.IsDigit).ToArray();
                 var vkentry = new VKGithubEntry(v.Name, new Models.Version(string.Join(".", version)))
                 {
                     DownloadUrl   = new Uri(v.DownloadUrl),
                     ComponentType = type,
                     Changelog     = changelog
                 };
                 if (corepkg != null)
                 {
                     vkentry.Dependencies = new List <IGitHubEntry>()
                     {
                         corepkg
                     }
                 }
                 ;
                 lst.Add(vkentry);
             }
             entries--;
             results--;
         }
         return(lst);
     }
     catch (AggregateException ex)
     {
         Log.Error(ex, "Error getting content from github");
         return(null);
     }
 }
        private void CheckForUpdate()
        {
            if (_entry.SubComponent != null)
            {
                var p = new PackageManager();
                if (!_updateSearchCoreDone)
                {
                    _coreUpdate           = p.GetUpdate(_entry.SubComponent.SubComponent);
                    _updateSearchCoreDone = true;
                }

                var update = p.GetUpdate(_entry.SubComponent);
                if (update == null)
                {
                    if (_coreUpdate != null)
                    {
                        _packageUpdate           = _coreUpdate;
                        _buttonUpdate.Content    = "Update";
                        _buttonUpdate.Visibility = Visibility.Visible;
                        CreateUpdateInfo(_packageUpdate);
                    }
                }
                else
                {
                    if (_coreUpdate != null)
                    {
                        update.Dependencies = new List <IGitHubEntry>()
                        {
                            _coreUpdate
                        };
                        CreateUpdateInfo(_coreUpdate);
                    }
                    _packageUpdate           = update;
                    _buttonUpdate.Content    = "Update";
                    _buttonUpdate.Visibility = Visibility.Visible;
                    CreateUpdateInfo(update);
                }
                if (_packageUpdate != null)
                {
                    NotifyService.Notify(new Notification("Update", $"There is an update available: {_packageUpdate.Name}"));
                }
            }
        }
 private async void _buttonUpdate_Click(object sender, RoutedEventArgs e)
 {
     if (_packageUpdate != null)
     {
         var updatemsg = "Update: Voukoder for " + _packageUpdate.ComponentType.ToString() +
                         " to version: " + _packageUpdate.Version.PackageVersion;
         if (_packageUpdate.Dependencies != null)
         {
             foreach (var v in _packageUpdate.Dependencies)
             {
                 updatemsg += "\nUpdate: Voukoder Core " + v.ComponentType.ToString() +
                              " to version: " + v.Version.PackageVersion;
             }
         }
         var msb = MessageBox.Show(updatemsg, "Update", MessageBoxButton.YesNo);
         if (msb == MessageBoxResult.Yes)
         {
             await DownloadPackage(_packageUpdate, true);
         }
         _coreUpdate = null;
     }
 }
Esempio n. 7
0
        private void radioButtonClickEvent(object sender, RoutedEventArgs e)
        {
            var t = (RadioButton)e.Source;

            _selectedEntry = (IGitHubEntry)t.DataContext;
        }