--- /dev/null
+/*
+ * Copyright (c) 2016 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 System;
+
+namespace ElmSharp.Wearable
+{
+ static class Preload
+ {
+ static public void WarmupWidgets(PreloadedWindow win)
+ {
+ var surface = new CircleSurface(win.BaseConformant);
+ win.BaseCircleSurface = surface;
+ new CircleDateTimeSelector(win, surface).Unrealize();
+ new CircleProgressBar(win, surface).Unrealize();
+ new CircleScroller(win, surface).Unrealize();
+ new CircleSlider(win, surface).Unrealize();
+ new CircleSpinner(win, surface).Unrealize();
+ new MoreOption(win).Unrealize();
+ }
+ }
+}
* limitations under the License.
*/
+using System;
+using System.ComponentModel;
+using System.Reflection;
+
namespace ElmSharp
{
- internal class PreloadedWindow : Window
+ /// <summary>
+ /// Pre-created window which prepares features that takes time in advance.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class PreloadedWindow : Window
{
static PreloadedWindow s_precreated;
- public PreloadedWindow(bool useBaseLayout=true) : base("PreloadWindow")
+ internal PreloadedWindow(bool useBaseLayout=true) : base("PreloadWindow")
{
s_precreated = this;
if (useBaseLayout)
BackButtonPressed += DummyHandler;
BackButtonPressed -= DummyHandler;
void DummyHandler(object sender, System.EventArgs e) { }
+
+ if (Elementary.GetProfile() == "wearable")
+ {
+ WarmupWearableWidgets();
+ }
}
public Layout BaseLayout
protected set;
}
+ public Conformant BaseConformant
+ {
+ get;
+ protected set;
+ }
+
+ public object BaseCircleSurface
+ {
+ get;
+ set;
+ }
+
+
public void InitializeBaseLayout()
{
var conformant = new Conformant(this);
+ BaseConformant = conformant;
conformant.Show();
var layout = new Layout(conformant);
new Index(this).Unrealize();
}
+ public void WarmupWearableWidgets()
+ {
+ try
+ {
+ Assembly assem = Assembly.Load("ElmSharp.Wearable");
+ var type = assem.GetType("ElmSharp.Wearable.Preload");
+ type.GetMethod("WarmupWidgets", BindingFlags.Public | BindingFlags.Static).Invoke(null, new object[] { this });
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e.ToString());
+ Console.WriteLine("Fail to preload ElmSharp.Wearable");
+ }
+ }
+
public static PreloadedWindow GetInstance()
{
var instance = s_precreated;