public static void CreateOpenDialog(string title, string message, string[] allowed_file_types, Action callback) { _OpenDialog = new OpenDialog(title, message); _OpenDialog.Id = "OpenFileDialog"; _OpenDialog.X = Pos.Center(); _OpenDialog.Y = Pos.Center(); _OpenDialog.ColorScheme = Colors.Dialog; _OpenDialog.AllowedFileTypes = allowed_file_types; _OpenDialog.AddButton(new Button("Set Dir...") { Clicked = () => { try { _OpenDialog.DirectoryPath = _OpenDialog.DirectoryPath; } catch (Exception) { /* nothing */ } } }); (_OpenDialog.Subviews.First().Subviews.FirstOrDefault(x => (x as Button ?? new Button("x")).Text == "Open") as Button).Clicked += callback; (_OpenDialog.Subviews.First().Subviews.FirstOrDefault(x => (x as Button ?? new Button("x")).Text == "Cancel") as Button).Clicked += () => Application.Top.SetFocus(Application.Top.MostFocused); Application.Run(_OpenDialog); }