|
1 |
| -/* |
2 |
| - The MIT License (MIT) |
3 |
| -
|
4 |
| - Copyright (c) 2005-2015 kiwidoggie productions |
5 |
| -
|
6 |
| - Permission is hereby granted, free of charge, to any person obtaining a copy |
7 |
| - of this software and associated documentation files (the "Software"), to deal |
8 |
| - in the Software without restriction, including without limitation the rights |
9 |
| - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 |
| - copies of the Software, and to permit persons to whom the Software is |
11 |
| - furnished to do so, subject to the following conditions: |
12 |
| -
|
13 |
| - The above copyright notice and this permission notice shall be included in all |
14 |
| - copies or substantial portions of the Software. |
15 |
| -
|
16 |
| - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 |
| - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 |
| - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 |
| - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 |
| - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 |
| - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22 |
| - SOFTWARE. |
23 |
| -
|
24 |
| -*/ |
25 |
| - |
26 |
| -using System; |
27 |
| -using System.Collections.Generic; |
28 |
| -using System.Linq; |
29 |
| -using System.Text; |
30 |
| -using System.Threading.Tasks; |
31 |
| - |
32 |
| -// WPF User Control |
33 |
| -using System.Windows.Controls; |
34 |
| - |
35 |
| -// Plugin System |
36 |
| -using Rime.Core.Plugins; |
| 1 | +using System.Windows.Controls; |
| 2 | +using RimeCommon.Logging; |
| 3 | +using RimeCommon.Plugins; |
37 | 4 |
|
38 | 5 | namespace RimePluginExample
|
39 | 6 | {
|
40 |
| - public class RimeExamplePlugin : IPlugin |
| 7 | + public class RimeExamplePlugin : RimePlugin |
41 | 8 | {
|
42 |
| - public string Name { get { return "RimeExamplePlugin"; } } |
43 |
| - public string Author { get { return "kiwidog"; } } |
44 |
| - public string Version { get { return "v0.1"; } } |
45 |
| - public string Description { get { return "Description"; } } |
46 |
| - public string Extension { get { return "example"; } } |
47 |
| - public bool UIEnabled { get { return MainControl != null; } } |
48 |
| - public UserControl MainControl { get; private set; } |
49 |
| - |
50 |
| - /// <summary> |
51 |
| - /// Initialization with no parameters |
52 |
| - /// </summary> |
53 |
| - /// <returns>True for success, False for failure</returns> |
54 |
| - public bool Init() |
55 |
| - { |
56 |
| - return true; |
57 |
| - } |
58 |
| - |
59 |
| - /// <summary> |
60 |
| - /// Initalization with one parameter, plugin will have to do all type and cast checking itself. |
61 |
| - /// </summary> |
62 |
| - /// <param name="p_Object">Object passed as argument</param> |
63 |
| - /// <returns>True for success, False for failure</returns> |
64 |
| - public bool Init(object p_Object) |
| 9 | + public override string Name { get { return "Rime Example Plugin"; } } |
| 10 | + public override string Author { get { return "Example Author"; } } |
| 11 | + public override string Version { get { return "1.0"; } } |
| 12 | + public override string Description { get { return "An description for the example plugin, hmmm.... what should it be?"; } } |
| 13 | + public override string Extension { get { return "_rime-plugin-example"; } } |
| 14 | + public override UserControl MainControl { get { return null; } } |
| 15 | + public override MountPoint Mount { get { return MountPoint.Center; } } |
| 16 | + |
| 17 | + public RimeExamplePlugin() |
65 | 18 | {
|
66 |
| - return false; |
| 19 | + WriteLog(LogsLevel.All, "RimeExamplePlugin ctor called."); |
67 | 20 | }
|
68 | 21 |
|
69 |
| - /// <summary> |
70 |
| - /// Initialization with multiple parameters, plugin will have to do all type and cast checking itself. |
71 |
| - /// </summary> |
72 |
| - /// <param name="p_Objects">Array of objects passed as arguments</param> |
73 |
| - /// <returns>True for success, False for failure</returns> |
74 |
| - public bool Init(object[] p_Objects) |
| 22 | + public override void Init() |
75 | 23 | {
|
76 |
| - return false; |
77 |
| - } |
78 |
| - |
79 |
| - /// <summary> |
80 |
| - /// Close is called when the plugin is being destroyed, free all memory, ui, resources here. |
81 |
| - /// </summary> |
82 |
| - public void Close() |
83 |
| - { |
84 |
| - |
| 24 | + |
85 | 25 | }
|
86 | 26 | }
|
87 | 27 | }
|
0 commit comments