{
//TODO consider loading this from xaml, xml or something...
steps = new LinkedList<Lazy<ProcessStep>>(new []{
+ new Lazy<ProcessStep>(() => new WifiStep()),
new Lazy<ProcessStep>(() => new LanguageStep()),
new Lazy<ProcessStep>(() => new RegionStep()),
new Lazy<ProcessStep>(() => new TermsStep()),
- new Lazy<ProcessStep>(() => new WifiStep()),
+
new Lazy<ProcessStep>(() => new WelcomeStep()),
}
);
using Tizen.NUI;
using Tizen.NUI.BaseComponents;
-namespace OobeCommon.Utils
+namespace Oobe.Common.Utils
{
- public static class Popup
+ public class Popup
{
- private static Layer layer = null;
+ private View view;
+ private Layer layer = null;
- public static void ShowCentered(View view)
+ public Popup(View view, bool centered = false)
{
- view.PositionUsesPivotPoint = true;
- view.PivotPoint = new Position(0.5f, 0.5f);
- view.ParentOrigin = new Position(0.5f, 0.5f);
- Show(view);
+ this.view = view;
+ if (centered)
+ {
+ view.PositionUsesPivotPoint = true;
+ view.PivotPoint = new Position(0.5f, 0.5f);
+ view.ParentOrigin = new Position(0.5f, 0.5f);
+ }
+ }
+
+ public void Show()
+ {
+ if (layer != null)
+ {
+ layer.Visibility = true;
+ }
+ else
+ {
+ ShowCore();
+ }
+ }
+
+ public void Hide()
+ {
+ if (layer != null)
+ {
+ layer.Visibility = false;
+ }
+ }
+
+ public void Dismiss()
+ {
+ if (layer != null)
+ {
+ Window.Instance.RemoveLayer(layer);
+ layer.Dispose();
+ layer = null;
+ }
}
- public static void Show(View view)
+ private void ShowCore()
{
Dismiss();
layer = new Layer();
layer.Add(view);
Window.Instance.AddLayer(layer);
}
-
- public static void Dismiss()
- {
- if (layer != null)
- {
- Window.Instance.RemoveLayer(layer);
- layer.Dispose();
- layer = null;
- }
- }
}
}
{
class WifiPasswordPopup : View
{
+ public event Action OnDismiss;
private PasswordEntry passwordEntry = null;
private Button okButton;
private Button cancelButton;
};
cancelButton.ClickEvent += (s, e) =>
{
- OobeCommon.Utils.Popup.Dismiss();
+ OnDismiss.Invoke();
};
this.Add(cancelButton);
UpdateOKButton();
if (success == true)
{
- OobeCommon.Utils.Popup.Dismiss();
+ OnDismiss.Invoke();
}
else
{
return manualWifi;
}
- private static View CreatePasswordPopup(Tizen.Network.WiFi.WiFiAP wifiAp)
+ private static async void ShowPasswordPopup(Tizen.Network.WiFi.WiFiAP wifiAp)
{
- var popup = new WifiPasswordPopup(wifiAp);
- return popup;
+ var view = new WifiPasswordPopup(wifiAp);
+ var popup = new Common.Utils.Popup(view);
+ view.OnDismiss += popup.Dismiss;
+ popup.Show();
+
+ //for verify
+ await System.Threading.Tasks.Task.Delay(1_000);
+ new Common.Utils.Popup(new View
+ {
+ BackgroundColor = Color.Red,
+ Size = new Size(100, 100)
+ }, centered: true)
+ .Show();
}
private static void OnApTapped(Tizen.Network.WiFi.WiFiAP wifiAp)
Tizen.Log.Debug("oobe", $"Already connected to {wifiAp.NetworkInformation.Essid}");
return;
}
- //show center requires correction
- //OobeCommon.Utils.Popup.ShowCentered(CreatePasswordPopup());
- OobeCommon.Utils.Popup.Show(CreatePasswordPopup(wifiAp));
+ ShowPasswordPopup(wifiAp);
}
private View CreateHeader(int width, int height)