2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.Runtime.InteropServices;
21 namespace Tizen.Applications
24 /// Represents the proxy class for the widget application.
26 /// <since_tizen> 3 </since_tizen>
27 [Obsolete("Deprecated since API10. Will be removed in API12.")]
28 public class RemoteView
31 /// The event types to send.
33 /// <since_tizen> 3 </since_tizen>
34 [Obsolete("Deprecated since API10. Will be removed in API12.")]
38 /// Type for feeding the mouse-up event to the widget application.
43 /// Type for canceling the click event procedure.
49 /// Layout object including preview image, overlay text, loading text, and remote screen image.
51 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
52 /// <since_tizen> 3 </since_tizen>
53 [Obsolete("Deprecated since API10. Will be removed in API12.")]
54 public Layout Layout { get; internal set; }
59 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
60 /// <since_tizen> 3 </since_tizen>
61 [Obsolete("Deprecated since API10. Will be removed in API12.")]
66 IntPtr ptr = Interop.WidgetViewerEvas.GetWidgetId(Layout);
68 return Marshal.PtrToStringAnsi(ptr);
73 /// The update period.
75 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
76 /// <since_tizen> 3 </since_tizen>
77 [Obsolete("Deprecated since API10. Will be removed in API12.")]
82 return Interop.WidgetViewerEvas.GetPeriod(Layout);
87 /// Contents of the widget.
90 /// This string can be used for creating contents of the widget again after rebooting a device or it can be recovered from a crash (abnormal status).
92 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
93 /// <since_tizen> 3 </since_tizen>
94 [Obsolete("Deprecated since API10. Will be removed in API12.")]
99 IntPtr ptr = Interop.WidgetViewerEvas.GetContentInfo(Layout);
101 return Marshal.PtrToStringAnsi(ptr);
106 /// Summarized string of the widget content for accessibility.
108 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
109 /// <since_tizen> 3 </since_tizen>
110 [Obsolete("Deprecated since API10. Will be removed in API12.")]
115 IntPtr ptr = Interop.WidgetViewerEvas.GetTitleString(Layout);
117 return Marshal.PtrToStringAnsi(ptr);
121 internal RemoteView()
125 internal static void CheckException(Interop.WidgetViewerEvas.ErrorCode err)
129 case Interop.WidgetViewerEvas.ErrorCode.Fault:
130 throw new InvalidOperationException("Fault at unmanaged code");
132 case Interop.WidgetViewerEvas.ErrorCode.PermissionDenied:
133 throw new UnauthorizedAccessException();
135 case Interop.WidgetViewerEvas.ErrorCode.NotSupported:
136 throw new NotSupportedException();
138 case Interop.WidgetViewerEvas.ErrorCode.InvalidParameter:
139 throw new InvalidOperationException("Invalid parameter error at unmanaged code");
141 case Interop.WidgetViewerEvas.ErrorCode.AlreadyExist:
142 throw new InvalidOperationException("Already exist");
144 case Interop.WidgetViewerEvas.ErrorCode.MaxExceeded:
145 throw new InvalidOperationException("Max exceeded");
147 case Interop.WidgetViewerEvas.ErrorCode.Disabled:
148 throw new InvalidOperationException("Disabled");
151 throw new InvalidOperationException("Invalid Operation");
156 /// Pauses all the connected widget applications.
158 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
159 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
160 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
161 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
162 /// <since_tizen> 3 </since_tizen>
163 [Obsolete("Deprecated since API10. Will be removed in API12.")]
164 public static void PauseAll()
166 CheckException(Interop.WidgetViewerEvas.NotifyPausedStatusOfViewer());
170 /// Resumes all the connected widget applications.
172 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
173 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
174 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
175 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
176 /// <since_tizen> 3 </since_tizen>
177 [Obsolete("Deprecated since API10. Will be removed in API12.")]
178 public static void ResumeAll()
180 CheckException(Interop.WidgetViewerEvas.NotifyResumedStatusOfViewer());
184 /// Pauses the widget application which is connected on this proxy.
186 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
187 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
188 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
189 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
190 /// <since_tizen> 3 </since_tizen>
191 [Obsolete("Deprecated since API10. Will be removed in API12.")]
194 CheckException(Interop.WidgetViewerEvas.PauseWidget(Layout));
198 /// Resumes the widget application which is connected on this proxy.
200 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
201 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
202 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
203 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
204 /// <since_tizen> 3 </since_tizen>
205 [Obsolete("Deprecated since API10. Will be removed in API12.")]
208 CheckException(Interop.WidgetViewerEvas.ResumeWidget(Layout));
212 /// Sends the event to the widget application which is connected on this proxy.
214 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
215 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
216 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
217 /// <since_tizen> 3 </since_tizen>
218 [Obsolete("Deprecated since API10. Will be removed in API12.")]
219 public void SendEvent(Event ev)
223 case Event.FeedMouseUp:
224 Interop.WidgetViewerEvas.FeedMouseUpEvent(Layout);
227 case Event.CancelClick:
228 Interop.WidgetViewerEvas.CancelClickEvent(Layout);
232 throw new NotSupportedException("Not supported event type");
235 int err = Internals.Errors.ErrorFacts.GetLastResult();
236 CheckException((Interop.WidgetViewerEvas.ErrorCode)err);
239 internal void HideLoadingMessage()
241 Interop.WidgetViewerEvas.DisableLoading(Layout);
242 int err = Internals.Errors.ErrorFacts.GetLastResult();
243 CheckException((Interop.WidgetViewerEvas.ErrorCode)err);
246 internal void HidePreviewImage()
248 Interop.WidgetViewerEvas.DisablePreview(Layout);
249 int err = Internals.Errors.ErrorFacts.GetLastResult();
250 CheckException((Interop.WidgetViewerEvas.ErrorCode)err);
253 internal void HideOverlayText()
255 Interop.WidgetViewerEvas.DisableOverlayText(Layout);
256 int err = Internals.Errors.ErrorFacts.GetLastResult();
257 CheckException((Interop.WidgetViewerEvas.ErrorCode)err);