/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using ElmSharp;
using System;
namespace Tizen.Applications
{
///
/// Represents a factory class for making the RemoteView objects.
///
/// 3
[Obsolete("Deprecated since API10. Will be removed in API12.")]
public static class RemoteViewFactory
{
private static bool _ready;
///
/// Initializes RemoteViewFactory.
///
/// Window object that will contain RemoteViews that are generated by RemoteViewFactory.
/// All the remote views will be located in the specified window object.
///
/// http://tizen.org/privilege/widget.viewer
/// Thrown when this operation failed.
/// Thrown when this operation is denied.
/// Thrown when this operation is not supported for this device.
/// 3
[Obsolete("Deprecated since API10. Will be removed in API12.")]
public static void Init(EvasObject win)
{
if (_ready)
throw new InvalidOperationException("Already initialized");
RemoteView.CheckException(Interop.WidgetViewerEvas.Init(win));
_ready = true;
}
///
/// Creates a RemoteView object.
///
/// Parent object.
/// Widget ID.
/// Contents that will be given to the widget instance.
/// Update period.
/// True if you want to show the preview image.
/// True if you want to show the overlay text.
/// True if you want to show the loading message.
/// RemoteView object.
/// http://tizen.org/privilege/widget.viewer
/// Thrown when this operation failed.
/// Thrown when this operation is denied.
/// Thrown when this operation is not supported for this device.
/// 3
[Obsolete("Deprecated since API10. Will be removed in API12.")]
public static RemoteView Create(EvasObject parent, string widgetId, string content, double period,
bool previewImage = true, bool overlayText = true, bool loadingMessage = true)
{
if (!_ready)
throw new InvalidOperationException("Not initialized");
var obj = new RemoteView()
{
Layout = new RemoteWindow(parent, widgetId, content, period)
};
if (!previewImage)
obj.HidePreviewImage();
if (!overlayText)
obj.HideOverlayText();
if (!loadingMessage)
obj.HideLoadingMessage();
return obj;
}
///
/// Finalizes the RemoteViewFactory.
///
/// http://tizen.org/privilege/widget.viewer
/// Thrown when this operation failed.
/// Thrown when this operation is denied.
/// Thrown when this operation is not supported for this device.
/// 3
[Obsolete("Deprecated since API10. Will be removed in API12.")]
public static void Shutdown()
{
if (!_ready)
throw new InvalidOperationException("Not initialized");
RemoteView.CheckException(Interop.WidgetViewerEvas.Fini());
_ready = false;
}
}
}