public class ButtonStyles
{
public static ButtonStyle Next = GetNextButtonStyle();
- public static ButtonStyle Previous = new ButtonStyle {
- Text = new TextLabelStyle {
- PointSize = new Selector<float?> {
+ public static ButtonStyle Previous = new ButtonStyle
+ {
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?>
+ {
Normal = 22.0f,
Pressed = 24.0f
},
EnableMarkup = true,
Text = "PREVIOUS",
- TextColor = new Selector<Color> {
+ TextColor = new Selector<Color>
+ {
Normal = new Color(0.0f, 20.0f / 255.0f, 71 / 255.0f, 1.0f),
Pressed = new Color(41.0f / 255.0f, 91.0f / 255.0f, 178 / 255.0f, 1.0f),
}
Size2D = new Size2D(240, 72),
};
public static ButtonStyle Skip = GetSkipButtonStyle();
+ public static ButtonStyle Scan = new ButtonStyle
+ {
+ BackgroundImage = new Selector<string>
+ {
+ Normal = NUIApplication.Current.DirectoryInfo.Resource + "12_icon_scan.png",
+ },
+ Size2D = new Size2D(72, 32),
+ };
+ public static ButtonStyle AddNetwork = new ButtonStyle
+ {
+ BackgroundImage = new Selector<string>
+ {
+ Normal = NUIApplication.Current.DirectoryInfo.Resource + "12_icon_addnetwork.png",
+ },
+ Size2D = new Size2D(42, 42),
+ };
private static ButtonStyle GetSkipButtonStyle()
{
return style;
}
- private static ButtonStyle GetNextButtonStyle() => new ButtonStyle {
+ private static ButtonStyle GetNextButtonStyle() => new ButtonStyle
+ {
BackgroundImage = new Selector<string>
{
Normal = NUIApplication.Current.DirectoryInfo.Resource + "button/02_CTA_empty_active.svg",
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Oobe.Wifi.Controls.Wifi
+{
+ struct WifiInfo
+ {
+ }
+
+ internal class WifiState
+ {
+ public event Action OnTurningOnFailed;
+ public event Action OnTurnedOn;
+ public event Action OnTurnedOff;
+ public bool IsTurnedOn { get; private set; } = true;
+
+ private int counter = 1; //for verify
+ public void TurnWifi()
+ {
+ if (IsTurnedOn)
+ {
+ //turn off wifi
+ IsTurnedOn = false;
+ OnTurnedOff?.Invoke();
+
+ }
+ else
+ {
+ //for verify
+ counter++;
+ if (counter % 3 == 0)
+ {
+ OnTurningOnFailed?.Invoke();
+ return;
+ }
+ //turn on wifi
+ //if succesful
+ IsTurnedOn = true;
+ OnTurnedOn?.Invoke();
+ }
+ }
+
+ async Task<IEnumerable<WifiInfo>> Scan()
+ {
+ return await Task.FromResult<IEnumerable<WifiInfo>>(null);
+ }
+ }
+}
--- /dev/null
+using Oobe.Common.Styles;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Oobe.Wifi.Controls.Wifi
+{
+ public class WifiView : IDisposable
+ {
+ private View view = null;
+ private ObservableCollection<View> items;
+ private int counter = 0;
+
+ private WifiState State { get; set; } = new WifiState();
+
+ private static IEnumerable<View> CreateViews(string pattern)
+ {
+ yield return CreateManualWifiView(460, 89);
+ foreach (var item in Enumerable.Range(1, 10))
+ {
+ yield return CreateWifiView(460, 89, $"Wi-Fi_{item}");
+ }
+ }
+
+ public View View
+ {
+ get
+ {
+ if (view == null)
+ {
+ view = new View()
+ {
+ Layout = new LinearLayout()
+ {
+ LinearOrientation = LinearLayout.Orientation.Vertical,
+ },
+ BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "Rectangle_918.png"),
+ //Size = new Size(480, 401),
+ };
+ view.Add(CreateHeader(480, 80));
+
+ view.Add(new View()
+ {
+ Size2D = new Size(400, 1),
+ BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "Line_94.png"),
+ Margin = new Extents(40, 0, 0, 0),
+ });
+
+ view.Add(CreateListViewPlaceHolder());
+
+ ForVerify();
+ }
+ return view;
+ }
+ }
+
+ private async void ForVerify()
+ {
+ counter++;
+ if (counter > 4)
+ return;
+ if (view != null)
+ {
+ await Task.Delay(2000);
+ items.RemoveAt(1);
+ //items.Insert(1, CreateViewAbsolute($"s{counter}"));
+ ForVerify();
+ }
+ }
+
+ private static View CreateManualWifiView(int width, int height)
+ {
+ var manualWifi = new View()
+ {
+ Size = new Size(width, height),
+ Layout = new AbsoluteLayout(),
+ };
+
+ manualWifi.Add(new Button(ButtonStyles.AddNetwork)
+ {
+ Position = new Position(29, 20),
+ Size = new Size(42, 42),
+ });
+
+ manualWifi.Add(new TextLabel("Add new...")
+ {
+ Position = new Position(87, 29),
+ PixelSize = 20f,
+ TextColor = new Color(0, 0x0C / 255f, 0x2B / 255f, 1.0f),
+ FontFamily = "BreezeSans",
+ FontStyle = FontsStyles.Regular(),
+ });
+ return manualWifi;
+ }
+
+ private static View CreateWifiView(int width, int height, string name)
+ {
+ var wifi = new View()
+ {
+ Size = new Size(width, height),
+ Layout = new AbsoluteLayout(),
+ };
+
+ wifi.Add(new View()
+ {
+ //Size = new Size(21, 15),
+ Position = new Position(39, 32),
+ BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "12_icon_wifi.svg"),
+ });
+
+ wifi.Add(new TextLabel(name)
+ {
+ Position = new Position(78, 28),
+ PixelSize = 20f,
+ TextColor = new Color(0, 0x0C / 255f, 0x2B / 255f, 1.0f),
+ FontFamily = "BreezeSans",
+ FontStyle = FontsStyles.Light(),
+ });
+
+ wifi.Add(new TextLabel("detail")
+ {
+ Position = new Position(79, 56),
+ PixelSize = 14f,
+ TextColor = new Color(0, 0x0C / 255f, 0x2B / 255f, 1.0f),
+ FontFamily = "BreezeSans",
+ FontStyle = FontsStyles.Regular(),
+ });
+ return wifi;
+ }
+
+ private View CreateHeader(int width, int height)
+ {
+ var header = new View()
+ {
+ Size = new Size(width, height),
+ Layout = new AbsoluteLayout(),
+ };
+
+ header.Add(new TextLabel("Wi-Fi")
+ {
+ Size = new Size(49, 24),
+ Position = new Position(40, 43),
+ PixelSize = 19f,
+ TextColor = new Color(0, 14.0f / 255.0f, 47.0f / 255.0f, 1.0f),
+ FontFamily = "BreezeSans",
+ FontStyle = FontsStyles.Regular(),
+ });
+
+ header.Add(new Button(ButtonStyles.Scan)
+ {
+ Size = new Size(72, 32),
+ Position = new Position(276, 39),
+ });
+
+ header.Add(CreateTurnOnButton());
+ return header;
+ }
+
+ private Button CreateTurnOnButton()
+ {
+ var button = new Button(new ButtonStyle())
+ {
+ Size = new Size(72, 32),
+ Position = new Position(369, 39),
+ };
+ button.Style.BackgroundImage = NUIApplication.Current.DirectoryInfo.Resource +
+ (State.IsTurnedOn ? "12_icon_wifion.png" : "12_icon_wifioff.png");
+
+ State.OnTurnedOff += () =>
+ button.Style.BackgroundImage = NUIApplication.Current.DirectoryInfo.Resource + "12_icon_wifioff.png";
+ State.OnTurnedOn += () =>
+ button.Style.BackgroundImage = NUIApplication.Current.DirectoryInfo.Resource + "12_icon_wifion.png";
+
+ button.ClickEvent += (s, e) => State.TurnWifi();
+ return button;
+ }
+
+ private View CreateListViewPlaceHolder()
+ {
+ var view = new View();
+ items = new ObservableCollection<View>(CreateViews($"{counter} "));
+ var listView = new ListView(480, 328)//480, 335
+ {
+ Items = items
+ }.View;
+ listView.Hide();
+ view.Add(listView);
+
+ var prompt = new TextLabel()
+ {
+ Position = new Position(42, 32),
+ PixelSize = 20,
+ TextColor = new Color(0, 0x14 / 255f, 0x47 / 255f, 1.0f),
+ FontFamily = "BreezeSans",
+ FontStyle = FontsStyles.Regular(),
+ };
+ view.Add(prompt);
+
+ void turnOn()
+ {
+ prompt.Hide();
+ listView.Show();
+ }
+ void turnOff(string message)
+ {
+ listView.Hide();
+ prompt.Text = message;
+ prompt.Show();
+ }
+ if (State.IsTurnedOn)
+ turnOn();
+ else
+ turnOff("To see available networks, turn on Wi - Fi.");
+ State.OnTurnedOff += () => turnOff("To see available networks, turn on Wi - Fi.");
+ State.OnTurnedOn += () => turnOn();
+ State.OnTurningOnFailed += () => turnOff("Connection failed.");
+ return view;
+ }
+
+ public void Dispose()
+ {
+ view = null;
+ }
+ }
+}
+++ /dev/null
-using Oobe.Common.Styles;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Threading.Tasks;
-using Tizen.NUI;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
-
-namespace Oobe.Wifi.Controls
-{
- public class WifiView : IDisposable
- {
- private View view = null;
- private ObservableCollection<View> items;
- private int counter = 0;
-
- private static IEnumerable<View> CreateViews(string pattern)
- {
- yield return CreateManualWifiView(460, 89);
- foreach (var item in Enumerable.Range(1, 10))
- {
- yield return CreateWifiView(460, 89, $"Wi-Fi_{item}");
- }
- }
-
- public View View
- {
- get
- {
- if (view == null)
- {
- view = new View()
- {
- Layout = new LinearLayout()
- {
- LinearOrientation = LinearLayout.Orientation.Vertical,
- },
- BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "Rectangle_918.png"),
- //Size = new Size(480, 401),
- };
- view.Add(CreateHeader(480, 80));
-
- view.Add(new View() // separator doesn't display
- {
- Size2D = new Size(400, 1),
- BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "Line_94.png"),
- Margin = new Extents(40, 0, 0, 0),
- });
-
- items = new ObservableCollection<View>(CreateViews($"{counter} "));
- view.Add(new ListView(480, 328)//480, 335
- {
- Items = items
- }.View);
-
- ForVerify();
- }
- return view;
- }
- }
-
- private async void ForVerify()
- {
- counter++;
- if (counter > 4)
- return;
- if (view != null)
- {
- await Task.Delay(2000);
- items.RemoveAt(1);
- //items.Insert(1, CreateViewAbsolute($"s{counter}"));
- ForVerify();
- }
- }
-
- private static View CreateManualWifiView(int width, int height)
- {
- var manualWifi = new View()
- {
- Size = new Size(width, height),
- Layout = new AbsoluteLayout(),
- };
-
- manualWifi.Add(new View()
- {
- Position = new Position(29, 20),
- BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "12_icon_addnetwork.png"),
- });
-
- manualWifi.Add(new TextLabel("Add new...")
- {
- Position = new Position(87, 29),
- PixelSize = 20f,
- TextColor = new Color(0, 0x0C / 255f, 0x2B / 255f, 1.0f),
- FontFamily = "BreezeSans",
- FontStyle = FontsStyles.Regular(),
- });
- return manualWifi;
- }
-
- private static View CreateWifiView(int width, int height, string name)
- {
- var wifi = new View()
- {
- Size = new Size(width, height),
- Layout = new AbsoluteLayout(),
- };
-
- wifi.Add(new View()
- {
- //Size = new Size(21, 15),
- Position = new Position(39, 32),
- BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "12_icon_wifi.svg"),
- });
-
- wifi.Add(new TextLabel(name)
- {
- Position = new Position(78, 28),
- PixelSize = 20f,
- TextColor = new Color(0, 0x0C / 255f, 0x2B / 255f, 1.0f),
- FontFamily = "BreezeSans",
- FontStyle = FontsStyles.Light(),
- });
-
- wifi.Add(new TextLabel("detail")
- {
- Position = new Position(79, 56),
- PixelSize = 14f,
- TextColor = new Color(0, 0x0C / 255f, 0x2B / 255f, 1.0f),
- FontFamily = "BreezeSans",
- FontStyle = FontsStyles.Regular(),
- });
- return wifi;
- }
-
- private static View CreateHeader(int width, int height)
- {
- var header = new View()
- {
- Size = new Size(width, height),
- Layout = new AbsoluteLayout(),
- };
-
- header.Add(new TextLabel("Wi-Fi")
- {
- Size = new Size(49, 24),
- Position = new Position(40, 43),
- PixelSize = 19f,
- TextColor = new Color(0, 14.0f / 255.0f, 47.0f / 255.0f, 1.0f),
- FontFamily = "BreezeSans",
- FontStyle = FontsStyles.Regular(),
- });
-
- header.Add(new Button()
- {
- Text = "Scan",
- Size = new Size(72, 32),
- Position = new Position(276, 39),
- });
-
- header.Add(new Button()
- {
- Text = "Off",
- Size = new Size(72, 32),
- Position = new Position(369, 39),
- });
- return header;
- }
-
- public void Dispose()
- {
- view = null;
- }
- }
-}
using Oobe.Common.Interfaces;
using Oobe.Common.Styles;
-using Oobe.Wifi.Controls;
using Tizen.NUI.Components;
using Tizen.NUI;
using Tizen.NUI.BaseComponents;
+using Oobe.Wifi.Controls.Wifi;
namespace Oobe.Wifi
{
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="72" height="32" viewBox="0 0 72 32"><defs><style>.a,.d{fill:none;}.a{stroke:#205247;}.b{fill:#205247;font-size:18px;font-family:BreezeSans;}.c{stroke:none;}</style></defs><g class="a"><rect class="c" width="72" height="32" rx="16"/><rect class="d" x="0.5" y="0.5" width="71" height="31" rx="15.5"/></g><text class="b" transform="translate(17 22)"><tspan x="0" y="0">Scan</tspan></text></svg>
\ No newline at end of file
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="72" height="32" viewBox="0 0 72 32"><defs><style>.a{fill:#dfeae4;}.b,.c{fill:#205247;}.b{font-size:18px;font-family:BreezeSans;}</style></defs><rect class="a" width="72" height="32" rx="16"/><text class="b" transform="translate(29 22)"><tspan x="0" y="0">OFF</tspan></text><circle class="c" cx="6" cy="6" r="6" transform="translate(11 10)"/></svg>
\ No newline at end of file
--- /dev/null
+<svg xmlns="http://www.w3.org/2000/svg" width="72" height="32" viewBox="0 0 72 32"><defs><style>.a{fill:#205247;}.b,.c{fill:#fff;}.b{font-size:18px;font-family:BreezeSans;}</style></defs><rect class="a" width="72" height="32" rx="16"/><text class="b" transform="translate(14 22)"><tspan x="0" y="0">ON</tspan></text><circle class="c" cx="6" cy="6" r="6" transform="translate(47 9)"/></svg>
\ No newline at end of file