public BottomMargin(IWpfTextView textView, IClassifierAggregatorService classifier, ITextDocumentFactoryService documentService)
        {
            _textView = textView;
            _classifier = classifier.GetClassifier(textView.TextBuffer);
            _foregroundBrush = new SolidColorBrush((Color)FindResource(VsColors.CaptionTextKey));
            _backgroundBrush = new SolidColorBrush((Color)FindResource(VsColors.ScrollBarBackgroundKey));

            this.Background = _backgroundBrush;
            this.ClipToBounds = true;

            _lblEncoding = new TextControl("Encoding");
            this.Children.Add(_lblEncoding);

            _lblContentType = new TextControl("Content type");
            this.Children.Add(_lblContentType);

            _lblClassification = new TextControl("Classification");
            this.Children.Add(_lblClassification);

            _lblSelection = new TextControl("Selection");
            this.Children.Add(_lblSelection);

            UpdateClassificationLabel();
            UpdateContentTypeLabel();
            UpdateContentSelectionLabel();

            if (documentService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _doc))
            {
                _doc.FileActionOccurred += FileChangedOnDisk;
                UpdateEncodingLabel(_doc);
            }

            textView.Caret.PositionChanged += CaretPositionChanged;
        }
示例#2
1
 public PkgCreateWin()
 {
     InitializeComponent();
     EnabledColor = SnapshotBtn.Foreground;
     DisabledColor =  new SolidColorBrush(System.Windows.Media.Colors.LightGray);
     SetUiMode(UiMode.WaitingForFile);
 }
示例#3
1
        public static void Draw(Canvas canvas, List<LinePoint> points, Brush stroke, bool clear = true)
        {
            if (clear)
            {
                canvas.Children.Clear();
            }

            PathFigureCollection myPathFigureCollection = new PathFigureCollection();
            PathGeometry myPathGeometry = new PathGeometry();

            foreach (LinePoint p in points)
            {
                PathFigure myPathFigure = new PathFigure();
                myPathFigure.StartPoint = p.StartPoint;

                LineSegment myLineSegment = new LineSegment();
                myLineSegment.Point = p.EndPoint;

                PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
                myPathSegmentCollection.Add(myLineSegment);

                myPathFigure.Segments = myPathSegmentCollection;

                myPathFigureCollection.Add(myPathFigure);
            }

            myPathGeometry.Figures = myPathFigureCollection;
            Path myPath = new Path();
            myPath.Stroke = stroke == null ? Brushes.Black : stroke;
            myPath.StrokeThickness = 1;
            myPath.Data = myPathGeometry;

            canvas.Children.Add(myPath);
        }
        void CreateAndAddAdornment(ITextViewLine line, SnapshotSpan span, Brush brush, bool extendToRight)
        {
            var markerGeometry = _view.TextViewLines.GetMarkerGeometry(span);

            double left = 0;
            double width = _view.ViewportWidth + _view.MaxTextRightCoordinate;
            if (markerGeometry != null)
            {
                left = markerGeometry.Bounds.Left;
                if (!extendToRight) width = markerGeometry.Bounds.Width;
            }

            Rect rect = new Rect(left, line.Top, width, line.Height);

            RectangleGeometry geometry = new RectangleGeometry(rect);

            GeometryDrawing drawing = new GeometryDrawing(brush, new Pen(), geometry);
            drawing.Freeze();

            DrawingImage drawingImage = new DrawingImage(drawing);
            drawingImage.Freeze();

            Image image = new Image();
            image.Source = drawingImage;

            Canvas.SetLeft(image, geometry.Bounds.Left);
            Canvas.SetTop(image, geometry.Bounds.Top);

            _layer.AddAdornment(AdornmentPositioningBehavior.TextRelative, span, null, image, null);
        }
