using System;
|
using System.Collections.Generic;
|
using HDL_ON.Entity;
|
using Shared;
|
|
namespace HDL_ON.UI
|
{
|
public partial class ResidentialManagePage
|
{
|
void LoadEventList()
|
{
|
LoadEvent_SkipFloorsPage();
|
LoadEvent_SkipRoomsPage();
|
LoadEvent_EditResidencName();
|
LoadEvent_EditResidencAddress();
|
}
|
|
/// <summary>
|
/// 加载修改住宅名称事件
|
/// </summary>
|
void LoadEvent_EditResidencName()
|
{
|
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
|
{
|
Action<string> callBack = (str) =>
|
{
|
if (string.IsNullOrEmpty(str))
|
{
|
new Tip()
|
{
|
CloseTime = 1,
|
Text = Language.StringByID(StringId.HouseNameCannotBeEmpty),
|
Direction = AMPopTipDirection.None,
|
}.Show(bodyView);
|
return;
|
}
|
DB_ResidenceData.residenceData.residecenInfo.Name = str;
|
|
var waitPage = new Loading();
|
waitPage.Start(Language.StringByID(StringId.PleaseWait));
|
new System.Threading.Thread(() =>
|
{
|
try
|
{
|
var responsePack = new DAL.Server.HttpServerRequest().EditResidenceInfo();
|
|
if (responsePack.StateCode.ToUpper() == "SUCCESS")
|
{
|
Application.RunOnMainThread(() =>
|
{
|
//MainPage.LoginUser.regionList.Find((obj) => obj.Name == btnResidenceName.Text.Trim()).Name = str;
|
btnResidenceName.Text = str;
|
upateResidenceName();
|
});
|
DB_ResidenceData.residenceData.residecenInfo.Name = str;
|
DB_ResidenceData.residenceData.SaveResidenceData();
|
}
|
else
|
{
|
var tipStr = "Server erorr";
|
switch (responsePack.StateCode)
|
{
|
case "NoLogin":
|
tipStr = Language.StringByID(StringId.InvalidLoginCertificate);
|
break;
|
case "ParameterOrEmpty":
|
|
break;
|
}
|
Application.RunOnMainThread(() =>
|
{
|
//提示原因
|
var tip = new Tip()
|
{
|
Text = tipStr,
|
CloseTime = 1,
|
Direction = AMPopTipDirection.None
|
};
|
tip.Show(bodyView);
|
});
|
}
|
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"update user name error : {ex.Message}");
|
}
|
finally
|
{
|
Application.RunOnMainThread(() =>
|
{
|
waitPage.Hide();
|
});
|
}
|
})
|
{ IsBackground = true }.Start();
|
};
|
new PublicAssmebly().LoadDialog_EditParater(StringId.ResidenceName, DB_ResidenceData.residenceData.residecenInfo.Name, callBack,StringId.HouseNameCannotBeEmpty,0,new List<string>());
|
};
|
btnResidenceName.MouseUpEventHandler = eventHandler;
|
btnEditResidenceNameIcon.MouseUpEventHandler = eventHandler;
|
}
|
/// <summary>
|
/// 加载修改住宅地址事件
|
/// </summary>
|
void LoadEvent_EditResidencAddress()
|
{
|
EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
|
{
|
Action<string> callBack = (str) =>
|
{
|
DB_ResidenceData.residenceData.residecenInfo.Address = str;
|
var responsePack = new DAL.Server.HttpServerRequest().EditResidenceInfo();
|
|
if (responsePack.StateCode.ToUpper() == "SUCCESS")
|
{
|
btnResidenceAddress.Text = str;
|
OnAppConfig.Instance.SaveUserConfig();
|
}
|
else
|
{
|
var tipStr = "Server erorr";
|
switch (responsePack.StateCode)
|
{
|
case "NoLogin":
|
tipStr = Language.StringByID(StringId.InvalidLoginCertificate);
|
break;
|
case "ParameterOrEmpty":
|
|
break;
|
}
|
Application.RunOnMainThread(() =>
|
{
|
//提示原因
|
var tip = new Tip()
|
{
|
Text = tipStr,
|
CloseTime = 1,
|
Direction = AMPopTipDirection.None
|
};
|
tip.Show(bodyView);
|
});
|
}
|
};
|
new PublicAssmebly().LoadDialog_EditParater(StringId.ResidenceAddress, DB_ResidenceData.residenceData.residecenInfo.Name, callBack,StringId.HouseAddressCannotBeEmpty,0,new List<string>());
|
};
|
btnResidenceAddress.MouseUpEventHandler = eventHandler;
|
btnLocationAddressIcon.MouseUpEventHandler = eventHandler;
|
}
|
|
/// <summary>
|
/// 跳转到楼层管理页面
|
/// </summary>
|
void LoadEvent_SkipFloorsPage()
|
{
|
EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
|
var skipPage = new FloorsManagementPage();
|
MainPage.BasePageView.AddChidren(skipPage);
|
skipPage.LoadPage(StringId.FloorsManagement);
|
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
|
};
|
floorManagementRow.MouseUpEventHandler = eventHandler;
|
btnFloorManagementSkinIcon.MouseUpEventHandler = eventHandler;
|
btnFloorManagementTitle.MouseUpEventHandler = eventHandler;
|
}
|
|
/// <summary>
|
/// 跳转到房间管理页面
|
/// </summary>
|
void LoadEvent_SkipRoomsPage()
|
{
|
EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
|
var skipPage = new RoomsManagementPage();
|
MainPage.BasePageView.AddChidren(skipPage);
|
skipPage.LoadPage();
|
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
|
};
|
roomManagementRow.MouseUpEventHandler = eventHandler;
|
btnRoomManagementSkinIcon.MouseUpEventHandler = eventHandler;
|
btnRoomManagementTitle.MouseUpEventHandler = eventHandler;
|
}
|
|
/// <summary>
|
/// 开关住宅调试权限
|
/// </summary>
|
void LoadEvent_ChangeDebugPrivilege()
|
{
|
btnCommissioningAuthoritySwitchIcon.MouseUpEventHandler = (sender, e) =>
|
{
|
var debugPrivilege = btnCommissioningAuthoritySwitchIcon.IsSelected = !btnCommissioningAuthoritySwitchIcon.IsSelected;
|
//if (debugPrivilege)
|
//{
|
//}
|
//var waitPage = new Loading();
|
//waitPage.Start(Language.StringByID(StringId.PleaseWait));
|
//new System.Threading.Thread(() =>
|
//{
|
// try
|
// {
|
// var responsePack = new DAL.Server.HttpServerRequest().EditResidenceInfo();
|
// if (responsePack.DB_ResidenceData.functionList
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// });
|
// }
|
// else
|
// {
|
// var tipStr = "Server erorr";
|
// switch (responsePack.StateCode)
|
// {
|
// case "NoLogin":
|
// tipStr = Language.StringByID(StringId.InvalidLoginCertificate);
|
// break;
|
// case "ParameterOrEmpty":
|
// break;
|
// }
|
// Application.RunOnMainThread(() =>
|
// {
|
// //提示原因
|
// var tip = new Tip()
|
// {
|
// Text = tipStr,
|
// CloseTime = 1,
|
// Direction = AMPopTipDirection.None
|
// };
|
// tip.Show(bodyView);
|
// });
|
// }
|
|
// }
|
// catch (Exception ex)
|
// {
|
// MainPage.Log($"update user name error : {ex.Message}");
|
// }
|
// finally
|
// {
|
// Application.RunOnMainThread(() =>
|
// {
|
// waitPage.Hide();
|
// });
|
// }
|
//})
|
//{ IsBackground = true }.Start();
|
};
|
}
|
}
|
}
|