private void nameTextBox_LostFocus(object sender, System.Windows.RoutedEventArgs e) { // 更新短影名. if (App.CurrentStoryName != this.nameTextBox.Text && this.nameTextBox.Text != null) { if (IsolatedStorageHelper.FileExists(this.nameTextBox.Text + ".xml")) { if (MessageBox.Show( "同样名称的短影已经存在. 是否覆盖?", "确认", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { this.RenameStory(); } // 回滚旧名. else { this.nameTextBox.Text = App.CurrentStoryName; } } else { this.RenameStory(); } } }
/// <summary> /// 重命名短影. /// </summary> private void RenameStory() { IsolatedStorageHelper.RenameFile(App.CurrentStoryName + ".xml", this.nameTextBox.Text + ".xml"); App.CurrentStoryName = this.nameTextBox.Text; }