示例#5
1
        internal static Brush GetBrush(this ResourceDictionary dictionary, string brushName, string colorName, Brush defaultBrush)
        {
            if (dictionary == null)
            {
                return defaultBrush;
            }

            var obj = dictionary[brushName];
            if (obj is Brush)
            {
                return (Brush)obj;
            }

            obj = dictionary[colorName];
            if (obj is Color?)
            {
                var color = (Color?)obj;
                if (color.HasValue)
                {
                    var brush = new SolidColorBrush(color.Value);
                    brush.Freeze();
                    return brush;
                }
            }

            return defaultBrush;
        }
		private void DrawChanges(DrawingContext drawingContext, NormalizedSnapshotSpanCollection changes, Brush brush)
		{
			if (changes.Count > 0)
			{
				double yTop = Math.Floor(_scrollBar.GetYCoordinateOfBufferPosition(changes[0].Start)) + markerStartOffset;
				double yBottom = Math.Ceiling(_scrollBar.GetYCoordinateOfBufferPosition(changes[0].End)) + markerEndOffset;

				for (int i = 1; i < changes.Count; ++i)
				{
					double y = _scrollBar.GetYCoordinateOfBufferPosition(changes[i].Start) + markerStartOffset;
					if (yBottom < y)
					{
						drawingContext.DrawRectangle(
							brush,
							null,
							new Rect(0, yTop, markerWidth, yBottom - yTop));

						yTop = y;
					}

					yBottom = Math.Ceiling(_scrollBar.GetYCoordinateOfBufferPosition(changes[i].End)) + markerEndOffset;
				}

				drawingContext.DrawRectangle(
					brush,
					null,
					new Rect(0, yTop, markerWidth, yBottom - yTop));
			}
		}
示例#7
0
 private LessThanColorConverter()
 {
     this.okBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#CC7DBEDA"));
     this.okBrush.Freeze();
     this.notOkBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#B3CD6969"));
     this.notOkBrush.Freeze();
 }
 void addStatusLabel(string text, Brush color, StackPanel panel)
 {
     TextBlock lbl = new TextBlock();
     lbl.Text = text;
     lbl.Foreground = color;
     panel.Children.Add(lbl);
 }
 public StandaloneMapControl(Brush backgroundColor)
 {
     InitializeComponent();
     //btnBypass.Click += new RoutedEventHandler(btnBypass_Click);
     this.MapBackground = backgroundColor;
     Construct();
 }
示例#10
0
        public static Brush ModifyFillBrushIfSelected(IFigure figure, Brush brush, FigureStyle style)
        {
            // Below is my suggestion for the fill appearance when a shape is selected. - David
            var brushAsSolidColor = brush as SolidColorBrush;
            if (figure != null && figure.Selected && !(style is PointStyle) && brushAsSolidColor != null)
            {
                // brush.Opacity = 0.2; // The previous method of showing a figure is selected.

                // The color of the stripes in the gradient is made by shifting the Fill color toward a gray value.
                var b = new LinearGradientBrush();
                var shapeWidth = 200;   // Arbitrary value.  Using the with of the figure would be better.
                b.StartPoint = new Point(0.0, 0.0);
                b.EndPoint = new Point(1.0, 0.0);
                double gap = 6;    // Actually half the gap between stripes in physical coordinates.
                double s = gap / shapeWidth;
                byte gray = 200;    // The gray value to shift the Fill color toward.
                double similarity = .65;    // How similar are the Fill color and the gray value (1 = similar, 0 = not).
                byte alpha = ((int)brushAsSolidColor.Color.A < 128) ? (byte)128 : brushAsSolidColor.Color.A;  // We need some opacity.
                for (double i = 0; i + s + s < 1; i += 2 * s)
                {
                    b.GradientStops.Add(new GradientStop() { Color = brushAsSolidColor.Color, Offset = i + .7 * s });
                    b.GradientStops.Add(new GradientStop()
                    {
                        Color = Color.FromArgb(alpha, (byte)(gray + (brushAsSolidColor.Color.R - gray) * similarity),
                                                      (byte)(gray + (brushAsSolidColor.Color.G - gray) * similarity),
                                                      (byte)(gray + (brushAsSolidColor.Color.B - gray) * similarity)),
                        Offset = i + s
                    });
                    b.GradientStops.Add(new GradientStop() { Color = brushAsSolidColor.Color, Offset = i + s + .3 * s });
                }
                brush = b;
            }
            // End of suggestion.
            return brush;
        }
示例#11
0
        private void DrawBorderStroke(PdfRenderContext context, Thickness thickness, Brush stroke, double actualWidth, double actualHeight)
        {
            if (stroke == null)
            {
                return;
            }

            if (thickness.Left != 0)
            {
                LineRenderer.DrawLine(context, thickness.Left / 2, 0, thickness.Left / 2, actualHeight, thickness.Left, stroke, null);
            }
            if (thickness.Top != 0)
            {
                LineRenderer.DrawLine(context, 0, thickness.Top / 2, actualWidth, thickness.Top / 2, thickness.Top, stroke, null);
            }
            if (thickness.Right != 0)
            {
                double x = actualWidth - (thickness.Right / 2);
                LineRenderer.DrawLine(context, x, 0, x, actualHeight, thickness.Right, stroke, null);
            }
            if (thickness.Bottom != 0)
            {
                double y = actualHeight - (thickness.Bottom / 2);
                LineRenderer.DrawLine(context, 0, y, actualWidth, y, thickness.Bottom, stroke, null);
            }
        }
