From 17c8d94258154ab2e9f6d2cf821202c873b9f118 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 16 十二月 2020 15:39:15 +0800
Subject: [PATCH] 22222
---
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs | 153 +++++++++++---------------------------------------
1 files changed, 35 insertions(+), 118 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
index 049a185..76d7f8f 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
@@ -76,7 +76,6 @@
Scene scene;
- int pageTitleId;
/// <summary>
/// 鏇存柊鍔熻兘row
/// </summary>
@@ -93,21 +92,13 @@
refreshFunctionRowAction = () => {
- LoadFunctionRow(functionListView);
+ LoadFunctionRow();
};
}
- public void LoadPage(int titleId,Action backRefresh)
+ public void LoadPage(Action backRefresh)
{
- pageTitleId = titleId;
- new TopViewDiv(bodyView, Language.StringByID(pageTitleId)).LoadTopView(backRefresh);
- initPage();
- }
-
- public void LoadPage(int titleId)
- {
- pageTitleId = titleId;
- new TopViewDiv(bodyView, Language.StringByID(pageTitleId)).LoadTopView();
+ new TopViewDiv(bodyView, Language.StringByID(StringId.EditScene)).LoadTopView(backRefresh);
initPage();
}
@@ -270,7 +261,7 @@
TextAlignment = TextAlignment.CenterRight,
TextColor = CSS_Color.PromptingColor1,
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- Text = scene.delayText
+ Text = FunctionList.List.GetDelayText( scene.delay)
};
sceneDelayRow.AddChidren(btnSceneDelayInfo);
@@ -288,7 +279,12 @@
btnSceneDelayTitle.MouseUpEventHandler = (sender, e) =>
{
- new PublicAssmebly().SetSceneDelayDialog(scene, btnSceneDelayInfo);
+ Action<string> action = (obj) => {
+ scene.delay = obj;
+ btnSceneDelayInfo.Text = FunctionList.List.GetDelayText(obj);
+ scene.EditScene();
+ };
+ new PublicAssmebly().SetSceneDelayDialog(action,scene.delay);
};
contentView.AddChidren(new Button()
@@ -333,7 +329,7 @@
};
contentView.AddChidren(functionListView);
- LoadFunctionRow(functionListView);
+ LoadFunctionRow();
Button btnLine1 = new Button()
{
@@ -365,9 +361,9 @@
Y = Application.GetRealHeight(667 - 50),
Height = Application.GetRealHeight(50),
TextAlignment = TextAlignment.Center,
- TextColor = pageTitleId == StringId.NewScene ? CSS_Color.MainColor : CSS_Color.WarningColor,
+ TextColor = CSS_Color.WarningColor,
TextSize = CSS_FontSize.SubheadingFontSize,
- TextID = pageTitleId == StringId.NewScene ? StringId.Complete : StringId.Del,
+ TextID = StringId.Del,
BackgroundColor = CSS_Color.MainBackgroundColor,
//IsBold = true
};
@@ -393,6 +389,7 @@
}
Application.RunOnMainThread(() =>
{
+ LoadFunctionRow();
waitPage.Hide();
});
}
@@ -409,7 +406,7 @@
/// <summary>
/// 鍔犺浇鍔熻兘鍒楄〃
/// </summary>
- void LoadFunctionRow(VerticalScrolViewLayout functionListView)
+ void LoadFunctionRow()
{
functionListView.RemoveAll();
functionListView.Height = Application.GetRealWidth(65 * scene.functions.Count);
@@ -440,8 +437,6 @@
};
row.AddChidren(btnRight);
-
-
var btnFunctionInfo = new Button()
{
Width = Application.GetRealWidth(327),
@@ -466,7 +461,7 @@
if (Convert.ToInt32( scenefunction.delay) > 0)
{
- btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + scenefunction.localFunction.delayText;
+ btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + FunctionList.List.GetDelayText(scenefunction.delay);
}
else
{
@@ -520,13 +515,11 @@
row.AddRightView(btnDelSceneFunction);
btnDelSceneFunction.MouseUpEventHandler = (sender, e) => {
scene.functions.Remove(scenefunction);
- scene.SaveSceneData(true);
+ scene.EditScene();
row.RemoveFromParent();
functionListView.Height = Application.GetRealWidth(65 * scene.functions.Count);
//LoadFunctionRow(functionListView);
};
-
-
}
}
@@ -546,7 +539,7 @@
}
}
- if (sceneFunction.status.Count == 0)
+ if (sceneFunction.status.Count == 1)
{
return sceneFunctionInfo += Language.StringByID(StringId.Open);
}
@@ -577,61 +570,6 @@
{
sceneFunctionInfo += Language.StringByID(StringId.Open) + " " + perState.value + "%";
}
- //FunctionAttributes perTrait;
-
- //switch (sceneFunction.localFunction.functionType)
- //{
- // case FunctionType.AC:
- // sceneFunctionInfo += sceneFunction.localFunction.attributes.Find((obj) => obj.key == "mode").GetCurValueText();
- // sceneFunctionInfo += " " + sceneFunction.localFunction.attributes.Find((obj) => obj.key == "set_temp").curValue.ToString() +
- // sceneFunction.localFunction.attributes.Find((obj) => obj.key == "set_temp").uintString;
- // sceneFunctionInfo += sceneFunction.localFunction.attributes.Find((obj) => obj.key == "fan").GetCurValueText();
- // break;
- // case FunctionType.FloorHeating:
- // sceneFunctionInfo += sceneFunction.localFunction.attributes.Find((obj) => obj.key == "mode").GetCurValueText();
- // sceneFunctionInfo += " " + sceneFunction.localFunction.attributes.Find((obj) => obj.key == "set_temp").curValue.ToString() +
- // sceneFunction.localFunction.attributes.Find((obj) => obj.key == "set_temp").uintString;
- // break;
- // case FunctionType.Dimmer:
- // perTrait = sceneFunction.localFunction.attributes.Find((obj) => obj.key == "brightness");
- // if (perTrait != null)
- // {
- // sceneFunctionInfo += Language.StringByID(StringId.Open) + " " + sceneFunction.localFunction.attributes.Find((obj) => obj.key == "brightness").curValue.ToString() + "%";
- // }
- // else
- // {
- // sceneFunctionInfo += Language.StringByID(StringId.Open);
- // }
- // break;
- // case FunctionType.Relay:
- // sceneFunctionInfo += Language.StringByID(StringId.Open);
- // break;
- // case FunctionType.RGB:
- // perTrait = sceneFunction.localFunction.attributes.Find((obj) => obj.key == "percent");
- // if (perTrait != null)
- // {
- // sceneFunctionInfo += Language.StringByID(StringId.Open) + " " + sceneFunction.localFunction.attributes.Find((obj) => obj.key == "brightness").curValue.ToString() + "%";
- // }
- // else
- // {
- // sceneFunctionInfo += Language.StringByID(StringId.Open);
- // }
- // break;
- // case FunctionType.Curtain:
- // sceneFunctionInfo += Language.StringByID(StringId.Open);
- // break;
- // case FunctionType.MotorCurtain:
- // perTrait = sceneFunction.localFunction.attributes.Find((obj) => obj.key == "percent");
- // if (perTrait != null)
- // {
- // sceneFunctionInfo += Language.StringByID(StringId.Open) + " " + sceneFunction.localFunction.attributes.Find((obj) => obj.key == "percent").curValue.ToString() + "%";
- // }
- // else
- // {
- // sceneFunctionInfo += Language.StringByID(StringId.Open);
- // }
- // break;
- //}
return sceneFunctionInfo;
}
@@ -744,7 +682,14 @@
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
{
Action backAction = () => {
- btnZoneName.Text = scene.GetRoomListName();
+ var result = scene.EditScene();
+ if (result == StateCode.SUCCESS)
+ {
+ btnZoneName.Text = scene.GetRoomListName();
+ }else
+ {
+ IMessageCommon.Current.ShowErrorInfoAlter(result);
+ }
};
var ssl = new SetSceneLocationPage(scene, backAction);
MainPage.BasePageView.AddChidren(ssl);
@@ -763,7 +708,7 @@
void LoadEvent_ChangeFunctionList()
{
btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => {
- var sefp =new SceneFunctionListEditPage(scene,refreshFunctionRowAction);
+ var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction);
MainPage.BasePageView.AddChidren(sefp);
sefp.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
@@ -805,30 +750,12 @@
{
btnTakePicture.IsSelected = false;
- //var pid = Guid.NewGuid();
- //CropImage.TakePicture((imagePath) =>
- //{
- // if (imagePath != null)
- // {
- // addSceneImageView.ImagePath = imagePath.ToString();
- // scene.ImagePath = addSceneImageView.ImagePath;
- // MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath);
- // }
- //}, pid.ToString(), 4, 3);
-
-
var imageName = Guid.NewGuid().ToString();
- //var imageName = scene.sid;
CropImage.TakePicture((imagePath) =>
{
CropImageCallBack(imagePath);
-
}, imageName, 4, 3);
- //if (pageTitleId == StringId.EditScene)
- //{
- // scene.SaveFunctionData();
- //}
pictureOptionView.Parent.RemoveFromParent();
};
btnAlbum.MouseDownEventHandler = (sender, e) => {
@@ -858,10 +785,6 @@
}, imageName, 4, 3);
- //if (pageTitleId == StringId.EditScene)
- //{
- // scene.SaveFunctionData();
- //}
pictureOptionView.Parent.RemoveFromParent();
};
@@ -870,10 +793,7 @@
Action<string> action = (obj) => {
scene.ImagePath = obj;
addSceneImageView.ImagePath = scene.ImagePath;
- if (pageTitleId == StringId.EditScene)
- {
- scene.SaveSceneData(true);
- }
+ scene.EditScene();
};
var galleryPage = new GalleryPage(scene.ImagePath,action);
@@ -899,12 +819,9 @@
//涓婁紶鎴愬姛鍒板洖璋�
Action<string> uploadSuccessAction = (imageUrl) =>
{
- //2020-12-03 闇�瑕佽鏈�鏂扮殑鍥剧墖璺緞鍚屾鍒颁簯绔�
- scene.ImagePath = imageUrl;
- if (pageTitleId == StringId.EditScene)
- {
- scene.SaveSceneData(true);
- }
+ //2020-12-03 闇�瑕佽鏈�鏂扮殑鍥剧墖璺緞鍚屾鍒颁簯绔�
+ scene.ImagePath = imageUrl;
+ scene.EditScene();
};
//涓婁紶鍥剧墖鍒颁簯绔�
UploadImage(selectImagePath, addSceneImageView, scene, uploadSuccessAction);
@@ -937,7 +854,7 @@
return;
}
}
- scene.SaveSceneData(true);
+ scene.EditScene();
FunctionList.List.scenes.Add(scene);
backAction();
this.RemoveFromParent();
@@ -974,11 +891,11 @@
}.Show(bodyView);
return;
}
- btnSceneName.Text = str;
scene.name = str;
- if (pageTitleId == StringId.EditScene)
+ var result = scene.EditScene();
+ if (result == StateCode.SUCCESS)
{
- scene.SaveSceneData(true);
+ btnSceneName.Text = str;
}
};
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
--
Gitblit v1.8.0