黄学彪
2019-10-12 c6b35c3138b944830b5336bf610f918154dd47c7
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs
@@ -36,6 +36,10 @@
        /// 设备需要保存的设备名字
        /// </summary>
        private Dictionary<int, string> dicDeviceSaveName = new Dictionary<int, string>();
        /// <summary>
        /// 设备需要保存的设备功能
        /// </summary>
        private Dictionary<int, DeviceFunctionType> dicDeviceFuncType = new Dictionary<int, DeviceFunctionType>();
        #endregion
@@ -110,6 +114,34 @@
                        }
                    }
                }
                foreach (var epoint in dicDeviceFuncType.Keys)
                {
                    var device = Common.LocalDevice.Current.GetDevice(deviceMac, epoint);
                    if (device == null)
                    {
                        continue;
                    }
                    //设置功能类型
                    device.DfunctionType = dicDeviceFuncType[epoint];
                    if (device.IsCustomizeImage == true)
                    {
                        continue;
                    }
                    //重新设置图片
                    if (device.DfunctionType == DeviceFunctionType.A开关)
                    {
                        device.IconPath = "Device/Switch.png";
                    }
                    else if (device.DfunctionType == DeviceFunctionType.A插座)
                    {
                        device.IconPath = "Device/Socket1.png";
                    }
                    else if (device.DfunctionType == DeviceFunctionType.A灯光)
                    {
                        device.IconPath = "Device/Light.png";
                    }
                    device.ReSave();
                }
                this.CloseProgressBar();
                //关闭自身
                this.CloseForm();
@@ -171,18 +203,6 @@
            //添加功能类型行
            this.AddFunctionTypeRow();
            //借用Y轴坐标
            var btnTemp = new BottomClickButton();
            var realHeight = listview.GetChildren(0).Height * listview.ChildrenCount;
            if (bodyFrameLayout.Height - btnTemp.Yaxis + realHeight > listview.Height)
            {
                //促使被挡住的菜单能够向上滑动
                var frameTemp = new FrameLayout();
                frameTemp.Height = bodyFrameLayout.Height - btnTemp.Yaxis + Application.GetRealHeight(115);
                listview.AddChidren(frameTemp);
            }
            btnTemp = null;
        }
        #endregion
@@ -252,32 +272,31 @@
            {
                //功能类型
                string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType);
                var DfunctionType = nowSelectDevice.DfunctionType;
                if (this.dicDeviceFuncType.ContainsKey(nowSelectDevice.DeviceEpoint) == true)
                {
                    DfunctionType = this.dicDeviceFuncType[nowSelectDevice.DeviceEpoint];
                }
                //功能类型的翻译名字
                int nowSelectNo = 1;
                string strType = string.Empty;
                if (nowSelectDevice.DfunctionType == DeviceFunctionType.A灯光)
                if (DfunctionType == DeviceFunctionType.A灯光)
                {
                    strType = Language.StringByID(R.MyInternationalizationString.uLight);
                    nowSelectNo = 1;
                }
                else if (nowSelectDevice.DfunctionType == DeviceFunctionType.A开关)
                else if (DfunctionType == DeviceFunctionType.A开关)
                {
                    strType = Language.StringByID(R.MyInternationalizationString.uSwitch);
                    nowSelectNo = 0;
                }
                else if (nowSelectDevice.DfunctionType == DeviceFunctionType.A插座)
                else if (DfunctionType == DeviceFunctionType.A插座)
                {
                    strType = Language.StringByID(R.MyInternationalizationString.uSocket1);
                    nowSelectNo = 2;
                }
                else
                {
                    //默认灯光
                    strType = Language.StringByID(R.MyInternationalizationString.uLight);
                    nowSelectDevice.DfunctionType = DeviceFunctionType.A灯光;
                    nowSelectDevice.ReSave();
                }
                var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2);
                btnFunction.UseClickStatu = false;
                listview.AddChidren(btnFunction);
@@ -307,19 +326,19 @@
                        {
                            btnFunction.Text = listText[selectNo];
                            nowSelectNo = selectNo;
                            //记录起当前选择的功能类型
                            if (selectNo == 0)
                            {
                                nowSelectDevice.DfunctionType = DeviceFunctionType.A开关;
                                dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A开关;
                            }
                            else if (selectNo == 1)
                            {
                                nowSelectDevice.DfunctionType = DeviceFunctionType.A灯光;
                                dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A灯光;
                            }
                            else
                            {
                                nowSelectDevice.DfunctionType = DeviceFunctionType.A插座;
                                dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A插座;
                            }
                            nowSelectDevice.ReSave();
                        };
                    };
                }