Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Gtk;
- using System.IO;
- public partial class MainWindow : Gtk.Window
- {
- public MainWindow() : base(Gtk.WindowType.Toplevel)
- {
- Build();
- }
- protected void OnDeleteEvent(object sender, DeleteEventArgs a)
- {
- Application.Quit();
- a.RetVal = true;
- }
- protected void OnWklejActionActivated(object sender, EventArgs e)
- {
- var schowek = textview1.GetClipboard(Gdk.Selection.Clipboard);
- textview1.Buffer.PasteClipboard(schowek);
- }
- protected void OnKopiujAction1Activated(object sender, EventArgs e)
- {
- var schowek = textview1.GetClipboard(Gdk.Selection.Clipboard);
- textview1.Buffer.CopyClipboard(schowek);
- }
- protected void OnWytnijAction1Activated(object sender, EventArgs e)
- {
- var schowek = textview1.GetClipboard(Gdk.Selection.Clipboard);
- textview1.Buffer.CutClipboard(schowek, true);
- }
- protected void OnZamknijActionActivated(object sender, EventArgs e)
- {
- MessageDialog md1 = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.YesNo, "Informacja");
- ResponseType wynik = (ResponseType)md1.Run();
- if (wynik == ResponseType.Yes)
- {
- Application.Quit();
- }
- md1.Destroy();
- }
- protected void OnNowyActionActivated(object sender, EventArgs e)
- {
- textview1.Buffer.Clear();
- }
- protected void OnOtworzActionActivated(object sender, EventArgs e)
- {
- Gtk.FileChooserDialog fileChooser = new Gtk.FileChooserDialog("Wybierz plik", this, FileChooserAction.Open, "Anuluj", ResponseType.Cancel, "Otwórz", ResponseType.Accept);
- if (fileChooser.Run() == (int)ResponseType.Accept)
- {
- String s = File.ReadAllText(fileChooser.Filename);
- textview1.Buffer.Text = s;
- fileChooser.Destroy();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment