| | |
| | | switch (function.functionType) |
| | | { |
| | | case FunctionType.AC: |
| | | LoadFunctionRow(function.function.Find((obj) => obj.name == "set_temperature")); |
| | | LoadFunctionRow(function.function.Find((obj) => obj.name == "mode")); |
| | | LoadFunctionRow(function.function.Find((obj) => obj.name == "fan")); |
| | | LoadFunctionRow(function.function.Find((obj) => obj.key == "set_temperature")); |
| | | LoadFunctionRow(function.function.Find((obj) => obj.key == "mode")); |
| | | LoadFunctionRow(function.function.Find((obj) => obj.key == "fan")); |
| | | break; |
| | | case FunctionType.FloorHeating: |
| | | LoadFunctionRow(function.function.Find((obj) => obj.name == "set_temperature")); |
| | | LoadFunctionRow(function.function.Find((obj) => obj.name == "mode")); |
| | | LoadFunctionRow(function.function.Find((obj) => obj.key == "set_temperature")); |
| | | LoadFunctionRow(function.function.Find((obj) => obj.key == "mode")); |
| | | break; |
| | | case FunctionType.Curtain: |
| | | //无操作 |
| | | break; |
| | | case FunctionType.MotorCurtain: |
| | | case FunctionType.RollingShutter: |
| | | LoadFunctionRow(function.function.Find((obj) => obj.name == "percent")); |
| | | LoadFunctionRow(function.function.Find((obj) => obj.key == "percent")); |
| | | break; |
| | | case FunctionType.Relay: |
| | | //无操作 |
| | | break; |
| | | case FunctionType.Dimmer: |
| | | case FunctionType.RGB: |
| | | LoadFunctionRow(function.function.Find((obj) => obj.name == "brightness")); |
| | | LoadFunctionRow(function.function.Find((obj) => obj.key == "brightness")); |
| | | break; |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// 加载功能Row |
| | | /// </summary> |
| | | void LoadFunctionRow(Trait trait) |
| | | void LoadFunctionRow(FunctionAttributes trait) |
| | | { |
| | | if (trait == null) |
| | | return; |
| | |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.AddChidren(row); |
| | | if (trait.name != "on_off") |
| | | if (trait.key != "on_off") |
| | | { |
| | | row.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor }); |
| | | } |
| | |
| | | row.AddChidren(btnFunctionName); |
| | | btnFunctionName.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | switch (trait.name) |
| | | switch (trait.key) |
| | | { |
| | | case "on_off": |
| | | LoadEditDialog_OnOff(trait, btnFunctionText); |
| | |
| | | /// </summary> |
| | | /// <param name="function"></param> |
| | | /// <param name="btn"></param> |
| | | void LoadEditDialog_OnOff(Trait trait, Button btn) |
| | | void LoadEditDialog_OnOff(FunctionAttributes trait, Button btn) |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.On, |
| | | IsSelected = function.trait_on_off.value.ToString() == "on" |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "on" |
| | | }; |
| | | optionView.AddChidren(btnOn); |
| | | |
| | |
| | | SelectedTextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.OFF, |
| | | IsSelected = function.trait_on_off.value.ToString() == "off" |
| | | IsSelected = function.trait_on_off.curValue.ToString() == "off" |
| | | }; |
| | | optionView.AddChidren(btnOff); |
| | | |
| | |
| | | }; |
| | | btnOn.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | trait.value = "on"; |
| | | trait.curValue = "on"; |
| | | btn.Text = trait.GetCurValueText() + trait.uintString; |
| | | }; |
| | | btnOff.MouseUpEventHandler = (sender,e) =>{ |
| | | dialog.Close(); |
| | | trait.value = "off"; |
| | | trait.curValue = "off"; |
| | | btn.Text= trait.GetCurValueText() + trait.uintString; |
| | | }; |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="function"></param> |
| | | /// <param name="btn"></param> |
| | | void LoadEditDialog_Temp(Trait trait, Button btn) |
| | | void LoadEditDialog_Temp(FunctionAttributes trait, Button btn) |
| | | { |
| | | List<string> pickerItems = new List<string>(); |
| | | if(trait == null) |
| | |
| | | } |
| | | uIPickerView.setNPicker(pickerItems, null, null); |
| | | optionBaseView.AddChidren(uIPickerView); |
| | | uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5); |
| | | string selectItem = trait.value.ToString() + trait.uintString; |
| | | uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.curValue.ToString()), 4, 5); |
| | | string selectItem = trait.curValue.ToString() + trait.uintString; |
| | | |
| | | dialog.Show(); |
| | | |
| | |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | btn.Text = selectItem; |
| | | trait.value = selectItem.Replace(trait.uintString,""); |
| | | trait.curValue = selectItem.Replace(trait.uintString,""); |
| | | }; |
| | | |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="function"></param> |
| | | /// <param name="btn"></param> |
| | | void LoadEditDialog_Percent(Trait trait, Button btn) |
| | | void LoadEditDialog_Percent(FunctionAttributes trait, Button btn) |
| | | { |
| | | if (trait == null) |
| | | { |
| | |
| | | ProgressTextColor = CSS_Color.FirstLevelTitleColor, |
| | | ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | MaxValue = 100, |
| | | Progress = trait.value.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32( trait.value), |
| | | Progress = trait.curValue.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32( trait.curValue), |
| | | SeekBarPadding = Application.GetRealWidth(20), |
| | | }; |
| | | optionBaseView.AddChidren(controlBar); |
| | |
| | | }; |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | trait.value = controlBar.Progress; |
| | | btn.Text = trait.value + trait.uintString; |
| | | trait.curValue = controlBar.Progress; |
| | | btn.Text = trait.curValue + trait.uintString; |
| | | }; |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// 加载功能属性数据选择弹窗 |
| | | /// </summary> |
| | | void LoadEditDialog_FunctionPar(Trait trait, Button btn) |
| | | void LoadEditDialog_FunctionPar(FunctionAttributes trait, Button btn) |
| | | { |
| | | Button lastButton = new Button(); |
| | | var lastData = ""; |
| | |
| | | |
| | | var optionBaseView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(579 - 50 * trait.value_key.Count), |
| | | Y = Application.GetRealHeight(579 - 50 * trait.value.Count), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(50 * trait.value_key.Count + 50), |
| | | Height = Application.GetRealHeight(50 * trait.value.Count + 50), |
| | | AnimateSpeed = 0.3f, |
| | | Animate = Animate.DownToUp, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | |
| | | }; |
| | | topView.AddChidren(btnConfrim); |
| | | int hei = 1; |
| | | foreach (var m in trait.value_key) |
| | | foreach (var m in trait.value) |
| | | { |
| | | var row = new FrameLayout() |
| | | { |
| | |
| | | Height = Application.GetRealHeight(50), |
| | | }; |
| | | optionBaseView.AddChidren(row); |
| | | if (trait.value_key.Count > hei) |
| | | if (trait.value.Count > hei) |
| | | { |
| | | optionBaseView.AddChidren(new Button() |
| | | { |
| | |
| | | |
| | | }; |
| | | row.AddChidren(btnChoose); |
| | | if (trait.value.ToString() == m) |
| | | if (trait.curValue.ToString() == m) |
| | | { |
| | | lastButton = btnChoose; |
| | | btnChoose.IsSelected = true; |
| | |
| | | }; |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | trait.value = lastData; |
| | | trait.curValue = lastData; |
| | | btn.Text = lastText; |
| | | }; |
| | | |