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",
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Components;
-namespace Oobe.Wifi.Controls
+namespace Oobe.Wifi.Controls.Wifi
{
public class WifiView : IDisposable
{
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);
};
view.Add(CreateHeader(480, 80));
- view.Add(new View() // separator doesn't display
+ 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),
});
- items = new ObservableCollection<View>(CreateViews($"{counter} "));
- view.Add(new ListView(480, 328)//480, 335
- {
- Items = items
- }.View);
+ view.Add(CreateListViewPlaceHolder());
ForVerify();
}
Layout = new AbsoluteLayout(),
};
- manualWifi.Add(new View()
+ manualWifi.Add(new Button(ButtonStyles.AddNetwork)
{
Position = new Position(29, 20),
- BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "12_icon_addnetwork.png"),
+ Size = new Size(42, 42),
});
manualWifi.Add(new TextLabel("Add new...")
return wifi;
}
- private static View CreateHeader(int width, int height)
+ private View CreateHeader(int width, int height)
{
var header = new View()
{
FontStyle = FontsStyles.Regular(),
});
- header.Add(new Button()
+ header.Add(new Button(ButtonStyles.Scan)
{
- Text = "Scan",
Size = new Size(72, 32),
Position = new Position(276, 39),
});
- header.Add(new Button()
+ header.Add(CreateTurnOnButton());
+ return header;
+ }
+
+ private Button CreateTurnOnButton()
+ {
+ var button = new Button(new ButtonStyle())
{
- Text = "Off",
Size = new Size(72, 32),
Position = new Position(369, 39),
- });
- return header;
+ };
+ 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()