write shit

This commit is contained in:
2021-05-15 16:23:16 +08:00
parent 1d700a02e3
commit dac0c36483
10 changed files with 564 additions and 54 deletions

View File

@ -1,4 +1,5 @@
using System;
using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -15,7 +16,7 @@ namespace BallanceTASEditor.UI {
if (!(bool)op.ShowDialog()) return "";
return op.FileName;
}
public static string SaveFileDialog() {
Microsoft.Win32.SaveFileDialog op = new Microsoft.Win32.SaveFileDialog();
op.RestoreDirectory = true;
@ -29,5 +30,17 @@ namespace BallanceTASEditor.UI {
return (result == MessageBoxResult.Yes);
}
public static bool InputNumber(string title, int min, int max, ref int result) {
while (true) {
var dialog = Interaction.InputBox(title, "Input number", "");
if (dialog == "") return false;
if (int.TryParse(dialog, out result)) {
if (result <= max && result >= min) break;
}
MessageBox.Show("Invalid number. Please input again", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
}
return true;
}
}
}