void SetTextColor(TextView tvText, BaseText concept) { if (!string.IsNullOrEmpty(concept.Color)) { tvText.SetTextColor(Android.Graphics.Color.ParseColor(concept.Color)); } }
protected void DecorateText(TextView tv, BaseText baseText, Android.Graphics.Color color, TextDecorationType tdType) { string text = GetTextCallback(baseText); if (baseText.Highlights != null && baseText.Highlights.Count > 0) { var span = new SpannableString(text); foreach (var highlight in baseText.Highlights) { switch (tdType) { case TextDecorationType.Foreground: span.SetSpan(new ForegroundColorSpan(color), highlight[0], highlight[1], SpanTypes.ExclusiveExclusive); break; case TextDecorationType.Background: span.SetSpan(new BackgroundColorSpan(color), highlight[0], highlight[1], SpanTypes.ExclusiveExclusive); break; } } tv.Append(span); } else { tv.Text = text; } }
void SetDrawableColor(View view, BaseText concept) { if (!string.IsNullOrEmpty(concept.Color)) { var background = view.Background as Android.Graphics.Drawables.GradientDrawable; background.SetColor(Android.Graphics.Color.ParseColor(concept.Color).ToArgb()); } }
///<summary> ///txtTokuisaki_KeyUp ///入力項目上でのキー判定と文字数判定 ///</summary> private void txtTokuisaki_KeyUp(object sender, KeyEventArgs e) { Control cActiveBefore = this.ActiveControl; BaseText basetext = new BaseText(); basetext.judKeyUp(cActiveBefore, e); }
///<summary> ///judtxtSeikyuItiranKeyUp ///入力項目上でのキー判定と文字数判定 ///</summary> private void judtxtSeikyuItiranKeyUp(object sender, KeyEventArgs e) { Control cActiveBefore = this.ActiveControl; BaseText basetext = new BaseText(); basetext.judKeyUp(cActiveBefore, e); }
///<summary> ///txtTantoshabetuDenpyoCount_KeyUp ///入力項目上でのキー判定と文字数判定 ///</summary> private void txtTantoshabetuDenpyoCount_KeyUp(object sender, KeyEventArgs e) { Control cActiveBefore = this.ActiveControl; BaseText basetext = new BaseText(); basetext.judKeyUp(cActiveBefore, e); }
///<summary> ///txtUriageCheckPrint_KeyUp ///入力項目上でのキー判定と文字数判定 ///</summary> private void txtUriageCheckPrint_KeyUp(object sender, KeyEventArgs e) { Control cActiveBefore = this.ActiveControl; BaseText basetext = new BaseText(); basetext.judKeyUp(cActiveBefore, e); }
public IHttpActionResult GetHeadersText([FromUri] Guid header_id) { if (IsTokenValid() && authenticationService.IsAllowedToGetHeaders(GetTokenUserEmail(), header_id)) { return(Ok(BaseText.ToModel(textManagementService.GetByHeader(header_id)))); } return(Unauthorized()); }
///<summary> ///judtxtShohinKeyUp ///入力項目上でのキー判定と文字数判定() ///</summary> private void judtxtShohinKeyUp(object sender, KeyEventArgs e) { cActiveBefore = this.ActiveControl; //入力項目上でのキー判定と文字数判定 BaseText basetext = new BaseText(); basetext.judKeyUp(cActiveBefore, e); }
/// <summary> /// Scans the number. /// </summary> /// <returns>Token containing number.</returns> public StiToken ScanNumber() { int posStart = positionInText; bool isFloat = false; while (positionInText != Text.Length && Char.IsDigit(Text[positionInText])) { positionInText++; } if (positionInText != Text.Length && Text[positionInText] == '.' && positionInText + 1 != Text.Length && Char.IsDigit(Text[positionInText + 1])) { positionInText++; while (positionInText != Text.Length && Char.IsDigit(Text[positionInText])) { positionInText++; } isFloat = true; } string nm = BaseText.Substring(posStart, positionInText - posStart); if (isFloat) { var nfi = new NumberFormatInfo { CurrencyDecimalSeparator = "." }; return(new StiToken(StiTokenType.Value, posStart, positionInText - posStart, double.Parse(nm, nfi))); } else { string valueStr = nm; try { ulong value = ulong.Parse(valueStr); return(new StiToken(StiTokenType.Value, posStart, positionInText - posStart, value)); } catch (Exception e) { if (e is OverflowException || e is FormatException) { return(new StiToken(StiTokenType.Value, posStart, positionInText - posStart, valueStr)); } else { throw; } } } }
///<summary> /// コードTextBox でのKeyUpイベント ///</summary> private void txtCdT_KeyUp(object sender, KeyEventArgs e) { Control cActiveBefore = this.ActiveControl; //ベーステキストのインスタンス生成 BaseText basetext = new BaseText(); //キー判定、文字数判定 basetext.judKeyUp(cActiveBefore, e); }
///<summary> ///judtxtShukoKeyUp ///入力項目上でのキー判定と文字数判定 ///</summary> private void judtxtShukoKeyUp(object sender, KeyEventArgs e) { //フォーカスの確保 Control cActiveBefore = this.ActiveControl; //ベーステキストのインスタンス生成 BaseText basetext = new BaseText(); //キーアップされた時の判断処理 basetext.judKeyUp(cActiveBefore, e); }
public void DrawText(Graphics graphics, BaseText text, int x, int y) { StringFormat format = StringFormat.GenericTypographic.Clone() as StringFormat; format.Alignment = text.Alignment; format.LineAlignment = text.LineAlignment; format.FormatFlags = text.FormatFlags | StringFormatFlags.NoClip; Rectangle rectangle = new Rectangle(x, y, size.Width, size.Height); graphics.DrawString(text.Value, new Font(text.FontFamily, text.FontSize, FontStyle.Bold), Brushes.Black, rectangle, format); }
void EnableIndicator(View letterView, BaseText concept, LetterTag letterTag) { if (letterTag == LetterTag.Short) { var view = letterView.FindViewById <View>(Resource.Id.shortIndicator); SetDrawableColor(view, concept); view.Visibility = ViewStates.Visible; } else if (letterTag == LetterTag.Long) { var view = letterView.FindViewById <View>(Resource.Id.longIndicator); SetDrawableColor(view, concept); view.Visibility = ViewStates.Visible; } }
public InputLine() { InitializeComponent(); txtShohin = new BaseText(); txtC1 = new BaseText(); txtC2 = new BaseText(); txtC3 = new BaseText(); txtC4 = new BaseText(); txtC5 = new BaseText(); txtC6 = new BaseText(); txtHNo = new BaseText(); txtShiireMei = new BaseText(); lsDaibun.Lschubundata = lsChubun; lsDaibun.Lsmakerdata = lsMaker; }
private Boolean inputCheck(BaseText tb, Boolean b, DataGridViewCell c) { Boolean ret = b; if (string.IsNullOrWhiteSpace(tb.Text)) { ret = false; tb.BackColor = Color.Red; } else { tb.BackColor = Color.White; c.Value = tb.Text; } return(ret); }
public IHttpActionResult GetParagraphsTexts([FromUri] Guid paragraph_id) { if (IsTokenValid() && authenticationService.IsAllowedToGetParagraphs(GetTokenUserEmail(), paragraph_id)) { try { return(Ok(BaseText.ToModel(textManagementService.GetAllByParagraph(paragraph_id)))); } catch (Exceptions e) { return(BadRequest(e.Message)); } } return(Unauthorized()); }
void SetTextAlign(TextView tvText, BaseText concept) { var lp = (tvText.LayoutParameters as LinearLayout.LayoutParams); switch (concept.Align) { case Models.TextAlignment.Center: lp.Gravity = GravityFlags.Center; break; case Models.TextAlignment.Left: lp.Gravity = GravityFlags.Left; break; case Models.TextAlignment.Right: lp.Gravity = GravityFlags.Right; break; } }
public IHttpActionResult GetFootersText([FromUri] Guid footer_id) { if (IsTokenValid() && authenticationService.IsAllowedToGetFooters(GetTokenUserEmail(), footer_id)) { try { return(Ok(BaseText.ToModel(textManagementService.GetByFooter(footer_id)))); } catch (MissingFooterException e) { return(BadRequest(e.Message)); } catch (Exceptions e) { return(BadRequest(e.Message)); } } return(Unauthorized()); }
View ApplyLetterTags(LayoutInflater inflater, BaseText concept) { string text = GetTextCallback(concept); if (concept is Word || concept is Syllable || concept is Sentence) { var viewGroup = (ViewGroup)inflater.Inflate(Resource.Layout.BaseTextGroup, null); for (int i = 0; i < text.Length; i++) { var view = inflater.Inflate(Resource.Layout.BaseText, null); var tvText = view.FindViewById <TextView>(Resource.Id.tvText); tvText.Text = char.ToString(text[i]); SetTextAlign(tvText, concept); SetTextColor(tvText, concept); AdjustTextSize(tvText, concept); EnableIndicator(view, concept, concept.LetterTags[i]); viewGroup.AddView(view); } return(viewGroup); } else if (concept is Letter) { var view = inflater.Inflate(Resource.Layout.BaseText, null); var tvText = view.FindViewById <TextView>(Resource.Id.tvText); tvText.Text = text; SetTextAlign(tvText, concept); SetTextColor(tvText, concept); AdjustTextSize(tvText, concept); EnableIndicator(view, concept, concept.LetterTags.First()); return(view); } else { throw new InvalidCastException("Unknown concept of type BaseText!"); } }
public IHttpActionResult AddTextToParagraph([FromUri] Guid paragraph_id, [FromBody] AddText text) { if (IsTokenValid() && authenticationService.IsAllowedToUpdateParagraphs(GetTokenUserEmail(), paragraph_id)) { try { Text newText = textManagementService.AddToParagraph(paragraph_id, AddText.ToEntity(text)); BaseText modelNewText = BaseText.ToModel(newText); documentLogger.LogModificationToParagraph(paragraph_id); return(CreatedAtRoute("AddTextToParagraph", new { paragraphid = paragraph_id, textid = modelNewText.Id }, modelNewText)); } catch (MissingParagraphException e) { return(BadRequest(e.Message)); } catch (Exceptions e) { return(BadRequest(e.Message)); } } return(Unauthorized()); }
void AdjustTextSize(TextView tvText, BaseText concept) { int textSize = 0; if (concept is Letter) { textSize = 32; } else if (concept is Syllable) { textSize = 26; } else if (concept is Word) { textSize = 22; } else if (concept is Sentence) { textSize = 18; } textSize = IsSmallHeight() ? textSize - 4 : textSize; if (concept.AddToTextSize != 0) { tvText.SetTextSize(Android.Util.ComplexUnitType.Dip, textSize + concept.AddToTextSize); } else if (Lesson is BaseConcept && (Lesson as BaseConcept).AddToTextSize != 0) { tvText.SetTextSize(Android.Util.ComplexUnitType.Dip, textSize + (Lesson as BaseConcept).AddToTextSize); } else { tvText.SetTextSize(Android.Util.ComplexUnitType.Dip, textSize); } }
/// <summary> /// repostion SelectionStart, recalculate SelectedLength /// </summary> protected override void OnKeyPress(KeyPressEventArgs e) { base.OnKeyPress(e); if (ReadOnly) { return; } if (e.KeyChar == (char)13 || e.KeyChar == (char)3 || e.KeyChar == (char)22 || e.KeyChar == (char)24) { return; } if (m_decimalLength == 0 && e.KeyChar == m_decimalSeparator) { e.Handled = true; return; } if (!m_allowNegative && e.KeyChar == m_negativeSign && base.Text.IndexOf(m_negativeSign) < 0) { e.Handled = true; return; } if (!char.IsDigit(e.KeyChar) && e.KeyChar != m_negativeSign && e.KeyChar != m_decimalSeparator) { e.Handled = true; return; } if (base.Text.Length >= m_MaxValueLength && e.KeyChar != m_negativeSign) { e.Handled = true; return; } if (e.KeyChar == m_decimalSeparator || e.KeyChar == m_negativeSign) // will position after dot(.) or first { SelectionLength = 0; } var isNegative = base.Text[0] == m_negativeSign ? true : false; if (isNegative && SelectionStart == 0) { SelectionStart = 1; } if (e.KeyChar == m_negativeSign) { var selStart = SelectionStart; if (!isNegative) { base.Text = m_negativeSign + base.Text; SelectionStart = selStart + 1; } else { base.Text = base.Text.Substring(1, base.Text.Length - 1); if (selStart >= 1) { SelectionStart = selStart - 1; } else { SelectionStart = 0; } } e.Handled = true; // minus(-) has been handled return; } var dotPos = base.Text.IndexOf(m_decimalSeparator) + 1; if (e.KeyChar == m_decimalSeparator) { if (dotPos > 0) { SelectionStart = dotPos; } e.Handled = true; // dot has been handled return; } if (base.Text == "0") { BaseText.SelectAll(); //清除默认0 //this.SelectionStart = 0; //this.SelectionStart = 1; // replace thre first char, ie. 0 } else if (base.Text == m_negativeSign + "0") { SelectionStart = 1; SelectionLength = 1; // replace thre first char, ie. 0 } else if (m_decimalLength > 0) { if (base.Text[0] == '0' && dotPos == 2 && SelectionStart <= 1) { SelectionStart = 0; SelectionLength = 1; // replace thre first char, ie. 0 } else if (base.Text.Substring(0, 2) == m_negativeSign + "0" && dotPos == 3 && SelectionStart <= 2) { SelectionStart = 1; SelectionLength = 1; // replace thre first char, ie. 0 } else if (SelectionStart == dotPos + m_decimalLength) { SelectionStart -= 1; SelectionLength = 1; // last position after text } else if (SelectionStart >= dotPos) { SelectionLength = 1; } else if (SelectionLength == dotPos + m_decimalLength) { ClearSelection(); SelectionStart = 0; SelectionLength = 1; } } }
public void AppendText(string ss) { BaseText.AppendText(ss); }
protected virtual string GetTextCallback(BaseText concept) { return(concept.Text); }
protected virtual bool IsTextCardCallback(BaseText concept) { return(concept.IsSolution || concept.IsOption || concept.ActivateOnSuccess || concept.ActivateOnMistake); }
private bool chkTime(BaseText tx) { if (string.IsNullOrWhiteSpace(tx.Text)) { return(true); } try { DateTime input = System.DateTime.ParseExact(tx.Text, "HH:mm", System.Globalization.DateTimeFormatInfo.InvariantInfo, System.Globalization.DateTimeStyles.NoCurrentDateDefault); return(true); } catch (Exception ex) { } try { DateTime input = System.DateTime.ParseExact(tx.Text, "HHmm", System.Globalization.DateTimeFormatInfo.InvariantInfo, System.Globalization.DateTimeStyles.NoCurrentDateDefault); string s = tx.Text; tx.Text = s.Substring(0, 2) + ":" + s.Substring(2); return(true); } catch (Exception ex) { } try { DateTime input = System.DateTime.ParseExact(tx.Text, "H:mm", System.Globalization.DateTimeFormatInfo.InvariantInfo, System.Globalization.DateTimeStyles.NoCurrentDateDefault); string s = tx.Text; tx.Text = "0" + s; return(true); } catch (Exception ex) { } try { DateTime input = System.DateTime.ParseExact(tx.Text, "HH:m", System.Globalization.DateTimeFormatInfo.InvariantInfo, System.Globalization.DateTimeStyles.NoCurrentDateDefault); string s = tx.Text; tx.Text = tx.Text = s.Substring(0, 2) + ":0" + s.Substring(3); return(true); } catch (Exception ex) { } try { DateTime input = System.DateTime.ParseExact(tx.Text, "H:m", System.Globalization.DateTimeFormatInfo.InvariantInfo, System.Globalization.DateTimeStyles.NoCurrentDateDefault); string s = tx.Text; tx.Text = tx.Text = "0" + s.Substring(0, 1) + ":0" + s.Substring(2); return(true); } catch (Exception ex) { } BaseMessageBox basemessagebox = new BaseMessageBox(this, CommonTeisu.TEXT_INPUT, CommonTeisu.LABEL_MISS, CommonTeisu.BTN_OK, CommonTeisu.DIAG_ERROR); basemessagebox.ShowDialog(); return(false); }
protected override string GetTextCallback(BaseText concept) { return(concept.IsSolution ? GetBlankText(concept) : concept.Text); }
/// <summary> /// ShouhinList /// フォーム関係の設定(通常のテキストボックスから) /// </summary> public ShouhinList(Control c) { //画面データが解放されていた時の対策 if (c == null) { return; } int intWindowWidth = c.Width; int intWindowHeight = c.Height; InitializeComponent(); //フォームが最大化されないようにする this.MaximizeBox = false; //フォームが最小化されないようにする this.MinimizeBox = false; //最大サイズと最小サイズを現在のサイズに設定する this.MaximumSize = this.Size; this.MinimumSize = this.Size; // フォームでもキーイベントを受け取る this.KeyPreview = true; this.btnF11.Text = "F11:検索"; this.btnF12.Text = "F12:戻る"; Screen s = null; s = Screen.FromControl(c); this.StartPosition = FormStartPosition.Manual; this.Location = s.Bounds.Location; //中分類setデータを読めるようにする labelSet_Daibunrui.Lschubundata = labelSet_Chubunrui; // 大分類の引き渡しチェック if (lsDaibunrui == null) { lsDaibunrui = new LabelSet_Daibunrui(); } // 中分類の引き渡しチェック if (lsChubunrui == null) { lsChubunrui = new LabelSet_Chubunrui(); } // メーカーの引き渡しチェック if (lsMaker == null) { lsMaker = new LabelSet_Maker(); } // 検索テキストの引き渡しチェック if (btxtKensaku == null) { btxtKensaku = new BaseText(); } // 商品コードの引き渡しチェック if (btxtShohinCd == null) { btxtShohinCd = new BaseText(); } // 品名の引き渡しチェック(C1のみ)(ベーステキスト) if (btxtHinC1 == null) { btxtHinC1 = new BaseText(); } // 品名の引き渡しチェック(C2のみ)(ベーステキスト) if (btxtHinC2 == null) { btxtHinC2 = new BaseText(); } // 品名の引き渡しチェック(C3のみ)(ベーステキスト) if (btxtHinC3 == null) { btxtHinC3 = new BaseText(); } // 品名の引き渡しチェック(C4のみ)(ベーステキスト) if (btxtHinC4 == null) { btxtHinC4 = new BaseText(); } // 品名の引き渡しチェック(C5のみ)(ベーステキスト) if (btxtHinC5 == null) { btxtHinC5 = new BaseText(); } // 品名の引き渡しチェック(C6のみ)(ベーステキスト) if (btxtHinC6 == null) { btxtHinC6 = new BaseText(); } // 品名の引き渡しチェック(C1~C6)(ベーステキスト) if (btxtHinC1Hinban == null) { btxtHinC1Hinban = new BaseText(); } // 品名の引き渡しチェック(中分類名 + C1~C6)(グレイラベル) if (lblGrayHinChuHinban == null) { lblGrayHinChuHinban = new BaseLabelGray(); } // 品名の引き渡しチェック(メーカー名 + C1~C6)(グレイラベル) if (lblGrayHinMakerHinban == null) { lblGrayHinMakerHinban = new BaseLabelGray(); } // 品名の引き渡しチェック(メーカー名 + 中分類名 + C1~C6)(グレイラベル) if (lblGrayHinMakerChuHinban == null) { lblGrayHinMakerChuHinban = new BaseLabelGray(); } // 品名の引き渡しチェック(メーカー名 + 中分類名 + 大分類名 + C1~C6)(グレイラベル) if (lblGrayHinMakerChuDaiHinban == null) { lblGrayHinMakerChuDaiHinban = new BaseLabelGray(); } // 品名の引き渡しチェック(メーカー名 + 中分類コード + 大分類コード + C1~C6)(グレイラベル) if (lblGrayHinMakerDaiCdChuCdHinban == null) { lblGrayHinMakerDaiCdChuCdHinban = new BaseLabelGray(); } // 棚番本社(本社)の引き渡しチェック(ラベルセット) if (lsTanabanH == null) { lsTanabanH = new LabelSet_Tanaban(); } // 棚番本社(岐阜)の引き渡しチェック(ラベルセット) if (lsTanabanG == null) { lsTanabanG = new LabelSet_Tanaban(); } // 棚番本社(本社)の引き渡しチェック(ベーステキスト) if (btxtTanabanH == null) { btxtTanabanH = new BaseText(); } // 棚番本社(岐阜)の引き渡しチェック(ベーステキスト) if (btxtTanabanG == null) { btxtTanabanG = new BaseText(); } // 棚番本社(本社)の引き渡しチェック(グレイラベル) if (lblGrayTanabanH == null) { lblGrayTanabanH = new BaseLabelGray(); } // 棚番本社(岐阜)の引き渡しチェック(グレイラベル) if (lblGrayTanabanG == null) { lblGrayTanabanG = new BaseLabelGray(); } // 年月の引き渡しチェック(グレイラベル) if (lblGrayYM == null) { lblGrayYM = new BaseLabelGray(); } // 標準売価の引き渡しチェック(ベーステキストマネー) if (bmtxtHyojunBaika == null) { bmtxtHyojunBaika = new BaseTextMoney(); } // 仕入単価の引き渡しチェック(ベーステキストマネー) if (bmtxtShireTanka == null) { bmtxtShireTanka = new BaseTextMoney(); } // 評価単価の引き渡しチェック(ベーステキストマネー) if (bmtxtHyokaTanka == null) { bmtxtHyokaTanka = new BaseTextMoney(); } // 建値仕入単価の引き渡しチェック(ベーステキストマネー) if (bmtxtTateneShire == null) { bmtxtTateneShire = new BaseTextMoney(); } // 箱入数初期値の引き渡しチェック(ベーステキストマネー) if (bmtxtHakosu == null) { bmtxtHakosu = new BaseTextMoney(); } // 在庫管理区分の引き渡しチェック(ベーステキストマネー) if (btxtZaikokbn == null) { btxtZaikokbn = new BaseText(); } // 定価の引き渡しチェック(ベーステキストマネー) if (bmtxtTeika == null) { bmtxtTeika = new BaseTextMoney(); } // メモの引き渡しチェック(ベーステキストマネー) if (btxtMemo == null) { btxtMemo = new BaseText(); } // コメントの引き渡しチェック(ベーステキストマネー) if (btxtComment == null) { btxtComment = new BaseText(); } // 仕入単価の引き渡しチェック(コンボボックス) if (cbShireTanka == null) { cbShireTanka = new ComboBox(); } // 本登録されたデータを呼び出した判定 if (chbxHontoroku == null) { chbxHontoroku = new CheckBox(); } }
protected override bool IsTextCardCallback(BaseText concept) { return(false); }