Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BookmarkPopover.cs - github.com/xamarin/macdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 510776bbb1256ea7db00242057c3ab3ca99d292e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using AppKit;

namespace macdoc
{
	public partial class BookmarkPopover : AppKit.NSView
	{
		public class BookmarkEventArgs : EventArgs
		{
			public string Name { get; set; }
			public string Notes { get; set; }
		}
		
		public event EventHandler<BookmarkEventArgs> Done;
		public event EventHandler Delete;
		
		public BookmarkPopover (IntPtr handle) : base (handle)
		{
		}

		[Export ("initWithCoder:")]
		public BookmarkPopover (NSCoder coder) : base (coder)
		{
		}
		
		public void PostInitialization ()
		{
			nameField.StringValue = Name ?? string.Empty;
			notesField.PlaceholderString = "You can add additional notes to this bookmark";
			notesField.LineBreakMode = NSLineBreakMode.TruncatingTail;
			doneButton.Activated += (sender, e) => Done (this, new BookmarkEventArgs () { Name = nameField.StringValue, Notes = notesField.StringValue });
			deleteButton.Activated += (sender, e) => Delete (this, EventArgs.Empty);
		}
		
		public string Name {
			get;
			set;
		}
	}
}