/* ************************************************************************************************************************ *************************************************************************************************************************/ protected bool openFileChooser(out String fileName, out String directory) { OpenFileDialog fileChooser = new OpenFileDialog(); fileChooser.Multiselect = false; fileChooser.Filter = "XML|*.xml;"; fileChooser.InitialDirectory = workingDirectory.path; if (fileChooser.ShowDialog(this) == true) { String fullFileName = fileChooser.FileName; fileName = fileChooser.SafeFileName; directory = fileChooser.FileName.TrimEnd(fileName.ToCharArray()); workingDirectory = new DirectoryHandler(directory, new controllerShowError(showErrorMessage)); return(true); } directory = fileName = null; return(false); }
//public xmlElem oldDataContainer //{ // set // { // if (value != null) // { // oldDataSource = value; // OnPropertyChanged("dataContainer"); // } // } // get // { // return oldDataSource; // } //} #endregion //default constructor public EditorController() { InitializeComponent(); retrieveSettingsFile(); filesOpen = new ObservableCollection <FileHandler>(); dataContainerList = new List <xmlElem>(); String tempWorkingDirectory = userSettings.getValue(EditorSettings.lastDirectoryOpened.ToString()); if (Directory.Exists(tempWorkingDirectory) == true) { workingDirectory = new DirectoryHandler(tempWorkingDirectory, new controllerShowError(showErrorMessage)); //String tempFileName = userSettings.getValue(EditorSettings.lastFileOpened.ToString()); //try //{ // currentFile = new FileHandler(workingDirectory.path + tempFileName); // oldDataSource = new xmlElem(currentFile.open()); // oldDataView = (CollectionView)CollectionViewSource.GetDefaultView(oldDataSource.xmlElements); //} //catch //{ // currentFile = new FileHandler(tempWorkingDirectory, ""); //} } else { workingDirectory = new DirectoryHandler(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\", new controllerShowError(showErrorMessage)); //showErrorMessage(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\"); //currentFile = new FileHandler(workingDirectory.path, ""); } showPrimaryWindow(); }
/* ************************************************************************************************************************ *************************************************************************************************************************/ protected bool openFileChooser(out String fileName, out String directory) { OpenFileDialog fileChooser = new OpenFileDialog(); fileChooser.Multiselect = false; fileChooser.Filter = "XML|*.xml;"; fileChooser.InitialDirectory = workingDirectory.path; if (fileChooser.ShowDialog(this) == true) { String fullFileName = fileChooser.FileName; fileName = fileChooser.SafeFileName; directory = fileChooser.FileName.TrimEnd(fileName.ToCharArray()); workingDirectory = new DirectoryHandler(directory, new controllerShowError(showErrorMessage)); return true; } directory = fileName = null; return false; }
//default constructor public EditorController() { InitializeComponent(); retrieveSettingsFile(); filesOpen = new ObservableCollection<FileHandler>(); dataContainerList = new List<xmlElem>(); String tempWorkingDirectory = userSettings.getValue(EditorSettings.lastDirectoryOpened.ToString()); if (Directory.Exists(tempWorkingDirectory) == true) { workingDirectory = new DirectoryHandler(tempWorkingDirectory, new controllerShowError(showErrorMessage)); //String tempFileName = userSettings.getValue(EditorSettings.lastFileOpened.ToString()); //try //{ // currentFile = new FileHandler(workingDirectory.path + tempFileName); // oldDataSource = new xmlElem(currentFile.open()); // oldDataView = (CollectionView)CollectionViewSource.GetDefaultView(oldDataSource.xmlElements); //} //catch //{ // currentFile = new FileHandler(tempWorkingDirectory, ""); //} } else { workingDirectory = new DirectoryHandler(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\", new controllerShowError(showErrorMessage)); //showErrorMessage(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\"); //currentFile = new FileHandler(workingDirectory.path, ""); } showPrimaryWindow(); }