Exemplo n.º 1
0
 /// <summary>
 /// 刷新控件
 /// </summary>
 private void RefreshControl()
 {
     if (WatchElement.DesignerControl != null && WatchElement.DesignerControl.Content != null && WatchElement.DesignerControl.Content is Image image)
     {
         HWCircle circel   = WatchElement.HWElement as HWCircle;
         int      curValue = ConstData.Datas[circel.Data_type];
         ClockDialCreater.SetClip(image, new Point(circel.Drawable_x, circel.Drawable_y), new Size(circel.Drawable_width, circel.Drawable_height),
                                  new Point(circel.Circle_x, circel.Circle_y), circel.Circle_r, circel.Line_width, circel.Arc_start,
                                  circel.Arc_end, curValue);
     }
 }
Exemplo n.º 2
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);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 刷新控件
 /// </summary>
 private void RefreshControl()
 {
     if (WatchElement.DesignerControl != null && WatchElement.DesignerControl.Content != null && WatchElement.DesignerControl.Content is Image image)
     {
         HWTextureMapper textureMapper = WatchElement.HWElement as HWTextureMapper;
         image.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
         image.VerticalAlignment   = VerticalAlignment.Top;
         image.Margin = new Thickness((textureMapper.Drawable_width - textureMapper.Rotation_center_x * 2) / 2.0, (textureMapper.Drawable_height - textureMapper.Rotation_center_y * 2.0) / 2, 0, 0);
         int    value = ConstData.Datas[textureMapper.Data_type];
         double angle = textureMapper.Begin_arc + (textureMapper.End_arc - textureMapper.Begin_arc) * value / 100.0;
         ClockDialCreater.SetRotateTransform(image, new Point(textureMapper.Rotation_center_x, textureMapper.Rotation_center_y), angle);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 数据改变
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CmbDataType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cmbDataType.SelectedValue != null && watchElement.HWElement != null)
            {
                HWLine line = watchElement.HWElement as HWLine;
                line.Data_type = cmbDataType.SelectedValue.ToString();

                if (watchElement.DesignerControl != null)
                {
                    int value = ConstData.Datas[line.Data_type];
                    ClockDialCreater.SetRectClip(((Image)watchElement.DesignerControl.Content), new Point(line.Drawable_x, line.Drawable_y), new Size(line.Drawable_width, line.Drawable_height), value);
                }
            }
        }
        /// <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);
            }
        }