using System;
|
using Shared;
|
using System.Collections.Generic;
|
|
|
namespace HDL_ON.UI.UI2.Intelligence.Automation
|
{
|
public class InputPushText : FrameLayout
|
{
|
public InputPushText()
|
{
|
Tag = "Logic";
|
}
|
public void Show()
|
{
|
|
this.BackgroundColor = CSS.CSS_Color.viewMiddle;
|
LogicView.TopView topView = new LogicView.TopView();
|
topView.topNameBtn.TextID = StringId.fasongtongzhi;
|
this.AddChidren(topView.FLayoutView());
|
|
FrameLayout viewLayout = new FrameLayout
|
{
|
Y = Application.GetRealHeight(64),
|
Width = Application.GetRealWidth(LogicView.TextSize.view375),
|
Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64 - 76),
|
BackgroundColor = CSS.CSS_Color.viewMiddle,
|
};
|
this.AddChidren(viewLayout);
|
#region 通知内容
|
LogicView.AddOutputInputTextView addInputTextView = new LogicView.AddOutputInputTextView();
|
addInputTextView.btnIf.TextID = StringId.tongzhineirong;
|
viewLayout.AddChidren(addInputTextView.FLayoutView(46, 12));
|
///输入推送文本
|
EditTextView textBox = new EditTextView//EditText
|
{
|
Y = Application.GetRealHeight(42),
|
X = Application.GetRealWidth(16),
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(152),
|
TextAlignment = TextAlignment.TopLeft,
|
Radius=(uint)Application.GetRealHeight(12),
|
Text= Logic.currlogic.noticeConfig.noticeContent,
|
TextSize = LogicView.TextSize.text14,
|
TextColor= CSS.CSS_Color.textColor,
|
PlaceholderText =Language.StringByID(StringId.xianzhichangdu),//"(100字以内)",
|
PlaceholderTextColor = CSS.CSS_Color.textCancelColor,
|
BackgroundColor = CSS.CSS_Color.textWhiteColor,
|
|
};
|
viewLayout.AddChidren(textBox);
|
textBox.TextChangeEventHandler += (sender, e) =>
|
{
|
var leng = e.Length;
|
if (leng > 100)
|
{
|
textBox.Text = e.Substring(0,100);
|
#if __Android__
|
textBox.SetSelectionEnd();
|
#endif
|
|
}
|
|
};
|
#endregion
|
#region App推送
|
LogicView.LogicTypeTitleView appPush = new LogicView.LogicTypeTitleView();
|
appPush.frameLayout.Y = Application.GetRealHeight(206);
|
appPush.frameLayout.Radius = (uint)Application.GetRealHeight(12);
|
appPush.btnText.TextID = StringId.apptuisong;
|
appPush.btnText.X = Application.GetRealWidth(12);
|
viewLayout.AddChidren(appPush.FLayoutView());
|
//定义一个局部账号列表用来记录选中数据;
|
List<string> selectedAccountList = new List<string>();
|
appPush.btnClick.MouseUpEventHandler += (sender, e) =>
|
{
|
var userList = new List<HDL_ON.Entity.ResidenceMemberInfo>();
|
Loading loading = new Loading();
|
this.AddChidren(loading);
|
loading.Start();
|
new System.Threading.Thread(() =>
|
{
|
try
|
{
|
userList = Send.GetResidenceMemberAccount();
|
|
}
|
catch { }
|
finally
|
{
|
Application.RunOnMainThread(() =>
|
{
|
loading.Hide();
|
userList.Add(new Entity.ResidenceMemberInfo { childAccountId = UserInfo.Current.ID, childAccountPhone = UserInfo.Current.userMobileInfo, childAccountEmail = UserInfo.Current.userEmailInfo });
|
//住宅子账号列表
|
List<string> accountList = new List<string>();
|
//之前状态列表
|
List<string> stateList = new List<string>();
|
for (int i = 0; i < userList.Count; i++)
|
{
|
var user = userList[i];
|
accountList.Add(user.Account);
|
}
|
|
if (Logic.currlogic.pushConfigs.Count > 0)
|
{
|
var list = Logic.currlogic.pushConfigs[0].pushTarget;
|
for (int i = 0;i< userList.Count; i++)
|
{
|
|
var user = userList[i];
|
if (list.Contains(user.childAccountId))
|
{
|
stateList.Add(user.Account);
|
}
|
|
}
|
|
|
}
|
|
PublicInterface view = new PublicInterface();
|
view.FrameOrVvList(this, accountList, stateList, StringId.zhanghaoxuanze
|
, (list) =>
|
{
|
//清空旧数据列表
|
selectedAccountList.Clear();
|
for (int i = 0;i<userList.Count; i++)
|
{
|
var user = userList[i];
|
if (list.Contains(user.Account))
|
{
|
selectedAccountList.Add(user.childAccountId);
|
}
|
}
|
|
});
|
});
|
}
|
})
|
{ IsBackground = true }.Start();
|
};
|
|
#endregion
|
#region 确认
|
LogicView.SaveView saveView = new LogicView.SaveView();
|
saveView.btnSave.TextID = StringId.queren;
|
saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
|
this.AddChidren(saveView.FLayoutView());
|
|
topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
|
{
|
this.RemoveFromParent();
|
};
|
saveView.btnClick.MouseUpEventHandler += (e, sen) =>
|
{
|
Logic.currlogic.noticeConfig.noticeContent = textBox.Text.Trim();
|
Logic.currlogic.pushConfigs.Clear();//清空旧数据列表
|
Logic.currlogic.pushConfigs.Add(new PushConfigs { pushTarget = selectedAccountList });
|
this.RemoveFromParent();
|
};
|
#endregion
|
|
}
|
|
/// <summary>
|
/// 手机账号为先,手机账号为空,其次到邮箱账号
|
/// </summary>
|
private string Account
|
{
|
get
|
{
|
///手机账号为先,手机账号为空,其次到邮箱账号;
|
if (!string.IsNullOrEmpty(UserInfo.Current.userMobileInfo))
|
{
|
//默认推送当前手机账号
|
return UserInfo.Current.userMobileInfo;
|
}
|
else
|
{
|
//默认推送当前邮箱账号
|
return UserInfo.Current.userEmailInfo;
|
}
|
}
|
}
|
}
|
}
|