Exemplo n.º 1
0
 /// <summary>
 /// 刷新控件
 /// </summary>
 private void RefreshControl()
 {
     if (WatchElement.DesignerControl != null && WatchElement.DesignerControl.Content != null && WatchElement.DesignerControl.Content is TextBlock text)
     {
         var textareaWithOneWildCard = WatchElement.HWElement as HWTextareaWithOneWildCard;
         int value = ConstData.Datas[textareaWithOneWildCard.Data_type];
         text.Foreground = new SolidColorBrush(Color.FromArgb(textareaWithOneWildCard.Alpha, textareaWithOneWildCard.Color_red, textareaWithOneWildCard.Color_green, textareaWithOneWildCard.Color_blue));
         text.Text       = value.ToString();
         ClockDialCreater.SetAlignment(text, textareaWithOneWildCard.Alignment_type);
         ClockDialCreater.SetFontSize(text, textareaWithOneWildCard.Font_type);
     }
 }
        /// <summary>
        /// 刷新控件
        /// </summary>
        private void RefreshControl()
        {
            if (WatchElement.DesignerControl != null && WatchElement.DesignerControl.Content != null && WatchElement.DesignerControl.Content is TextBlock text)
            {
                var    textareaWithTwoWildCard = WatchElement.HWElement as HWTextareaWithTwoWildCard;
                int    value   = ConstData.Datas[textareaWithTwoWildCard.Data_type];
                string connect = "";
                switch (textareaWithTwoWildCard.Data_connector_type)
                {
                case "CONN_COLON": connect = ":"; break;           // 冒号	“:”

                case "CONN_STUB": connect = "-"; break;            /// CONN_STUB       // 短线	“-”

                case "CONN_SLASH": connect = "/"; break;           /// CONN_SLASH		// 斜线	“/”

                case "CONN_BACKSLASH": connect = "\\"; break;      /// CONN_BACKSLASH	// 反斜线“\”

                case "CONN_POINT": connect = "."; break;           /// CONN_POINT		// 点	“.”

                case "CONN_PERCENT": connect = "%"; break;         /// CONN_PERCENT		// 百分号“%”

                case "CONN_SPACE": connect = " "; break;           /// CONN_SPACE		// 空格	“ ”
                }
                if (textareaWithTwoWildCard.Data2_type == "DATA_NULL")
                {
                    text.Text = value + connect;
                }
                else
                {
                    int value2 = ConstData.Datas[textareaWithTwoWildCard.Data2_type];
                    text.Text = value + connect + value2;
                }
                text.Foreground = new SolidColorBrush(Color.FromArgb(textareaWithTwoWildCard.Alpha, textareaWithTwoWildCard.Color_red, textareaWithTwoWildCard.Color_green, textareaWithTwoWildCard.Color_blue));
                ClockDialCreater.SetAlignment(text, textareaWithTwoWildCard.Alignment_type);
                ClockDialCreater.SetFontSize(text, textareaWithTwoWildCard.Font_type);
            }
        }