/// <summary> /// Loads a query from disk /// </summary> private void LoadQuery() { using (OpenFileDialog diag = new OpenFileDialog()) { diag.Filter = "xml Files (*.xml)|*.xml"; if (diag.ShowDialog() == DialogResult.OK) { QueryObj = QuerySerilizer.LoadQuery(diag.FileName); } } }
/// <summary> /// Writes out the query to file /// </summary> private void SaveQuery() { if (String.IsNullOrWhiteSpace(SearchDir)) { using (FolderBrowserDialog diag = new FolderBrowserDialog()) { diag.Description = "Choose a Destination"; diag.RootFolder = Environment.SpecialFolder.MyComputer; if (diag.ShowDialog() == DialogResult.OK) { if (!Directory.Exists(diag.SelectedPath)) { Directory.CreateDirectory(diag.SelectedPath); } SearchDir = diag.SelectedPath; } } } QuerySerilizer.SaveQuery(QueryObj); }