private void CommandBinding_Save_Executed(object sender, ExecutedRoutedEventArgs e) { HostsFileHandler.GetInstance().WriteHostsFile(TextBox.Text); if (HostsFileHandler.GetInstance().GetHostsAllString() == TextBox.Text) { MessageBox.Show("保存成功"); } else { MessageBox.Show("保存失败"); } }
public MainWindow() { InitializeComponent(); TextBox.Text = HostsFileHandler.GetInstance().GetHostsAllString(); }