Ziomnexpl

notatnik monogame

Jan 20th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. using System;
  2. using Gtk;
  3. using System.IO;
  4.  
  5. public partial class MainWindow : Gtk.Window
  6. {
  7. public MainWindow() : base(Gtk.WindowType.Toplevel)
  8. {
  9. Build();
  10. }
  11.  
  12. protected void OnDeleteEvent(object sender, DeleteEventArgs a)
  13. {
  14. Application.Quit();
  15. a.RetVal = true;
  16. }
  17.  
  18. protected void OnWklejActionActivated(object sender, EventArgs e)
  19. {
  20. var schowek = textview1.GetClipboard(Gdk.Selection.Clipboard);
  21. textview1.Buffer.PasteClipboard(schowek);
  22. }
  23.  
  24. protected void OnKopiujAction1Activated(object sender, EventArgs e)
  25. {
  26. var schowek = textview1.GetClipboard(Gdk.Selection.Clipboard);
  27. textview1.Buffer.CopyClipboard(schowek);
  28. }
  29.  
  30. protected void OnWytnijAction1Activated(object sender, EventArgs e)
  31. {
  32. var schowek = textview1.GetClipboard(Gdk.Selection.Clipboard);
  33. textview1.Buffer.CutClipboard(schowek, true);
  34. }
  35.  
  36. protected void OnZamknijActionActivated(object sender, EventArgs e)
  37. {
  38. MessageDialog md1 = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.YesNo, "Informacja");
  39. ResponseType wynik = (ResponseType)md1.Run();
  40. if (wynik == ResponseType.Yes)
  41. {
  42. Application.Quit();
  43. }
  44. md1.Destroy();
  45. }
  46.  
  47. protected void OnNowyActionActivated(object sender, EventArgs e)
  48. {
  49. textview1.Buffer.Clear();
  50. }
  51.  
  52. protected void OnOtworzActionActivated(object sender, EventArgs e)
  53. {
  54. Gtk.FileChooserDialog fileChooser = new Gtk.FileChooserDialog("Wybierz plik", this, FileChooserAction.Open, "Anuluj", ResponseType.Cancel, "Otwórz", ResponseType.Accept);
  55. if (fileChooser.Run() == (int)ResponseType.Accept)
  56. {
  57. String s = File.ReadAllText(fileChooser.Filename);
  58. textview1.Buffer.Text = s;
  59. fileChooser.Destroy();
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment