private void avatarIconView_DragDataReceived(object sender, DragDataReceivedArgs args) { if (args.SelectionData.Length >= 0 && args.SelectionData.Format == 8) { try { string fileName = new Uri(args.SelectionData.Text.Trim()).LocalPath; if (File.Exists(fileName)) { AddFile(fileName); } } catch (Exception ex) { Gui.ShowMessageDialog(ex.Message); } } Gtk.Drag.Finish(args.Context, false, false, args.Time); }
private void browseButton_clicked(object o, EventArgs args) { FileSelector selector = new FileSelector("Select Image"); selector.Show(); int result = selector.Run(); if (result == (int)Gtk.ResponseType.Ok) { try { AddFile(selector.Filename); } catch (Exception ex) { selector.Hide(); Gui.ShowMessageDialog(ex.Message); return; } } selector.Hide(); }
public static bool QuitMeshwork() { try { int result = Gui.ShowMessageDialog("Are you sure you want to quit Meshwork?", Gui.MainWindow.Window, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo); if (result == (int)ResponseType.Yes) { Gui.Settings.SaveSettings(); Core.Stop(); Gtk.Application.Quit(); Environment.Exit(0); return(true); } else { return(false); } } catch (Exception ex) { LoggingService.LogError(ex); throw ex; } }