-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathRemoteControlWrapper.cs
210 lines (170 loc) · 4.33 KB
/
RemoteControlWrapper.cs
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
using System;
namespace Tomboy
{
/// <summary>
/// Wrap the RemoteControl class methods in Gtk.Application.Invoke.
/// </summary>
public class RemoteControlWrapper : MarshalByRefObject, IRemoteControl
{
#region Static Members
// Store the RemoteControl instance statically because:
// 1. We only want one anyway.
// 2. Otherwise .NET remoting will want to start
// serializing RemoteControl, NoteManager, etc.
private static RemoteControl remote;
public static void Initialize (RemoteControl remote)
{
RemoteControlWrapper.remote = remote;
}
#endregion
#region IRemoteControl Members
public bool AddTagToNote (string uri, string tag_name)
{
return remote.AddTagToNote (uri, tag_name);
}
public string CreateNamedNote (string linked_title)
{
return remote.CreateNamedNote (linked_title);
}
public string CreateNamedNoteWithUri (string linked_title, string uri)
{
return remote.CreateNamedNoteWithUri (linked_title, uri);
}
public string CreateNote ()
{
return remote.CreateNote ();
}
public bool DeleteNote (string uri)
{
return remote.DeleteNote (uri);
}
public bool DisplayNote (string uri)
{
bool result = false;
Gtk.Application.Invoke (delegate {
result = remote.DisplayNote (uri);
});
return result;
}
public bool DisplayNoteWithSearch (string uri, string search)
{
bool result = false;
Gtk.Application.Invoke (delegate {
result = remote.DisplayNoteWithSearch (uri, search);
});
return result;
}
public void DisplaySearch ()
{
Gtk.Application.Invoke (delegate {
remote.DisplaySearch ();
});
}
public void DisplaySearchWithText (string search_text)
{
Gtk.Application.Invoke (delegate {
remote.DisplaySearchWithText (search_text);
});
}
public string FindNote (string linked_title)
{
return remote.FindNote (linked_title);
}
public string FindStartHereNote ()
{
return remote.FindStartHereNote ();
}
public string [] GetAllNotesWithTag (string tag_name)
{
return remote.GetAllNotesWithTag (tag_name);
}
public long GetNoteChangeDate (string uri)
{
return remote.GetNoteChangeDate (uri);
}
public string GetNoteCompleteXml (string uri)
{
return remote.GetNoteCompleteXml (uri);
}
public string GetNoteContents (string uri)
{
return remote.GetNoteContents (uri);
}
public string GetNoteContentsXml (string uri)
{
return remote.GetNoteContentsXml (uri);
}
public long GetNoteCreateDate (string uri)
{
return remote.GetNoteCreateDate (uri);
}
public string GetNoteTitle (string uri)
{
return remote.GetNoteTitle (uri);
}
public string [] GetTagsForNote (string uri)
{
return remote.GetTagsForNote (uri);
}
public bool HideNote (string uri)
{
bool result = false;
Gtk.Application.Invoke (delegate {
result = remote.HideNote (uri);
});
return result;
}
public string [] ListAllNotes ()
{
return remote.ListAllNotes ();
}
public event RemoteAddedHandler NoteAdded;
public event RemoteDeletedHandler NoteDeleted;
public bool NoteExists (string uri)
{
return remote.NoteExists (uri);
}
public event RemoteSavedHandler NoteSaved;
public bool RemoveTagFromNote (string uri, string tag_name)
{
return remote.RemoveTagFromNote (uri, tag_name);
}
public string [] SearchNotes (string query, bool case_sensitive)
{
return remote.SearchNotes (query, case_sensitive);
}
public bool SetNoteCompleteXml (string uri, string xml_contents)
{
return remote.SetNoteCompleteXml (uri, xml_contents);
}
public bool SetNoteContents (string uri, string text_contents)
{
return remote.SetNoteContents (uri, text_contents);
}
public bool SetNoteContentsXml (string uri, string xml_contents)
{
return remote.SetNoteContentsXml (uri, xml_contents);
}
public string Version ()
{
return remote.Version ();
}
public string GetNotebookForNote (string uri)
{
return remote.GetNotebookForNote (uri);
}
public bool AddNoteToNotebook (string uri, string notebook_name)
{
return remote.AddNoteToNotebook (uri, notebook_name);
}
public string [] GetAllNotesInNotebook (string notebook_name)
{
return remote.GetAllNotesInNotebook (notebook_name);
}
public bool AddNotebook (string notebook_name)
{
return remote.AddNotebook (notebook_name);
}
#endregion
}
}