private void openBudget(string fileName) { var formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode.Open); props = (properties)formatter.Deserialize(fs); myProperties = (CustomClass)formatter.Deserialize(fs); fs.Close(); openFileName = System.IO.Path.GetFileName(fileName); propGrid.SelectedObject = props; propGridCustom.SelectedObject = myProperties; props.removeEventHandlers(); props.addEventHandlers(); fillTotalValues(props); this.Title = string.Format("{0} - Otthoni költségvetéskezelő", openFileName); }
private void SaveMenuItem_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog { Filter = "Költségvetés fájlok (*.budget)|*.budget", FilterIndex = 0, Title = "Költségvetés elmentése", InitialDirectory = System.IO.Path.Combine((Environment.CurrentDirectory), "Saved Budgets"), //System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Saved Budgets"), AddExtension = true, FileName = openFileName }; if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { props.removeEventHandlers(); trySave(sfd.FileName); props.addEventHandlers(); } }