示例#12
0
 public GridLabel(string text, double location, Orientation orientation, Brush brush=null) {
   Text = text;
   Location = location;
   Orientation = orientation;
   Brush = brush ?? _defaultBrush;
   IsFloating = false;
 }
示例#13
0
        public static RenderTargetBitmap GetImage(UIElement fe, Brush background = null, Size sz = default(Size), int dpi = 144)
        {
            if (sz.Width < alib.Math.math.ε || sz.Height < alib.Math.math.ε)
            {
                fe.Measure(util.infinite_size);
                sz = fe.DesiredSize; //VisualTreeHelper.GetContentBounds(fe).Size; //
            }

            DrawingVisual dv = new DrawingVisual();
            RenderOptions.SetEdgeMode(dv, EdgeMode.Aliased);

            using (DrawingContext ctx = dv.RenderOpen())
            {
                Rect r = new Rect(0, 0, sz.Width, sz.Height);
                if (background != null)
                    ctx.DrawRectangle(background, null, r);

                VisualBrush br = new VisualBrush(fe);
                br.AutoLayoutContent = true;
                ctx.DrawRectangle(br, null, r);
            }

            Double f = dpi / 96.0;

            RenderTargetBitmap bitmap = new RenderTargetBitmap(
                (int)(sz.Width * f) + 1,
                (int)(sz.Height * f) + 1,
                dpi,
                dpi,
                PixelFormats.Pbgra32);
            bitmap.Render(dv);
            return bitmap;
        }
 private void UpdateCircleColour(Brush brush, Ellipse circle)
 {
     if (!brush.Equals(Gray) && !circle.Fill.Equals(Gray))
         circle.Fill = Violet;
     else
         circle.Fill = brush;
 }
示例#15
0
 private DurationBGColorConverter()
 {
     this.defaultBrush = Brushes.Transparent;
       this.defaultBrush.Freeze();
       this.lessHoursPerDayBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#B3CD6969"));
       this.lessHoursPerDayBrush.Freeze();
 }
 public ProjectielVanMonsterkeNaarLinks(ISpel spel, Point startpunt, Brush brush)
     : base(brush)
 {
     Spel = spel;
     Locatie = startpunt;
     _gestopt = false;
 }
 public EllipseCreator(Brush outlineBrush, Brush fillBrush, double radius, double opacity)
 {
     _outlineBrush = outlineBrush;
     _fillBrush = fillBrush;
     _radius = radius;
     _opacity = opacity;
 }
 public InlineLink Match(String word, Brush lBrush, IStatusUpdate oStatusUpdate)
 {
     if (word == null) return null;
     bool result = _websymbols.AsParallel().Any(p => p.Key == word.ToLower());
     if (!result) return null;
     return _textProcessorEngine.WebSymbolHelper(_websymbols[word.ToLower()], word);
 }
示例#19
0
    //public void DrawDrawing(Drawing drawing);

    public void DrawEllipse(Brush brush, Pen pen, Point center, double radiusX, double radiusY)
    {
      Ellipse ellipse = new Ellipse();
      SetupShape(ellipse, center.X - radiusX, center.Y - radiusY, radiusX * 2, radiusY * 2, brush, pen);
      ellipse.Fill = brush;
      _canvas.Children.Add(ellipse);
    }
示例#20
0
 public CPlayer(int _row, int _column, bool _state, Brush _color)
 {
     Row = _row;
     Column = _column;
     State = _state;
     ColorPlayer = _color;
 }
