public static async Task <string> SelectFile(string title, FileSelection fileSelection, Predicate <string> fileFilter = null, string startPath = null) { var game = AGSGame.Game; var dialog = new AGSSelectFileDialog(game, title, fileSelection, fileFilter, startPath); return(await dialog.Run()); }
public ImportCommand() { // select the file to import fs = new FileSelection ("Choose the file to import ..."); // user selects type and format dialog = new ImportDialog (dialogData); }
//OKLocalBtn_Click. OK selectd from 'remote' tab, save settings & close private void OKRemoteBtn_Click(object sender, RoutedEventArgs e) { gi.useRemote = true; Result = gi; saveGI(); this.Close(); }
public void OnBrowseDefaultPath(object o, EventArgs args) { FileSelection fs = new FileSelection("Select where to find media"); fs.FileList.Parent.Hide(); //fs.SelectionEntry.Hide(); fs.FileopDelFile.Hide(); fs.FileopRenFile.Hide(); fs.HideFileopButtons(); CConfig config = CConfig.Instance; if (File.Exists((string)config["Interface/currentPat h"])) { fs.Complete((string)config["Interface/currentPath"]); } //fs.Complete("*"); fs.Resizable = true; fs.Modal = true; int res = fs.Run(); fs.Hide(); fs.Dispose(); if (res == (int)ResponseType.Ok) { Console.WriteLine(fs.Filename); Console.WriteLine(fs.Selections[0]); pathEntry.Text = fs.Filename; } }
public void on_open1_activate(object o, EventArgs args) { FileSelection fs = new FileSelection("Select a PDF file..."); // TODO: This doesn't filter the file list... fs.Complete("*.pdf"); fs.Run(); fs.Hide(); appbar1.Push("Opening document..."); m_doc = new Pdf(fs.Filename); appbar1.Push(m_doc.PageCount + " page document"); // Populate the pages list Gtk.ListStore model = new Gtk.ListStore(typeof(string)); Gtk.TreeIter iter = new Gtk.TreeIter(); Console.WriteLine("List has " + model.NColumns + " columns"); for (int i = 0; i < m_doc.PageCount; i++) { iter = model.Append(); GLib.Value v = new GLib.Value((i + 1).ToString()); model.SetValue(iter, 0, v); } pages.Model = model; pages.Show(); }
private void OnSelectImageOk(object o, EventArgs args) { FileSelection selection = ((FileSelection.FSButton)o).FileSelection; string file = selection.Filename; selection.Destroy(); ChangeImage(new FileInfo(file).Name); int startid = tileset.Tiles.Count; for (int y = 0; y < TilesY; ++y) { for (int x = 0; x < TilesX; ++x) { int i = y * TilesX + x; Tile tile = new Tile(); tile.ID = startid + i; ImageRegion region = new ImageRegion(); region.ImageFile = currentimage; region.Region = new System.Drawing.Rectangle(x * 32, y * 32, 32, 32); tile.Images.Add(region); if (Tiles[i] != null) { Console.WriteLine( "Warning Tile in this region already existed..."); } Tiles[i] = tile; tileset.Tiles.Add(tile); } } FillTileList(); }
private void InputFileSelect_Click(object sender, RoutedEventArgs e) { string inputFilename = FileSelection.SelectInputFile(); InputFilename.Text = inputFilename; OutputFilename.Text = FileSelection.DetermineOutputFilename(inputFilename); }
private void OnImportImage(object o, EventArgs e) { FileSelection selection = new FileSelection("Select ImageFile"); selection.OkButton.Clicked += new EventHandler(OnSelectImageOk); selection.CancelButton.Clicked += new EventHandler(OnSelectImageCancel); selection.Show(); }
public HdBdStreamExtractor() { InitializeComponent(); if (MainForm.Instance.Settings.Eac3toLastUsedFileMode) { FileSelection.Select(); } }
public void verify_selected_path_available() { // Read path from config, if not available, default to path of current execution call. var configurationPath = "/this/does/not/exist"; var fileSelection = new FileSelection(configurationPath); Assert.Equal(fileSelection.OperationsPath(), Directory.GetCurrentDirectory()); }
public void verify_correct_number_tasks_derived_from_files() { var migrationPath = TestHelpers.SetupMigrationsForTests(true, Guid.NewGuid()); var result = new FileSelection(migrationPath).GetFiles(); Assert.Equal(9, result.Count); TestHelpers.TearDownMigrationsTested(migrationPath); }
private static string GetMigrationsToExecute(out MigrationPath migrationsToExecute) { var path = TestHelpers.SetupMigrationsForTests(true, Guid.NewGuid()); var filesToProcess = new FileSelection(path).GetFiles(); migrationsToExecute = new MigrationPath(filesToProcess); return(path); }
public void verify_migration_files_exist() { var migrationPath = TestHelpers.SetupMigrationsForTests(true, Guid.NewGuid()); var fileSystem = new FileSelection(migrationPath); Assert.True(fileSystem.ProspectiveMigrationsExist()); TestHelpers.TearDownMigrationsTested(migrationPath); }
private void OnOpenProject(object sender, EventArgs args) { TrackerCore.Instance.State = CoreState.OpenProject; fFileSelection = new FileSelection("Open Project"); fFileSelection.Response += OnFileSelectionResponce; fFileSelection.Run(); fFileSelection.Hide(); }
void Show() { window = new FileSelection (caption); window.OkButton.Clicked += new EventHandler (OnFileSelectionOk); window.CancelButton.Clicked += new EventHandler (OnFileSelectionCancel); window.ShowAll (); }
public void verify_migration_path_list() { var migrationPath = TestHelpers.SetupMigrationsForTests(true, Guid.NewGuid()); var fileSystem = new FileSelection(migrationPath); var result = fileSystem.ShowMigrationPath(); Assert.True(result.Ready()); TestHelpers.TearDownMigrationsTested(migrationPath); }
private void OnSelectTileSetOk(object o, EventArgs e) { FileSelection selection = ((FileSelection.FSButton)o).FileSelection; string file = selection.Filename; selection.Destroy(); LoadTileSet(file); }
void Show() { window = new FileSelection(caption); window.OkButton.Clicked += new EventHandler(OnFileSelectionOk); window.CancelButton.Clicked += new EventHandler(OnFileSelectionCancel); window.ShowAll(); }
void OnFileSelectionCancel(object o, EventArgs args) { window.OkButton.Clicked -= new EventHandler(OnFileSelectionOk); window.CancelButton.Clicked -= new EventHandler(OnFileSelectionCancel); fh = null; window.Destroy(); window = null; }
public TextFileForm() { _fileSelection = new FileSelection(); _fileSerialization = new FileSerialization(); _fileDbService = new FileDbService(); InitializeComponent(); DbGridDataLoading(); BrowseFileInitialize(); }
protected virtual void OnOpenActivated(object sender, System.EventArgs e) { //Open fileselector file_selection = new FileSelection("Select an NFO file"); file_selection.Complete("*.NFO"); file_selection.OkButton.Clicked += new EventHandler(sel_OK_Clicked); file_selection.CancelButton.Clicked += new EventHandler(sel_Cancel_Clicked); file_selection.HideFileopButtons(); file_selection.Run(); }
public void verify_selected_path_available_and_exists() { var newPath = "newpath"; Directory.CreateDirectory(newPath); var fileSelection = new FileSelection(newPath); Assert.Equal(fileSelection.OperationsPath(), newPath); Directory.Delete(newPath); }
public void SelectedFileConents(string fileName, int expectedSize) { //assign FileSelection gitDiffChecker = new FileSelection(fileName); //action string[] actualFile = gitDiffChecker.GetContents(); //assert Assert.AreEqual(expectedSize, actualFile.Length); }
public FileSelectionDialog (string title, FileSelectionEventHandler fileSelectedHandler) { window = new FileSelection (title); window.OkButton.Clicked += new EventHandler (OnFileSelectionOk); window.CancelButton.Clicked += new EventHandler (OnFileSelectionCancel); if(fileSelectedHandler == null) throw new Exception ("FileSelectionDialog fileSelectedHandler is null"); fh = fileSelectedHandler; window.ShowAll (); }
public void verify_tasks_are_ready_for_migration_execution() { var migrationPath = TestHelpers.SetupMigrationsForTests(true, Guid.NewGuid()); var filesToProcess = new FileSelection(migrationPath).GetFiles(); var migrationsToExecute = new MigrationPath(filesToProcess); Assert.True(migrationsToExecute.Ready()); TestHelpers.TearDownMigrationsTested(migrationPath); }
private FileSelection startSelection(string viewCaption, string directoryKey, string fileSelectionCaption, bool selectFile) { _selectFile = selectFile; _view.SetFileSelectionCaption(fileSelectionCaption); _directoryKey = directoryKey; _view.Caption = viewCaption; _fileSelection = new FileSelection(); _view.BindTo(_fileSelection); _view.Display(); return(_view.Canceled ? null : _fileSelection); }
private static void OnAgreeSaveAs(FileSelection fileSelection, bool isServerSettings) { string fileName = fileSelection.FileNameEntry.Text; if (string.IsNullOrEmpty(fileName)) { return; } fileSelection.Close(); fileName = fileName.Split('/')[^ 1].Split('.')[0];
private void OnAgreeSaveAs(FileSelection fileSelection) { string fileName = fileSelection.FileNameEntry.Text; if (string.IsNullOrEmpty(fileName) || Window.Instance == null) { return; } fileSelection.Close(); fileName = fileName.Split('/')[^ 1].Split('.')[0];
public void CreateFileSelection() { _fileSelection?.Close(); FileSelection fileSelection = Hud.Current.GeneralHudPanel.FindPopupPanel().Add.FileSelection(); fileSelection.DefaultSelectionFileType = "*"; fileSelection.OnAgree = () => fileSelection.Close(); fileSelection.IsDataFolder = false; fileSelection.Display(); _fileSelection = fileSelection; }
public FileSelectionDialog(string title, FileSelectionEventHandler fileSelectedHandler) { window = new FileSelection(title); window.OkButton.Clicked += new EventHandler(OnFileSelectionOk); window.CancelButton.Clicked += new EventHandler(OnFileSelectionCancel); if (fileSelectedHandler == null) { throw new Exception("FileSelectionDialog fileSelectedHandler is null"); } fh = fileSelectedHandler; window.ShowAll(); }
public void Load() { _currentFileSelection?.Close(); FileSelection fileSelection = FindRootPanel().Add.FileSelection(); fileSelection.DefaultSelectionFileType = $"*{VISUALPROGRAMMING_FILE_EXTENSION}"; fileSelection.OnAgree = () => OnAgreeLoadVisualProgrammingFrom(fileSelection); fileSelection.DefaultSelectionPath = GetSettingsPathByData(Utils.Realm.Client); fileSelection.Display(); _currentFileSelection = fileSelection; }
public OpenFile() { Result = null; gi = new FileSelection(); gi.SSHKey = Tailer.Properties.Settings.Default.lastSSHKey; gi.RemoteUser = Tailer.Properties.Settings.Default.lastUser; gi.RemoteHost = Tailer.Properties.Settings.Default.lastHost; gi.RemoteFile = Tailer.Properties.Settings.Default.lastRemoteFile; gi.LocalFile = Tailer.Properties.Settings.Default.lastFile; gi.RemotePass = Tailer.Properties.Settings.Default.lastPass; DataContext = gi; InitializeComponent(); }
private AGSSelectFileDialog(IGame game, IGLUtils glUtils, string title, FileSelection fileSelection, string startPath = null) { _glUtils = glUtils; _game = game; _title = title; _fileSelection = fileSelection; _startPath = startPath ?? Hooks.FileSystem.GetCurrentDirectory(); _buttonsTextConfig = new AGSTextConfig(alignment: Alignment.BottomCenter, autoFit: AutoFit.TextShouldFitLabel, font: Hooks.FontLoader.LoadFont(null, 10f)); _filesTextConfig = new AGSTextConfig(alignment: Alignment.BottomCenter, autoFit: AutoFit.TextShouldFitLabel, font: Hooks.FontLoader.LoadFont(null, 10f), brush: Hooks.BrushLoader.LoadSolidBrush(Colors.Black)); _tcs = new TaskCompletionSource<bool>(false); }
private AGSSelectFileDialog(IGame game, string title, FileSelection fileSelection, Predicate <string> fileFilter = null, string startPath = null) { _game = game; _title = title; _fileSelection = fileSelection; _fileFilter = fileFilter; _startPath = startPath ?? _device.FileSystem.GetCurrentDirectory() ?? ""; _buttonsTextConfig = game.Factory.Fonts.GetTextConfig(alignment: Alignment.BottomCenter, autoFit: AutoFit.TextShouldFitLabel, font: game.Factory.Fonts.LoadFont(game.Settings.Defaults.TextFont.FontFamily, 10f)); _filesTextConfig = game.Factory.Fonts.GetTextConfig(alignment: Alignment.BottomCenter, autoFit: AutoFit.TextShouldFitLabel, font: game.Factory.Fonts.LoadFont(game.Settings.Defaults.TextFont.FontFamily, 10f), brush: _device.BrushLoader.LoadSolidBrush(Colors.White)); _tcs = new TaskCompletionSource <bool>(false); }
public static Gtk.Window Create() { window = new FileSelection ("File Selection Dialog"); window.HideFileopButtons (); window.OkButton.Clicked += new EventHandler (file_selection_ok); window.CancelButton.Clicked += new EventHandler (file_selection_cancel); check_button = new CheckButton ("Show Fileops"); check_button.Toggled += new EventHandler (show_fileops); window.ActionArea.PackStart (check_button, false, false, 0); toggle_button = new ToggleButton ("Select Multiple"); toggle_button.Clicked += new EventHandler (select_multiple); window.ActionArea.PackStart (toggle_button, false, false, 0); window.ShowAll (); return window; }
void OnFileSelectionOk(object o, EventArgs args) { string filename = window.Filename; FileSelectionEventArgs fa = new FileSelectionEventArgs (filename); if (fh != null) { fh (this, fa); } window.OkButton.Clicked -= new EventHandler (OnFileSelectionOk); window.CancelButton.Clicked -= new EventHandler (OnFileSelectionCancel); fa = null; fh = null; o = null; window.Destroy (); window = null; }
public static string GetFilePath( string prompt, string defaultfilename ) { using (FileSelection dialog = new FileSelection( prompt )) { dialog.Filename = Path.Combine( lastdirectorypath, defaultfilename ); ResponseType response = (ResponseType)dialog.Run(); dialog.Hide(); if (response == ResponseType.Ok) { LogFile.WriteLine( "got filepath: " + dialog.Filename ); lastdirectorypath = Path.GetDirectoryName( dialog.Filename ); return dialog.Filename; } else { LogFile.WriteLine( "Cancel pressed" ); return ""; } } }
/// <summary> /// Rebuild the file table with all files in the database table which match the specified selection. /// </summary> public void SelectFiles(FileSelection selection) { string query = "SELECT * FROM " + Constant.DatabaseTable.FileData; string where = this.GetFilesWhere(selection); if (String.IsNullOrEmpty(where) == false) { query += Constant.Sql.Where + where; } if (this.OrderFilesByDateTime) { query += " ORDER BY " + Constant.DatabaseColumn.DateTime; } DataTable images = this.Database.GetDataTableFromSelect(query); this.Files = new FileTable(images); this.Files.BindDataGrid(this.boundDataGrid, this.onFileDataTableRowChanged); // persist the current selection this.ImageSet.FileSelection = selection; }
public void OnOpen (object o, EventArgs args) { string fileName = null; FileSelection dialog = new FileSelection ("Choose a file"); dialog.HideFileopButtons (); // TODO: How to set a filter ??? // close, but not usable // dialog.Complete ("*.cov"); if (dialog.Run () == (int) ResponseType.Ok) { fileName = dialog.Filename; } dialog.Destroy (); if (fileName != null) { OpenFile (fileName); } }
private string GetFilesWhere(FileSelection selection) { switch (selection) { case FileSelection.All: return String.Empty; case FileSelection.Corrupt: case FileSelection.Dark: case FileSelection.NoLongerAvailable: case FileSelection.Ok: return this.DataLabelFromStandardControlType[Constant.DatabaseColumn.ImageQuality] + "=" + Utilities.QuoteForSql(selection.ToString()); case FileSelection.MarkedForDeletion: return this.DataLabelFromStandardControlType[Constant.DatabaseColumn.DeleteFlag] + "=" + Utilities.QuoteForSql(Boolean.TrueString); case FileSelection.Custom: return this.CustomSelection.GetFilesWhere(); default: throw new NotSupportedException(String.Format("Unhandled selection {0}.", selection)); } }
string GetFilePath(string prompt, string defaultfilename) { using (FileSelection dialog = new FileSelection(prompt)) { dialog.Complete(defaultfilename); ResponseType response = (ResponseType)dialog.Run(); dialog.Hide(); if (response == ResponseType.Ok) { Console.WriteLine("got filepath: " + dialog.Filename); return dialog.Filename; } else { Console.WriteLine("Cancel pressed"); return ""; } } }
public void onImportVCard(object o, EventArgs args) { FileSelection fs = new FileSelection ("Select VCard to Import..."); int rc = fs.Run (); fs.Hide (); if(rc == -5) { Contact newContact = null; StreamReader reader = null; bool hasmore = true; try { reader = new StreamReader(fs.Filename); if (reader != null) { while(hasmore) { newContact = curAddrBook.ImportVCard(reader); if(newContact != null) { ContactTreeStore.AppendValues(newContact); } try { String newline = reader.ReadLine(); if(newline == null) hasmore = false; } catch(Exception e) { hasmore = false; } } } } catch(Exception e) { Console.WriteLine(e); } finally { if (reader != null) { reader.Close(); } } } }
void _OnDatabaseBtnClick( object sender, EventArgs args ) { FileSelection dlg = new FileSelection( "Enter Database Path" ); dlg.Filename = _databaseEntry.Text; if ((ResponseType)dlg.Run() == ResponseType.Ok) _databaseEntry.Text = dlg.Filename; dlg.Destroy(); }
private void SaveAs() { FileSelection fs = new FileSelection("File to open"); int response = fs.Run(); string fileName = fs.Filename; fs.Destroy(); if (response == (int)Gtk.ResponseType.Cancel || response == (int)Gtk.ResponseType.None || response == (int)Gtk.ResponseType.DeleteEvent || fileName == null || fileName.Trim() == "") { return; } if (File.Exists(fileName)) { if (AskQuestion("File exists. Overrite it?") == false) { return; } } try { textEditor.SaveFile(fileName); } catch (Exception e) { ShowError("Unable to save the file"); } ShowMessage("File saved"); }
public void onExportVCard(object o, EventArgs args) { TreeSelection tSelect = ContactTreeView.Selection; if(tSelect.CountSelectedRows() == 1) { TreeModel tModel; TreeIter iter; tSelect.GetSelected(out tModel, out iter); Contact cnt = (Contact) tModel.GetValue(iter,0); if(cnt != null) { string fileName = cnt.FN + ".vcf"; FileSelection fs = new FileSelection ("Export VCard to..."); fs.Filename = fileName; int rc = fs.Run (); fs.Hide (); if(rc == -5) { cnt.ExportVCard(fs.Filename); } } } }
private void Open() { FileSelection fs = new FileSelection("File to open"); int response = fs.Run(); string fileName = fs.Filename; fs.Destroy(); if (response == (int)Gtk.ResponseType.Cancel || response == (int)Gtk.ResponseType.None || response == (int)Gtk.ResponseType.DeleteEvent || fileName == null || fileName.Trim() == "") { return; } try { textEditor.LoadFile(fileName, true); } catch (Exception e) { ShowError("Unable to open the file"); } }
public void OnFileOpen (object sender, EventArgs args) { appbar1.ProgressPercentage = 0.0f; FileSelection fs = new FileSelection ("Open"); try { bool ok = (fs.Run () == (int)Gtk.ResponseType.Ok); fs.Hide (); if (ok) { OnFileNew (sender, args); FileLoad (fs.Filename); OnFindEntryChange (sender, args); } } finally { fs.Destroy (); appbar1.ProgressPercentage = 1.0f; } }
public void OnFileExportAs(object sender, EventArgs args) { appbar1.ProgressPercentage = 0.0f; FileSelection fs = new FileSelection ("Export As"); try { bool ok = (fs.Run () == (int)Gtk.ResponseType.Ok); fs.Hide (); if (ok) { FileExport (fs.Filename); } } finally { fs.Destroy (); appbar1.ProgressPercentage = 1.0f; } }
void OnFileSelectionCancel (object o, EventArgs args) { window.OkButton.Clicked -= new EventHandler (OnFileSelectionOk); window.CancelButton.Clicked -= new EventHandler (OnFileSelectionCancel); fh = null; window.Destroy (); window = null; }
private void on_load_browse_clicked(object o, EventArgs args) { FileSelection fs = new FileSelection ("Choose an invitation file"); fs.ShowFileops = false; if(loadPathEntry.Text.Length > 0) { fs.Filename = loadPathEntry.Text; } int rc = fs.Run (); if(rc == -5) loadPathEntry.Text = fs.Filename; fs.Hide (); }
private void OnOpen(object o, EventArgs e) { FileSelection selection = new FileSelection("Select TileSet"); selection.OkButton.Clicked += new EventHandler(OnSelectTileSetOk); selection.CancelButton.Clicked += new EventHandler(OnSelectImageCancel); selection.Show(); }
private void on_UserImageButton_clicked(object o, EventArgs args) { FileSelection fs = new FileSelection("Choose a new Image"); fs.Modal = true; fs.TransientFor = contactEditorDialog; int retVal = fs.Run(); fs.Hide(); if(retVal == -5) { if(currentContact.ImportPhoto(fs.Filename)) { Pixbuf pb = GetScaledPhoto(currentContact, 64); if(pb != null) UserImage.FromPixbuf = pb; } } }
void _OnMp3BtnClick( object sender, EventArgs args ) { // The GTK widget is not well suited to selecting directories // right now. I'll do the best I can for the moment: FileSelection dlg = new FileSelection( "Enter Database Path" ); dlg.Filename = _mp3RootDirEntry.Text; dlg.SelectionEntry.Text = "."; // Try to make this into a directory selection dialog. :/ dlg.HideFileopButtons(); dlg.FileList.Parent.Visible = false; dlg.SelectionEntry.Visible = false; if ((ResponseType)dlg.Run() == ResponseType.Ok) _mp3RootDirEntry.Text = dlg.Filename; dlg.Destroy(); }
private async Task SelectFilesAndShowFileAsync(FileSelection selection) { long fileID = Constant.Database.DefaultFileID; if (this.dataHandler != null && this.dataHandler.ImageCache != null && this.dataHandler.ImageCache.Current != null) { fileID = this.dataHandler.ImageCache.Current.ID; } await this.SelectFilesAndShowFileAsync(fileID, selection); }
public static async Task<string> SelectFile(string title, FileSelection fileSelection, string startPath = null) { var dialog = new AGSSelectFileDialog(AGSGame.Game, AGSGame.Resolver.Container.Resolve<IGLUtils>(), title, fileSelection, startPath); return await dialog.Run(); }
private async Task SelectFilesAndShowFileAsync(long fileID, FileSelection selection) { // change selection // if the data grid is bound the file database automatically updates its contents on SelectFiles() Debug.Assert(this.dataHandler != null, "SelectFilesAndShowFile() should not be reachable with a null data handler. Is a menu item wrongly enabled?"); Debug.Assert(this.dataHandler.FileDatabase != null, "SelectFilesAndShowFile() should not be reachable with a null database. Is a menu item wrongly enabled?"); this.dataHandler.FileDatabase.SelectFiles(selection); // explain to user if their selection has gone empty and change to all files if ((this.dataHandler.FileDatabase.CurrentlySelectedFileCount < 1) && (selection != FileSelection.All)) { // These cases are reached when // 1) datetime modifications result in no files matching a custom selection // 2) all files which match the selection get deleted this.statusBar.SetMessage("Resetting selection to 'All files'."); MessageBox messageBox = new MessageBox("Resetting selection to 'All files' (no files match the current selection)", this); messageBox.Message.StatusImage = MessageBoxImage.Information; switch (selection) { case FileSelection.Corrupt: messageBox.Message.Problem = "Corrupted files were previously selected but no files are currently corrupted, so nothing can be shown."; messageBox.Message.Reason = "No files have their ImageQuality set to Corrupted."; messageBox.Message.Hint = "If you have files you think should be marked as Corrupted, set their ImageQuality to Corrupted and then reselect corrupted files."; break; case FileSelection.Custom: messageBox.Message.Problem = "No files currently match the custom selection so nothing can be shown."; messageBox.Message.Reason = "No files match the criteria set in the current Custom selection."; messageBox.Message.Hint = "Create a different custom selection and apply it view the matching files."; break; case FileSelection.Dark: messageBox.Message.Problem = "Dark files were previously selected but no files are currently dark so nothing can be shown."; messageBox.Message.Reason = "No files have their ImageQuality set to Dark."; messageBox.Message.Hint = "If you have files you think should be marked as Dark, set their ImageQuality to Dark and then reselect dark files."; break; case FileSelection.NoLongerAvailable: messageBox.Message.Problem = "Files no londer available were previously selected but all files are availale so nothing can be shown."; messageBox.Message.Reason = "No files have their ImageQuality field set to FilesNoLongerAvailable."; messageBox.Message.Hint = "If you have removed files set their ImageQuality field to FilesNoLongerAvailable and then reselect files no longer available."; break; case FileSelection.MarkedForDeletion: messageBox.Message.Problem = "Files marked for deletion were previously selected but no files are currently marked so nothing can be shown."; messageBox.Message.Reason = "No files have their Delete? box checked."; messageBox.Message.Hint = "If you have files you think should be marked for deletion, check their Delete? box and then reselect files marked for deletion."; break; case FileSelection.Ok: messageBox.Message.Problem = "Ok files were previously selected but no files are currently OK so nothing can be shown."; messageBox.Message.Reason = "No files have their ImageQuality field set to Ok."; messageBox.Message.Hint = "If you have files you think should be marked as Ok, set their ImageQuality field to Ok and then reselect Ok files."; break; default: throw new NotSupportedException(String.Format("Unhandled selection {0}.", selection)); } messageBox.Message.Result = "The 'All files' selection will be applied, where all files in your image set are displayed."; messageBox.ShowDialog(); selection = FileSelection.All; this.dataHandler.FileDatabase.SelectFiles(selection); } // update status and menu state to reflect what the user selected string status; switch (selection) { case FileSelection.All: status = "(all files selected)"; break; case FileSelection.Corrupt: status = "corrupted files"; break; case FileSelection.Custom: status = "files matching your custom selection"; break; case FileSelection.Dark: status = "dark files"; break; case FileSelection.MarkedForDeletion: status = "files marked for deletion"; break; case FileSelection.NoLongerAvailable: status = "files no longer available"; break; case FileSelection.Ok: status = "Ok files"; break; default: throw new NotSupportedException(String.Format("Unhandled file selection {0}.", selection)); } this.statusBar.SetView(status); this.MenuSelectAllFiles.IsChecked = selection == FileSelection.All; this.MenuSelectCorruptedFiles.IsChecked = selection == FileSelection.Corrupt; this.MenuSelectDarkFiles.IsChecked = selection == FileSelection.Dark; this.MenuSelectOkFiles.IsChecked = selection == FileSelection.Ok; this.MenuSelectFilesNoLongerAvailable.IsChecked = selection == FileSelection.NoLongerAvailable; this.MenuSelectFilesMarkedForDeletion.IsChecked = selection == FileSelection.MarkedForDeletion; this.MenuSelectCustom.IsChecked = selection == FileSelection.Custom; // after a selection change update the file navigatior slider's range and tick space this.FileNavigatorSlider_EnableOrDisableValueChangedCallback(false); this.FileNavigatorSlider.Maximum = this.dataHandler.FileDatabase.CurrentlySelectedFileCount; // slider is one based so no - 1 on the count if (this.FileNavigatorSlider.Maximum <= 50) { this.FileNavigatorSlider.IsSnapToTickEnabled = true; this.FileNavigatorSlider.TickFrequency = 1.0; } else { this.FileNavigatorSlider.IsSnapToTickEnabled = false; this.FileNavigatorSlider.TickFrequency = 0.02 * this.FileNavigatorSlider.Maximum; } // Display the specified file or, if it's no longer selected, the next closest one // Showfile() handles empty image sets, so those don't need to be checked for here. await this.ShowFileAsync(this.dataHandler.FileDatabase.GetFileOrNextFileIndex(fileID)); // Update the status bar accordingly this.statusBar.SetCurrentFile(this.dataHandler.ImageCache.CurrentRow); this.statusBar.SetFileCount(this.dataHandler.FileDatabase.CurrentlySelectedFileCount); this.FileNavigatorSlider_EnableOrDisableValueChangedCallback(true); }
private void on_accept_browse_clicked(object o, EventArgs args) { FileSelection fs = new FileSelection ("Choose a directory"); fs.FileList.Parent.Hide(); fs.SelectionEntry.Hide(); fs.FileopDelFile.Hide(); fs.FileopRenFile.Hide(); if(acceptPathEntry.Text.Length > 0) { fs.Filename = acceptPathEntry.Text; fs.Filename += "/"; } int rc = fs.Run (); if(rc == -5) acceptPathEntry.Text = fs.Filename; fs.Hide (); }
public int GetFileCount(FileSelection fileSelection) { string query = "Select Count(*) FROM " + Constant.DatabaseTable.FileData; string where = this.GetFilesWhere(fileSelection); if (String.IsNullOrEmpty(where)) { if (fileSelection == FileSelection.Custom) { // if no search terms are active the image count is undefined as no filtering is in operation return -1; } // otherwise, the query is for all images as no where clause is present } else { query += Constant.Sql.Where + where; } return this.Database.GetCountFromSelect(query); }