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.
20 namespace Tizen.Applications
23 /// Represents a factory class for making the RemoteView objects.
25 public static class RemoteViewFactory
27 private static bool _ready;
30 /// Initializes RemoteViewFactory.
32 /// <param name="win">Window object that will contain RemoteViews that are generated by RemoteViewFactory.
33 /// All the remote views will be located in the specified window object.
35 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
36 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
37 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
38 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
39 public static void Init(EvasObject win)
42 throw new InvalidOperationException("Already initialized");
43 RemoteView.CheckException(Interop.WidgetViewerEvas.Init(win));
48 /// Creates a RemoteView object.
50 /// <param name="parent">Parent object.</param>
51 /// <param name="widgetId">Widget ID.</param>
52 /// <param name="content">Contents that will be given to the widget instance.</param>
53 /// <param name="period">Update period.</param>
54 /// <param name="previewImage">True if you want to show the preview image.</param>
55 /// <param name="overlayText">True if you want to show the overlay text.</param>
56 /// <param name="loadingMessage">True if you want to show the loading message.</param>
57 /// <returns>RemoteView object.</returns>
58 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
59 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
60 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
61 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
62 public static RemoteView Create(EvasObject parent, string widgetId, string content, double period,
63 bool previewImage = true, bool overlayText = true, bool loadingMessage = true)
66 throw new InvalidOperationException("Not initialized");
68 var obj = new RemoteView()
70 Layout = new RemoteWindow(parent, widgetId, content, period)
74 obj.HidePreviewImage();
77 obj.HideOverlayText();
80 obj.HideLoadingMessage();
86 /// Finalizes the RemoteViewFactory.
88 /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
89 /// <exception cref="InvalidOperationException">Thrown when this operation failed.</exception>
90 /// <exception cref="UnauthorizedAccessException">Thrown when this operation is denied.</exception>
91 /// <exception cref="NotSupportedException">Thrown when this operation is not supported for this device.</exception>
92 public static void Shutdown()
95 throw new InvalidOperationException("Not initialized");
96 RemoteView.CheckException(Interop.WidgetViewerEvas.Fini());