| | |
| | | txtInput.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uYouSuggestionMsg);
|
| | | frameInput.AddChidren(txtInput);
|
| | | txtInput.InitIosPlaceholderUILabelWithHeight(Application.GetRealHeight(60));
|
| | | txtInput.TextChangeEventHandler += (sender, txtvalue) =>
|
| | | //输入值改变事件
|
| | | Action<View, string> txtInputChangedEvent = (sender, txtValue) =>
|
| | | {
|
| | | if (this.suggestionCount <= 0)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | int length = txtvalue.Length;
|
| | | var newValue = txtValue;
|
| | | //如果输入的值,已经大于指定的数,则截取
|
| | | if (newValue.Length > 500)
|
| | | {
|
| | | //截取指定的byte字节
|
| | | newValue = newValue.Substring(0, 500);
|
| | | txtInput.Text = newValue;
|
| | | //将光标至于最后
|
| | | #if Android
|
| | | txtInput.SetSelectionEnd();
|
| | | #endif
|
| | | }
|
| | |
|
| | | int length = newValue.Length;
|
| | | if (length == 0)
|
| | | {
|
| | | if (btnSubmit.CanClick == true) { btnSubmit.CanClick = false; }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (btnSubmit.CanClick == false) |
| | | if (btnSubmit.CanClick == false)
|
| | | {
|
| | | //变灰色字体
|
| | | btnFild.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | |
| | | }
|
| | | }
|
| | | btnFild.Text = (500 - length).ToString();
|
| | |
|
| | | if (length > 500)
|
| | | {
|
| | | if (btnSubmit.CanClick == true) |
| | | { |
| | | btnSubmit.CanClick = false;
|
| | | //变红色字体
|
| | | btnFild.TextColor = Common.ZigbeeColor.Current.GXCTextRed;
|
| | | }
|
| | | }
|
| | | };
|
| | | txtInput.TextChangeEventHandler += txtInputChangedEvent;
|
| | | |
| | | var framType = new FrameLayout();
|
| | | framType.Height = Application.GetRealHeight(150);
|
| | |
| | | frameEmail.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameEmail.Y = framType.Bottom + Application.GetRealHeight(23);
|
| | | bodyFrameLayout.AddChidren(frameEmail);
|
| | | //邮箱地址
|
| | | var btnEmail = new NormalViewControl(220, 60, true);
|
| | | btnEmail.X = ControlCommonResourse.XXLeft;
|
| | | btnEmail.Gravity = Gravity.CenterVertical;
|
| | | btnEmail.TextID = R.MyInternationalizationString.uEmailAddress;
|
| | | frameEmail.AddChidren(btnEmail);
|
| | | var txtEmail = new TextInputControl(500, 60, true);
|
| | | //联系方式
|
| | | var btnContact = new NormalViewControl(220, 60, true);
|
| | | btnContact.X = ControlCommonResourse.XXLeft;
|
| | | btnContact.Gravity = Gravity.CenterVertical;
|
| | | btnContact.TextID = R.MyInternationalizationString.uContactInformation;
|
| | | frameEmail.AddChidren(btnContact);
|
| | | var txtEmail = new TextInputControl(720, 60, true);
|
| | | txtEmail.X = Application.GetRealWidth(314);
|
| | | txtEmail.Gravity = Gravity.CenterVertical;
|
| | | txtEmail.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputYouEmailAddress);
|
| | | txtEmail.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputYourContactInformation);
|
| | | frameEmail.AddChidren(txtEmail);
|
| | |
|
| | | //提交
|
| | |
| | | this.UploadSuggestion(txtInput.Text, txtEmail.Text);
|
| | | };
|
| | |
|
| | |
|
| | | var strFile = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.SuggestionFile);
|
| | | if (System.IO.File.Exists(strFile) == false)
|
| | | {
|
| | | return;
|
| | | }
|
| | | var data = UserCenterLogic.LoadFileContent(strFile);
|
| | | var data = HdlFileLogic.Current.ReadFileTextContent(DirNameResourse.SuggestionFile);
|
| | | if (data != null)
|
| | | {
|
| | | var strNowData = DateTime.Now.ToString("yyyyMMdd");
|
| | |
| | | /// <param name="email"></param>
|
| | | private void UploadSuggestion(string strContent, string email)
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(async() =>
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | var pra = new
|
| | | {
|
| | |
| | | OpinionFeedbackType = this.typeMode,
|
| | | Email = email
|
| | | };
|
| | | var result = await UserCenterLogic.GetResultStatuByRequestHttps("App/AddOpinionFeedback", false, pra);
|
| | | var result = UserCenterLogic.GetResultStatuByRequestHttps("App/AddOpinionFeedback", false, pra);
|
| | | if (result == true)
|
| | | {
|
| | | //保存次数
|
| | | this.suggestionCount--;
|
| | | var strFile = System.IO.Path.Combine(Shared.IO.FileUtils.RootPath, Common.Config.Instance.Guid, DirNameResourse.SuggestionFile);
|
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(this.suggestionCount + DateTime.Now.ToString("yyyyMMdd"));
|
| | | //写入内容
|
| | | Shared.IO.FileUtils.WriteFileByBytes(strFile, byteData);
|
| | | HdlFileLogic.Current.SaveTextToFile(DirNameResourse.SuggestionFile, this.suggestionCount + DateTime.Now.ToString("yyyyMMdd"));
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|