{
private WiFi mWifi;
private APSource mApSource;
-
- private static readonly int itemCount = 3;
- private MenuItem[] menuItems = new MenuItem[itemCount];
+ private Button mScanButton, mAddNetwork;
public override string ProvideIconPath() => GetResourcePath("main-menu-wifi-icon.svg");
public override Color ProvideIconColor() => new Color(ThemeManager.PlatformThemeId == "org.tizen.default-light-theme" ? "#FF6200" : "#FF8A00");
public override IEnumerable<View> ProvideMoreActions()
{
- var scanButton = new Button()
+ bool? active = GetWifiState();
+ bool wifiState = active.HasValue && active.Value;
+
+ ViewStyle viewStyle = GetButtonViewStyle();
+
+ mScanButton = new Button()
{
Text = Resources.IDS_WIFI_BUTTON_SCAN,
- IsEnabled = GetWifiState().HasValue,
+ IsEnabled = wifiState,
};
- scanButton.Clicked += OnScanClicked;
+ mScanButton.Clicked += OnScanClicked;
+ mScanButton.ApplyStyle(viewStyle);
- var addNetwork = new Button()
+ mAddNetwork = new Button()
{
Text = Resources.IDS_ST_BODY_ADD_NETWORK,
- IsEnabled = GetWifiState().HasValue,
+ IsEnabled = wifiState,
};
- addNetwork.Clicked += OnAddNetworkClicked;
+ mAddNetwork.Clicked += OnAddNetworkClicked;
+ mAddNetwork.ApplyStyle(viewStyle);
- return new View[] { scanButton, addNetwork };
+ return new View[] { mScanButton, mAddNetwork };
+ }
+
+ private ViewStyle GetButtonViewStyle()
+ {
+ ViewStyle viewStyle = new ViewStyle();
+ viewStyle.Opacity = new Selector<float?>()
+ {
+ Normal = 1.0f,
+ Disabled = 0.0f
+ };
+
+ return viewStyle;
}
protected override View OnCreate()
await mWifi.Activate();
}
/* TODO: auto connect */
+ UpdateMainPageButtonState(true);
mApSource.UpdateGroupTitle(Resources.IDS_ST_HEADER_AVAILABLE_NETWORKS);
ScanAP();
}
}
mApSource.RemoveScanList();
mApSource.UpdateGroupTitle("");
+ UpdateMainPageButtonState(false);
}
}
+ private void UpdateMainPageButtonState(bool isEnabled)
+ {
+ mScanButton.IsEnabled = isEnabled;
+ mAddNetwork.IsEnabled = isEnabled;
+ }
+
private void OnScanClicked(object sender, ClickedEventArgs e)
{
Debug("OnScanClicked");