陈嘉乐
2021-01-12 330e3ae4cdd1e9facb14b6ea2b3e609166c04fd3
2021-1-12-1

完成室外环境功能
12个文件已修改
467 ■■■■ 已修改文件
.vs/HDL_APP_Project/xs/UserPrefs.xml 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/sqlite3/storage.ide 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_Android/Assets/Language.ini 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL-ON_iOS/Resources/Language.ini 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/Common/R.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs 231 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,37 +1,35 @@
<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
  <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.D4411691-F5B8-40F4-97C1-964F33115DBC" />
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs">
  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs">
    <Files>
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs" Line="386" Column="56" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Weather.cs" Line="7" Column="16" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs" Line="428" Column="34" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs" Line="94" Column="51" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs" Line="302" Column="72" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs" Line="1" Column="1" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Weather.cs" Line="62" Column="67" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs" Line="6" Column="36" />
      <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" Line="264" Column="70" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
        <State name="__root__">
          <Node name="HDL_APP_Project" expanded="True">
            <Node name="HDL_ON" expanded="True">
              <Node name="Common" expanded="True" />
              <Node name="UI" expanded="True">
                <Node name="UI2" expanded="True">
                  <Node name="3-Intelligence" expanded="True">
                    <Node name="Automation" expanded="True">
                      <Node name="LogicView" expanded="True">
                        <Node name="TipPopView.cs" selected="True" />
                      </Node>
                      <Node name="LogicView" expanded="True" />
                      <Node name="InpOrOutLogicMethod.cs" selected="True" />
                    </Node>
                  </Node>
                </Node>
              </Node>
            </Node>
            <Node name="HDL-ON_Android" expanded="True">
              <Node name="Assets" expanded="True">
                <Node name="Phone" expanded="True">
                  <Node name="LogicIcon" expanded="True" />
                </Node>
              </Node>
              <Node name="Assets" expanded="True" />
            </Node>
            <Node name="HDL-ON_iOS" expanded="True">
              <Node name="Resources" expanded="True" />
            </Node>
          </Node>
        </State>
.vs/HDL_APP_Project/xs/sqlite3/storage.ide
Binary files differ
.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm
Binary files differ
.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal
Binary files differ
HDL-ON_Android/Assets/Language.ini
@@ -561,6 +561,15 @@
7098=晴天
7099=多云
7100=下雨
7101=*请在这个范围(1~100)设置值。
7102=还没有设置值。
7103=优:0~35ug/m³
7104=良:35~75ug/m³
7105=轻度污染:75~115ug/m³
7106=中度污染:115~150ug/m³
7107=重度污染:>150ug/m³
9000=请使用新的手机账号登录APP
HDL-ON_iOS/Resources/Language.ini
@@ -561,6 +561,13 @@
7098=晴天
7099=多云
7100=下雨
7101=*请在这个范围(1~100)设置值。
7102=还没有设置值。
7103=优:0~35ug/m³
7104=良:35~75ug/m³
7105=轻度污染:75~115ug/m³
7106=中度污染:115~150ug/m³
7107=重度污染:>150ug/m³
9000=请使用新的手机账号登录APP
HDL_ON/Common/R.cs
@@ -555,6 +555,14 @@
        public const int clearday =7098;
        public const int cloudy= 7099;
        public const int rain = 7100;
        public const int setvalue = 7101;
        public const int nullvalue = 7102;
        public const int pmyou = 7103;
        public const int pmliang = 7104;
        public const int pmqingdu= 7105;
        public const int pmzhongdu = 7106;
        public const int pmzhongduwuran= 7107;
        #region LE新增
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -170,6 +170,60 @@
                            }
                        }
                        break;
                    case "4":
                        {
                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
                            string strtext = "";
                            string strvalue = "";
                            foreach (var dic in dicList)
                            {
                                string key = dic["key"];
                                string comparator = dic["comparator"];
                                string value = dic["value"];
                                switch (key)
                                {
                                    case "outdoor_temp":
                                        {
                                            strvalue = value;
                                            if (comparator==">") {
                                                strtext = Language.StringByID(StringId.wendugaoyu);
                                            }
                                            else  if(comparator == "<"){
                                                strtext = Language.StringByID(StringId.wendudiyu);
                                            }
                                        }
                                        break;
                                    case "outdoor_humity":
                                        {
                                            strvalue = value;
                                            if (comparator == ">")
                                            {
                                                strtext = Language.StringByID(StringId.shidugaoyu);
                                            }
                                            else if (comparator == "<")
                                            {
                                                strtext = Language.StringByID(StringId.shidudiyu);
                                            }
                                        }
                                        break;
                                    case "pm2.5":
                                        {
                                            strtext = Language.StringByID(StringId.PM25);
                                            strvalue = new OutdoorEnvironment { }.GetString(value);
                                        }
                                        break;
                                }
                            }
                            inputView.btnText.Text = strtext;
                            inputView.btnState.Text = strvalue;
                        }
                        break;
                    case "6":
                        {
                            inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
@@ -223,7 +277,6 @@
                            break;
                        }
                    }
                    //标记编辑状态
                    bool edit = true;
                    switch (button.Name)
