private void mDosyaYeni_Click(object sender, RoutedEventArgs e) { string pFilePath = mFilePath; sbFileName.Text = mFilePath = SaveFile("", "Yeni", mFileFilter); if (string.IsNullOrEmpty(mFilePath)) { sbFileName.Text = mFilePath = pFilePath; return; } else { if (File.Exists(mFilePath)) { File.Delete(mFilePath); } DataContext = AppFileTemplate.CreateTemplate(); AppFileTemplate.Serialize((AppFileTemplate)DataContext, mFilePath); (DataContext as AppFileTemplate).PropertyChanged -= DataContextPropertyChangedEventHandler; (DataContext as AppFileTemplate).PropertyChanged += DataContextPropertyChangedEventHandler; PlotView.Model = (DataContext as AppFileTemplate).GetModel(); WriteToInfoBox(); } }
private void mDosyaKaydet_Click(object sender, RoutedEventArgs e) { string pFilePath = mFilePath; if (!File.Exists(mFilePath)) { sbFileName.Text = mFilePath = SaveFile("", "Kaydet", mFileFilter); if (string.IsNullOrEmpty(mFilePath)) { sbFileName.Text = mFilePath = pFilePath; return; } else { if (DataContext == null) { DataContext = AppFileTemplate.CreateTemplate(); } oldFile = (AppFileTemplate)DataContext; AppFileTemplate.Serialize((AppFileTemplate)DataContext, mFilePath); } } else { AppFileTemplate.Serialize((AppFileTemplate)DataContext, mFilePath); } }
public MainWindow() { InitializeComponent(); DataContext = AppFileTemplate.CreateTemplate(); oldFile = ((AppFileTemplate)DataContext).GetClone(); }