Esempio n. 1
0
        public string ToString(Theme t)
        {
            var a = new StylesheetStringBuilder();

            a.AppendAttribute("background-color", t.ResolveColor(BackgroundColor));
            a.AppendAttribute("background-image", BackgroundImage);
            a.AppendAttribute("width", Width);
            a.AppendAttribute("height", Height);
            if (null != Margin && !Margin.IsEmpty)
            {
                a.AppendAttribute("margin", Margin.ToString());
            }
            if (null != Padding && !Padding.IsEmpty)
            {
                a.AppendAttribute("padding", Padding.ToString());
            }
            if (ThemeBorder.AreSame(BorderTop, BorderBottom, BorderLeft, BorderRight))
            {
                a.AppendAttribute("border", BorderTop.ToString(t));
            }
            else
            {
                if (null != BorderTop && !BorderTop.IsEmpty)
                {
                    a.AppendAttribute("border-top", BorderTop.ToString(t));
                }
                if (null != BorderBottom && !BorderBottom.IsEmpty)
                {
                    a.AppendAttribute("border-bottom", BorderBottom.ToString(t));
                }
                if (null != BorderLeft && !BorderLeft.IsEmpty)
                {
                    a.AppendAttribute("border-left", BorderLeft.ToString(t));
                }
                if (null != BorderRight && !BorderRight.IsEmpty)
                {
                    a.AppendAttribute("border-right", BorderRight.ToString(t));
                }
            }
            return(a.ToString());
        }
        public void Test(List <WriteableBitmap> bList)
        {
            if (bList == null || bList.Count == 0)
            {
                return;
            }
            var b = bList.FirstOrDefault();

            sb = WriteableBitmapHelper.Clone(b);
            if (!IsLeft)
            {
                b = isoc.FlipYImage(b);
            }

            lChartPhoto1.Photo = (b);
            try
            {
                long l = isoc.getResoveLines(sb, 0.735f, IsLeft);
                if (IsLeft)
                {
                    textBlockIsLeft.Text = "左";
                }
                else
                {
                    textBlockIsLeft.Text = "右";
                }

                testResult.Text = l.ToString() + "LP";

                BorderLeft  = Convert.ToDouble(isoc.ptp.ProcessInfor["RayleiResolutionLeftBorder"]);
                BorderRight = Convert.ToDouble(isoc.ptp.ProcessInfor["RayleiResolutionRightBorder"]);
                double p = Convert.ToDouble(isoc.ptp.ProcessInfor["RayleiResolutionRightPosition"]);



                string st = isoc.ptp.ProcessInfor["ISOCardType"].ToString();
                if (st == "100-600")
                {
                    comboBox1.SelectedIndex = 2;
                }
                if (st == "500-2000")
                {
                    comboBox1.SelectedIndex = 0;
                }
                if (st == "1000-4000")
                {
                    comboBox1.SelectedIndex = 1;
                }

                leftBorder.Text  = BorderLeft.ToString();
                rightBorder.Text = BorderRight.ToString();
                RayleP.Text      = p.ToString();

                ll.Y1 = 0;
                ll.Y2 = lChartPhoto1.Height;
                ll.X1 = BorderLeft / b.PixelWidth * lChartPhoto1.Width;
                ll.X2 = ll.X1;
                if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(ll))
                {
                    lChartPhoto1.getDrawObjectCanvas().Children.Add(ll);
                }

                rl.Y1 = 0;
                rl.Y2 = lChartPhoto1.Height;
                rl.X1 = BorderRight / b.PixelWidth * lChartPhoto1.Width;
                rl.X2 = rl.X1;
                if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(rl))
                {
                    lChartPhoto1.getDrawObjectCanvas().Children.Add(rl);
                }

                pl.Y1 = 0;
                pl.Y2 = lChartPhoto1.Height;
                pl.X1 = p / b.PixelWidth * lChartPhoto1.Width;
                pl.X2 = pl.X1;
                if (!lChartPhoto1.getDrawObjectCanvas().Children.Contains(pl))
                {
                    lChartPhoto1.getDrawObjectCanvas().Children.Add(pl);
                }

                canvasBright.Children.Clear();
                DrawGraphic dg = new DrawGraphic(canvasBright);
                dg.DrawBrightLines(isoc.getImageGrayVLine(b, Convert.ToInt64(p)));
            }
            catch (Exception xe)        //未知的异常
            {
                if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛
                {
                    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                }
                else
                {
                    SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片");
                }
            }
        }