示例#21
0
        // Use C# Reorder Parameters helpTopic for C# and VB.
        internal ChangeSignatureDialog(ChangeSignatureDialogViewModel viewModel)
            : base(helpTopic: "vs.csharp.refactoring.reorder")
        {
            _viewModel = viewModel;

            InitializeComponent();

            // Set these headers explicitly because binding to DataGridTextColumn.Header is not
            // supported.
            modifierHeader.Header = ServicesVSResources.Modifier;
            defaultHeader.Header = ServicesVSResources.Default;
            typeHeader.Header = ServicesVSResources.Type;
            parameterHeader.Header = ServicesVSResources.Parameter;

            ParameterText = SystemParameters.HighContrast ? SystemColors.WindowTextBrush : new SolidColorBrush(Color.FromArgb(0xFF, 0x1E, 0x1E, 0x1E));
            RemovedParameterText = SystemParameters.HighContrast ? SystemColors.WindowTextBrush : new SolidColorBrush(Colors.Gray);
            DisabledParameterBackground = SystemParameters.HighContrast ? SystemColors.WindowBrush : new SolidColorBrush(Color.FromArgb(0xFF, 0xDF, 0xE7, 0xF3));
            DisabledParameterForeground = SystemParameters.HighContrast ? SystemColors.GrayTextBrush : new SolidColorBrush(Color.FromArgb(0xFF, 0xA2, 0xA4, 0xA5));
            Members.Background = SystemParameters.HighContrast ? SystemColors.WindowBrush : new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF));
            StrikethroughBrush = SystemParameters.HighContrast ? SystemColors.WindowTextBrush : new SolidColorBrush(Colors.Red);

            DataContext = viewModel;

            Loaded += ChangeSignatureDialog_Loaded;
            IsVisibleChanged += ChangeSignatureDialog_IsVisibleChanged;
        }
        public ProvisionalText(ITextView textView, Span textSpan)
        {
            IgnoreChange = false;

            _textView = textView;

            var wpfTextView = (IWpfTextView)_textView;
            _layer = wpfTextView.GetAdornmentLayer("HtmlProvisionalTextHighlight");

            var textBuffer = _textView.TextBuffer;
            var snapshot = textBuffer.CurrentSnapshot;
            var provisionalCharSpan = new Span(textSpan.End - 1, 1);

            TrackingSpan = snapshot.CreateTrackingSpan(textSpan, SpanTrackingMode.EdgeExclusive);
            _textView.Caret.PositionChanged += OnCaretPositionChanged;

            textBuffer.Changed += OnTextBufferChanged;
            textBuffer.PostChanged += OnPostChanged;

            var projectionBuffer = _textView.TextBuffer as IProjectionBuffer;
            if (projectionBuffer != null)
            {
                projectionBuffer.SourceSpansChanged += OnSourceSpansChanged;
            }

            Color highlightColor = SystemColors.HighlightColor;
            Color baseColor = Color.FromArgb(96, highlightColor.R, highlightColor.G, highlightColor.B);
            _highlightBrush = new SolidColorBrush(baseColor);

            ProvisionalChar = snapshot.GetText(provisionalCharSpan)[0];
            HighlightSpan(provisionalCharSpan.Start);
        }
示例#23
0
        private void OnForegroundPropertyChanged(Brush foregroundBrush) {
            ColumnHeader.Foreground = foregroundBrush;
            RowHeader.Foreground = foregroundBrush;
            Data.Foreground = foregroundBrush;

            Refresh();
        }
        public BgEditorControl(MainWindow mainWindow)
        {
            _mainWindow = mainWindow;
            InitializeComponent();
            _orgColor = ColorPreview.Background;

            ShowUserImageToggle.Checked += _mainWindow.ToggleButton_OnChecked;
            ShowUserImageToggle.Unchecked += _mainWindow.ToggleButton_OnUnchecked;

            ShowGlyphsIconsToggle.Checked += _mainWindow.ToggleButton_OnChecked;
            ShowGlyphsIconsToggle.Unchecked += _mainWindow.ToggleButton_OnUnchecked;

            ShowUserImageToggle.IsChecked = Settings.Default.Get("uimage", true);//Settings.Default.uimage;
            ShowGlyphsIconsToggle.IsChecked = Settings.Default.Get("gimage", true);//Settings.Default.gimage;

            //Debug.WriteLine(Settings.Default.flyoutloc);
            switch (Settings.Default.Get("flyout", Position.Right))
            {
                case Position.Right:
                    FlyoutPosSelect.SelectedIndex = 1;
                    break;

                case Position.Left:
                    FlyoutPosSelect.SelectedIndex = 0;
                    break;
            }
        }
示例#25
0
        internal static void SetFill(PdfRenderContext context, Brush brush, double width, double height)
        {
            var fill = PdfColorHelper.ConvertBrush(brush, context.opacity, context.drawingSurface.Position, width, height);

            context.drawingSurface.GraphicProperties.IsFilled = fill != null;
            context.drawingSurface.GraphicProperties.FillColor = fill;
        }
