using System;
|
using System.Collections.Generic;
|
using Shared.Common;
|
using Shared.Phone.Device.CommonForm;
|
using Shared.Phone.UserCenter;
|
using Shared.Phone.UserView;
|
using ZigBee.Device;
|
|
namespace Shared.Phone.MainPage
|
{
|
/// <summary>
|
/// 未分配的管理界面
|
/// </summary>
|
public class UnallocatedRoomForm : EditorCommonForm
|
{
|
#region ■ 变量声明___________________________
|
|
/// <summary>
|
/// 界面关闭事件
|
/// </summary>
|
public Action FormCloseEvent = null;
|
/// <summary>
|
/// 添加到 的背景图控件
|
/// </summary>
|
private FrameLayoutStatuControl frameAddBackGroud = null;
|
/// <summary>
|
/// 功能的桌布控件
|
/// </summary>
|
private NormalFrameLayout DeviceBodyTableControl = null;
|
/// <summary>
|
/// 场景的列表控件
|
/// </summary>
|
private VerticalFrameControl listSceneView = null;
|
/// <summary>
|
/// 设备的列表控件
|
/// </summary>
|
private VerticalListControl listDeviceView = null;
|
/// <summary>
|
/// 场景的桌布控件
|
/// </summary>
|
private NormalFrameLayout SceneBodyTableControl = null;
|
/// <summary>
|
/// 全选控件
|
/// </summary>
|
private NormalViewControl btnAllSelect = null;
|
/// <summary>
|
/// 选择的场景
|
/// </summary>
|
private Dictionary<int, SceneUI> dicSelectScene = new Dictionary<int, SceneUI>();
|
/// <summary>
|
/// 选择的设备
|
/// </summary>
|
private Dictionary<string, CommonDevice> dicSelectDevice = new Dictionary<string, CommonDevice>();
|
/// <summary>
|
/// 当前选择的设备类型信息(为了处理速度使用)
|
/// </summary>
|
private DeviceRowInfo nowSelectDeviceInfo = null;
|
/// <summary>
|
/// 全部分组的设备信息
|
/// </summary>
|
private Dictionary<string, DeviceRowInfo> dicGroupDevice = null;
|
/// <summary>
|
/// 是否已经改变了数据
|
/// </summary>
|
private bool dataHadChanged = false;
|
/// <summary>
|
/// 能否全选的状态
|
/// </summary>
|
private bool canSelectAll = true;
|
|
#endregion
|
|
#region ■ 初始化_____________________________
|
|
/// <summary>
|
/// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
/// </summary>
|
public void ShowForm()
|
{
|
//初始化头部控件
|
this.InitTopFrameLayout();
|
//初始化中部控件
|
this.InitBodyFrameLayout();
|
|
//设置头部信息
|
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.Unallocated));
|
|
//初始化全选控件
|
this.InitAllSelectControl();
|
|
//初始化中部信息
|
this.InitMiddleFrame();
|
}
|
|
/// <summary>
|
/// 初始化中部信息
|
/// </summary>
|
private void InitMiddleFrame()
|
{
|
var tabControl = new SceneFunctionSwitchControl();
|
tabControl.Y = Application.GetRealHeight(40);
|
bodyFrameLayout.AddChidren(tabControl);
|
|
//初始化场景桌布
|
this.SceneBodyTableControl = new NormalFrameLayout();
|
SceneBodyTableControl.Y = tabControl.Bottom;
|
SceneBodyTableControl.Height = bodyFrameLayout.Height - tabControl.Bottom;
|
bodyFrameLayout.AddChidren(SceneBodyTableControl);
|
//初始化设备桌布
|
this.DeviceBodyTableControl = new NormalFrameLayout();
|
DeviceBodyTableControl.Y = tabControl.Bottom;
|
DeviceBodyTableControl.Height = bodyFrameLayout.Height - tabControl.Bottom;
|
bodyFrameLayout.AddChidren(DeviceBodyTableControl);
|
|
tabControl.SelectTabEvent += (index) =>
|
{
|
//场景
|
if (index == 0)
|
{
|
//初始化场景分支的控件
|
this.InitSceneCaseControl();
|
//检测各控件状态
|
this.CheckControlsStatu(null);
|
}
|
//功能
|
else
|
{
|
//初始化功能分支的控件
|
this.InitDeviceCaseControl();
|
//检测各控件状态
|
this.CheckControlsStatu(this.nowSelectDeviceInfo);
|
}
|
};
|
|
//开始初始化场景功能切换控件
|
var listTitle = new List<string>();
|
listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence));
|
listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction));
|
//他会自动回调事件
|
tabControl.InitControl(listTitle);
|
}
|
|
#endregion
|
|
#region ■ 场景分支___________________________
|
|
/// <summary>
|
/// 初始化场景分支的控件
|
/// </summary>
|
private void InitSceneCaseControl()
|
{
|
//隐藏设备列表
|
this.DeviceBodyTableControl.Visible = false;
|
//显示场景
|
this.SceneBodyTableControl.Visible = true;
|
if (this.SceneBodyTableControl.Name == "Scene")
|
{
|
//已经初始化过
|
return;
|
}
|
//打个标识而已
|
this.SceneBodyTableControl.Name = "Scene";
|
//开始执行初始化场景分支的控件
|
this.DoInitSceneCaseControl();
|
}
|
|
/// <summary>
|
/// 开始执行初始化场景分支的控件
|
/// </summary>
|
private void DoInitSceneCaseControl()
|
{
|
HdlThreadLogic.Current.RunMainInThread(() =>
|
{
|
//清空桌布
|
this.SceneBodyTableControl.RemoveAll();
|
|
this.listSceneView = new VerticalFrameControl(3);
|
listSceneView.Y = Application.GetRealHeight(53);
|
listSceneView.Height = SceneBodyTableControl.Height;
|
SceneBodyTableControl.AddChidren(listSceneView);
|
|
var listScene = HdlSceneLogic.Current.GetUnalloctedScenes();
|
if (listScene.Count == 0) { return; }
|
|
foreach (var data in listScene)
|
{
|
//场景图片
|
var frameContr = new ScenePictrueControl();
|
listSceneView.AddChidren(frameContr);
|
frameContr.InitControl(data);
|
|
//添加选择控件
|
frameContr.AddSelectControl();
|
|
//收藏
|
frameContr.AddCollectionControl();
|
frameContr.CollectEvent += (collect) =>
|
{
|
//如果当前是收藏房间,则需要刷新主页
|
if (HdlRoomLogic.Current.NowMainPageRoom.IsLove == true)
|
{
|
this.dataHadChanged = true;
|
}
|
};
|
|
frameContr.ButtonClickEvent += (sender, e) =>
|
{
|
//选择
|
frameContr.IsSelected = !frameContr.IsSelected;
|
if (frameContr.IsSelected == true)
|
{
|
dicSelectScene[data.Id] = data;
|
}
|
else
|
{
|
dicSelectScene.Remove(data.Id);
|
}
|
//检测各控件状态
|
this.CheckControlsStatu(null);
|
};
|
}
|
//促使它超过时,能够往上滑
|
var frameTemp = new FrameLayout();
|
frameTemp.Height = Application.GetRealHeight(202 + 23);
|
listSceneView.AddChidren(frameTemp);
|
});
|
}
|
|
#endregion
|
|
#region ■ 功能分支___________________________
|
|
/// <summary>
|
/// 初始化功能分支的控件
|
/// </summary>
|
private void InitDeviceCaseControl()
|
{
|
//隐藏场景列表
|
this.SceneBodyTableControl.Visible = false;
|
//显示功能
|
this.DeviceBodyTableControl.Visible = true;
|
if (this.DeviceBodyTableControl.Name == "Function")
|
{
|
//已经初始化过
|
return;
|
}
|
//打个标识而已
|
this.DeviceBodyTableControl.Name = "Function";
|
//开始执行初始化功能分支的控件
|
this.DoInitDeviceCaseControl();
|
}
|
|
/// <summary>
|
/// 开始执行初始化功能分支的控件
|
/// </summary>
|
private void DoInitDeviceCaseControl()
|
{
|
HdlThreadLogic.Current.RunMainInThread(() =>
|
{
|
//清空桌布,不清空这个的话,它里面还有上一次的东西
|
this.listDeviceView?.RemoveAll();
|
this.DeviceBodyTableControl.RemoveAll();
|
|
//获取分组后的设备列表
|
this.dicGroupDevice = this.GetAllGroupDevice();
|
if (dicGroupDevice.Count == 0)
|
{
|
this.listDeviceView = null;
|
return;
|
}
|
|
//设备的背景容器
|
var frameDeviceBack = new FrameLayout();
|
frameDeviceBack.X = HdlControlResourse.XXLeft;
|
frameDeviceBack.Y = Application.GetRealHeight(369);
|
frameDeviceBack.BackgroundColor = UserCenterColor.Current.White;
|
frameDeviceBack.Width = bodyFrameLayout.Width;
|
frameDeviceBack.Height = Application.GetRealHeight(1236);
|
frameDeviceBack.Radius = (uint)Application.GetRealHeight(58);
|
DeviceBodyTableControl.AddChidren(frameDeviceBack);
|
//设备列表控件
|
this.listDeviceView = new VerticalListControl(35);
|
listDeviceView.Y = Application.GetRealHeight(14);
|
listDeviceView.Height = Application.GetRealHeight(1236 - 14);
|
frameDeviceBack.AddChidren(listDeviceView);
|
|
//初始化设备类型菜单
|
this.InitDeviceObjectMenu();
|
});
|
}
|
|
#endregion
|
|
#region ■ 初始化设备类型菜单_________________
|
|
/// <summary>
|
/// 初始化设备类型菜单
|
/// </summary>
|
private void InitDeviceObjectMenu()
|
{
|
//头部的白色背景
|
var functionBack1 = new FrameLayout();
|
functionBack1.X = HdlControlResourse.XXLeft;
|
functionBack1.Y = Application.GetRealHeight(55);
|
functionBack1.Height = Application.GetRealHeight(160);
|
functionBack1.Width = Application.GetRealWidth(1028);
|
functionBack1.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
DeviceBodyTableControl.AddChidren(functionBack1);
|
functionBack1.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft);
|
var functionBack2 = new FrameLayout();
|
functionBack2.X = HdlControlResourse.XXLeft;
|
functionBack2.Y = functionBack1.Bottom - Application.GetRealHeight(50);
|
functionBack2.Height = Application.GetRealHeight(279 - 160 + 50);
|
functionBack2.Width = Application.GetRealWidth(1028);
|
functionBack2.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
|
DeviceBodyTableControl.AddChidren(functionBack2);
|
functionBack2.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft);
|
|
//左右滑动的控件
|
var HorizontalView = new HorizontalScrolViewLayout();
|
HorizontalView.X = HdlControlResourse.XXLeft;
|
HorizontalView.Y = Application.GetRealHeight(55);
|
HorizontalView.Height = Application.GetRealHeight(279);
|
HorizontalView.Width = Application.GetRealWidth(1028);
|
DeviceBodyTableControl.AddChidren(HorizontalView);
|
|
//上一次选择的菜单
|
Controls.DeviceFunctionMenuControl oldSelectContr = null;
|
foreach (string strText in this.dicGroupDevice.Keys)
|
{
|
var rowInfo = dicGroupDevice[strText];
|
|
//设备类型的容器
|
var devieFrame = new FrameLayout();
|
devieFrame.Width = Application.GetRealWidth(220);
|
HorizontalView.AddChidren(devieFrame);
|
|
//菜单图片控件
|
var deviceObjContr = new Controls.DeviceFunctionMenuControl();
|
devieFrame.AddChidren(deviceObjContr);
|
deviceObjContr.InitControl(strText, rowInfo.IconPath, rowInfo.IconPathSelected);
|
deviceObjContr.ButtonClickEvent += (sender, e) =>
|
{
|
//选择的是同一个东西的话,不处理
|
if (this.nowSelectDeviceInfo.Text != rowInfo.Text)
|
{
|
//上一次的菜单取消,本次菜单选择
|
oldSelectContr.SetSelectStatu(false);
|
deviceObjContr.SetSelectStatu(true);
|
oldSelectContr = deviceObjContr;
|
|
this.nowSelectDeviceInfo = rowInfo;
|
HdlThreadLogic.Current.RunMainInThread(() =>
|
{
|
//初始化设备列表控件
|
this.InitListDeviceControls(rowInfo);
|
//检测各控件状态
|
this.CheckControlsStatu(this.nowSelectDeviceInfo);
|
});
|
}
|
};
|
|
if (this.nowSelectDeviceInfo == null)
|
{
|
//设置初始选择
|
this.nowSelectDeviceInfo = rowInfo;
|
//记录初始选择的菜单控件
|
oldSelectContr = deviceObjContr;
|
deviceObjContr.SetSelectStatu(true);
|
}
|
}
|
if (this.nowSelectDeviceInfo != null)
|
{
|
//初始化默认的设备列表控件
|
this.InitListDeviceControls(nowSelectDeviceInfo);
|
}
|
}
|
|
#endregion
|
|
#region ■ 初始化设备列表控件_________________
|
|
/// <summary>
|
/// 初始化设备列表控件
|
/// </summary>
|
/// <param name="rowInfo"></param>
|
/// <param name="listView"></param>
|
private void InitListDeviceControls(DeviceRowInfo rowInfo)
|
{
|
this.listDeviceView.RemoveAll();
|
//初始化设备列表控件
|
foreach (var deviceKey in rowInfo.listDeviceKeys)
|
{
|
var device = HdlDeviceCommonLogic.Current.GetDevice(deviceKey);
|
var deviceRow = new Controls.DeviceSelectUnallocatedControl(listDeviceView.rowSpace / 2);
|
listDeviceView.AddChidren(deviceRow);
|
deviceRow.InitControl(device);
|
|
if (this.dicSelectDevice.ContainsKey(deviceKey) == true)
|
{
|
//如果它之前选择了的话
|
deviceRow.IsSelected = true;
|
}
|
deviceRow.ButtonClickEvent += (sender, e) =>
|
{
|
deviceRow.IsSelected = !deviceRow.IsSelected;
|
//记录缓存
|
if (deviceRow.IsSelected == true)
|
{
|
this.dicSelectDevice[deviceKey] = device;
|
}
|
else
|
{
|
this.dicSelectDevice.Remove(deviceKey);
|
}
|
//检测各控件状态
|
this.CheckControlsStatu(rowInfo);
|
};
|
}
|
//促使它超过时,能够往上滑
|
var frameTemp = new FrameLayout();
|
frameTemp.Height = Application.GetRealHeight(202 + 23);
|
listDeviceView.AddChidren(frameTemp);
|
}
|
|
#endregion
|
|
#region ■ 全选控件___________________________
|
|
/// <summary>
|
/// 初始化全选控件
|
/// </summary>
|
private void InitAllSelectControl()
|
{
|
this.btnAllSelect = new NormalViewControl(150, 70, true);
|
btnAllSelect.TextAlignment = TextAlignment.CenterRight;
|
btnAllSelect.X = topFrameLayout.Width - Application.GetRealWidth(150 + 115);
|
btnAllSelect.Gravity = Gravity.CenterVertical;
|
btnAllSelect.TextID = R.MyInternationalizationString.AllSelect;
|
btnAllSelect.IsBold = true;
|
topFrameLayout.AddChidren(btnAllSelect);
|
btnAllSelect.ButtonClickEvent += (sender, e) =>
|
{
|
//场景分支
|
if (SceneBodyTableControl.Visible == true)
|
{
|
if (listSceneView == null) { return; }
|
for (int i = 0; ; i++)
|
{
|
var myContr = listSceneView.frameTable.GetChildren(i);
|
if (myContr == null)
|
{
|
break;
|
}
|
if (myContr is ScenePictrueControl)
|
{
|
((ScenePictrueControl)myContr).IsSelected = this.canSelectAll;
|
var scene = ((ScenePictrueControl)myContr).scene;
|
if (this.canSelectAll == true)
|
{
|
//添加缓存
|
dicSelectScene[scene.Id] = scene;
|
}
|
else
|
{
|
//移除缓存
|
dicSelectScene.Remove(scene.Id);
|
}
|
}
|
}
|
//检测各控件状态
|
this.CheckControlsStatu(null);
|
}
|
//功能分支
|
else
|
{
|
if (listDeviceView == null) { return; }
|
for (int i = 0; ; i++)
|
{
|
var myContr = listDeviceView.GetChildren(i);
|
if (myContr == null)
|
{
|
break;
|
}
|
if (myContr is Controls.DeviceSelectUnallocatedControl)
|
{
|
((Controls.DeviceSelectUnallocatedControl)myContr).IsSelected = this.canSelectAll;
|
var device = ((Controls.DeviceSelectUnallocatedControl)myContr).device;
|
if (this.canSelectAll == true)
|
{
|
//添加缓存
|
dicSelectDevice[HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device)] = device;
|
}
|
else
|
{
|
//移除缓存
|
dicSelectDevice.Remove(HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device));
|
}
|
}
|
}
|
//检测各控件状态
|
this.CheckControlsStatu(this.nowSelectDeviceInfo);
|
}
|
};
|
}
|
|
#endregion
|
|
#region ■ [添加到]控件_______________________
|
|
/// <summary>
|
/// 初始化添加到控件
|
/// </summary>
|
private void InitAddToControl()
|
{
|
//添加到 的背景图控件
|
this.frameAddBackGroud = new FrameLayoutStatuControl();
|
frameAddBackGroud.UseClickStatu = false;
|
frameAddBackGroud.Height = Application.GetRealHeight(202);
|
frameAddBackGroud.Gravity = Gravity.BottomCenter;
|
frameAddBackGroud.BackgroundImagePath = "Room/AddBackground.png";
|
bodyFrameLayout.AddChidren(frameAddBackGroud);
|
frameAddBackGroud.Visible = false;
|
|
//添加到 按钮
|
var btnAdd = new NormalViewControl(1034, 156, true);
|
btnAdd.Gravity = Gravity.Center;
|
btnAdd.BackgroundColor = UserCenterColor.Current.White;
|
btnAdd.TextColor = ZigbeeColor.Current.GXCTextSelectedColor4;
|
btnAdd.TextAlignment = TextAlignment.Center;
|
btnAdd.TextID = R.MyInternationalizationString.AddTo;
|
btnAdd.TextSize = 17;
|
btnAdd.Radius = (uint)Application.GetRealHeight(35);
|
frameAddBackGroud.AddChidren(btnAdd, ChidrenBindMode.BindEvent);
|
frameAddBackGroud.ButtonClickEvent += (sender, e) =>
|
{
|
HdlControlLogic.Current.ShowBottomListRoomView(string.Empty, Language.StringByID(R.MyInternationalizationString.AddTo), (selectId, selectName) =>
|
{
|
if (selectId == string.Empty)
|
{
|
//选择的是未分配
|
return;
|
}
|
//变更了当前房间的东西,主页需要刷新
|
if (HdlRoomLogic.Current.NowMainPageRoom.Id == selectId)
|
{
|
this.dataHadChanged = true;
|
}
|
//保存选择的设备和场景
|
var room = HdlRoomLogic.Current.GetRoomById(selectId);
|
this.SaveSelectDeviceAndScene(room);
|
//分类界面需要刷新
|
UserPage.Instance.RefreshCategoryForm = true;
|
//上传空间区域信息
|
HdlRoomLogic.Current.SetRoomInfoToGateway();
|
});
|
};
|
}
|
|
/// <summary>
|
/// 保存选择的设备和场景
|
/// </summary>
|
/// <param name="room"></param>
|
private void SaveSelectDeviceAndScene(Room room)
|
{
|
foreach (var deviceKey in this.dicSelectDevice.Keys)
|
{
|
//添加设备
|
HdlRoomLogic.Current.AddDevice(room, dicSelectDevice[deviceKey], true);
|
foreach (var rowInf in dicGroupDevice.Values)
|
{
|
//移除缓存
|
if (rowInf.listDeviceKeys.Contains(deviceKey) == true)
|
{
|
rowInf.listDeviceKeys.Remove(deviceKey);
|
}
|
}
|
}
|
foreach (var scene in this.dicSelectScene.Values)
|
{
|
//添加场景
|
HdlSceneLogic.Current.AddSceneToRoom(room, scene);
|
}
|
//清空缓存
|
this.dicSelectScene.Clear();
|
this.dicSelectDevice.Clear();
|
//右上角的文字切换为 全选
|
btnAllSelect.TextID = R.MyInternationalizationString.AllSelect;
|
this.canSelectAll = true;
|
|
//场景分支需要重新初始化
|
this.DoInitSceneCaseControl();
|
|
if (this.nowSelectDeviceInfo != null)
|
{
|
|
bool allHadDevice = true;
|
foreach (var data in this.dicGroupDevice.Values)
|
{
|
if (data.listDeviceKeys.Count == 0)
|
{
|
//有分支已经没有设备了
|
allHadDevice = false;
|
break;
|
}
|
}
|
//如果所有分支都还有设备的话,就刷新当前的列表即可
|
if (allHadDevice == true)
|
{
|
//初始化设备列表控件
|
this.InitListDeviceControls(this.nowSelectDeviceInfo);
|
}
|
else
|
{
|
//如果存在分支已经没有设备了的话,那么它的菜单也需要删除掉,所以需要重新初始化
|
this.nowSelectDeviceInfo = null;
|
this.DoInitDeviceCaseControl();
|
}
|
}
|
//隐藏 添加到 按钮
|
this.frameAddBackGroud.Visible = false;
|
}
|
|
#endregion
|
|
#region ■ 整合设备___________________________
|
|
/// <summary>
|
/// 获取分组后的设备
|
/// </summary>
|
/// <returns></returns>
|
private Dictionary<string, DeviceRowInfo> GetAllGroupDevice()
|
{
|
//全部的设备
|
var listDevice = HdlRoomLogic.Current.GetUnalloctedDevice();
|
//根据设备所属类型排序
|
listDevice = HdlDeviceCommonLogic.Current.SortDeviceByBelongType(listDevice);
|
var dic = new Dictionary<string, DeviceRowInfo>();
|
foreach (var device in listDevice)
|
{
|
var typeInfo = HdlDeviceCommonLogic.Current.GetDeviceBelongEnumInfo(device);
|
//按所属ID分组
|
if (dic.ContainsKey(typeInfo.BeloneText) == false)
|
{
|
dic[typeInfo.BeloneText] = new DeviceRowInfo();
|
string path1 = string.Empty;
|
string path2 = string.Empty;
|
//获取图片
|
HdlDeviceCommonLogic.Current.GetDeviceFunctionTypeMenuIcon(typeInfo, ref path1, ref path2);
|
dic[typeInfo.BeloneText].IconPath = path1;
|
dic[typeInfo.BeloneText].IconPathSelected = path2;
|
dic[typeInfo.BeloneText].Text = typeInfo.BeloneText;
|
}
|
dic[typeInfo.BeloneText].listDeviceKeys.Add(HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device));
|
}
|
return dic;
|
}
|
|
#endregion
|
|
#region ■ 界面关闭___________________________
|
|
/// <summary>
|
/// 界面关闭
|
/// </summary>
|
public override void CloseFormBefore()
|
{
|
//调用回调事件
|
this.FormCloseEvent?.Invoke();
|
this.FormCloseEvent = null;
|
|
if (this.dataHadChanged == true)
|
{
|
HdlThreadLogic.Current.RunMainInThread(() =>
|
{
|
//刷新主页
|
HomeMainPageForm.Instance?.RefreshBodyView();
|
});
|
}
|
base.CloseFormBefore();
|
}
|
|
#endregion
|
|
#region ■ 一般方法___________________________
|
|
/// <summary>
|
/// 检测各控件状态
|
/// </summary>
|
private void CheckControlsStatu(DeviceRowInfo rowInfo)
|
{
|
if (this.frameAddBackGroud == null)
|
{
|
//初始化添加到控件
|
this.InitAddToControl();
|
}
|
|
if (dicSelectScene.Count == 0 && dicSelectDevice.Count == 0)
|
{
|
//隐藏 添加到 控件
|
if (frameAddBackGroud.Visible == true)
|
{
|
frameAddBackGroud.Visible = false;
|
}
|
}
|
else
|
{
|
//显示 添加到 控件
|
if (frameAddBackGroud.Visible == false)
|
{
|
frameAddBackGroud.Visible = true;
|
}
|
}
|
//当前选择的是场景分支
|
if (rowInfo == null)
|
{
|
if (this.dicSelectScene.Count > 0)
|
{
|
//右上角的文字切换为 取消
|
btnAllSelect.TextID = R.MyInternationalizationString.Cancel;
|
this.canSelectAll = false;
|
}
|
else
|
{
|
//右上角的文字切换为 全选
|
btnAllSelect.TextID = R.MyInternationalizationString.AllSelect;
|
this.canSelectAll = true;
|
}
|
}
|
//当前选择的是功能分支
|
else
|
{
|
foreach (var deviceKey in rowInfo.listDeviceKeys)
|
{
|
//如果当前的设备类型选择分支下,存在之前选择的设备的话
|
if (this.dicSelectDevice.ContainsKey(deviceKey) == true)
|
{
|
//右上角的文字切换为 取消
|
btnAllSelect.TextID = R.MyInternationalizationString.Cancel;
|
this.canSelectAll = false;
|
return;
|
}
|
}
|
//如果不存在的话,右上角的文字切换为 全选
|
btnAllSelect.TextID = R.MyInternationalizationString.AllSelect;
|
this.canSelectAll = true;
|
}
|
}
|
|
#endregion
|
|
#region ■ 结构体_____________________________
|
|
/// <summary>
|
/// 设备行信息
|
/// </summary>
|
private class DeviceRowInfo
|
{
|
/// <summary>
|
/// 文本,目前用来做主键
|
/// </summary>
|
public string Text = string.Empty;
|
/// <summary>
|
/// 图标
|
/// </summary>
|
public string IconPath = string.Empty;
|
/// <summary>
|
/// 图标
|
/// </summary>
|
public string IconPathSelected = string.Empty;
|
/// <summary>
|
/// 设备回路主键
|
/// </summary>
|
public List<string> listDeviceKeys = new List<string>();
|
}
|
|
#endregion
|
}
|
}
|