InkCanvasForClass/Ink Canvas/Windows/NamesInputWindow.xaml.cs

47 lines
1.3 KiB
C#
Raw Normal View History

2023-12-22 00:14:15 +08:00
using Ink_Canvas.Helpers;
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();
AnimationsHelper.ShowWithSlideFromBottomAndFade(this, 0.25);
2021-10-30 23:55:38 +08:00
}
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)
{
2023-05-17 21:51:13 +08:00
if (File.Exists(App.RootPath + "Names.txt"))
2021-10-30 23:55:38 +08:00
{
2023-05-17 21:51:13 +08:00
TextBoxNames.Text = File.ReadAllText(App.RootPath + "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)
{
2023-05-17 21:51:13 +08:00
File.WriteAllText(App.RootPath + "Names.txt", TextBoxNames.Text);
2021-10-30 23:55:38 +08:00
}
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Close();
}
}
}