示例#26
0
        public static void DrawCenterText(this DrawingContext dc, string text, Rect rect, Brush foreground)
        {
            if (string.IsNullOrEmpty(text)) return;

            FormattedText formattedText;

            if (!_formatedTextCaches.ContainsKey(text))
            {
                formattedText = text.ToFormattedText(foreground);

                var charWidth = formattedText.Width / text.Length;

                if (formattedText.Width > rect.Width)
                {
                    var maxChar = (int)(rect.Width / charWidth);
                    formattedText = text.Substring(0, maxChar).ToFormattedText(foreground);
                }
                _formatedTextCaches[text] = formattedText;
            }
            else
                formattedText = _formatedTextCaches[text];


            var horizontailMargin = (rect.Width - formattedText.Width) / 2; //margin left & right


            dc.DrawText(formattedText, new Point(rect.Left + horizontailMargin, rect.Top + ((rect.Height - formattedText.Baseline) / 2)));
        }
 public ServerTileUserControl(string nomeServer, int index, Brush color)
 {
     this.nomeServer = nomeServer;
     this.index = index;
     this.color = color;
     InitializeComponent();
 }
        private static void ShowDialog(object rootModel, object context, Brush overlay, IEnumerable<KeyValuePair<string, object>> settings)
        {
            var dialog = new Coding4FunDialog
            {
                Context = context,
                RootModel = rootModel
            };

            if (settings != null)
            {
                var type = dialog.GetType();
                foreach (var setting in settings)
                {
                    var propertyInfo = type.GetProperty(setting.Key);
                    if (propertyInfo != null)
                    {
                        propertyInfo.SetValue(dialog, setting.Value, null);
                    }
                }
            }

            var activate = rootModel as IActivate;
            if (activate != null)
            {
                activate.Activate();
            }

            var deactivate = rootModel as IDeactivate;
            if (deactivate != null)
            {
                dialog.Completed += (sender, args) => deactivate.Deactivate(true);
            }

            dialog.Show();
        }
示例#29
0
 public TextGlowStrategy()
 {
     m_nThickness=2;
     m_brushText = null;
     m_bClrText = true;
     disposed = false;
 }
