| | |
| | | /// <param name="titleName">标题名称</param> |
| | | /// <param name="stateValue">之前状态值</param> |
| | | /// <param name="action">返回回调</param> |
| | | public void FLayoutView(FrameLayout frame, string titleName,string stateValue, Action<string> action) |
| | | public void FLayoutView(FrameLayout frame, string titleName,string stateValue, Action<string,string> action) |
| | | { |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | |
| | | frameLayout.AddChidren(btn_add); |
| | | frameLayout.AddChidren(btn_add_click); |
| | | btnTitle.Text = titleName; |
| | | //进来的状态 |
| | | if (stateValue.Contains("%")) |
| | | { |
| | | //百分比 |
| | | } |
| | | else if (stateValue.Contains("°")) |
| | | { |
| | | //角度 |
| | | //角度取值范围 |
| | | seekBarVol.MinValue = 0; |
| | | seekBarVol.MaxValue = 180; |
| | | seekBarVol.ProgressBarUnitSring = "°"; |
| | | } |
| | | else |
| | | { |
| | | //音量没有单位 |
| | | seekBarVol.MinValue = 0; |
| | | seekBarVol.MaxValue = 100; |
| | | seekBarVol.ProgressBarUnitSring = ""; |
| | | } |
| | | //第一个变化记录选中值 |
| | | int brightnesValue = 0; |
| | | if (stateValue != "") |
| | | { |
| | | try |
| | | { |
| | | //进来的状态 |
| | | brightnesValue = int.Parse(stateValue.Replace("%", "")); |
| | | brightnesValue = int.Parse(UnitDisposeSring(stateValue)); |
| | | seekBarVol.Progress = brightnesValue; |
| | | } |
| | | catch { } |
| | |
| | | //{ |
| | | // return; |
| | | //} |
| | | action(brightnesValue.ToString()); |
| | | action(brightnesValue.ToString(), UnitSring(stateValue)); |
| | | //移除fLayout界面 |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | //进度值显示单位 |
| | | /// </summary> |
| | | /// <param name="str"></param> |
| | | /// <returns></returns> |
| | | public string UnitSring(string str) |
| | | { |
| | | |
| | | //进来的状态 |
| | | if (str.Contains("%")) |
| | | { |
| | | //百分比 |
| | | return "%"; |
| | | } |
| | | else if (str.Contains("°")) |
| | | { |
| | | //角度 |
| | | return "°"; |
| | | |
| | | } |
| | | else { |
| | | //没有单位 |
| | | return ""; |
| | | } |
| | | } |
| | | /// <summary> |
| | | ///去单位 |
| | | /// </summary> |
| | | /// <param name="str"></param> |
| | | /// <returns></returns> |
| | | public string UnitDisposeSring(string str) |
| | | { |
| | | |
| | | //进来的状态 |
| | | if (str.Contains("%")) |
| | | { |
| | | //百分比 |
| | | return str.Replace("%", ""); |
| | | } |
| | | else if (str.Contains("°")) |
| | | { |
| | | //角度 |
| | | return str.Replace("°", ""); |
| | | } |
| | | else |
| | | { |
| | | //没有单位 |
| | | return str; |
| | | } |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// View的方法 |