using System;
|
using System.Collections.Generic;
|
using Shared;
|
namespace HDL_ON.UI.UI2.Intelligence.Automation
|
{
|
public class PublicInterface
|
{
|
/// <summary>
|
/// 单选择
|
/// </summary>
|
/// <param name="frame">显示在哪个界面的父控件</param>
|
/// <param name="list">显示数据源</param>
|
/// <param name="titleText"></param>
|
/// <param name="stateText">之前状态文本</param>
|
/// <param name="action">返回值</param>
|
/// <param name="textSize">显示文本字体大小</param>
|
public void SingleSelectionShow(FrameLayout frame, List<string> list, string titleText, string stateText, Action<string> action, int textSize = LogicView.TextSize.text14)
|
{
|
if (list == null)
|
{
|
return;
|
}
|
FrameLayout frameLayout = new FrameLayout
|
{
|
BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
|
};
|
frame.AddChidren(frameLayout);
|
|
LogicView.DateView view = new LogicView.DateView();
|
view.btnTitle.Text = titleText;
|
view.FLayoutView(frameLayout, list.Count);
|
view.btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
//移除fLayout界面
|
frameLayout.RemoveFromParent();
|
};
|
///定义一个Btn记录选中状态
|
Button checkBtn = new Button
|
{
|
Tag = "unknown",
|
};
|
for (int i = 0; i < list.Count; i++)
|
{
|
string str = list[i];
|
LogicView.CheckView checkView = new LogicView.CheckView();
|
checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
|
checkView.btnText.TextSize = textSize;
|
view.frameLayout.AddChidren(checkView.FLayoutView());
|
checkView.btnText.Text = str;
|
checkView.btnClick.Tag = str;//标记
|
|
if (stateText == str)
|
{
|
//显示之前的选中状态
|
checkBtn.IsSelected = false;
|
checkView.btnCheckIcon.IsSelected = true;
|
checkBtn = checkView.btnCheckIcon;
|
checkBtn.Tag = checkView.btnClick.Tag.ToString();
|
}
|
//点击事件
|
checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
|
{
|
checkBtn.IsSelected = false;
|
checkView.btnCheckIcon.IsSelected = true;
|
checkBtn = checkView.btnCheckIcon;
|
checkBtn.Tag = checkView.btnClick.Tag.ToString();
|
};
|
|
}
|
view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
|
{
|
if (checkBtn.Tag.ToString() == "unknown")
|
{
|
return;
|
}
|
action(checkBtn.Tag.ToString());
|
//移除fLayout界面
|
frameLayout.RemoveFromParent();
|
};
|
|
}
|
|
/// <summary>
|
/// 多选择
|
/// </summary>
|
/// <param name="frameLayout">父控件</param>
|
/// <param name="list">显示数据源</param>
|
/// <param name="titleText"></param>
|
/// <param name="stateTextList">之前状态文本</param>
|
/// <param name="action">返回值</param>
|
/// <param name="textSize">显示文本字体大小</param>
|
public void MultiSelectShow(FrameLayout frameLayout, List<string> list, string titleText, List<string> stateTextList, Action<List<string>> action, int textSize = LogicView.TextSize.text14)
|
{
|
LogicView.DateView view = new LogicView.DateView();
|
view.btnTitle.Text = titleText;
|
view.FLayoutView(frameLayout, list.Count);
|
view.btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
//移除fLayout界面
|
view.frameLayout.RemoveFromParent();
|
};
|
for (int i = 0; i < list.Count; i++)
|
{
|
string str = list[i];
|
LogicView.CheckView checkView = new LogicView.CheckView();
|
checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
|
checkView.btnText.TextSize = textSize;
|
view.frameLayout.AddChidren(checkView.FLayoutView());
|
checkView.btnText.Text = str;
|
checkView.btnClick.Tag = str;//标记
|
|
if (stateTextList.Contains(str))
|
{
|
//显示之前的选中状态
|
checkView.btnCheckIcon.IsSelected = true;
|
}
|
//点击事件
|
checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
|
{
|
|
string clickIndex = checkView.btnClick.Tag.ToString();
|
checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected;
|
if (checkView.btnClick.IsSelected)
|
{
|
checkView.btnCheckIcon.IsSelected = true;
|
if (!stateTextList.Contains(clickIndex))
|
{
|
//添加选中数据
|
stateTextList.Add(clickIndex);
|
}
|
}
|
else
|
{
|
checkView.btnCheckIcon.IsSelected = false;
|
if (stateTextList.Contains(clickIndex))
|
{
|
//移除选中数据
|
stateTextList.Remove(clickIndex);
|
}
|
}
|
|
};
|
|
}
|
view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
|
{
|
if (stateTextList.Count == 0)
|
{
|
return;
|
}
|
action(stateTextList);
|
//移除fLayout界面
|
frameLayout.RemoveFromParent();
|
};
|
|
}
|
|
/// <summary>
|
/// 月-多选择
|
/// </summary>
|
/// <param name="frameLayout">父控件</param>
|
/// <param name="action">显示文本字体大小</param>
|
public void MonSelectShow(FrameLayout frameLayout, Logic logic, Action<List<string>> action)
|
{
|
LogicView.MonView monView = new LogicView.MonView();
|
monView.btnTitle.TextID = StringId.monthly;
|
monView.FLayoutView(frameLayout);
|
monView.btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
monView.frameLayout.RemoveFromParent();
|
};
|
//定义一个局部monList列表用来记录选中数据;
|
List<string> monList = new List<string>();
|
if (logic.cycle.type == "mon")
|
{
|
//加载之前保存的数据
|
monList.AddRange(logic.cycle.value);
|
}
|
//定义一个变量记录行数
|
int lineSun = 0;
|
for (int i = 1; i < 32; i++)
|
{
|
Button monTextBtn = new Button
|
{
|
Width = Application.GetRealWidth(30),
|
Height = Application.GetRealWidth(30),
|
Radius = (uint)Application.GetRealWidth(15),
|
Text = i.ToString(),
|
TextSize = LogicView.TextSize.text14,
|
TextColor = CSS.CSS_Color.textColor,
|
SelectedTextColor = CSS.CSS_Color.view,
|
SelectedBackgroundColor = CSS.CSS_Color.textConfirmColor,
|
BackgroundColor = CSS.CSS_Color.viewTranslucence,
|
Tag = i,
|
};
|
monView.frameLayout.AddChidren(monTextBtn);
|
if (lineSun > 0)
|
{
|
monTextBtn.X = Application.GetRealWidth(16 + ((i - 1) - lineSun * 7) * 46);
|
}
|
else
|
{
|
|
monTextBtn.X = Application.GetRealWidth(16 + (i - 1) * 46);
|
}
|
monTextBtn.Y = Application.GetRealWidth(58 + 10 + lineSun * (30 + 10));
|
|
if (i % 7 == 0)
|
{
|
//一定执行完再判断是否要换行.
|
lineSun = lineSun + 1;
|
|
}
|
monTextBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
string clickIndex = monTextBtn.Tag.ToString();
|
monTextBtn.IsSelected = !monTextBtn.IsSelected;
|
if (monTextBtn.IsSelected)
|
{
|
monTextBtn.IsSelected = true;
|
if (!monList.Contains(clickIndex))
|
{
|
//添加选中数据
|
monList.Add(clickIndex);
|
}
|
}
|
else
|
{
|
monTextBtn.IsSelected = false;
|
if (monList.Contains(clickIndex))
|
{
|
//移除选中数据
|
monList.Remove(clickIndex);
|
}
|
}
|
};
|
|
if (monList.Contains(i.ToString()))
|
{
|
monTextBtn.IsSelected = true;
|
}
|
}
|
//确定点击事件
|
monView.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
|
{
|
if (monList.Count == 0)
|
{
|
//提示:还没选中执行周期
|
return;
|
}
|
|
|
action(monList);
|
frameLayout.RemoveFromParent();
|
};
|
|
}
|
|
/// <summary>
|
/// 超出5个元素该用滑动控件
|
/// </summary>
|
/// <param name="frame">显示在哪个界面的父控件</param>
|
/// <param name="list">显示数据源</param>
|
/// <param name="titleText">标题</param>
|
/// <param name="action">返回值索引值</param>
|
public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<int> action)
|
{
|
|
int line = 0;
|
if (list.Count == 0 || list.Count > 5)
|
{
|
//超出5个只能默认5个;
|
line = 5;
|
}
|
else
|
{
|
line = list.Count;
|
}
|
|
FrameLayout frameLayout = new FrameLayout
|
{
|
BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
|
};
|
frame.AddChidren(frameLayout);
|
|
LogicView.DateView view = new LogicView.DateView();
|
view.btnTitle.TextID = titleText;
|
view.FLayoutView(frameLayout, line);
|
view.btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
//移除fLayout界面
|
frameLayout.RemoveFromParent();
|
};
|
//小于5使用
|
FrameLayout frameL = new FrameLayout
|
{
|
Y = Application.GetRealHeight(56),
|
Height = Application.GetRealHeight(50 * line),
|
};
|
//大于5使用
|
VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout
|
{
|
Y = Application.GetRealHeight(56),
|
Height = Application.GetRealHeight(50 * 5),
|
|
};
|
verticalRefresh.BeginHeaderRefreshingAction += () =>
|
{
|
//关闭刷新View;
|
verticalRefresh.EndHeaderRefreshing();
|
};
|
|
if (list.Count == 0)
|
{
|
Button btnTipNot = new Button
|
{
|
X = Application.GetRealWidth(93),
|
Y = Application.GetRealHeight(80),
|
Width = Application.GetRealWidth(158),
|
Height = Application.GetRealWidth(158),
|
UnSelectedImagePath = "TipNot.png",
|
|
};
|
view.frameLayout.AddChidren(btnTipNot);
|
|
Button btnTipNotText = new Button()
|
{
|
Y = btnTipNot.Bottom + Application.GetRealHeight(16),
|
Height = Application.GetRealHeight(20),
|
TextID = StringId.secnenull,
|
TextColor = CSS.CSS_Color.textColor,
|
TextSize = LogicView.TextSize.text14,
|
TextAlignment = TextAlignment.Center,
|
};
|
view.frameLayout.AddChidren(btnTipNotText);
|
}
|
else if (list.Count > 0 && list.Count <= 5)
|
{
|
view.frameLayout.AddChidren(frameL);
|
}
|
else if (list.Count > 5)
|
{
|
view.frameLayout.AddChidren(verticalRefresh);
|
|
}
|
///定义一个Btn记录选中状态
|
Button checkBtn = new Button
|
{
|
Tag = "unknown",
|
};
|
for (int i = 0; i < list.Count; i++)
|
{
|
string strName = list[i];
|
LogicView.CheckView checkView = new LogicView.CheckView();
|
checkView.btnText.TextSize = LogicView.TextSize.text14;
|
if (list.Count <= 5)
|
{
|
checkView.frameLayout.Y = Application.GetRealWidth(i * 50);
|
frameL.AddChidren(checkView.FLayoutView());
|
if (line - 1 == i)
|
{
|
checkView.btnLine.BackgroundColor = CSS.CSS_Color.view;
|
}
|
}
|
else
|
{
|
verticalRefresh.AddChidren(checkView.FLayoutView());
|
}
|
|
if (stateList.Contains(strName))
|
{
|
checkView.btnCheckIcon.IsSelected = true;
|
}
|
checkView.btnText.Text = strName;
|
checkView.btnClick.Tag = i;//标记
|
//点击事件
|
checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
|
{
|
checkBtn.IsSelected = false;
|
checkView.btnCheckIcon.IsSelected = true;
|
checkBtn = checkView.btnCheckIcon;
|
checkBtn.Tag = checkView.btnClick.Tag.ToString();
|
};
|
|
}
|
view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
|
{
|
if (checkBtn.Tag.ToString() == "unknown")
|
{
|
return;
|
}
|
//列表索引值
|
int indexValue = int.Parse(checkBtn.Tag.ToString());
|
action(indexValue);
|
//移除fLayout界面
|
frameLayout.RemoveFromParent();
|
};
|
|
}
|
/// <summary>
|
/// 超出5个元素该用滑动控件
|
/// </summary>
|
/// <param name="frame">显示在哪个界面的父控件</param>
|
/// <param name="list">显示数据源</param>
|
/// <param name="stateList">之前状态数据源</param>
|
/// <param name="titleText">标题</param>
|
/// <param name="action">返回值列表</param>
|
public void FrameOrVvList(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<List<string>> action)
|
{
|
|
int line = 0;
|
if (list.Count == 0 || list.Count > 5)
|
{
|
//超出5个只能默认5个;
|
line = 5;
|
}
|
else
|
{
|
line = list.Count;
|
}
|
|
FrameLayout frameLayout = new FrameLayout
|
{
|
BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
|
};
|
frame.AddChidren(frameLayout);
|
|
LogicView.DateView view = new LogicView.DateView();
|
view.btnTitle.TextID = titleText;
|
view.FLayoutView(frameLayout, line);
|
view.btnCancel.MouseUpEventHandler += (sender, e) =>
|
{
|
//移除fLayout界面
|
frameLayout.RemoveFromParent();
|
};
|
//小于5使用
|
FrameLayout frameL = new FrameLayout
|
{
|
Y = Application.GetRealHeight(56),
|
Height = Application.GetRealHeight(50 * line),
|
};
|
//大于5使用
|
VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout
|
{
|
Y = Application.GetRealHeight(56),
|
Height = Application.GetRealHeight(50 * 5),
|
|
};
|
verticalRefresh.BeginHeaderRefreshingAction += () =>
|
{
|
//关闭刷新View;
|
verticalRefresh.EndHeaderRefreshing();
|
};
|
|
if (list.Count == 0)
|
{
|
//Button btnTipNot = new Button
|
//{
|
// X = Application.GetRealWidth(93),
|
// Y = Application.GetRealHeight(80),
|
// Width = Application.GetRealWidth(158),
|
// Height = Application.GetRealWidth(158),
|
// UnSelectedImagePath = "TipNot.png",
|
|
//};
|
//view.frameLayout.AddChidren(btnTipNot);
|
|
//Button btnTipNotText = new Button()
|
//{
|
// Y = btnTipNot.Bottom + Application.GetRealHeight(16),
|
// Height = Application.GetRealHeight(20),
|
// TextID = StringId.secnenull,
|
// TextColor = CSS.CSS_Color.textColor,
|
// TextSize = LogicView.TextSize.text14,
|
// TextAlignment = TextAlignment.Center,
|
//};
|
//view.frameLayout.AddChidren(btnTipNotText);
|
}
|
else if (list.Count > 0 && list.Count <= 5)
|
{
|
view.frameLayout.AddChidren(frameL);
|
}
|
else if (list.Count > 5)
|
{
|
view.frameLayout.AddChidren(verticalRefresh);
|
|
}
|
List<string> selecetdList = new List<string>();
|
for (int i = 0; i < list.Count; i++)
|
{
|
string strName = list[i];
|
LogicView.CheckView checkView = new LogicView.CheckView();
|
checkView.btnText.TextSize = LogicView.TextSize.text14;
|
if (list.Count <= 5)
|
{
|
checkView.frameLayout.Y = Application.GetRealWidth(i * 50);
|
frameL.AddChidren(checkView.FLayoutView());
|
if (line - 1 == i)
|
{
|
checkView.btnLine.BackgroundColor = CSS.CSS_Color.view;
|
}
|
}
|
else
|
{
|
verticalRefresh.AddChidren(checkView.FLayoutView());
|
}
|
if (stateList.Contains(strName))
|
{
|
checkView.btnClick.IsSelected = true;
|
checkView.btnCheckIcon.IsSelected = true;
|
selecetdList.Add(strName);
|
}
|
checkView.btnText.Text = strName;
|
checkView.btnClick.Tag = strName;//标记
|
//点击事件
|
checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
|
{
|
checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected;
|
checkView.btnCheckIcon.IsSelected = checkView.btnClick.IsSelected;
|
if (checkView.btnClick.IsSelected)
|
{
|
if (!selecetdList.Contains(checkView.btnClick.Tag.ToString()))
|
{
|
selecetdList.Add(checkView.btnClick.Tag.ToString());
|
}
|
|
}
|
else
|
{
|
if (selecetdList.Contains(checkView.btnClick.Tag.ToString()))
|
{
|
selecetdList.Remove(checkView.btnClick.Tag.ToString());
|
}
|
}
|
};
|
|
}
|
view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
|
{
|
if (selecetdList.Count == 0)
|
{
|
return;
|
}
|
//列表索引值
|
action(selecetdList);
|
//移除fLayout界面
|
frameLayout.RemoveFromParent();
|
};
|
|
}
|
|
/// <summary>
|
/// 温湿度组合界面
|
/// </summary>
|
/// <param name="frameLayout">父控件</param>
|
/// <param name="text1">标题文本1</param>
|
/// <param name="text2">标题文本2</param>
|
/// <param name="action">回调函数</param>
|
public void ViewZuHe(FrameLayout frameLayout, int text1, int text2, Action<int, FrameLayout> action)
|
{
|
|
FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewMiddle };
|
frameLayout.AddChidren(frame);
|
LogicView.TopView topView = new LogicView.TopView();
|
topView.topNameBtn.TextID = StringId.wendu;
|
frame.AddChidren(topView.FLayoutView());
|
topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
|
{
|
frame.RemoveFromParent();
|
};
|
FrameLayout viewLayout = new FrameLayout
|
{
|
Y = Application.GetRealHeight(64),
|
Width = Application.GetRealWidth(LogicView.TextSize.view375),
|
Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64),
|
BackgroundColor = CSS.CSS_Color.viewMiddle,
|
};
|
frame.AddChidren(viewLayout);
|
|
//温,湿度高于
|
LogicView.SelectTypeView temperaturehigherView = new LogicView.SelectTypeView();
|
temperaturehigherView.btnIcon.Visible = false;
|
temperaturehigherView.btnText.X = Application.GetRealWidth(16);
|
temperaturehigherView.btnLine.X = Application.GetRealWidth(16);
|
temperaturehigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
|
temperaturehigherView.btnText.TextID = text1;
|
viewLayout.AddChidren(temperaturehigherView.FLayoutView());
|
//温,湿度低于
|
LogicView.SelectTypeView temperatureunderView = new LogicView.SelectTypeView();
|
temperatureunderView.frameLayout.Y = temperaturehigherView.frameLayout.Bottom;
|
temperatureunderView.btnIcon.Visible = false;
|
temperatureunderView.btnText.X = Application.GetRealWidth(16);
|
temperatureunderView.btnLine.X = Application.GetRealWidth(16);
|
temperatureunderView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
|
temperatureunderView.btnText.TextID = text2;
|
viewLayout.AddChidren(temperatureunderView.FLayoutView());
|
|
//温,湿度高于
|
temperaturehigherView.btnClick.MouseUpEventHandler += (sen, e) =>
|
{
|
action(text1, frame);
|
};
|
//温,湿度低于
|
temperatureunderView.btnClick.MouseUpEventHandler += (sen, e) =>
|
{
|
action(text2, frame);
|
};
|
}
|
|
/// <summary>
|
/// 获取界面列表
|
/// </summary>
|
/// <param name="isStr">自己定义自己用</param>
|
/// <returns></returns>
|
public List<string> GetViewList(string isStr)
|
{
|
List<string> list = null;
|
switch (isStr)
|
{
|
case "mode":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.coolLogic),
|
Language.StringByID(StringId.heatingLogic),
|
Language.StringByID(StringId.autoLogic),
|
Language.StringByID(StringId.dehumidifyLogic),
|
};
|
}
|
break;
|
case "fan":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.LowWindSpeed),
|
Language.StringByID(StringId.MiddleWindSpeed),
|
Language.StringByID(StringId.HighWindSpeed),
|
Language.StringByID(StringId.Auto),
|
};
|
}
|
break;
|
case "floorheatingmode":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.dayMode),
|
Language.StringByID(StringId.nightMode),
|
Language.StringByID(StringId.leaveMode),
|
Language.StringByID(StringId.ordinaryMode),
|
Language.StringByID(StringId.timeMode),
|
};
|
}
|
break;
|
case "airFresh":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.zidong),
|
Language.StringByID(StringId.shoudong),
|
Language.StringByID(StringId.dingshi),
|
Language.StringByID(StringId.zhineng),
|
};
|
}
|
break;
|
case "week":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.monday),
|
Language.StringByID(StringId.tuesday),
|
Language.StringByID(StringId.wednesday),
|
Language.StringByID(StringId.thursday),
|
Language.StringByID(StringId.friday),
|
Language.StringByID(StringId.saturday),
|
Language.StringByID(StringId.sunday),
|
};
|
}
|
break;
|
case "andor":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.andCondition),
|
Language.StringByID(StringId.orCondition),
|
};
|
}
|
break;
|
case "time":
|
{
|
list = new List<string> {
|
// "30 s",
|
"1 min",
|
"2 min",
|
"3 min",
|
"5 min",
|
"10 min",
|
};
|
}
|
break;
|
case "pm25":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.pmyou),
|
Language.StringByID(StringId.pmliang),
|
Language.StringByID(StringId.pmqingdu),
|
Language.StringByID(StringId.pmzhongdu),
|
Language.StringByID(StringId.pmzhongduwuran),
|
};
|
}
|
break;
|
case "co2":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.zhengchang)+ ":0~1000PPM",
|
Language.StringByID(StringId.piangao) + ":1001~2000PPM",
|
Language.StringByID(StringId.chaobiao) + ":>2000PPM",
|
};
|
}
|
break;
|
case "tvoc":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.zhengchang)+ ":0~399PPB",
|
Language.StringByID(StringId.chaobiao)+ ":400~699PPB",
|
Language.StringByID(StringId.yanzhong)+":>700PPB",
|
};
|
}
|
break;
|
case "hcho":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.youxiu)+ ":(0~0.08mg/m3)",
|
Language.StringByID(StringId.lianghao)+":(0.09~0.1mg/m3)",
|
Language.StringByID(StringId.chaobiao)+ ":>(0.1mg/m3)",
|
};
|
}
|
break;
|
case "security":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.bufang ),
|
Language.StringByID(StringId.chefang),
|
};
|
}
|
break;
|
case "地理围栏":
|
{
|
list = new List<string> {
|
Language.StringByID(StringId.likai ),
|
Language.StringByID(StringId.daoda),
|
};
|
}
|
break;
|
}
|
return list;
|
}
|
/// <summary>
|
/// 模式/风速互相转换值的方法
|
/// </summary>
|
/// <param name="text">文本</param>
|
/// <param name="type">自己定义自己用</param>
|
/// <returns></returns>
|
public string GetModeValueString(string text, string type)
|
{
|
string str = "";
|
switch (type)
|
{
|
case "mode":
|
{
|
if (text == Language.StringByID(StringId.coolLogic))
|
{
|
str = "cool";
|
}
|
else if (text == Language.StringByID(StringId.heatingLogic))
|
{
|
str = "heat";
|
}
|
else if (text == Language.StringByID(StringId.autoLogic))
|
{
|
str = "auto";
|
}
|
else if (text == Language.StringByID(StringId.dehumidifyLogic))
|
{
|
str = "dry";
|
}
|
}
|
break;
|
case "fan":
|
{
|
if (text == Language.StringByID(StringId.HighWindSpeed))
|
{
|
str = "high";
|
}
|
else if (text == Language.StringByID(StringId.MiddleWindSpeed))
|
{
|
str = "medium";
|
}
|
else if (text == Language.StringByID(StringId.LowWindSpeed))
|
{
|
str = "low";
|
}
|
else if (text == Language.StringByID(StringId.Auto))
|
{
|
str = "auto";
|
}
|
}
|
break;
|
case "floorheatingmode":
|
{
|
if (text == Language.StringByID(StringId.dayMode))
|
{
|
str = "day";
|
}
|
else if (text == Language.StringByID(StringId.nightMode))
|
{
|
str = "night";
|
}
|
else if (text == Language.StringByID(StringId.leaveMode))
|
{
|
str = "away";
|
}
|
else if (text == Language.StringByID(StringId.ordinaryMode))
|
{
|
str = "normal";
|
}
|
else if (text == Language.StringByID(StringId.timeMode))
|
{
|
str = "timer";
|
}
|
}
|
break;
|
case "airFresh":
|
{
|
|
if (text == Language.StringByID(StringId.autoLogic))
|
{
|
str = "auto";
|
}
|
else if (text == Language.StringByID(StringId.shoudong))
|
{
|
str = "manual";
|
}
|
else if (text == Language.StringByID(StringId.dingshi))
|
{
|
str = "timer";
|
}
|
else if (text == Language.StringByID(StringId.zhineng))
|
{
|
str = "smart";
|
}
|
}
|
break;
|
}
|
return str;
|
}
|
/// <summary>
|
/// 星期int和string互相转换值的方法
|
/// </summary>
|
/// <param name="list"></param>
|
/// <param name="str_or_int"></param>
|
/// <returns></returns>
|
public List<string> GetWeekString(List<string> list, string str_or_int)
|
{
|
string weekTextName = "";
|
List<string> stateList = new List<string>();
|
for (int i = 0; i < list.Count; i++)
|
{
|
var s = list[i];
|
if (str_or_int == "int")
|
{
|
switch (s)
|
{
|
case "1":
|
{
|
weekTextName = Language.StringByID(StringId.monday);
|
}
|
break;
|
case "2":
|
{
|
weekTextName = Language.StringByID(StringId.tuesday);
|
}
|
break;
|
case "3":
|
{
|
weekTextName = Language.StringByID(StringId.wednesday);
|
}
|
break;
|
case "4":
|
{
|
weekTextName = Language.StringByID(StringId.thursday);
|
}
|
break;
|
case "5":
|
{
|
weekTextName = Language.StringByID(StringId.friday);
|
}
|
break;
|
case "6":
|
{
|
weekTextName = Language.StringByID(StringId.saturday);
|
}
|
break;
|
case "0":
|
{
|
weekTextName = Language.StringByID(StringId.sunday);
|
}
|
break;
|
}
|
|
}
|
else
|
{
|
if (Language.StringByID(StringId.monday) == s)
|
{
|
weekTextName = "1";
|
}
|
else if (Language.StringByID(StringId.tuesday) == s)
|
{
|
weekTextName = "2";
|
}
|
else if (Language.StringByID(StringId.wednesday) == s)
|
{
|
weekTextName = "3";
|
}
|
else if (Language.StringByID(StringId.thursday) == s)
|
{
|
weekTextName = "4";
|
}
|
else if (Language.StringByID(StringId.friday) == s)
|
{
|
weekTextName = "5";
|
}
|
else if (Language.StringByID(StringId.saturday) == s)
|
{
|
weekTextName = "6";
|
}
|
else if (Language.StringByID(StringId.sunday) == s)
|
{
|
weekTextName = "0";
|
}
|
}
|
stateList.Add(weekTextName);
|
|
}
|
|
return stateList;
|
}
|
/// <summary>
|
/// 数值返回文本
|
/// </summary>
|
/// <param name="type">类型</param>
|
/// <param name="strValue">值</param>
|
/// <returns></returns>
|
public string GetString(string type, string strValue)
|
{
|
string text = "";
|
switch (type)
|
{
|
case "pm25":
|
{
|
|
switch (strValue)
|
{
|
case "(0,35]":
|
{
|
text = Language.StringByID(StringId.pmyou);
|
}
|
break;
|
case "(35,75]":
|
{
|
text = Language.StringByID(StringId.pmliang);
|
}
|
break;
|
case "(75,115]":
|
{
|
text = Language.StringByID(StringId.pmqingdu);
|
}
|
break;
|
case "(115,150]":
|
{
|
text = Language.StringByID(StringId.pmzhongdu);
|
}
|
break;
|
case "(151,100000]":
|
{
|
text = Language.StringByID(StringId.pmzhongduwuran);
|
}
|
break;
|
}
|
|
}
|
break;
|
case "co2":
|
{
|
switch (strValue)
|
{
|
case "(0,1000]":
|
{
|
text = Language.StringByID(StringId.zhengchang) + ":0~1000PPM";
|
}
|
break;
|
case "(1000,2000]":
|
{
|
text = Language.StringByID(StringId.piangao) + ":1001~2000PPM";
|
}
|
break;
|
case "(2000,200000]":
|
{
|
text = Language.StringByID(StringId.chaobiao) + ":>2000PPM";
|
}
|
break;
|
}
|
}
|
break;
|
case "tvoc":
|
{
|
switch (strValue)
|
{
|
case "(0,399]":
|
{
|
text = Language.StringByID(StringId.zhengchang) + ":0~399PPB";
|
}
|
break;
|
case "(399,699]":
|
{
|
text = Language.StringByID(StringId.chaobiao) + ":400~699PPB";
|
}
|
break;
|
case "(699,70000]":
|
{
|
text = Language.StringByID(StringId.yanzhong) + ":>700PPB";
|
}
|
break;
|
}
|
|
}
|
break;
|
case "hcho":
|
{
|
switch (strValue)
|
{
|
case "(0,0.08]":
|
{
|
text = Language.StringByID(StringId.youxiu) + ":(0~0.08mg/m3)";
|
}
|
break;
|
case "(0.08,0.1]":
|
{
|
text = Language.StringByID(StringId.lianghao) + ":(0.09~0.1mg/m3)";
|
}
|
break;
|
case "(0.1,10000]":
|
{
|
text = Language.StringByID(StringId.chaobiao) + ":>(0.1mg/m3)";
|
}
|
break;
|
}
|
|
}
|
break;
|
}
|
return text;
|
}
|
|
/// <summary>
|
/// 本文返回数值返回
|
/// </summary>
|
/// <param name="type">类型</param>
|
/// <param name="text">文本</param>
|
/// <returns></returns>
|
public string GetValue(string type, string text)
|
{
|
string value = "";
|
switch (type)
|
{
|
case "pm25":
|
{
|
if (text == Language.StringByID(StringId.pmyou))
|
{
|
value = "(0,35]";
|
}
|
else if (text == Language.StringByID(StringId.pmliang))
|
{
|
value = "(35,75]";
|
}
|
else if (text == Language.StringByID(StringId.pmqingdu))
|
{
|
value = "(75,115]";
|
}
|
else if (text == Language.StringByID(StringId.pmzhongdu))
|
{
|
value = "(115,150]";
|
}
|
else if (text == Language.StringByID(StringId.pmzhongduwuran))
|
{
|
value = "(150,100000]";
|
}
|
}
|
break;
|
case "co2":
|
{
|
if (text == Language.StringByID(StringId.zhengchang) + ":0~1000PPM")
|
{
|
value = "(0,1000]";
|
}
|
else if (text == Language.StringByID(StringId.piangao) + ":1001~2000PPM")
|
{
|
value = "(1000,2000]";
|
}
|
else if (text == Language.StringByID(StringId.chaobiao) + ":>2000PPM")
|
{
|
value = "(2000,200000]";
|
}
|
}
|
break;
|
case "tvoc":
|
{
|
if (text == Language.StringByID(StringId.zhengchang) + ":0~399PPB")
|
{
|
value = "(0,399]";
|
}
|
else if (text == Language.StringByID(StringId.chaobiao) + ":400~699PPB")
|
{
|
value = "(399,699]";
|
}
|
else if (text == Language.StringByID(StringId.yanzhong) + ":>700PPB")
|
{
|
value = "(699,70000]";
|
}
|
}
|
break;
|
case "hcho":
|
{
|
if (text == Language.StringByID(StringId.youxiu) + ":(0~0.08mg/m3)")
|
{
|
value = "(0,0.08]";
|
}
|
else if (text == Language.StringByID(StringId.lianghao) + ":(0.09~0.1mg/m3)")
|
{
|
value = "(0.08,0.1]";
|
}
|
else if (text == Language.StringByID(StringId.chaobiao) + ":>(0.1mg/m3)")
|
{
|
value = "(0.1,10000]";
|
}
|
}
|
break;
|
|
}
|
return value;
|
}
|
|
|
}
|
}
|