private WiFi mWifi;
private APSource mApSource;
private AP mAp;
- private string mPassword;
private AddNetworkItem mNetworkItem;
CheckBox mShowAdvancedButton;
CollectionView mAdvancedViewCollection;
CollectionView mNetworkDetailsCollection;
- Window mWindow = NUIApplication.GetDefaultWindow();
internal AddNetwork(WiFi wifi)
{
mWifi = wifi;
- mNetworkItem = new AddNetworkItem("None", "DHCP", "None");
+ mNetworkItem = new AddNetworkItem(Resources.IDS_ST_BODY_NONE, "DHCP", Resources.IDS_ST_BODY_NONE);
}
internal void CreateComponents(APSource apSource)
{
OnIPSettingsClicked(sender, e);
}
- else if (info.InfoTitle == Resources.IDS_ST_SBODY_PROXY_ADDRESS)
+ else if (info.InfoTitle == Resources.IDS_WIFI_BODY_PROXY)
{
OnProxyClicked(sender, e);
}
string[] options = new string[]
{
- "DHCP",
"Static",
+ "DHCP",
};
- var page = new AddNetworkInfoInputPage(mNetworkItem, mNetworkDetailsInfoSource);
+ var page = new AddNetworkInfoInputPage(mNetworkItem, mAddNetworkInfoSource);
page.CreateRadioComponents(Resources.IDS_WIFI_BODY_IP_SETTINGS, options);
NUIApplication.GetDefaultWindow().GetDefaultNavigator().Push(page);
}
"Manual",
};
- var page = new AddNetworkInfoInputPage(mNetworkItem, mNetworkDetailsInfoSource);
- page.CreateRadioComponents(Resources.IDS_ST_SBODY_PROXY_ADDRESS, options);
+ var page = new AddNetworkInfoInputPage(mNetworkItem, mAddNetworkInfoSource);
+ page.CreateRadioComponents(Resources.IDS_WIFI_BODY_PROXY, options);
NUIApplication.GetDefaultWindow().GetDefaultNavigator().Push(page);
}
}
}
}
-
private TextField mValueField;
private RadioButton[] mRadioButtons;
private RadioButtonGroup mGroup;
- private ButtonStyle mRadioButtonStyle;
-
private string mTitle;
private int mCount;
private string mImagesPath;
private string[] mOptionNames;
-
+ private int mSelectedIndex;
internal AddNetworkInfoInputPage(AddNetworkItem item, AddNetworkInfoSource infoSource)
{
HeightSpecification = LayoutParamPolicies.WrapContent,
};
- mValueField = new TextField()
+ if(mTitle == Resources.IDS_WIFI_HEADER_PASSWORD)
{
- WidthSpecification = 600,
- PlaceholderText = value,
- };
+ mValueField = CreatePasswordField();
+ }
+ else
+ {
+ mValueField = new TextField()
+ {
+ WidthSpecification = 600,
+ PlaceholderText = value,
+ };
+ }
+
infoView.Add(mValueField);
var cancelButton = new Button()
cancelButton.Clicked += OnCancelClicked;
var okButton = new Button()
{
- Text = "OK",
+ Text = Resources.IDS_WIFI_SK2_OK,
};
okButton.Clicked += OnOkClicked;
};
}
+ internal TextField CreatePasswordField()
+ {
+ Debug("");
+ var passwordField = new TextField()
+ {
+ WidthSpecification = 600,
+ BackgroundColor = Color.Silver,
+ PlaceholderText = Resources.IDS_WIFI_HEADER_PASSWORD,
+ };
+
+ var hiddenInput = new Tizen.NUI.Text.HiddenInput();
+ hiddenInput.Mode = HiddenInputModeType.ShowLastCharacter;
+ hiddenInput.SubstituteCharacter = '*';
+ hiddenInput.SubstituteCount = 0;
+ hiddenInput.ShowLastCharacterDuration = 1000;
+ passwordField.SetHiddenInput(hiddenInput);
+
+ return passwordField;
+ }
internal void CreateRadioComponents(string title, string[] options)
{
Debug("CreateRadioComponents" + title);
mOptionNames = options;
mCount = options.Length;
mRadioButtons = new RadioButton[mCount];
+ getSelectedIndex();
- CreateRadioButtonStyle();
var optionView = new View()
{
Layout = new LinearLayout()
okButton.Clicked += OnRadioOkClicked;
CreateRadioOptions(optionView);
- mRadioButtons[0].IsSelected = true;
+ mRadioButtons[mSelectedIndex].IsSelected = true;
Content = new AlertDialog()
{
Title = mTitle,
Actions = new View[] { okButton },
};
}
+
+ private void getSelectedIndex()
+ {
+ Debug("");
+ mSelectedIndex = 0;
+ if (mTitle == Resources.IDS_ST_BUTTON_SECURITY_ABB)
+ {
+ switch (mAddItem.SecurityType)
+ {
+ case "None":
+ mSelectedIndex = 0;
+ break;
+ case "WEP":
+ mSelectedIndex = 1;
+ break;
+ case "WPA PSK":
+ mSelectedIndex = 2;
+ break;
+ case "WPA2 PSK":
+ mSelectedIndex = 3;
+ break;
+ }
+ }
+ else if (mTitle == Resources.IDS_WIFI_BODY_IP_SETTINGS)
+ {
+ switch (mAddItem.IPSettings)
+ {
+ case "Static":
+ mSelectedIndex = 0;
+ break;
+ case "DHCP":
+ mSelectedIndex = 1;
+ break;
+ }
+ }
+ else if (mTitle == Resources.IDS_WIFI_BODY_PROXY)
+ {
+ switch (mAddItem.ProxyType)
+ {
+ case "None":
+ mSelectedIndex = 0;
+ break;
+ case "Manual":
+ mSelectedIndex = 1;
+ break;
+ }
+ }
+ }
private void CreateRadioOptions(View optionView)
{
for (int i = 0; i < mCount; i++)
{
+ int index = i;
var childView = new View()
{
Layout = new GridLayout()
},
};
mRadioButtons[i] = new RadioButton();
+ var buttonStyle = mRadioButtons[i].Style;
+ CreateRadioButtonStyle(buttonStyle);
mRadioButtons[i].SelectedChanged += (object sender, SelectedChangedEventArgs args) =>
{
- OnSelectionChanged(sender, args, i);
+ OnSelectionChanged(sender, args, index);
};
- mRadioButtons[i].ApplyStyle(mRadioButtonStyle);
+ mRadioButtons[i].ApplyStyle(buttonStyle);
mRadioButtons[i].Size = new Size(48, 48);
mRadioButtons[i].Icon.Size = new Size(48, 48);
mGroup.Add(mRadioButtons[i]);
-
var nameLabel = new TextLabel(mOptionNames[i]);
nameLabel.WidthSpecification = 150;
childView.Add(nameLabel);
optionView.Add(childView);
}
}
- void CreateRadioButtonStyle()
+ void CreateRadioButtonStyle(ButtonStyle buttonStyle)
{
- mRadioButtonStyle = new ButtonStyle();
- mRadioButtonStyle.Icon.Opacity = new Selector<float?>
+ Debug("");
+ buttonStyle.Icon.Opacity = new Selector<float?>
{
Normal = 1.0f,
Selected = 1.0f,
Disabled = 0.4f,
DisabledSelected = 0.4f
};
- mRadioButtonStyle.Icon.BackgroundImage = "";
+ buttonStyle.Icon.BackgroundImage = "";
- mRadioButtonStyle.Icon.ResourceUrl = new Selector<string>
+ buttonStyle.Icon.ResourceUrl = new Selector<string>
{
Normal = mImagesPath + "controller_btn_radio_off.png",
Selected = mImagesPath + "controller_btn_radio_on.png",
void OnSelectionChanged(object sender, SelectedChangedEventArgs e, int i)
{
- Debug($"Left {i}th Utility RadioButton's IsSelected is changed to {e.IsSelected}.");
- // To Do
+ Debug($"{i}th RadioButton's IsSelected is changed to {e.IsSelected}.");
+ if (e.IsSelected)
+ {
+ mSelectedIndex = i;
+ Debug("Selected index: " + mSelectedIndex);
+ }
}
private void OnRadioOkClicked(object source, ClickedEventArgs args)
{
Debug("OnRadioOkClicked");
+ mInfoSource.Clear();
+ UpdateInfo(mTitle, mOptionNames[mSelectedIndex]);
NUIApplication.GetDefaultWindow().GetDefaultNavigator().Pop();
}
private void OnOkClicked(object sender, ClickedEventArgs e)
{
Debug("OnOkClicked " + mValueField.Text + " : " + mTitle);
- UpdateInfo(mTitle, mValueField.Text);
mInfoSource.Clear();
- mInfoSource.ShowNetworkInfo();
+ UpdateInfo(mTitle, mValueField.Text);
NUIApplication.GetDefaultWindow().GetDefaultNavigator().Pop();
}
if (fieldName == Resources.IDS_WIFI_BODY_NETWORK_NAME)
{
+ Debug("Name: Updating value to " + value + " from " + mAddItem.NetworkName);
mAddItem.NetworkName = value;
- Debug("Name after: " + mAddItem.NetworkName);
+ mInfoSource.ShowNetworkInfo();
}
else if (fieldName == Resources.IDS_ST_BUTTON_SECURITY_ABB)
{
+ Debug("Security: Updating value to " + value + " from " + mAddItem.SecurityType);
mAddItem.SecurityType = value;
+ mInfoSource.ShowNetworkInfo();
}
else if (fieldName == Resources.IDS_WIFI_BODY_IP_SETTINGS)
{
+ Debug("IP: Updating value to " + value + " from " + mAddItem.IPSettings);
mAddItem.IPSettings = value;
+ mInfoSource.ShowAdvancedInfo();
}
- else if (fieldName == Resources.IDS_ST_SBODY_PROXY_ADDRESS)
+ else if (fieldName == Resources.IDS_WIFI_BODY_PROXY)
{
+ Debug("Proxy: Updating value to " + value + " from " + mAddItem.ProxyType);
mAddItem.ProxyType = value;
- }else if (fieldName == Resources.IDS_WIFI_HEADER_PASSWORD)
+ mInfoSource.ShowAdvancedInfo();
+ }
+ else if (fieldName == Resources.IDS_WIFI_HEADER_PASSWORD)
{
+ Debug("Password: Updating value to " + value + " from " + mAddItem.Password);
mAddItem.Password = value;
+ mInfoSource.ShowNetworkInfo();
}
}
}