2023-02-12 22:50:17 +08:00
|
|
|
|
using System.IO;
|
2021-10-30 23:55:38 +08:00
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
namespace Ink_Canvas
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for NamesInputWindow.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class NamesInputWindow : Window
|
|
|
|
|
{
|
|
|
|
|
public NamesInputWindow()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-31 17:23:23 +08:00
|
|
|
|
string originText = "";
|
|
|
|
|
|
2021-10-30 23:55:38 +08:00
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (File.Exists(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "Names.txt"))
|
|
|
|
|
{
|
|
|
|
|
TextBoxNames.Text = File.ReadAllText(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "Names.txt");
|
2021-10-31 17:23:23 +08:00
|
|
|
|
originText = TextBoxNames.Text;
|
2021-10-30 23:55:38 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
|
|
|
{
|
2021-10-31 17:23:23 +08:00
|
|
|
|
if (originText != TextBoxNames.Text)
|
2021-10-30 23:55:38 +08:00
|
|
|
|
{
|
|
|
|
|
var result = MessageBox.Show("是否保存?", "名单导入", MessageBoxButton.YesNo);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
File.WriteAllText(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "Names.txt", TextBoxNames.Text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|