示例#30
0
        public void AddVisualText(String text, String name_of_element, FontFamily fontFamily, Double fontSize, Point location, Double rotateAngle, Brush brush)
        {
            Typeface typeface = new Typeface(fontFamily, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
            DrawingContext dc;

            DrawingVisual dv = new DrawingVisual();
            FormattedText ft1 = new FormattedText(text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, fontSize, brush);

            if (location.X == -1)
            {
                location = new Point(this.Width / 2 - ft1.Width / 2, location.Y);
            }
            if (location.Y == -1)
            {
                location = new Point(location.X, this.Height / 2 - ft1.Height / 2);
            }

            RotateTransform rt = new RotateTransform(rotateAngle, location.X + ft1.Width / 2, location.Y + ft1.Height / 2);

            dc = dv.RenderOpen();
            dc.PushTransform(rt);
            dc.DrawText(ft1, location);
            dc.Close();

            this.visuals.Add(new NamedVisual(name_of_element, dv));
            this.AddVisualChild(dv);

        }
示例#31
0
 public BankAccountItemViewModel(SecureItemSearchResult item, System.Windows.Media.Brush defaultColor, ImageSource defaultIcon) : base(item, defaultColor, defaultIcon)
 {
     type    = SecurityItemsDefaultProperties.SecurityItemType_DigitalWallet;
     subType = SecurityItemsDefaultProperties.SecurityItemSubType_DW_Bank;
 }
 public void SetColor(Color color)
 {
     patternBrush = null;
     AllocatePen(color, Pen != null ? Pen.Thickness : 1, Pen != null ? Pen.DashStyle : DashStyles.Solid);
 }
 public void SetPattern(Brush brush)
 {
     patternBrush = brush;
 }
示例#34
0
 /// <summary>
 /// 展示鼠标点击
 /// </summary>
 /// <param name="view"></param>
 /// <param name="mousePoint"></param>
 public static void ShowMouseIndicator(MouseIndicatorWinView view, Point mousePoint, System.Windows.Media.Brush mouseColorBrush)
 {
     view.Show();
     view.MouseColor      = mouseColorBrush;
     view.Topmost         = true;
     view.Left            = mousePoint.X - 20;
     view.Top             = mousePoint.Y - 20;
     view.MouseVisibility = Visibility.Visible;
 }
示例#35
0
 private void ChangeTextBox(System.Windows.Controls.TextBox textBox, System.Windows.Media.Brush backgroundColor, string value)
 {
     textBox.Text       = value;
     textBox.Background = backgroundColor;
 }
示例#36
0
        private void SelectFileBTN_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog
            {
                InitialDirectory = @"C:\",
                Title            = "Select XML File",
                Multiselect      = false,
                CheckFileExists  = true,
                CheckPathExists  = true,
                DefaultExt       = "xml",
                Filter           = "XML files (*.xml)|*.xml|All files (*.*)|*.*",
                FilterIndex      = 1,
                RestoreDirectory = true,
                ReadOnlyChecked  = true,
                ShowReadOnly     = true
            };

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                selectedFileName = null;
                invCount         = 0;
                eachInvoice      = new List <string>();
                foreach (string filename in openFileDialog1.FileNames)
                {
                    filePath        = filename;
                    FilePathTB.Text = filePath;

                    var bc = new BrushConverter();
                    System.Windows.Media.Brush greenBack = (System.Windows.Media.Brush)bc.ConvertFrom("#FF6DEC73");
                    System.Windows.Media.Brush redBack   = (System.Windows.Media.Brush)bc.ConvertFrom("#FFE06B6B");

                    XmlDocument doc = new XmlDocument();
                    doc.Load(filePath);

                    XmlNamespaceManager namespaces = new XmlNamespaceManager(doc.NameTable);
                    namespaces.AddNamespace("dft", "http://www.kewill.com/Customs/edi");

                    XmlNodeList WorkMgmtNode = doc.SelectNodes("/dft:SHIPMENT/dft:SHIPMENT_MAIN/dft:DASHBOARD_WORK_MGMT", namespaces);
                    foreach (XmlNode node in WorkMgmtNode)
                    {
                        if (node["MASTER_BILL"] != null)
                        {
                            ChangeTextBox(MasterBillDBTB, greenBack, node["MASTER_BILL"].InnerText);
                        }
                        else
                        {
                            ChangeTextBox(MasterBillDBTB, redBack, "NO VALUE IN FILE");
                        }
                        if (node["PROCESS_CD"] != null)
                        {
                            ChangeTextBox(ProcessCDTB, greenBack, node["PROCESS_CD"].InnerText); processCD = node["PROCESS_CD"].InnerText;
                        }
                        else
                        {
                            ChangeTextBox(ProcessCDTB, redBack, "NO VALUE IN FILE");
                        }
                        if (node["CUST_NO"] != null)
                        {
                            ChangeTextBox(ClientNoTB, greenBack, node["CUST_NO"].InnerText); clientNo = node["CUST_NO"].InnerText;
                        }
                        else
                        {
                            ChangeTextBox(ClientNoTB, redBack, "NO VALUE IN FILE");
                        }
                    }

                    XmlNodeList GeneralShipmentInformation = doc.SelectNodes("/dft:SHIPMENT/dft:SHIPMENT_MAIN/dft:EDI_SHIPMENT_HEADER", namespaces);
                    foreach (XmlNode node in GeneralShipmentInformation)
                    {
                        if (node["MASTER_BILL"] != null)
                        {
                            ChangeTextBox(MasterBillEETB, greenBack, node["MASTER_BILL"].InnerText);
                        }
                        else
                        {
                            ChangeTextBox(MasterBillEETB, redBack, "NO VALUE IN FILE");
                        }
                        if (node["MATCH_ENTRY"] != null)
                        {
                            ChangeTextBox(MatchEntryTB, greenBack, node["MATCH_ENTRY"].InnerText);
                        }
                        else
                        {
                            ChangeTextBox(MatchEntryTB, redBack, "NO VALUE IN FILE");
                        }
                        if (node["HOUSE_BILL"] != null)
                        {
                            ChangeTextBox(HouseBillTB, greenBack, node["HOUSE_BILL"].InnerText);
                        }
                        else
                        {
                            ChangeTextBox(HouseBillTB, redBack, "NO VALUE IN FILE");
                        }
                        if (node["MATCH_SHIPMENT"] != null)
                        {
                            ChangeTextBox(MatchShipmentTB, greenBack, node["MATCH_SHIPMENT"].InnerText);
                        }
                        else
                        {
                            ChangeTextBox(MatchShipmentTB, redBack, "NO VALUE IN FILE");
                        }
                        if (node["SUB_SUB_BILL"] != null)
                        {
                            ChangeTextBox(SubSubBillTB, greenBack, node["SUB_SUB_BILL"].InnerText);
                        }
                        else
                        {
                            ChangeTextBox(SubSubBillTB, redBack, node["NO VALUE IN FILE"].InnerText);
                        }
                        if (node["ENTRY_NO"] != null)
                        {
                            ChangeTextBox(EntryNoTB, greenBack, node["ENTRY_NO"].InnerText);
                        }
                        else
                        {
                            ChangeTextBox(EntryNoTB, redBack, "NO VALUE IN FILE");
                        }
                    }

                    //TODO:
                    XmlNodeList EDIInvoiceHeaderList = doc.SelectNodes("/dft:SHIPMENT/dft:SHIPMENT_MAIN/dft:EDI_SHIPMENT_HEADER/dft:EDI_INVOICE_HEADER", namespaces);
                    invCount = EDIInvoiceHeaderList.Count;

                    foreach (XmlNode commNode in EDIInvoiceHeaderList)
                    {
                        if (invCount > 1)
                        {
                            string invName = commNode["COMM_INV_NO"].InnerText;
                            eachInvoice.Add(invName);
                        }
                        else
                        {
                            if (commNode["COMM_INV_NO"] != null)
                            {
                                ChangeTextBox(CommInvNoTB1, greenBack, commNode["COMM_INV_NO"].InnerText);
                                //ChangeTextBox(CommInvNoTB2, redBack, "");
                                string invName = commNode["COMM_INV_NO"].InnerText;
                                eachInvoice.Add(invName);
                            }
                        }
                    }

                    if (invCount > 1)
                    {
                        ChangeTextBox(CommInvNoTB1, greenBack, eachInvoice[0]);
                        ChangeTextBox(CommInvNoTB2, greenBack, eachInvoice[invCount - 1]);
                    }
                }

                NewClientNoTB.Text      = "";
                NewCommInvNoTB.Text     = "";
                NewCommInvNoTB2.Text    = "";
                NewEntryNoTB.Text       = "";
                NewHouseBillTB.Text     = "";
                NewMasterBillDBTB.Text  = "";
                NewMasterBillEETB.Text  = "";
                NewMatchShipmentTB.Text = "";
                NewMatchEntryTB.Text    = "";
                NewProcessCDTB.Text     = "";
                NewSubSubBillTB.Text    = "";
            }
        }