@@ -291,6 +344,69 @@
                                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                            }
                            break;
                        case "4":
                            {
                                ///当前的索引值数据对象
                                Input inputedit = Logic.currlogic.input[indexVulae];
                                ///状态值
                                string stateValue = "";
                                ///状态值文本
                                int intValue = -1;
                                foreach (var dic in inputedit.condition)
                                {
                                    string key = dic["key"];
                                    string comparator = dic["comparator"];
                                    stateValue = dic["value"];
                                    switch (key)
                                    {
                                        case "outdoor_temp":
                                            {
                                                if (comparator == ">")
                                                {
                                                    intValue=StringId.wendugaoyu;
                                                }
                                                else if (comparator == "<")
                                                {
                                                    intValue = StringId.wendudiyu;
                                                }
                                            }
                                            break;
                                        case "outdoor_humity":
                                            {
                                                if (comparator == ">")
                                                {
                                                    intValue = StringId.shidugaoyu;
                                                }
                                                else if (comparator == "<")
                                                {
                                                    intValue = StringId.shidudiyu;
                                                }
                                            }
                                            break;
                                        case "pm2.5":
                                            {
                                                intValue = StringId.PM25;
                                            }
                                            break;
                                    }
                                }
                                OutdoorEnvironment outdoorEnvironment = new OutdoorEnvironment();
                                if (intValue == StringId.PM25)
                                {
                                    outdoorEnvironment.PmAction(thisView, stateValue);
                                }
                                else
                                {
                                    outdoorEnvironment.InputBoxAction(intValue, stateValue);
                                }
                            }
                            break;
                        case "6":
                            {
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs
@@ -361,9 +361,8 @@
        /// </summary>
        /// <param name="titleId">标题文本</param>
        /// <param name="tnputEditTxet">显示文本</param>
        /// <param name="errorId_IsNullOrEmpty">输入框本文为空自定义提示错误文本</param>
        /// <param name="confirmAction">回调函数</param>
        public void InputBox1(int titleId, string tnputEditTxet, int errorId_IsNullOrEmpty, Action<string> confirmAction)
        public void InputBox(int titleId, string tnputEditTxet, Action<string> confirmAction)
        {
            Dialog dialog = new Dialog()
            {
@@ -425,13 +424,7 @@
                IsNumberKeyboardType=true,
            };
            editBjView.AddChidren(editText);
            editText.MouseUpEventHandler += (sen, e) =>
            {
                if (!editText.Foucs)
                    editText.Foucs = true;
            };
            Button btn_subtract = new Button
            {
                X = Application.GetRealWidth(17),
@@ -452,27 +445,29 @@
            whiteView.AddChidren(btn_add);
            btn_subtract.MouseUpEventHandler += (sender, e) =>
            {
                string editTextValue = editText.Text;
                if (!string.IsNullOrEmpty(editTextValue))
                {
                    int intValue = int.Parse(editTextValue);
                    if (intValue - 1 >= 0)
                    if (intValue>1)
                    {
                        editText.Text = (intValue - 1).ToString();
                        editText.Foucs = false;
                    }
                }
            };
            btn_add.MouseUpEventHandler += (sender, e) =>
            {
                string editTextValue = editText.Text;
                if (!string.IsNullOrEmpty(editTextValue))
                {
                    int intValue = int.Parse(editTextValue);
                    if (intValue - 1 <= 100)
                    if (intValue <100)
                    {
                        editText.Text = (intValue + 1).ToString();
                        editText.Foucs = false;
                    }
                }
            };
@@ -529,9 +524,22 @@
            btnConfirm.MouseUpEventHandler += (sender, e) =>
            {
                string errorId_IsNullOrEmpty = "";
                if (string.IsNullOrEmpty(editText.Text.Trim()))
                {
                    errorId_IsNullOrEmpty = Language.StringByID(StringId.nullvalue);
                }
                else
                {
                    var editTextValue = editText.Text.Trim();
                    int intValue = int.Parse(editTextValue);
                    if (intValue <= 0 || intValue > 100)
                    {
                        errorId_IsNullOrEmpty = Language.StringByID(StringId.setvalue);
                    }
                }
                if (errorId_IsNullOrEmpty!="")
                {
                    whiteView.Height = Application.GetRealHeight(183);
                    btnLine.Y = whiteView.Height - Application.GetRealHeight(44 + 1);
                    btnCancel.Y = btnLine.Bottom;
@@ -539,17 +547,16 @@
                    btnConfirm.Y = btnLine.Bottom;
                    btnConfirm.Gravity = Gravity.BottomRight;
                    btnTip.X = Application.GetRealWidth(24);
                    btnTip.X = Application.GetRealWidth(53);
                    btnTip.Y = editBjView.Bottom + Application.GetRealHeight(12);
                    btnTip.Width = Application.GetRealWidth(222);
                    btnTip.Width = Application.GetRealWidth(200);
                    btnTip.Height = Application.GetRealHeight(17);
                    btnTip.Text = Language.StringByID(errorId_IsNullOrEmpty);
                    btnTip.Text = errorId_IsNullOrEmpty;
                    btnTip.TextColor = CSS_Color.textRedColor;
                    btnTip.TextSize = TextSize.text12;
                    btnTip.TextAlignment = TextAlignment.CenterLeft;
                    return;
                }
                confirmAction(editText.Text.Trim());
                dialog.Close();
HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
@@ -1,5 +1,6 @@
using System;
using Shared;
using System.Collections.Generic;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
    public class OutdoorEnvironment : FrameLayout
@@ -48,7 +49,7 @@
            //湿度高于
            LogicView.SelectTypeView humidityhigherView = new LogicView.SelectTypeView();
            humidityhigherView.frameLayout.Y = temperatureunderView.frameLayout.Bottom+Application.GetRealHeight(8);
            humidityhigherView.frameLayout.Y = temperatureunderView.frameLayout.Bottom + Application.GetRealHeight(8);
            humidityhigherView.btnIcon.Visible = false;
            humidityhigherView.btnText.X = Application.GetRealWidth(16);
            humidityhigherView.btnLine.X = Application.GetRealWidth(16);
@@ -65,24 +66,16 @@
            humidityunderView.btnText.TextID = StringId.shidudiyu;
            viewLayout.AddChidren(humidityunderView.FLayoutView());
            //PM2.5高于
            //PM2.5
            LogicView.SelectTypeView pmhigherView = new LogicView.SelectTypeView();
            pmhigherView.frameLayout.Y = humidityunderView.frameLayout.Bottom + Application.GetRealHeight(8);
            pmhigherView.btnIcon.Visible = false;
            pmhigherView.btnText.X = Application.GetRealWidth(16);
            pmhigherView.btnLine.X = Application.GetRealWidth(16);
            pmhigherView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
            pmhigherView.btnText.TextID = StringId.pmgaoyu;
            pmhigherView.btnText.TextID = StringId.PM25;
            viewLayout.AddChidren(pmhigherView.FLayoutView());
            //PM2.5低于
            LogicView.SelectTypeView pmunderView = new LogicView.SelectTypeView();
            pmunderView.frameLayout.Y = pmhigherView.frameLayout.Bottom;
            pmunderView.btnIcon.Visible = false;
            pmunderView.btnText.X = Application.GetRealWidth(16);
            pmunderView.btnLine.X = Application.GetRealWidth(16);
            pmunderView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
            pmunderView.btnText.TextID = StringId.pmdiyu;
            viewLayout.AddChidren(pmunderView.FLayoutView());
            #endregion
@@ -90,41 +83,231 @@
            //温度高于
            temperaturehigherView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                InputBoxAction(StringId.wendugaoyu);
                new LogicView.TipPopView { }.InputBox1(1,"",1,(s)=> { });
            };
            //温度低于
            temperatureunderView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                InputBoxAction(StringId.wendudiyu);
            };
            //湿度高于
            humidityhigherView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                InputBoxAction(StringId.shidugaoyu);
            };
            //湿度低于
            humidityunderView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                InputBoxAction(StringId.shidudiyu);
            };
            //PM2.5高于
            //PM2.5
            pmhigherView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
                PmAction(this);
            };
            //PM2.5低于
            pmunderView.btnClick.MouseUpEventHandler += (sen, e) =>
            {
            };
            #endregion
        }
        /// <summary>
        /// 温度,湿度弹框设置值
        /// </summary>
        /// <param name="textInt">文本</param>
        /// <param name="stateValue">编辑之前的状态值,默认为20</param>
        public void InputBoxAction(int textInt,string stateValue="20")
        {
            new LogicView.TipPopView { }.InputBox(textInt, stateValue, (value) =>
            {
                string keyValue = "";
                string comparator = "=";
                switch (textInt)
                {
                    case StringId.wendugaoyu:
                        {
                            keyValue = "outdoor_temp";
                            comparator = ">";
                        }
                        break;
                    case StringId.wendudiyu:
                        {
                            keyValue = "outdoor_temp";
                            comparator = "<";
                        }
                        break;
                    case StringId.shidugaoyu:
                        {
                            keyValue = "outdoor_humity";
                            comparator = ">";
                        }
                        break;
                    case StringId.shidudiyu:
                        {
                            keyValue = "outdoor_humity";
                            comparator = "<";
                        }
                        break;
                }
                AddDic(keyValue, comparator, value);
            });
        }
        /// <summary>
        /// 温度,湿度弹框设置值
        /// </summary>
        /// <param name="frame">当前界面</param>
        /// <param name="stateValue">编辑之前的状态值,默认为""</param>
        public void PmAction(FrameLayout frame, string stateValue = "")
        {
            PublicInterface pmView = new PublicInterface();
            var pmListStr = pmView.GetViewList("pm2.5");
            pmView.SingleSelectionShow(frame, pmListStr, Language.StringByID(StringId.PM25), GetString(stateValue)
               , (text) =>
               {
                   string value = "";
                   if (text == Language.StringByID(StringId.pmyou))
                   {
                       value = "10";
                   }
                   else if (text == Language.StringByID(StringId.pmliang))
                   {
                       value = "50";
                   }
                   else if (text == Language.StringByID(StringId.pmqingdu))
                   {
                       value = "90";
                   }
                   else if (text == Language.StringByID(StringId.pmzhongdu))
                   {
                       value = "130";
                   }
                   else if (text == Language.StringByID(StringId.pmzhongduwuran))
                   {
                       value = "170";
                   }
                   AddDic("pm2.5", "=", value);
               });
        }
        /// <summary>
        /// 封装数据
        /// </summary>
        /// <param name="keyValue">类型值(pm2.5;outdoor_temp;outdoor_humity)</param>
        /// <param name="comparator">比较关系</param>
        /// <param name="value">值</param>
        private void AddDic(string keyValue, string comparator, string value)
        {
            Input input = new Input();
            input.sid = LogicMethod.NewSid();
            input.condition_type = "4";
            Dictionary<string, string> dic = new Dictionary<string, string>();
            LogicMethod.dictionary(dic, "key", keyValue);
            LogicMethod.dictionary(dic, "comparator", comparator);
            LogicMethod.dictionary(dic, "data_type", "float");
            LogicMethod.dictionary(dic, "value", value);
            input.condition.Add(dic);
            AddCondition(input, keyValue, comparator);
        }
        /// <summary>
        /// 添加条件
        /// </summary>
        /// <param name="input"></param>
        /// <param name="keyValue"></param>
        /// <param name="comparator">比较关系</param>
        private void AddCondition(Input input, string keyValue,string comparator)
        {
            ///记录索引值
            int index = -1;
            for (var i = 0; i < Logic.currlogic.input.Count; i++)
            {
                var condition_type = Logic.currlogic.input[i].condition_type;
                if (condition_type == "4")
                {
                    var dicList = Logic.currlogic.input[i].condition;
                    if (ExistKey(dicList, keyValue, comparator))
                    {
                        ///找到标记索引,退出循环体
                        index = i;
                        break;
                    }
                }
            }
            if (index != -1)
            {
                //移除旧数据
                Logic.currlogic.input.RemoveAt(index);
                //新数据插入旧数据的位置
                Logic.currlogic.input.Insert(index, input);
            }
            else
            {
                Logic.currlogic.input.Add(input);
            }
            LogicMethod.RemoveAllView();
            AddLogic addLogic = new AddLogic();
            MainPage.BasePageView.AddChidren(addLogic);
            addLogic.Show();
            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
        }
        /// <summary>
        /// 判断是否存在Key
        /// </summary>
        /// <param name="dicList"></param>
        /// <param name="keyValue"></param>
        /// <param name="comparator">比较关系</param>
        /// <returns></returns>
        private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator)
        {
            for (int i = 0; i < dicList.Count; i++)
            {
                var dic = dicList[i];
                string key = dic["key"];
                string comparatorValue = dic["comparator"];
                if (key == keyValue && comparatorValue == comparator)
                {
                    //判断是否存在
                    return true;
                }
            }
            return false;
        }
        public string GetString(string strValue)
        {
            string text = "";
            int intValue = 0;
            if (strValue != "")
            {
                intValue = int.Parse(strValue);
            }
            if (intValue > 0 && intValue < 35)
            {
                text = Language.StringByID(StringId.pmyou);
            }
            else if (intValue > 35 && intValue < 75)
            {
                text = Language.StringByID(StringId.pmliang);
            }
            else if (intValue > 75 && intValue < 115)
            {
                text = Language.StringByID(StringId.pmqingdu);
            }
            else if (intValue > 115 && intValue < 150)
            {
                text = Language.StringByID(StringId.pmzhongdu);
            }
            else if (intValue > 150)
            {
                text = Language.StringByID(StringId.pmzhongduwuran);
            }
            return text;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -462,6 +462,17 @@
                      };
                    }
                    break;
                case "pm2.5":
                    {
                        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;
            }
            return list;
@@ -636,5 +647,7 @@
            return stateList;
        }
    }
}
HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
@@ -99,16 +99,16 @@
        /// <param name="value"></param>
        private void AddDic(string value)
        {
            Input inputTime = new Input();
            inputTime.sid = LogicMethod.NewSid();
            inputTime.condition_type = "6";
            Input input = new Input();
            input.sid = LogicMethod.NewSid();
            input.condition_type = "6";
            Dictionary<string, string> dic = new Dictionary<string, string>();
            LogicMethod.dictionary(dic, "key", "weather");
            LogicMethod.dictionary(dic, "comparator", "=");
            LogicMethod.dictionary(dic, "data_type", "string");
            LogicMethod.dictionary(dic, "value", value);
            inputTime.condition.Add(dic);
            AddCondition(inputTime);
            input.condition.Add(dic);
            AddCondition(input);
        }
        /// <summary>
        /// 添加条件