Ejemplo n.º 1
0
        /// <summary>
        /// Ask for vacuuming the database when clicking on the corresponding menuitem.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuitem_VacuumDb_Click(object sender, RoutedEventArgs e)
        {
            this.Collection.Blackout(true);

            TwoButtonsDialog dialog = new TwoButtonsDialog(
                Lang.Text("compactDb", "This operation will compact the database to reduce its size and make it faster.\n\n(a backup will be made just in case)\n"),
                Lang.Text("vacuumDb", "Vacuum database"), Lang.START, Lang.ABORT
                );

            dialog.Owner = this;

            if (dialog.Open())
            {
                App.db.Backup();
                App.db.Vacuum();

                this.Notify(
                    Constants.Notify.Notif,
                    Lang.OPERATION_FINISHED_TITLE,
                    Lang.Text("vacuumSuccess", "Database vacuumed succesfully")
                    );
            }

            this.Collection.Blackout(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reconstruct the DB when clicking on the corresponding menuitem.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuitem_EmptyDb_Click(object sender, RoutedEventArgs e)
        {
            this.Collection.Blackout(true);

            TwoButtonsDialog dialog = new TwoButtonsDialog(
                Lang.Text("emptyDbDescr"),
                Lang.WARNING, Lang.EXECUTE, Lang.ABORT
                );

            dialog.Owner = this;

            if (dialog.Open())
            {
                App.db.Backup();
                App.db.Recreate();

                Collection.Level      = Level.Serie;
                Collection.Breadcrumb = null;

                this.Collection._controller.RefreshStatus();
                this.Collection._controller.Refresh();
            }

            this.Collection.Blackout(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Ask the user for restarting the program.
        /// </summary>
        public static void AskRestart()
        {
            View.Window.TwoButtonsDialog dialog = new View.Window.TwoButtonsDialog(
                Lang.NEED_RESTART, Lang.RESTART + "?", Lang.RESTART_NOW, Lang.CONTINUE_NO_RESTART
                );

            if (dialog.Open())
            {
                Tools.Restart();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Custom window closing function.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            if (this.validated || !this.moved)
            {
                return;
            }

            // Some files were moved, warn the user about it
            bool clickedOnYes = new TwoButtonsDialog(
                "Some episode files were moved. If you close this window without validating the changes those episodes will have missing files.",
                "Warning", "Yes", "No"
                ).Open();

            // Prevent the window to be closed
            if (!clickedOnYes)
            {
                e.Cancel = true;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Remove images from covers/full and covers/thumb folders not referenced in DB.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuitem_DeleteUnusedCoverFiles_Click(object sender, RoutedEventArgs e)
        {
            this.Collection.Blackout(true);

            TwoButtonsDialog dialog = new TwoButtonsDialog(
                Lang.Text("removeUnusedCovers", "This operation will remove unused covers from disk."),
                Lang.Text("deleteUnusedCover", "Delete unused cover files"), Lang.START, Lang.ABORT
                );

            dialog.Owner = this;

            if (dialog.Open())
            {
                int deleted = this.DeleteUnusedCoverFiles();

                this.Notify(
                    Constants.Notify.Notif,
                    Lang.OPERATION_FINISHED_TITLE,
                    String.Format(Lang.Content("fileRemovalSuccess"), deleted)
                    );
            }

            this.Collection.Blackout(false);
        }