From 1410e38e50687272a162123552de122661d981ee Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 25 十一月 2020 17:53:04 +0800
Subject: [PATCH] 2020-11-25-2
---
HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs | 2
/dev/null | 0
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 23 ++++++-
.vs/HDL_APP_Project/xs/sqlite3/storage.ide | 0
.vs/HDL_APP_Project/xs/UserPrefs.xml | 16 ++--
HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs | 129 ++++++++++++++++++++++++++++++++++---------
6 files changed, 131 insertions(+), 39 deletions(-)
diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index ced7733..1065d9a 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,19 +1,20 @@
锘�<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/AddOutputInputView.cs">
+ <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs">
<Files>
<File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs" Line="19" Column="15" IsPinned="True" />
<File FileName="HDL_ON/Common/R.cs" Line="467" Column="1" />
<File FileName="HDL-ON_Android/Assets/Language.ini" Line="460" Column="8" />
- <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" Line="79" Column="63" />
- <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs" Line="225" Column="120" />
+ <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs" Line="69" Column="69" />
+ <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs" Line="239" Column="66" />
<File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs" Line="185" Column="67" />
- <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs" Line="44" Column="82" />
+ <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs" Line="226" Column="36" />
<File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs" Line="57" Column="44" />
<File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" Line="45" Column="38" />
<File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs" Line="60" Column="18" />
- <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs" Line="5" Column="18" />
+ <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/SelectTypeView.cs" Line="18" Column="43" />
<File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/AddOutputInputView.cs" Line="53" Column="11" />
+ <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/TimeTpye.cs" Line="124" Column="14" />
</Files>
<Pads>
<Pad Id="ProjectPad">
@@ -31,9 +32,8 @@
<Node name="UI2" expanded="True">
<Node name="3-Intelligence" expanded="True">
<Node name="Automation" expanded="True">
- <Node name="LogicView" expanded="True">
- <Node name="AddOutputInputView.cs" selected="True" />
- </Node>
+ <Node name="LogicView" expanded="True" />
+ <Node name="DeviceFunList.cs" selected="True" />
</Node>
</Node>
</Node>
diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide
index 19bf656..4995ffa 100644
--- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide
+++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide
Binary files differ
diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm
deleted file mode 100644
index a46d97a..0000000
--- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-shm
+++ /dev/null
Binary files differ
diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal
deleted file mode 100644
index 37f2433..0000000
--- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal
+++ /dev/null
Binary files differ
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs
index 929669b..cb35527 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/DeviceFunList.cs
@@ -10,8 +10,9 @@
Tag = "Logic";
}
- public void Show(Entity.Function device)
+ public void Show(Entity.Function device, int index, bool edit)
{
+ #region 鐣岄潰甯冨眬
this.BackgroundColor = CSS.CSS_Color.viewMiddle;
LogicView.TopView topView = new LogicView.TopView();
this.AddChidren(topView.FLayoutView());
@@ -27,17 +28,24 @@
Height = Application.GetRealHeight(667 - 64),
};
this.AddChidren(fLayout);
-
- Input inputdevice = new Input();
- inputdevice.condition_type = "3";
- inputdevice.sid = device.sid;
-
+ #endregion
+
+ //瀹氫箟涓�涓彉閲忥紝璁板綍閫変腑鐘舵��
+ string selectedState = "unknown";
+
+ Input inputdevice = new Input();
+ inputdevice.condition_type = "3";
+ inputdevice.sid = device.sid;
+
switch (device.functionType)
{
//寮�鍏崇伅鍏�
case FunctionType.Relay:
{
+
+
+
//for (int i = 0; i < device.function.Count; i++)
//{
//}
@@ -46,9 +54,9 @@
relayView.btnState.Visible = true;
relayView.btnText.TextSize = LogicView.TextSize.text16;
relayView.btnText.Height = Application.GetRealHeight(22);
- relayView.btnText.TextID =StringId.switchLogic;
+ relayView.btnText.TextID = StringId.switchLogic;
relayView.btnText.X = Application.GetRealWidth(16);
- relayView.btnText.Width= Application.GetRealWidth(130);
+ relayView.btnText.Width = Application.GetRealWidth(130);
relayView.btnLine.X = Application.GetRealWidth(16);
relayView.btnLine.Width = Application.GetRealWidth(343);
fLayout.AddChidren(relayView.FLayoutView());
@@ -61,7 +69,7 @@
this.AddChidren(relayFunView);
LogicView.SwitchView switchView = new LogicView.SwitchView();
switchView.FLayoutView(relayFunView, 2);
-
+
Button btnOn = new Button
{
TextAlignment = TextAlignment.Center,
@@ -96,18 +104,43 @@
LogicMethod.dictionary(dic, "comparator", "=");
LogicMethod.dictionary(dic, "data_type", "string");
inputdevice.condition.Add(dic);
- btnOn.MouseUpEventHandler += (sender2, e2) => {
+ btnOn.MouseUpEventHandler += (sender2, e2) =>
+ {
LogicMethod.dictionary(dic, "value", "on");
RemView(relayFunView);
relayView.btnState.TextID = StringId.onLogic;
+ selectedState = device.functionType + "_on";
};
- btnOff.MouseUpEventHandler += (sender3, e3) => {
+ btnOff.MouseUpEventHandler += (sender3, e3) =>
+ {
LogicMethod.dictionary(dic, "value", "off");
RemView(relayFunView);
relayView.btnState.TextID = StringId.offLogic;
+ selectedState = device.functionType + "_off";
};
};
+ if (edit)
+ {
+ Input inputs = Logic.currlogic.input[index];
+ if (inputs.condition_type == "3")
+ {
+ List<Dictionary<string, string>> dicList = inputs.condition as List<Dictionary<string, string>>;
+ foreach (var dic in dicList)
+ {
+ string value = dic["value"];
+ if (value == "on")
+ {
+ relayView.btnState.Text = Language.StringByID(StringId.onLogic);
+
+ }
+ else
+ {
+ relayView.btnState.Text = Language.StringByID(StringId.offLogic);
+ }
+ }
+ }
+ }
}
break;
@@ -124,21 +157,31 @@
this.AddChidren(saveView.FLayoutView());
saveView.btnClick.MouseUpEventHandler += (sen, e) =>
{
- //if (edit)
- //{
- // //绉婚櫎鏃ф暟鎹�
- // Logic.currlogic.input.RemoveAt(index);
- // //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�;
- // Logic.currlogic.input.Insert(index, inputdevice);
- //}
- //else
- //{
- // //娣诲姞涓�涓柊鐨勬椂闂寸偣鏉′欢
- // Logic.currlogic.input.Add(inputdevice);
- //}
-
- //娣诲姞涓�涓柊鐨勬椂闂寸偣鏉′欢
- Logic.currlogic.input.Add(inputdevice);
+ if (selectedState != "unknown")
+ {
+ if (edit)
+ {
+ //绉婚櫎鏃ф暟鎹�
+ Logic.currlogic.input.RemoveAt(index);
+ //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�;
+ Logic.currlogic.input.Insert(index, inputdevice);
+ }
+ else
+ {
+ //娣诲姞涓�涓柊鐨勬椂闂寸偣鏉′欢
+ Logic.currlogic.input.Add(inputdevice);
+ }
+ }
+ else
+ {
+ if (!edit)
+ {
+ //鎻愮ず鐢ㄦ埛
+ return;
+ }
+ this.RemoveFromParent();
+ return;
+ }
RemoveViewByTag("Logic");
AddLogic addLogic = new AddLogic();
MainPage.BasePageView.AddChidren(addLogic);
@@ -153,8 +196,40 @@
/// 绉婚櫎鎺т欢
/// </summary>
/// <param name="frame"></param>
- public void RemView(FrameLayout frame) {
+ public void RemView(FrameLayout frame)
+ {
frame.RemoveFromParent();
}
+
+ public void GetState(Entity.Function device, bool edit, int index,Button button1,Button button2,Button button3,Button button4)
+ {
+ if (edit)
+ {
+ Input inputs = Logic.currlogic.input[index];
+ var dicList = inputs.condition as List<Dictionary<string, string>>;
+ switch (device.functionType)
+ {
+ //寮�鍏崇伅鍏�
+ case FunctionType.Relay:
+ {
+ foreach (var dic in dicList)
+ {
+ string value = dic["value"];
+ //if (value == "on")
+ //{
+ // relayView.btnState.Text = Language.StringByID(StringId.onLogic);
+
+ //}
+ //else
+ //{
+ // relayView.btnState.Text = Language.StringByID(StringId.offLogic);
+ //}
+ }
+ }
+ break;
+
+ }
+ }
+ }
}
}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
index 4fa1668..e407af8 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/FunTpye.cs
@@ -240,7 +240,7 @@
funView.btnClick.MouseUpEventHandler += (sen,e) => {
DeviceFunList deviceFunList = new DeviceFunList();
MainPage.BasePageView.AddChidren(deviceFunList);
- deviceFunList.Show(dev);
+ deviceFunList.Show(dev,0,false);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 5648d36..c00a35e 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -59,7 +59,7 @@
inputView.btnIcon.UnSelectedImagePath = LogicMethod.GetIconPath(device.functionType);
//鏄剧ず璁惧鍚嶇О
inputView.btnText.Text = device.name;
- //鏀瑰彉璁惧鍚嶇О瀹藉害
+ //鏀瑰彉璁惧鍚嶇О鏄剧ず鎺т欢瀹藉害
inputView.btnText.Width = Application.GetRealWidth(80);
//鍖哄埆涓嶅悓璁惧锛屾樉绀轰笉鍚岃澶囩姸鎬�
switch (device.functionType)
@@ -90,6 +90,10 @@
inputView.btnClick.MouseUpEventHandler += (sen, e) =>
{
Button button = (Button)sen;
+ //鎵惧埌褰撳墠缂栬緫鐨勭储寮�
+ int indexVulae = int.Parse(inputView.btnClick.Tag.ToString());
+ //鏍囪缂栬緫鐘舵��
+ bool edit = true;
switch (button.Name)
{
case "1":
@@ -100,7 +104,7 @@
};
thisView.AddChidren(fLayout);
TimeTpye timeTpye = new TimeTpye();
- timeTpye.TimePoint(fLayout, true, int.Parse(inputView.btnClick.Tag.ToString()));
+ timeTpye.TimePoint(fLayout, edit, indexVulae);
}
break;
case "2":
@@ -111,9 +115,22 @@
};
thisView.AddChidren(fLayout);
TimeTpye timeTpye = new TimeTpye();
- timeTpye.TimeHorizon(fLayout, true, int.Parse(inputView.btnClick.Tag.ToString()));
+ timeTpye.TimeHorizon(fLayout, edit, indexVulae);
}
break;
+
+ case "3":
+ {
+ //鐢╯id鎵惧埌璁惧锛�
+ var device = LogicMethod.GetDevice(inputCondition.sid);
+ DeviceFunList deviceFunList = new DeviceFunList();
+ MainPage.BasePageView.AddChidren(deviceFunList);
+ deviceFunList.Show(device, indexVulae,edit);
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ }
+ break;
+
+
}
};
}
--
Gitblit v1.8.0