Ejemplo n.º 1
0
        void RestoreSaveClicked(object sender, EventArgs e)
        {
            WorldSave save = (sender as ISaveManagerDialog).SelectedSave;

            if (save == null)
            {
                return;
            }

            IRestoreBackupDialog restoreDialog = GUIManager.Main.RestoreBackupDialog();

            restoreDialog.Parent          = sender as IWindow;
            restoreDialog.DefaultPosition = DefWindowPosition.CenterParent;

            restoreDialog.Response += (o, args) =>
            {
                if (args.Response == DialogResponse.OK)
                {
                    StartModalTask(new RestoreTask(save, restoreDialog.SelectedHash));
                }
            };

            restoreDialog.LoadBackupList(save);
            restoreDialog.Run();
        }
Ejemplo n.º 2
0
        void BackupSaveClicked(object sender, EventArgs e)
        {
            WorldSave save = (sender as ISaveManagerDialog).SelectedSave;

            if (save == null)
            {
                return;
            }

            ITextInputDialog inputDialog = GUIManager.Main.TextInputDialog(
                "Please enter a name for your backup.",
                "Unnamed MultiMC Backup");

            inputDialog.Title = "Backup Save";

            inputDialog.Shown += (o, args) => inputDialog.HighlightText();

            inputDialog.Response += (o, args) =>
            {
                if (args.Response == DialogResponse.OK)
                {
                    StartModalTask(new BackupTask(save,
                                                  inputDialog.Input != null ?
                                                  inputDialog.Input : "Unnamed MultiMC Backup"),
                                   inputDialog);
                }
            };

            inputDialog.Run();
        }