Exemplo n.º 1
0
        public override void OnActivated(string invokedArgs, NotificationUserInput userInput, string appUserModelId)
        {
            Log.Information("Activator activated with {Args}", invokedArgs);
            // Clear all toasts
            try
            {
                DesktopNotificationManagerCompat.History.Clear();
            }
            catch (Exception)
            {
                // Ignore errors (when notification service is not available)
            }
            switch (invokedArgs)
            {
            case UpdateAllAction:
                Choco.UpdateAllPackages();
                Environment.Exit(0);
                break;

            case UpdateAction:
            default:
                App.ShowUpdateDialog();
                break;
            }
        }
Exemplo n.º 2
0
        private void UpdateAllPackages(object _)
        {
            // Disable button
            _updating = true;
            CommandManager.InvalidateRequerySuggested();

            Choco.UpdateAllPackages();

            // End app
            Environment.Exit(0);
        }
Exemplo n.º 3
0
        private void UpdateSelectedPackages(object _)
        {
            // Disable button
            _updating = true;
            CommandManager.InvalidateRequerySuggested();

            Choco.UpdatePackages(Packages.Where(pck => pck.IsSelected).Select(pck => pck.Name).ToArray());

            // End app
            Environment.Exit(0);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Loads all outdated choco packages
        /// </summary>
        private void LoadOutdatedChocoPackages()
        {
            var pcks = Choco.OutdatedPackages(false);

            Dispatcher.BeginInvoke(new Action(() =>
            {
                IsLoading = false;
                foreach (var pck in pcks)
                {
                    var model = new PackageModel(pck.Name, pck.OldVersion, pck.NewVersion, pck.IsPinned);
                    model.IsSelectedChanged += IsSelectedChanged;
                    Packages.Add(model);
                }
            }));
        }
Exemplo n.º 5
0
        private void Run(CheckOptions o)
        {
            _exit = false;
            Log.Debug("Mode: check");
            // Check for outdated packages
            Task.Run(() =>
            {
                var pcks = Choco.OutdatedPackages();
                Log.Debug("Choco found {PackageCount} outdated packages", pcks.Count);

                if (pcks.Count > 0)
                {
                    try
                    {
                        ShowOutdatedNotification(pcks.Count, string.Join(", ", pcks.Select(p => p.Name)));
                    }
                    catch (Exception e)
                    {
                        Log.Error(e, "Error sending notification");
                    }
                }
            });
        }