示例#37
0
 public PrescriptionSecureItemViewModel(SecureItemSearchResult item, System.Windows.Media.Brush defaultColor, ImageSource defaultIcon) : base(item, defaultColor, defaultIcon)
 {
     type    = SecurityItemsDefaultProperties.SecurityItemType_SecureNotes;
     subType = SecurityItemsDefaultProperties.SecurityItemSubType_SN_Prescription;
 }
示例#38
0
 public AddressSecureItemViewModel(SecureItemSearchResult item, System.Windows.Media.Brush defaultColor, ImageSource defaultIcon) : base(item, defaultColor, defaultIcon)
 {
     type    = SecurityItemsDefaultProperties.SecurityItemType_PersonalInfo;
     subType = SecurityItemsDefaultProperties.SecurityItemSubType_PI_Address;
 }
 public GeometryDrawing(Brush brush, Pen pen, Geometry geometry)
 {
 }
示例#40
0
 public static Drawing.Color DrawingColorFromBrush(System.Windows.Media.Brush brush)
 {
     return(DrawingColorFromMediaColor((brush as SolidColorBrush).Color));
 }
示例#41
0
        private static ImageSource CreateGlyph(string text, FontFamily fontFamily, FontStyle fontStyle, FontWeight fontWeight, FontStretch fontStretch, Brush foreBrush)
        {
            if (fontFamily != null && !string.IsNullOrEmpty(text))
            {
                var typeface = new Typeface(fontFamily, fontStyle, fontWeight, fontStretch);

                GlyphTypeface glyphTypeface;
                if (!typeface.TryGetGlyphTypeface(out glyphTypeface))
                {
                    throw Log.ErrorAndCreateException <InvalidOperationException>("No glyph type face found");
                }

                var glyphIndexes  = new ushort[text.Length];
                var advanceWidths = new double[text.Length];

                for (var i = 0; i < text.Length; i++)
                {
                    ushort glyphIndex;

                    try
                    {
                        var key = text[i];

                        if (!glyphTypeface.CharacterToGlyphMap.TryGetValue(key, out glyphIndex))
                        {
                            glyphIndex = 42;
                        }
                    }
                    catch (Exception)
                    {
                        glyphIndex = 42;
                    }

                    glyphIndexes[i] = glyphIndex;

                    var width = glyphTypeface.AdvanceWidths[glyphIndex] * 1.0;
                    advanceWidths[i] = width;
                }

                try
                {
#pragma warning disable 618
                    var glyphRun = new GlyphRun(glyphTypeface, 0, false, RenderingEmSize, glyphIndexes, new Point(0, 0), advanceWidths, null, null, null, null, null, null);
#pragma warning restore 618
                    var glyphRunDrawing = new GlyphRunDrawing(foreBrush, glyphRun);

                    var drawingImage = new DrawingImage(glyphRunDrawing);
                    return(drawingImage);
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "Error in generating Glyphrun");
                }
            }

            return(null);
        }
