| | |
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 0:Bug、1:优化、2:新需求
|
| | | /// 1:BUG、2:优化(OPTIMIZE)、3:新需求(REQUIRE)
|
| | | /// </summary>
|
| | | private int typeMode = 0;
|
| | | private string typeMode = string.Empty;
|
| | | /// <summary>
|
| | | /// 意见反馈剩余次数
|
| | | /// </summary>
|
| | |
| | | bodyFrameLayout.AddChidren(frameInput); |
| | | |
| | | //字数
|
| | | var btnFild = new NormalViewControl(120, 60, true);
|
| | | btnFild.X = frameInput.Width - ControlCommonResourse.XXLeft - Application.GetRealWidth(80);
|
| | | var btnFild = new NormalViewControl(150, 60, true);
|
| | | btnFild.X = frameInput.Width - HdlControlResourse.XXLeft - Application.GetRealWidth(150);
|
| | | btnFild.Y = Application.GetRealHeight(503);
|
| | | btnFild.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnFild.TextSize = 12;
|
| | |
| | |
|
| | | //您的反馈和意见会让我们变得更好
|
| | | var txtInput = new EditTextView();
|
| | | txtInput.Width = bodyFrameLayout.Width - ControlCommonResourse.XXLeft * 2;
|
| | | txtInput.Width = bodyFrameLayout.Width - HdlControlResourse.XXLeft * 2;
|
| | | txtInput.Height = Application.GetRealHeight(470);
|
| | | txtInput.Y = Application.GetRealHeight(32);
|
| | | txtInput.TextAlignment = TextAlignment.TopLeft;
|
| | |
| | | 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;
|
| | | if (length > 500)
|
| | | var newValue = txtValue;
|
| | | //如果输入的值,已经大于指定的数,则截取
|
| | | if (newValue.Length > 500)
|
| | | {
|
| | | if (btnSubmit.CanClick == true) { btnSubmit.CanClick = false; }
|
| | | btnFild.Text = "0";
|
| | | return;
|
| | | //截取指定的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) { btnSubmit.CanClick = true; }
|
| | | if (btnSubmit.CanClick == false)
|
| | | {
|
| | | //变灰色字体
|
| | | btnFild.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnSubmit.CanClick = true;
|
| | | }
|
| | | }
|
| | | btnFild.Text = (500 - length).ToString();
|
| | | };
|
| | | txtInput.TextChangeEventHandler += txtInputChangedEvent;
|
| | | |
| | | var framType = new FrameLayout();
|
| | | framType.Height = Application.GetRealHeight(150);
|
| | |
| | |
|
| | | //反馈类型
|
| | | var btnType = new NormalViewControl(220, 60, true);
|
| | | btnType.X = ControlCommonResourse.XXLeft;
|
| | | btnType.X = HdlControlResourse.XXLeft;
|
| | | btnType.Gravity = Gravity.CenterVertical;
|
| | | btnType.TextID = R.MyInternationalizationString.uSuggestionType;
|
| | | framType.AddChidren(btnType);
|
| | | //Bug
|
| | | var frameBug = new FrameLayoutControl();
|
| | | var frameBug = new FrameLayoutStatuControl();
|
| | | frameBug.UseClickStatu = false;
|
| | | frameBug.Width = Application.GetRealWidth(200);
|
| | | frameBug.X = Application.GetRealWidth(314);
|
| | |
| | | btnBugIcon.IsSelected = true;
|
| | | btnOptimizationIcon.IsSelected = false;
|
| | | btnDemandIcon.IsSelected = false;
|
| | | this.typeMode = 0;
|
| | | this.typeMode = "BUG";
|
| | | }
|
| | | };
|
| | | //优化
|
| | | var frameOptimization = new FrameLayoutControl();
|
| | | var frameOptimization = new FrameLayoutStatuControl();
|
| | | frameOptimization.UseClickStatu = false;
|
| | | frameOptimization.Width = Application.GetRealWidth(200);
|
| | | frameOptimization.X = Application.GetRealWidth(524);
|
| | |
| | |
|
| | | btnBugIcon.IsSelected = false;
|
| | | btnDemandIcon.IsSelected = false;
|
| | | this.typeMode = 1;
|
| | | this.typeMode = "OPTIMIZE";
|
| | | }
|
| | | };
|
| | | //新需求
|
| | | var frameDemand = new FrameLayoutControl();
|
| | | var frameDemand = new FrameLayoutStatuControl();
|
| | | frameDemand.UseClickStatu = false;
|
| | | frameDemand.Width = Application.GetRealWidth(200);
|
| | | frameDemand.X = Application.GetRealWidth(734);
|
| | |
| | |
|
| | | btnBugIcon.IsSelected = false;
|
| | | btnOptimizationIcon.IsSelected = false;
|
| | | this.typeMode = 2;
|
| | | this.typeMode = "REQUIRE";
|
| | | }
|
| | | };
|
| | |
|
| | |
| | | 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 = HdlControlResourse.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);
|
| | |
|
| | | //提交
|
| | |
| | | btnSubmit.CanClick = false;
|
| | | btnSubmit.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //如果是虚拟住宅,则此功能无效
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //上传意见
|
| | | 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(HdlFileNameResourse.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
|
| | | var pra = new { contactWay = email, content = strContent, feedbackType = this.typeMode };
|
| | | var result = HdlHttpLogic.Current.RequestResponseFromZigbeeHttps("home-wisdom/app/feedback/add", RestSharp.Method.POST, pra);
|
| | | //检测状态码
|
| | | if (HdlCheckLogic.Current.CheckNetCode(result, ShowNetCodeMode.YES) == false)
|
| | | {
|
| | | RequestVersion = Common.CommonPage.RequestVersion,
|
| | | LoginAccessToken = Common.Config.Instance.Token,
|
| | | Content = strContent,
|
| | | OpinionFeedbackType = this.typeMode,
|
| | | Email = email
|
| | | };
|
| | | var result = await 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);
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uSubmitSuccessMsg));
|
| | | //关闭界面
|
| | | this.CloseForm();
|
| | | });
|
| | | return;
|
| | | }
|
| | | //保存次数
|
| | | this.suggestionCount--;
|
| | | //写入内容
|
| | | HdlFileLogic.Current.SaveTextToFile(HdlFileNameResourse.SuggestionFile, this.suggestionCount + DateTime.Now.ToString("yyyyMMdd"));
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //显示成功的界面
|
| | | this.ShowSuccessMsg();
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 显示成功的界面
|
| | | /// </summary>
|
| | | private void ShowSuccessMsg()
|
| | | {
|
| | | var frameBack = new FrameLayout();
|
| | | frameBack.BackgroundColor = 0x80000000;
|
| | | this.AddChidren(frameBack);
|
| | |
|
| | | var frameMsg = new FrameLayout();
|
| | | frameMsg.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameMsg.Width = Application.GetRealWidth(622);
|
| | | frameMsg.Height = Application.GetRealHeight(317);
|
| | | frameMsg.Radius = (uint)Application.GetRealHeight(17);
|
| | | frameMsg.Gravity = Gravity.CenterHorizontal;
|
| | | frameMsg.Y = Application.GetRealHeight(792);
|
| | | frameBack.AddChidren(frameMsg);
|
| | |
|
| | | //提示
|
| | | var btnTitle = new NormalViewControl(492, 65, true);
|
| | | btnTitle.Y = Application.GetRealHeight(68);
|
| | | btnTitle.Gravity = Gravity.CenterHorizontal;
|
| | | btnTitle.TextID = R.MyInternationalizationString.NormalTip;
|
| | | btnTitle.TextAlignment = TextAlignment.Center;
|
| | | btnTitle.TextColor = 0xFF333443;
|
| | | frameMsg.AddChidren(btnTitle);
|
| | |
|
| | | //您的反馈已成功提交
|
| | | var btnSuccess = new NormalViewControl(frameMsg.Width, Application.GetRealHeight(60), false);
|
| | | btnSuccess.Y = Application.GetRealHeight(166);
|
| | | btnSuccess.TextAlignment = TextAlignment.Center;
|
| | | btnSuccess.TextColor = UserCenterColor.Current.TextGrayColor1;
|
| | | btnSuccess.TextID = R.MyInternationalizationString.uSubmitSuccessMsg;
|
| | | frameMsg.AddChidren(btnSuccess);
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | System.Threading.Thread.Sleep(2000);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | this.CloseForm();
|
| | | });
|
| | | });
|
| | | }
|
| | |
|