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)
127 if (err != Interop.WidgetViewerEvas.ErrorCode.None)
131 case Interop.WidgetViewerEvas.ErrorCode.Fault:
132 throw new InvalidOperationException("Fault at unmanaged code");
134 case Interop.WidgetViewerEvas.ErrorCode.PermissionDenied:
135 throw new UnauthorizedAccessException();
137 case Interop.WidgetViewerEvas.ErrorCode.NotSupported:
138 throw new NotSupportedException();
140 case Interop.WidgetViewerEvas.ErrorCode.InvalidParameter:
141 throw new InvalidOperationException("Invalid parameter error at unmanaged code");
143 case Interop.WidgetViewerEvas.ErrorCode.AlreadyExist:
144 throw new InvalidOperationException("Already exist");
146 case Interop.WidgetViewerEvas.ErrorCode.MaxExceeded:
147 throw new InvalidOperationException("Max exceeded");
149 case Interop.WidgetViewerEvas.ErrorCode.Disabled:
150 throw new InvalidOperationException("Disabled");
153 throw new InvalidOperationException("Invalid Operation");
159 /// Pauses all the connected widget applications.
161 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
162 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
163 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
164 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
165 /// <since_tizen> 3 </since_tizen>
166 [Obsolete("Deprecated since API10. Will be removed in API12.")]
167 public static void PauseAll()
169 CheckException(Interop.WidgetViewerEvas.NotifyPausedStatusOfViewer());
173 /// Resumes all the connected widget applications.
175 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
176 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
177 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
178 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
179 /// <since_tizen> 3 </since_tizen>
180 [Obsolete("Deprecated since API10. Will be removed in API12.")]
181 public static void ResumeAll()
183 CheckException(Interop.WidgetViewerEvas.NotifyResumedStatusOfViewer());
187 /// Pauses the widget application which is connected on this proxy.
189 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
190 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
191 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
192 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
193 /// <since_tizen> 3 </since_tizen>
194 [Obsolete("Deprecated since API10. Will be removed in API12.")]
197 CheckException(Interop.WidgetViewerEvas.PauseWidget(Layout));
201 /// Resumes the widget application which is connected on this proxy.
203 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
204 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
205 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
206 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
207 /// <since_tizen> 3 </since_tizen>
208 [Obsolete("Deprecated since API10. Will be removed in API12.")]
211 CheckException(Interop.WidgetViewerEvas.ResumeWidget(Layout));
215 /// Sends the event to the widget application which is connected on this proxy.
217 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
218 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
219 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
220 /// <since_tizen> 3 </since_tizen>
221 [Obsolete("Deprecated since API10. Will be removed in API12.")]
222 public void SendEvent(Event ev)
226 case Event.FeedMouseUp:
227 Interop.WidgetViewerEvas.FeedMouseUpEvent(Layout);
230 case Event.CancelClick:
231 Interop.WidgetViewerEvas.CancelClickEvent(Layout);
235 throw new NotSupportedException("Not supported event type");
238 int err = Internals.Errors.ErrorFacts.GetLastResult();
239 CheckException((Interop.WidgetViewerEvas.ErrorCode)err);
242 internal void HideLoadingMessage()
244 Interop.WidgetViewerEvas.DisableLoading(Layout);
245 int err = Internals.Errors.ErrorFacts.GetLastResult();
246 CheckException((Interop.WidgetViewerEvas.ErrorCode)err);
249 internal void HidePreviewImage()
251 Interop.WidgetViewerEvas.DisablePreview(Layout);
252 int err = Internals.Errors.ErrorFacts.GetLastResult();
253 CheckException((Interop.WidgetViewerEvas.ErrorCode)err);
256 internal void HideOverlayText()
258 Interop.WidgetViewerEvas.DisableOverlayText(Layout);
259 int err = Internals.Errors.ErrorFacts.GetLastResult();
260 CheckException((Interop.WidgetViewerEvas.ErrorCode)err);