示例#42
0
        public void SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame != null)
                {
                    skeletonData = new Skeleton[6];
                    skeletonFrame.CopySkeletonDataTo(skeletonData);

                    // Retrieves Skeleton objects with Tracked state
                    var trackedSkeletons = skeletonData.Where(s => s.TrackingState == SkeletonTrackingState.Tracked);

                    // By default, assume all the drawn skeletons are inactive
                    foreach (SkeletonFigure skeleton in skeletons.Values)
                    {
                        skeleton.Status = ActivityState.Inactive;
                    }

                    foreach (Skeleton trackedSkeleton in trackedSkeletons)
                    {
                        SkeletonFigure skeletonFigure;

                        // Checks if the tracked skeleton is already drawn.
                        if (!skeletons.TryGetValue(trackedSkeleton.TrackingId, out skeletonFigure))
                        {
                            // If not, create a new drawing on our canvas
                            skeletonFigure = new SkeletonFigure(this.skeletonCanvas, this.color);
                            try
                            {
                                skeletons.Add(trackedSkeleton.TrackingId, skeletonFigure);
                            }
                            catch (Exception err)
                            {
                                //shhhhh
                            }
                            activeSkel = trackedSkeleton;
                            Canvas.SetTop(this.skeletonCanvas, 0);
                            Canvas.SetLeft(this.skeletonCanvas, 0);
                        }

                        //update the depth of the tracked skeleton
                        skelDepth = trackedSkeleton.Position.Z;
                        skelL     = trackedSkeleton.Joints[JointType.HandLeft].Position.X;
                        skelR     = trackedSkeleton.Joints[JointType.HandRight].Position.X;

                        skelDepth       = skelDepth * 1000;
                        skelDepthPublic = skelDepth;
                        skeletonFigure.setDepth(skelDepthPublic);
                        skelL = (320 * (1 + skelL)) * 4;
                        skelR = (320 * (1 + skelR)) * 4;

                        // Update the drawing
                        Update(trackedSkeleton, skeletonFigure);
                        skeletonFigure.Status = ActivityState.Active;

                        System.Windows.Media.Brush prevColor = this.color;

                        //change color
                        if (tooFarForward())
                        {
                            this.color = blue;
                        }
                        else if (tooFarBack())
                        {
                            this.color = red;
                        }
                        else
                        {
                            this.color = green;
                        }
                        //if color has been changed, change the skel colour
                        if (!(this.color.Equals(prevColor)))
                        {
                            skeletonFigure.setColor(this.color);
                        }
                    }

                    foreach (SkeletonFigure skeleton in skeletons.Values)
                    {
                        // Erase all the still inactive drawings. It means they are not tracked anymore.
                        if (skeleton.Status == ActivityState.Inactive)
                        {
                            skeleton.Erase();
                        }
                    }
                }
                else
                {
                    return;
                }
            }
        }
示例#43
0
        /// <summary>
        /// Creates the formatted text.
        /// </summary>
        public static FormattedText CreateFormattedText(string text, Typeface typeface, double emSize, WpfBrush brush)
        {
            //FontFamily fontFamily = new FontFamily(testFontName);
            //typeface = new Typeface(fontFamily, FontStyles.Normal, FontWeights.Bold, FontStretches.Condensed);
            //List<Typeface> typefaces = new List<Typeface>(fontFamily.GetTypefaces());
            //typefaces.GetType();
            //typeface = s_typefaces[0];

            // BUG: does not work with fonts that have others than the four default styles
            FormattedText formattedText = new FormattedText(text, new CultureInfo("en-us"), FlowDirection.LeftToRight, typeface, emSize, brush, 1.0); //VisualTreeHelper.GetDpi(this).PixelsPerDip);

            // .NET 4.0 feature new NumberSubstitution(), TextFormattingMode.Display);
            //formattedText.SetFontWeight(FontWeights.Bold);
            //formattedText.SetFontStyle(FontStyles.Oblique);
            //formattedText.SetFontStretch(FontStretches.Condensed);
            return(formattedText);
        }