Example #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.rootBlock = ((System.Windows.Documents.BlockUIContainer)(target));
                return;

            case 2:
                this.rootBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.borderWaveNumAccGraphic = ((System.Windows.Controls.Border)(target));
                return;

            case 4:
                this.borderWaveNumAccGraphicPath = ((System.Windows.Controls.Border)(target));
                return;

            case 5:
                this.para = ((System.Windows.Controls.Border)(target));
                return;
            }
            this._contentLoaded = true;
        }
        public static FileTransferControl AddNewFileTransfer(this FlowDocument doc, Tox tox, FileTransfer transfer)
        {
            var fileTableCell = new TableCell();
            var fileTransferControl = new FileTransferControl(transfer, fileTableCell);

            var usernameParagraph = new Section();
            var newTableRow = new TableRow();
            newTableRow.Tag = transfer;

            var fileTransferContainer = new BlockUIContainer();
            fileTransferControl.HorizontalAlignment = HorizontalAlignment.Stretch;
            fileTransferControl.HorizontalContentAlignment = HorizontalAlignment.Stretch;
            fileTransferContainer.Child = fileTransferControl;

            usernameParagraph.Blocks.Add(fileTransferContainer);
            usernameParagraph.Padding = new Thickness(0);

            fileTableCell.ColumnSpan = 3;
            fileTableCell.Blocks.Add(usernameParagraph);
            newTableRow.Cells.Add(fileTableCell);
            fileTableCell.Padding = new Thickness(0, 10, 0, 10);

            var MessageRows = (TableRowGroup)doc.FindName("MessageRows");
            MessageRows.Rows.Add(newTableRow);

            return fileTransferControl;
        }
Example #3
0
        public static FileTransfer AddNewFileTransfer(this FlowDocument doc, Tox tox, int friendnumber, int filenumber, string filename, ulong filesize, bool is_sender)
        {
            FileTransferControl fileTransferControl = new FileTransferControl(tox.GetName(friendnumber), friendnumber, filenumber, filename, filesize);
            FileTransfer transfer = new FileTransfer() { FriendNumber = friendnumber, FileNumber = filenumber, FileName = filename, FileSize = filesize, IsSender = is_sender, Control = fileTransferControl };

            Section usernameParagraph = new Section();
            TableRow newTableRow = new TableRow();

            BlockUIContainer fileTransferContainer = new BlockUIContainer();
            fileTransferControl.HorizontalAlignment = HorizontalAlignment.Stretch;
            fileTransferControl.HorizontalContentAlignment = HorizontalAlignment.Stretch;
            fileTransferContainer.Child = fileTransferControl;

            usernameParagraph.Blocks.Add(fileTransferContainer);
            usernameParagraph.Padding = new Thickness(0);

            TableCell fileTableCell = new TableCell();
            fileTableCell.ColumnSpan = 2;
            fileTableCell.Blocks.Add(usernameParagraph);
            newTableRow.Cells.Add(fileTableCell);
            fileTableCell.Padding = new Thickness(0, 10, 0, 10);

            TableRowGroup MessageRows = (TableRowGroup)doc.FindName("MessageRows");
            MessageRows.Rows.Add(newTableRow);

            return transfer;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.rootBlock = ((System.Windows.Documents.BlockUIContainer)(target));
                return;

            case 2:
                this.rootBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.header = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this.borderGraphic = ((System.Windows.Controls.Border)(target));
                return;

            case 5:
                this.borderGraphicPath = ((System.Windows.Controls.Border)(target));
                return;

            case 6:
                this.resolution = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.scans = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 8:
                this.gain = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 9:
                this.zeroFill = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 10:
                this.phaseCorrection = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:
                this.apodization = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 12:
                this.velocity = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #5
0
        private void TheBigList_Loaded(object sender, RoutedEventArgs e)
        {
            var FooterContainer = new BlockUIContainer();
            //BigFlowDocument.PagePadding.
            var vm = SimpleIoc.Default.GetInstance<PrintViewModel>();
            var cr = vm.Examen.ComptesRendus;
            var titres = 0;
            var lignes = 0;

            foreach (var compteRendu in cr)
            {
                if (string.IsNullOrEmpty(compteRendu.Contenu) || compteRendu.Contenu.Length < 3)
                    continue;
                var paragrapheTitreCompterendu = new Paragraph {FontSize = 16};
                paragrapheTitreCompterendu.Inlines.Add(compteRendu.Nom + ":");
                titres++;

                var paragrapheContenu = new Paragraph {FontSize = 12};

                paragrapheContenu.Inlines.Add(compteRendu.Contenu);
                var line = Regex.Matches(compteRendu.Contenu, "\r", RegexOptions.IgnoreCase).Count;
                if (line == 0)
                    line = 1;
                lignes += line;

                TheBigList.ListItems.Add(new ListItem {Blocks = {paragrapheTitreCompterendu, paragrapheContenu}});
            }

            PrintDlg = new PrintDialog();
            BigFlowDocument.PageHeight = PrintDlg.PrintableAreaHeight;
            BigFlowDocument.PageWidth = PrintDlg.PrintableAreaWidth;
            var diff = 500 - (titres*22 + lignes*18);
            if (lignes + titres >= 30)
                diff = 860 - (titres*22 + lignes*18) + (30*19);
            if (diff > 0)
                FooterContainer.Margin = new Thickness {Top = diff};
            Print();
            var prvm = SimpleIoc.Default.GetInstance<PrintViewModel>();
            MessageBox.Show("L'impression du compte rendu de Mr/Mmme:\n"+prvm.Examen.Malade.Nom+" "+ prvm.Examen.Malade.Prenom + " a été ajoutée à votre liste d'impression ", "Impression Confirmée !");
            Thread.Sleep(500);
            var editableexam = SimpleIoc.Default.GetInstance<EditableExamenViewModel>();
            var newmalade = SimpleIoc.Default.GetInstance<NewMaladeViewModel>();
            if (newmalade!=null && newmalade.SelectedMalade!=null)
                newmalade.Attentes_malades.Remove(newmalade.SelectedMalade);
            editableexam.ResetForms();
            Close();
        }
Example #6
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 12 "..\..\PrintTest.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.PrintMenu_Click);

            #line default
            #line hidden
                return;

            case 2:
                this.flowDocument = ((System.Windows.Documents.FlowDocument)(target));
                return;

            case 3:
                this.uiContainer = ((System.Windows.Documents.BlockUIContainer)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #7
0
        public MainWindow()
        {
            api = new Base();
              scrollChanged_flows = new ScrollChangedEventHandler(scrollViewer1_ScrollChanged_flows);
              scrollChanged_drops = new ScrollChangedEventHandler(scrollViewer1_ScrollChanged_drops);
              InitializeComponent();
              {
            UI.GIFImageControl img = new UI.GIFImageControl()
            {
              GIFSource = "Resources/ajax-loader.gif",
              MaxHeight = 100,
              MaxWidth = 100
            };
            img.PreviewMouseWheel += FAGGUI.XamlHelpers.Bubbler;

            BlockUIContainer buic = new BlockUIContainer(img);
            buic.PreviewMouseWheel += FAGGUI.XamlHelpers.Bubbler;

            FlowDocument doc = new FlowDocument() { TextAlignment = TextAlignment.Center };
            doc.PreviewMouseWheel += FAGGUI.XamlHelpers.Bubbler;
            doc.Blocks.Add(buic);

            loader_fdsv = new FlowDocumentScrollViewer()
            {
              HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
              Document = doc,
              VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
              Background = new SolidColorBrush(Colors.White)
            };

            loader_fdsv.PreviewMouseWheel += FAGGUI.XamlHelpers.Bubbler;
            loader_fdsv.SizeChanged += FAGGUI.XamlHelpers.Resizer;
              }
              lastExpression = expressionBox.Text;
              lastOffset = 0;
              LoadFlows();
        }
        private void AddRow(Table tab, RowBlock rowBlock, Vehicle currentVehicle, int i, int i2)
        {
            //MessageBox.Show("Количество вертикальных блоков " + rowBlock.Blocks.Count.ToString());
            var b = new BlockUIContainer();
            var canvas = new Canvas();
            canvas.Width = currentVehicle.Width / scale;
            canvas.Height = currentVehicle.Height / scale + 20;

            //Рисуем рамку вокруг canvas
            var r = new Rectangle();
            r.Width = currentVehicle.Width / scale;
            r.Height = currentVehicle.Height / scale;
            Brush brush = new SolidColorBrush();
            brush = Brushes.White;
            r.Stroke = new SolidColorBrush(Colors.Red);
            r.Fill = brush;
            Canvas.SetLeft(r, 0);
            Canvas.SetTop(r, 20);
            canvas.Children.Add(r);

            //пишем заголовок
            tab.RowGroups[0].Rows.Add(new TableRow());

            var currentRow = tab.RowGroups[0].Rows[i2 - 1];
            currentRow.Background = Brushes.White;
            currentRow.FontSize = 18;
            currentRow.FontWeight = FontWeights.Normal;

            currentRow.Cells.Add(
                new TableCell(
                    new Paragraph(
                        new Run("Шаг " + i + ": " + rowBlock.Name + "контейнеров: " + rowBlock.Count + ", вес: " +
                                rowBlock.Mass + ", плотность: " + rowBlock.Fullness + "(" + rowBlock.FullnessWidth + ")"))));
            currentRow.Cells[0].ColumnSpan = 2;
            //пишем схему ряда
            var t2 = new TextBlock();
            t2.FontSize = 14;

            var t = new TextBlock();
            //рисуем контейнеры 
            foreach (var v in rowBlock.Blocks)
            {
                //MessageBox.Show("Количество ящиков в вертикальном блоке " + v.Blocks.Count.ToString());             
                foreach (Object p in v.Blocks)
                {
                    var c = (Container)p;
                    r = new Rectangle();
                    r.Width = c.Length / scale;
                    r.Height = c.Height / scale;
                    brush = new SolidColorBrush();
                    brush = Brushes.White;

                    r.Stroke = new SolidColorBrush(Colors.Black);
                    r.Fill = brush;
                    Canvas.SetLeft(r, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale);
                    Canvas.SetTop(r, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale);
                    canvas.Children.Add(r);

                    t = new TextBlock();
                    t.Text = c.Name;
                    if (c.Kind == "VerticalPallet")
                    {
                        t.FontSize = 14;
                    }
                    else
                    {
                        t.FontSize = 20;
                    }

                    Canvas.SetLeft(t, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale + 2);
                    var delta = 2;
                    Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 2);
                    canvas.Children.Add(t);

                    t = new TextBlock();
                    t.Text = "Габ: " + c.Vgh;
                    t.FontSize = 14;
                    Canvas.SetLeft(t, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale + 2);

                    delta = delta + 22;
                    Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta);
                    canvas.Children.Add(t);

                    t = new TextBlock();
                    t.Text = "Вес:" + c.Mass;
                    t.FontSize = 14;
                    Canvas.SetLeft(t, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale + 2);
                    delta = delta + 22;
                    Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta);
                    canvas.Children.Add(t);
                    if (p is VerticalBlock)
                    {
                        t2.Text = t2.Text + "\n" + c.Name + "\n";
                        t2.Text = t2.Text + "  Габариты:" + c.Vgh + "\n";
                        t2.Text = t2.Text + "  Вес:" + c.Mass + "\n";
                        var vB = (VerticalBlock)p;
                        foreach (var cont in vB.Blocks)
                        {
                            t2.Text = t2.Text + "  * " + cont.Name + " (" + cont.ContainerType + ")" + " \n";
                            t = new TextBlock();
                            t.Text = cont.Name;
                            t.FontSize = 16;
                            Canvas.SetLeft(t, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale + 2);
                            delta = delta + 22;
                            Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta);
                            canvas.Children.Add(t);
                        }
                    }
                    else if (p is HorizontalBlock)
                    {
                        t2.Text = t2.Text + "\n" + c.Name + " \n";
                        t2.Text = t2.Text + "  Габариты:" + c.Vgh + "\n";
                        t2.Text = t2.Text + "  Вес:" + c.Mass + "\n";
                        var vB = (HorizontalBlock)p;
                        foreach (var cont in vB.Blocks)
                        {
                            t2.Text = t2.Text + "  * " + cont.Name + " (" + cont.ContainerType + ")" + " \n";
                            t = new TextBlock();
                            t.Text = cont.Name;
                            t.FontSize = 16;
                            Canvas.SetLeft(t, (c.FirstPoint.Y - currentVehicle.FirstPoint.Y) / scale + 2);
                            delta = delta + 22;
                            Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta);
                            canvas.Children.Add(t);
                        }
                    }
                    else
                    {
                        t2.Text = t2.Text + "\n" + c.Name + " (" + c.ContainerType + ")" + "\n";
                        t2.Text = t2.Text + "  Габариты:" + c.Vgh + "\n";
                        t2.Text = t2.Text + "  Вес:" + c.Mass + "\n";
                    }
                }
            }

            b.Child = canvas;

            tab.RowGroups[0].Rows.Add(new TableRow());

            currentRow = tab.RowGroups[0].Rows[i2];
            currentRow.Background = Brushes.White;
            currentRow.FontSize = 14;
            currentRow.FontWeight = FontWeights.Normal;
            currentRow.Cells.Add(new TableCell(new Paragraph(new Run(t2.Text))));
            currentRow.Cells[0].ColumnSpan = 1;
            currentRow.Cells.Add(new TableCell(b));
            currentRow.Cells[1].ColumnSpan = 1;
        }
        private void AddCanvas2(FlowDocument doc, RowBlock rowBlock, int cWidth, int cHeight)
        {
            var b = new BlockUIContainer();
            var canvas = new Canvas();
            canvas.Width = cWidth / scale;
            canvas.Height = cHeight / scale + 20;

            //Рисуем рамку вокруг canvas
            var r = new Rectangle();
            r.Width = cWidth / scale;
            r.Height = cHeight / scale;
            Brush brush = new SolidColorBrush();
            brush = Brushes.White;
            r.Stroke = new SolidColorBrush(Colors.Red);
            r.Fill = brush;
            Canvas.SetLeft(r, 0);
            Canvas.SetTop(r, 20);
            canvas.Children.Add(r);

            //пишем заголовок
            var t = new TextBlock();
            t.Text = rowBlock.Name + "Количество контейнеров: " + rowBlock.Count + " общий вес: " + rowBlock.Mass +
                     "; плотность загрузки - " + rowBlock.Fullness + "(" + rowBlock.FullnessWidth + ")";
            t.FontSize = 14;
            Canvas.SetLeft(t, 20);
            Canvas.SetTop(t, 2);
            canvas.Children.Add(t);

            //рисуем контейнеры 
            foreach (var v in rowBlock.Blocks)
            {
                foreach (Object p in v.Blocks)
                {
                    var c = (Container)p;

                    r = new Rectangle();
                    r.Width = c.Length / scale;
                    r.Height = c.Height / scale;
                    brush = new SolidColorBrush();
                    brush = Brushes.White;

                    r.Stroke = new SolidColorBrush(Colors.Black);
                    r.Fill = brush;
                    Canvas.SetLeft(r, c.FirstPoint.Y / scale);
                    Canvas.SetTop(r, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale);
                    canvas.Children.Add(r);

                    t = new TextBlock();
                    t.Text = c.Name;
                    t.FontSize = 20;
                    Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
                    var delta = 2;
                    Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 2);
                    canvas.Children.Add(t);


                    t = new TextBlock();
                    t.Text = "Габ: " + c.Length + "x" + c.Width + "x" + c.Height;
                    t.FontSize = 18;
                    Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);

                    delta = delta + 22;
                    Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta);
                    canvas.Children.Add(t);

                    t = new TextBlock();
                    t.Text = "Вес:" + c.Mass;
                    t.FontSize = 18;
                    Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
                    delta = delta + 22;
                    Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta);
                    canvas.Children.Add(t);
                    if (p is VerticalBlock)
                    {
                        var vB = (VerticalBlock)p;
                        foreach (var cont in vB.Blocks)
                        {
                            t = new TextBlock();
                            t.Text = cont.Name;
                            t.FontSize = 16;
                            Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
                            delta = delta + 22;
                            Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta);
                            canvas.Children.Add(t);
                        }
                    }
                    else if (p is HorizontalBlock)
                    {
                        var vB = (HorizontalBlock)p;
                        foreach (var cont in vB.Blocks)
                        {
                            t = new TextBlock();
                            t.Text = cont.Name;
                            t.FontSize = 16;
                            Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
                            delta = delta + 22;
                            Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + delta);
                            canvas.Children.Add(t);
                        }
                    }
                }
            }
            b.Child = canvas;
            doc.Blocks.Add(b);
        }
        private void AddContainer(FlowDocument doc, Container c)
        {
            var b = new BlockUIContainer();
            var canvas = new Canvas();
            canvas.Width = c.Width / scale;
            canvas.Height = c.Height / scale;


            var r = new Rectangle();
            r.Width = c.Length / scale;
            r.Height = c.Height / scale;
            Brush brush = new SolidColorBrush();
            brush = Brushes.White;
            r.Stroke = new SolidColorBrush(Colors.Black);
            r.Fill = brush;
            Canvas.SetLeft(r, c.FirstPoint.Y / scale);
            Canvas.SetTop(r, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale);
            canvas.Children.Add(r);

            var t = new TextBlock();
            t.Text = c.Name + " (" + c.ContainerType + ")";
            t.FontSize = 10;
            Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
            Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 2);
            canvas.Children.Add(t);

            t = new TextBlock();
            t.Text = "Габ: " + c.Length + "x" + c.Width + "x" + c.Height + "мм.Вес:" + c.Mass;
            t.FontSize = 10;
            Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
            Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 15);
            canvas.Children.Add(t);

            t = new TextBlock();
            t.Text = "Цена: " + c.Price + "; Направление загрузки д: " + c.DirLength + "; ш: " + c.DirWidth + "; в: " +
                     c.DirHeight + "; ";
            t.FontSize = 10;
            Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
            Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 28);
            canvas.Children.Add(t);

            t = new TextBlock();
            t.Text = "Порядок загрузки + " + c.Order + "; Допуст.давление: " + c.PressHeight + "; Хрупкость: " +
                     c.FragilityHeight + "; ";
            t.FontSize = 10;
            Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
            Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 41);
            canvas.Children.Add(t);

            t = new TextBlock();
            t.Text = "Уровень: " + c.Level + "; Количество: " + c.Quantity + "; На пол: " + c.Only4Bottom + "; ";
            t.FontSize = 10;
            Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
            Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 54);
            canvas.Children.Add(t);

            b.Child = canvas;
            doc.Blocks.Add(b);
        }
Example #11
0
 private static void ParseBlockUIContainer(BlockUIContainer blockUIContainer, List<TextElement> list)
 {
     list.Add(blockUIContainer);
 }
Example #12
0
        //------------------------------------------------------
        //
        // Internal Virtual Methods - TextSelection Extensibility
        //
        //------------------------------------------------------

        #region Internal Virtual Methods

        //......................................................
        //
        //  Formatting
        //
        //......................................................

        // Worker for AppendEmbeddedElement; enabled extensibility for TextSelection
        internal virtual void InsertEmbeddedUIElementVirtual(FrameworkElement embeddedElement)
        {
            Invariant.Assert(this.HasConcreteTextContainer, "Can't insert embedded object to non-TextContainer range!");
            Invariant.Assert(embeddedElement != null);

            TextRangeBase.BeginChange(this);
            try
            {
                // Delete existing selected content
                this.Text = String.Empty;

                // Calling EnsureInsertionPosition has the effect of inserting a paragraph 
                // before insert the embedded UIElement at BlockUIContainer or InlineUIConatiner.
                TextPointer startPosition = TextRangeEditTables.EnsureInsertionPosition(this.Start);

                // Choose what wrapper to use - BlockUIContainer or InlineUIContainer -
                // depending on the current paragraph emptiness
                Paragraph paragraph = startPosition.Paragraph;

                if (paragraph != null)
                {
                    if (Paragraph.HasNoTextContent(paragraph))
                    {
                        // Use BlockUIContainer as a replacement of the current paragraph
                        BlockUIContainer blockUIContainer = new BlockUIContainer(embeddedElement);

                        // Translate embedded element's horizontal alignment property to the BlockUIContainer's text alignment
                        blockUIContainer.TextAlignment = TextRangeEdit.GetTextAlignmentFromHorizontalAlignment(embeddedElement.HorizontalAlignment);

                        // Replace paragraph with BlockUIContainer
                        paragraph.SiblingBlocks.InsertAfter(paragraph, blockUIContainer);
                        paragraph.SiblingBlocks.Remove(paragraph);
                        this.Select(blockUIContainer.ContentStart, blockUIContainer.ContentEnd);
                    }
                    else
                    {
                        // Use InlineUIContainer
                        InlineUIContainer inlineUIContainer = new InlineUIContainer(embeddedElement);
                        TextPointer insertionPosition = TextRangeEdit.SplitFormattingElements(this.Start, /*keepEmptyFormatting:*/false);
                        insertionPosition.InsertTextElement(inlineUIContainer);
                        this.Select(inlineUIContainer.ElementStart, inlineUIContainer.ElementEnd);
                    }
                }
            }
            finally
            {
                TextRangeBase.EndChange(this);
            }
        }
        /// <summary>
        /// Handle code elements
        /// </summary>
        /// <param name="props">The element properties</param>
        private static void CodeElement(ElementProperties props)
        {
            XAttribute attribute;
            Section code = new Section();
            props.Converter.AddToBlockContainer(code);
            string language = "none", title, sourceFile, region;
            bool removeRegionMarkers, numberLines;

            if(props.Element.Name.LocalName != "codeReference")
            {
                attribute = props.Element.Attribute("lang");

                if(attribute == null)
                    attribute = props.Element.Attribute("language");

                if(attribute != null)
                    language = attribute.Value;

                // If there is a title attribute, use that for the title.  If not, map the language ID to
                // a display title.
                attribute = props.Element.Attribute("title");

                // For a blank title, a single space is required.  If empty, use the language title.
                if(attribute != null && attribute.Value.Length != 0)
                    title = attribute.Value;
                else
                    if(CodeColorizer == null || !CodeColorizer.FriendlyNames.TryGetValue(language, out title))
                        title = String.Empty;

                // If there are nested code blocks, import the code and replace them with their content
                foreach(var nestedBlock in props.Element.Descendants(ddue + "code").ToList())
                {
                    attribute = nestedBlock.Attribute("source");

                    if(attribute != null)
                    {
                        sourceFile = attribute.Value;
                        attribute = nestedBlock.Attribute("region");

                        if(attribute != null)
                            region = attribute.Value;
                        else
                            region = null;

                        attribute = nestedBlock.Attribute("removeRegionMarkers");

                        if(attribute == null || !Boolean.TryParse(attribute.Value, out removeRegionMarkers))
                            removeRegionMarkers = false;

                        nestedBlock.Value = LoadCodeBlock(sourceFile, region, removeRegionMarkers);
                    }
                }
            }
            else
                title = "Code Reference";

            // Create the title and Copy link elements.  These will reside in a grid in a block UI container.
            Grid g = new Grid();

            g.ColumnDefinitions.Add(new ColumnDefinition());
            g.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });

            TextBlock tb = new TextBlock
            {
                TextAlignment = TextAlignment.Left,
                FontWeight = FontWeights.Bold,
                Text = title
            };
            
            Grid.SetColumn(tb, 0);
            g.Children.Add(tb);

            Hyperlink l = new Hyperlink(new Run("Copy"))
            {
                // The URI signals the generic handler to copy code rather than launch the URL
                NavigateUri = new Uri("copy://code", UriKind.RelativeOrAbsolute),
                ToolTip = "Copy Code",
                FontSize = 10
            };

            tb = new TextBlock(l) { TextAlignment = TextAlignment.Right };
            Grid.SetColumn(tb, 1);
            g.Children.Add(tb);

            BlockUIContainer buic = new BlockUIContainer(g) { Margin = new Thickness(0, 3, 0, 3) };
            code.Blocks.Add(buic);

            // Create the section that will hold the code block
            Section codeBlock = new Section();
            code.Blocks.Add(codeBlock);
            codeBlock.SetResourceReference(Section.StyleProperty, NamedStyle.CodeBlock);

            Paragraph p = new Paragraph();
            codeBlock.Blocks.Add(p);

            // See if lines are to be numbered
            attribute = props.Element.Attribute("numberLines");

            if(attribute == null || !Boolean.TryParse(attribute.Value, out numberLines))
                numberLines = false;

            // If importing from an external file, include that info in the content
            attribute = props.Element.Attribute("source");

            if(attribute != null)
            {
                sourceFile = attribute.Value;
                attribute = props.Element.Attribute("region");

                if(attribute != null)
                    region = attribute.Value;
                else
                    region = null;

                attribute = props.Element.Attribute("removeRegionMarkers");

                if(attribute == null || !Boolean.TryParse(attribute.Value, out removeRegionMarkers))
                    removeRegionMarkers = false;

                if(CodeColorizer != null)
                    ColorizeCode(LoadCodeBlock(sourceFile, region, removeRegionMarkers), language, numberLines, p);
                else
                    p.Inlines.Add(new Run(LoadCodeBlock(sourceFile, region, removeRegionMarkers)));
            }
            else
                if(props.Element.Name.LocalName != "codeReference" && CodeColorizer != null)
                    ColorizeCode(props.Element.Value, language, numberLines, p);
                else
                    p.Inlines.Add(new Run(StripLeadingWhitespace(props.Element.Value, 4)));

            props.ParseChildren = false;
        }
 Inline Render(HTMLImageElement element)
 {
     var f = new Figure();
     f.FlowDirection = FlowDirection.LeftToRight;
     var container = new BlockUIContainer();
     var img = new Image();
     img.Stretch = Stretch.None;
     var src = new BitmapImage();
     src.BeginInit();
     src.UriSource = new Uri(url, Sanitize(element.Src));
     src.EndInit();
     f.Blocks.Add(container);
     container.Child = img;
     img.Source = src;
     return f;
 }
Example #15
0
        private void DrawCanvasVeels(FlowDocument doc, Vehicle vehicle)
        {
            double length = vehicle.Length/Scale;
            var height = 0.3*vehicle.Height/Scale;
            //создаем объект для рисования
            var blockUiContainer = new BlockUIContainer();
            var canvas = new Canvas();
            canvas.Width = length;
            canvas.Height = height;

            //Рисуем  переднее колесо
            DrawWheel(canvas, height, 50);
            //DrawAxelTonnage(canvas, v.Front_axle_current_tonnage, 50);

            //Рисуем  заднее колесо
            DrawWheel(canvas, height, length - height - 50);
            //DrawAxelTonnage(canvas, v.Back_axle_current_tonnage, length - height - 50);
            blockUiContainer.Child = canvas;
            doc.Blocks.Add(blockUiContainer);
        }
Example #16
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.DocumentReader = ((System.Windows.Controls.FlowDocumentReader)(target));
     return;
     case 2:
     this.ImageContainer = ((System.Windows.Documents.BlockUIContainer)(target));
     return;
     case 3:
     this.imag = ((System.Windows.Controls.Image)(target));
     return;
     case 4:
     this.btnStackePanel = ((System.Windows.Controls.StackPanel)(target));
     return;
     case 5:
     this.btnback = ((System.Windows.Controls.Button)(target));
     
     #line 31 "..\..\..\com.rta.vsd.hh.ui\PrintPreview.xaml"
     this.btnback.Click += new System.Windows.RoutedEventHandler(this.btnback_Click_1);
     
     #line default
     #line hidden
     return;
     case 6:
     this.btnPrint = ((System.Windows.Controls.Button)(target));
     
     #line 32 "..\..\..\com.rta.vsd.hh.ui\PrintPreview.xaml"
     this.btnPrint.Click += new System.Windows.RoutedEventHandler(this.btnPrint_Click_1);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }
Example #17
0
        private void DrawCanvas(FlowDocument doc, Vehicle vehicle, Direction direction)
        {
            double length = vehicle.Length;
            double height = vehicle.Height;
            if (direction == Direction.Up)
            {
                length = vehicle.Length/Scale;
                height = vehicle.Height/Scale;
            }
            else if (direction == Direction.Front)
            {
                length = vehicle.Length/Scale;
                height = vehicle.Width/Scale;
            }
            else
            {
                MessageBox.Show("не опознан вид проекции");
            }
            ;

            //создаем объект для рисования
            var blockUiContainer = new BlockUIContainer();
            var canvas = new Canvas();
            canvas.Width = length;
            canvas.Height = height;

            //Рисуем рамку вокруг canvas
            var rectangle = new Rectangle();
            rectangle.Width = length;
            rectangle.Height = height;
            Brush brush = new SolidColorBrush();
            brush = Brushes.White;
            rectangle.Stroke = new SolidColorBrush(Colors.Black);
            rectangle.StrokeThickness = 2;
            rectangle.Fill = brush;
            Canvas.SetLeft(rectangle, 0);
            Canvas.SetTop(rectangle, 0);
            canvas.Children.Add(rectangle);

            //рисуем контейнеры 
            foreach (var rowBlock in vehicle.Blocks)
            {
                DrawBlock(canvas, rowBlock, direction, vehicle);
            }

            DrawMassCenter(vehicle, canvas, direction);
            blockUiContainer.Child = canvas;
            doc.Blocks.Add(blockUiContainer);
        }
Example #18
0
        protected override void Write([NotNull] WpfRenderer renderer, [NotNull] MathBlock obj)
        {
            string text = string.Empty; // obj.Content.Text.Substring(obj.Content.Start, obj.Content.Length);

            for (int i = 0; i < obj.Lines.Count; ++i)
            {
                var l = obj.Lines.Lines[i];
                text += l.Slice.Text.Substring(l.Slice.Start, l.Slice.Length);
            }

            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            TexFormula formula = null;

            try
            {
                formula = formulaParser.Parse(text);
            }
            catch (Exception)
            {
                var paragraph = new Paragraph()
                {
                    Tag = obj
                };
                renderer.Push(paragraph);
                renderer.WriteInline(new Run("[!!FORMULA PARSE ERROR!!]")
                {
                    Tag = obj
                });
                renderer.Pop();
                return;
            }

            var fontSize = renderer.CurrentFontSize();

            if (fontSize <= 0)
            {
                throw new InvalidProgramException();
            }

            var formulaRenderer = formula.GetRenderer(TexStyle.Display, fontSize, "Arial");
            var geo             = formulaRenderer.RenderToGeometry(0, 0);
            var geoD            = new System.Windows.Media.GeometryDrawing(Brushes.Black, null, geo);
            var di      = new DrawingImage(geoD);
            var uiImage = new System.Windows.Controls.Image()
            {
                Source = di
            };

            uiImage.Height = formulaRenderer.RenderSize.Height; // size image to match rendersize -> get a zoom of 100%
            // uiImage.Margin = new System.Windows.Thickness(0, 0, 0, -formulaRenderer.RenderSize.Height * formulaRenderer.RelativeDepth); // Move image so that baseline matches that of text
            var uiBlock = new System.Windows.Documents.BlockUIContainer()
            {
                Child = uiImage,
                Tag   = obj,
            };

            renderer.WriteBlock(uiBlock);
        }
Example #19
0
        public static FlowDocument Convert(string filename)
        {
            FlowDocument fdoc = new FlowDocument();

            Package pkg = Package.Open(filename, FileMode.Open, FileAccess.Read);
            string pack = "pack://temp.xps";
            PackageStore.AddPackage(new Uri(pack), pkg);
            XpsDocument _doc = new XpsDocument(pkg, CompressionOption.Fast, pack);

            /*foreach (DocumentReference dr in _doc.GetFixedDocumentSequence().References)
            {
                foreach (PageContent pc in dr.GetDocument(false).Pages)
                {
                    FixedPage fp = pc.GetPageRoot(false);
                    BlockUIContainer cont = new BlockUIContainer();
                    cont.Child = fp;
                    fdoc.Blocks.Add(cont);
                }
            }
            viewer.Document = fdoc;
            this.Content = viewer;
            return;*/

            IXpsFixedDocumentSequenceReader fixedDocSeqReader = _doc.FixedDocumentSequenceReader;


            
            Dictionary<string, string> fontList = new Dictionary<string, string>();

            foreach (IXpsFixedDocumentReader docReader in fixedDocSeqReader.FixedDocuments)
            {
                foreach (IXpsFixedPageReader fixedPageReader in docReader.FixedPages)
                {
                    while (fixedPageReader.XmlReader.Read())
                    {

                        string page = fixedPageReader.XmlReader.ReadOuterXml();
                        string path = string.Empty;

                        foreach (XpsFont font in fixedPageReader.Fonts)
                        {
                            
                            string name = font.Uri.GetFileName();
                            path = string.Format(@"{0}\{1}", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), name);

                            if (!fontList.ContainsKey(font.Uri.OriginalString))
                            {
                                fontList.Add(font.Uri.OriginalString, path);
                                font.SaveToDisk(path);
                            }
                        }

                        foreach (XpsImage image in fixedPageReader.Images)
                        {
                            //here to get images
                        }

                        foreach(KeyValuePair<string,string> val in fontList) 
                        {
                            page = page.ReplaceAttribute("FontUri", val.Key,val.Value); 
                        }


                        FixedPage fp = XamlReader.Load(new MemoryStream(Encoding.Default.GetBytes(page))) as FixedPage;

                        /*fp.Children.OfType<Glyphs>().ToList().ForEach(glyph =>
                            {
                                Binding b = new Binding();
                                b.Source = glyph;
                                b.Path = new PropertyPath(Glyphs.UnicodeStringProperty);
                                glyph.SetBinding(TextSearch.TextProperty, b);
                            });*/

                        BlockUIContainer cont = new BlockUIContainer();
                        cont.Child = fp;
                        fdoc.Blocks.Add(cont);

                        //string outp = XamlWriter.Save(fp);
                    }

                }
            }

            return fdoc;

        }
        private void AddCanvas(FlowDocument doc, VerticalBlock vBlock, int cWidth, int cHeight)
        {
            //MessageBox.Show("Количество вертикальных блоков " + rowBlock.Blocks.Count.ToString());
            var b = new BlockUIContainer();
            var canvas = new Canvas();
            canvas.Width = cWidth / scale;
            canvas.Height = cHeight / scale + 20;

            //Рисуем рамку вокруг canvas
            var r = new Rectangle();
            r.Width = cWidth / scale;
            r.Height = cHeight / scale;
            Brush brush = new SolidColorBrush();
            brush = Brushes.White;
            r.Stroke = new SolidColorBrush(Colors.Red);
            r.Fill = brush;
            Canvas.SetLeft(r, 0);
            Canvas.SetTop(r, 20);
            canvas.Children.Add(r);

            //пишем заголовок
            var t = new TextBlock();
            t.Text = "Количество контейнеров: " + vBlock.Count + " общий вес: " + vBlock.Mass;
            t.FontSize = 14;
            Canvas.SetLeft(t, 20);
            Canvas.SetTop(t, 2);
            canvas.Children.Add(t);

            vBlock.SetFirstPointVerticalBlock(new Point3D(0, 0, 0));
            //рисуем контейнеры
            foreach (var c in vBlock.Blocks)
            {
                r = new Rectangle();
                r.Width = c.Length / scale;
                r.Height = c.Height / scale;
                brush = new SolidColorBrush();
                brush = Brushes.White;
                r.Stroke = new SolidColorBrush(Colors.Black);
                r.Fill = brush;
                Canvas.SetLeft(r, c.FirstPoint.Y / scale);
                Canvas.SetTop(r, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale);
                canvas.Children.Add(r);

                t = new TextBlock();
                t.Text = c.Name;
                t.FontSize = 10;
                Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
                Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 2);
                canvas.Children.Add(t);

                t = new TextBlock();
                t.Text = "Габ: " + c.Length + "x" + c.Width + "x" + c.Height + "мм.Вес:" + c.Mass;
                t.FontSize = 10;
                Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
                Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 15);
                canvas.Children.Add(t);

                t = new TextBlock();
                t.Text = "Цена: " + c.Price + "; Направление загрузки д: " + c.DirLength + "; ш: " + c.DirWidth +
                         "; в: " + c.DirHeight + "; ";
                t.FontSize = 10;
                Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
                Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 28);
                canvas.Children.Add(t);

                t = new TextBlock();
                t.Text = "Порядок загрузки + " + c.Order + "; Допуст.давление: " + c.PressHeight + "; Хрупкость: " +
                         c.FragilityHeight + "; ";
                t.FontSize = 10;
                Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
                Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 41);
                canvas.Children.Add(t);

                t = new TextBlock();
                t.Text = "Уровень: " + c.Level + "; Количество: " + c.Quantity + "; На пол: " + c.Only4Bottom + "; ";
                t.FontSize = 10;
                Canvas.SetLeft(t, c.FirstPoint.Y / scale + 2);
                Canvas.SetTop(t, canvas.Height - c.Height / scale - c.FirstPoint.Z / scale + 54);
                canvas.Children.Add(t);
            }
            b.Child = canvas;
            doc.Blocks.Add(b);
        }
        private void displayHelp(String title)
        {
            // Load and display the RTF file.
            Uri uri = new Uri("pack://application:,,,/Helps/"+title+"Text.rtf");
            StreamResourceInfo info = Application.GetResourceStream(uri);
            using (StreamReader txtReader = new StreamReader(info.Stream))
            {
                _txtHelpContent.Text = txtReader.ReadToEnd();
                try
                {
                    BitmapImage bitmap = new BitmapImage(new Uri("pack://application:,,,/Helps/" + title + ".png"));
                    if (bitmap != null)
                    {
                        Paragraph para = new Paragraph();
                        para.Inlines.Add(new Run("Image "));
                        fld.Blocks.Add(para);

                        // Add an image
                        para = new Paragraph();
                        Image image = new Image();
                        image.Source = bitmap;
                        Figure figure = new Figure();
                        figure.Width = new FigureLength(200);
                        BlockUIContainer container = new BlockUIContainer(image);
                        figure.Blocks.Add(container);
                        para.Inlines.Add(figure);
                        fld.Blocks.Add(para);
                    }
                }
                catch (Exception e)
                {}
            }
        }
 /// <summary>
 /// The write image.
 /// </summary>
 /// <param name="i">
 /// The i.
 /// </param>
 public void WriteImage(Image i)
 {
     // var figure = new Figure();
     var img = new System.Windows.Controls.Image();
     var bi = new BitmapImage();
     bi.BeginInit();
     bi.UriSource = new Uri(Path.GetFullPath(i.Source), UriKind.Absolute);
     bi.EndInit();
     img.Source = bi;
     var c = new BlockUIContainer(img) { Child = img };
     this.doc.Blocks.Add(c);
 }
Example #23
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.rootBlock = ((System.Windows.Documents.BlockUIContainer)(target));
                return;

            case 2:
                this.rootBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.txtCompany = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this.txtOperator = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 5:
                this.txtInstrumentNo = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.txtCalibrateTime = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.imgResolution = ((System.Windows.Controls.Image)(target));
                return;

            case 8:
                this.target = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 9:
                this.borderAccuracyGraphic = ((System.Windows.Controls.Border)(target));
                return;

            case 10:
                this.maxRes = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:
                this.thresoldDev = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 12:
                this.realRes = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 13:
                this.imgNoise = ((System.Windows.Controls.Image)(target));
                return;

            case 14:
                this.borderSnrGraphic = ((System.Windows.Controls.Border)(target));
                return;

            case 15:
                this.maxNoise = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 16:
                this.realNoise = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 17:
                this.imgEnergy = ((System.Windows.Controls.Image)(target));
                return;

            case 18:
                this.minEnergy = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 19:
                this.maxEnergy = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 20:
                this.imgLineSlope = ((System.Windows.Controls.Image)(target));
                return;

            case 21:
                this.dataGrid = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 22:
                this.imgTreRep = ((System.Windows.Controls.Image)(target));
                return;

            case 23:
                this.testRegion = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 24:
                this.maxDev = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 25:
                this.realDev = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 26:
                this.imgAcc = ((System.Windows.Controls.Image)(target));
                return;

            case 27:
                this.txtPeak = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 28:
                this.txtAcc = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 29:
                this.realPeak = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 30:
                this.realAcc = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 31:
                this.imgWaveRep = ((System.Windows.Controls.Image)(target));
                return;

            case 32:
                this.maxWaveRepDev = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 33:
                this.realmaxWaveDev = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 34:
                this.txtAllResult = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 35:
                this.imgAllResult = ((System.Windows.Controls.Image)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #24
0
        public static Block GameMessageToBlock(IGameMessage m)
        {
            if (m == null)
                return null;

            if (m is PlayerEventMessage)
            {
                if (m.IsMuted) return null;
                var b = new GameMessageBlock(m);
                var p = new Paragraph();
                var prun = new Run(m.From + " ");
                prun.Foreground = m.From.Color.CacheToBrush();
                prun.FontWeight = FontWeights.Bold;
                p.Inlines.Add(prun);

                var chatRun = MergeArgsv2(m.Message, m.Arguments);
                chatRun.Foreground = new SolidColorBrush(m.From.Color);
                //chatRun.FontWeight = FontWeights.Bold;
                p.Inlines.Add(chatRun);

                b.Blocks.Add(p);

                return b;
            }
            else if (m is ChatMessage)
            {
                if (m.IsMuted) return null;

                var p = new Paragraph();
                var b = new GameMessageBlock(m);

                var inline = new Span();

                inline.Foreground = m.From.Color.CacheToBrush();
                var chatRun = new Run("<" + m.From + "> ");
                chatRun.Foreground = m.From.Color.CacheToBrush();
                chatRun.FontWeight = FontWeights.Bold;
                inline.Inlines.Add(chatRun);

                inline.Inlines.Add(MergeArgsv2(m.Message, m.Arguments));

                p.Inlines.Add(inline);

                b.Blocks.Add(p);

                return b;
            }
            else if (m is WarningMessage)
            {
                if (m.IsMuted) return null;

                var b = new GameMessageBlock(m);
                var block = new BlockUIContainer();
                var border = new Border()
                {
                    CornerRadius = new CornerRadius(4),
                    BorderBrush = Brushes.Gray,
                    BorderThickness = new Thickness(1),
                    Padding = new Thickness(5),
                    Background = Brushes.LightGray,
                };
                var tb = new TextBlock(MergeArgsv2(m.Message, m.Arguments));
                tb.Foreground = m.From.Color.CacheToBrush();
                tb.TextWrapping = TextWrapping.Wrap;

                border.Child = tb;
                block.Child = border;

                b.Blocks.Add(block);

                return b;
            }
            else if (m is SystemMessage)
            {
                if (m.IsMuted) return null;

                var p = new Paragraph();
                var b = new GameMessageBlock(m);
                var chatRun = MergeArgsv2(m.Message, m.Arguments);
                chatRun.Foreground = m.From.Color.CacheToBrush();
                p.Inlines.Add(chatRun);
                b.Blocks.Add(p);
                return b;
            }
            else if (m is NotifyMessage)
            {
                if (m.IsMuted) return null;

                var p = new Paragraph();
                var b = new GameMessageBlock(m);
                var chatRun = MergeArgsv2(m.Message, m.Arguments);
                chatRun.Foreground = m.From.Color.CacheToBrush();
                b.Blocks.Add(p);
                p.Inlines.Add(chatRun);
                return b;
            }
            else if (m is TurnMessage)
            {
                if (m.IsMuted) return null;

                var brush = m.From.Color.CacheToBrush();

                var p = new Paragraph();
                var b = new GameMessageBlock(m);
                b.TextAlignment = TextAlignment.Center;
                b.Margin = new Thickness(2);

                p.Inlines.Add(
                    new Line
                    {
                        X1 = 0,
                        X2 = 40,
                        Y1 = -4,
                        Y2 = -4,
                        StrokeThickness = 2,
                        Stroke = brush
                    });

                var chatRun = new Run(string.Format(m.Message, m.Arguments));
                chatRun.Foreground = brush;
                chatRun.FontWeight = FontWeights.Bold;
                p.Inlines.Add(chatRun);

                var prun = new Run(" " + (m as TurnMessage).TurnPlayer + " ");
                prun.Foreground = (m as TurnMessage).TurnPlayer.Color.CacheToBrush();
                prun.FontWeight = FontWeights.Bold;
                p.Inlines.Add(prun);

                p.Inlines.Add(
                    new Line
                    {
                        X1 = 0,
                        X2 = 40,
                        Y1 = -4,
                        Y2 = -4,
                        StrokeThickness = 2,
                        Stroke = brush
                    });

                b.Blocks.Add(p);

                //if (((Paragraph)output.Document.Blocks.LastBlock).Inlines.Count == 0)
                //    output.Document.Blocks.Remove(output.Document.Blocks.LastBlock);

                return b;

                //output.Document.Blocks.Add(new Paragraph { Margin = new Thickness() });
            }
            else if (m is DebugMessage)
            {
                if (m.IsMuted) return null;
                var p = new Paragraph();
                var b = new GameMessageBlock(m);
                var chatRun = MergeArgsv2(m.Message, m.Arguments);
                chatRun.Foreground = m.From.Color.CacheToBrush();
                p.Inlines.Add(chatRun);
                b.Blocks.Add(p);
                return b;
            }
            else if (m is NotifyBarMessage)
            {
                if (m.IsMuted) return null;
                var p = new Paragraph();
                var b = new GameMessageBlock(m);
                var chatRun = MergeArgsv2(m.Message, m.Arguments);
                chatRun.Foreground = (m as NotifyBarMessage).MessageColor.CacheToBrush();
                p.Inlines.Add(chatRun);
                b.Blocks.Add(p);
                return b;
            }
            return null;
        }
Example #25
0
        /// <summary>
        /// This method is not used, I just put it here to help
        /// you in case you want to make a rich text box and enable
        /// emoticons for example.
        /// Just add a richTextBox control and set
        /// richTextBox.Document = MakeDocument(imgid, text);
        /// </summary>
        /// <param name="imgID"></param>
        /// <param name="text"></param>
        /// <returns></returns>
        // ReSharper disable once UnusedMember.Local on purpose
        private FlowDocument MakeDocument(int imgID, string text)
        {
            Dictionary<int, Image> images = GetImages();
            Image img = images[imgID];
            img.Height = 70;
            img.Width = 60;


            Block imgBlock = new BlockUIContainer(img);
            Block txtBlock = new Paragraph(new Run(text));


            FlowDocument doc = new FlowDocument();
            doc.Blocks.Add(imgBlock);

            doc.Blocks.Add(txtBlock);

            doc.FlowDirection = FlowDirection.LeftToRight;
            return doc;
        }
        //=====================================================================

        /// <summary>
        /// Handle media link elements
        /// </summary>
        /// <param name="props">The element properties</param>
        private static void MediaLinkElement(ElementProperties props)
        {
            BlockUIContainer imageBlock = new BlockUIContainer();
            XElement imageElement = props.Element.Descendants(ddue + "image").FirstOrDefault(),
                captionElement = props.Element.Descendants(ddue + "caption").FirstOrDefault();
            XAttribute attribute;
            HorizontalAlignment alignment = HorizontalAlignment.Left;
            KeyValuePair<string, string> imageInfo = new KeyValuePair<string, string>(null, null);
            Image image = new Image();
            string id = "???", caption = null, leadIn = null;
            bool captionAfter = false;

            if(imageElement != null)
            {
                attribute = imageElement.Attribute(xlink + "href");

                if(attribute != null)
                {
                    id = attribute.Value;

                    if(!props.Converter.MediaFiles.TryGetValue(id, out imageInfo))
                        imageInfo = new KeyValuePair<string, string>(null, null);
                }

                attribute = imageElement.Attribute("placement");

                if(attribute != null)
                    switch(attribute.Value)
                    {
                        case "center":
                            alignment = HorizontalAlignment.Center;
                            break;

                        case "far":
                            alignment = HorizontalAlignment.Right;
                            break;
                    }
            }

            if(captionElement != null)
            {
                caption = reCondenseWhitespace.Replace(captionElement.Value.Trim(), " ");

                attribute = captionElement.Attribute("placement");

                if(attribute != null && attribute.Value == "after")
                    captionAfter = true;

                attribute = captionElement.Attribute("lead");

                if(attribute != null)
                    leadIn = attribute.Value;
            }

            if(!String.IsNullOrEmpty(imageInfo.Key) && File.Exists(imageInfo.Key))
            {
                var bm = new BitmapImage();

                // Cache on load to prevent it locking the image
                bm.BeginInit();
                bm.CacheOption = BitmapCacheOption.OnLoad;
                bm.UriSource = new Uri(imageInfo.Key);
                bm.EndInit();

                // Use the actual image size to mimic the HTML layout
                image.Height = bm.Height;
                image.Width = bm.Width;
                image.ToolTip = !String.IsNullOrEmpty(imageInfo.Value) ? imageInfo.Value :
                    "ID: " + id + "\nFilename: " + imageInfo.Key;
                image.Margin = new Thickness(10);
                image.HorizontalAlignment = alignment;

                image.Source = bm;

                if(String.IsNullOrEmpty(caption))
                    imageBlock.Child = image;
                else
                {
                    StackPanel sp = new StackPanel();
                    sp.HorizontalAlignment = alignment;

                    if(captionAfter)
                        sp.Children.Add(image);

                    StackPanel spChild = new StackPanel { Orientation = Orientation.Horizontal };
                    spChild.HorizontalAlignment = alignment;

                    if(!String.IsNullOrEmpty(leadIn))
                        spChild.Children.Add(new TextBlock
                        {
                            Text = leadIn + ": ",
                            FontWeight = FontWeights.Bold,
                            Foreground = new SolidColorBrush(Color.FromRgb(0, 0x33, 0x99))
                        });

                    spChild.Children.Add(new TextBlock
                    {
                        Text = caption,
                        Foreground = new SolidColorBrush(Color.FromRgb(0, 0x33, 0x99))
                    });

                    sp.Children.Add(spChild);

                    if(!captionAfter)
                        sp.Children.Add(image);

                    imageBlock.Child = sp;
                }
            }
            else
                imageBlock.Child = new TextBlock
                {
                    Text = String.Format(CultureInfo.InvariantCulture, "[INVALID IMAGE ID: {0}]", id),
                    Background = new SolidColorBrush(Colors.Red),
                    Foreground = new SolidColorBrush(Colors.White),
                    HorizontalAlignment = alignment
                };

            props.Converter.AddToBlockContainer(imageBlock);
            props.ParseChildren = false;
        }
Example #27
0
        /// <summary>
        /// Renders DOM text elements recursively, i.e. including their childs.
        /// </summary>
        /// <param name="e">The root DOM text element.</param>
        /// <returns>The corresponding Wpf element.</returns>
        /// <exception cref="System.InvalidOperationException">
        /// </exception>
        /// <exception cref="System.NotImplementedException"></exception>
        public object RenderRecursively(TextElement e)
        {
            object wpf = null;

            switch (e)
            {
            case BlockUIContainer buc:
            {
                wpf = new swd.BlockUIContainer();
            }
            break;

            case FlowDocument flowDocument:
            {
                // make sure the standard colors were set
                flowDocument.Foreground = ExCSS.Color.Black;
                flowDocument.Background = ExCSS.Color.White;

                var flowDocumente = new swd.FlowDocument()
                {
                    Name = NameOfFlowDocument
                };
                if (TemplateBindingViewportWidth is null)
                {
                    TemplateBindingViewportWidth = new Binding("ColumnWidth")
                    {
                        Source = flowDocumente
                    }
                }
                ;
                if (TemplateBindingViewportHeight is null)
                {
                    TemplateBindingViewportHeight = new Binding("ColumnWidth")
                    {
                        Source = flowDocumente
                    }
                }
                ;                                                                                    // Binding to ColumnWidth is not optimal, but better than nothing!

                if (flowDocument.Background.HasValue)
                {
                    flowDocumente.Background = GetBrushFromColor(flowDocument.Background.Value);
                }
                if (flowDocument.Foreground.HasValue)
                {
                    flowDocumente.Foreground = GetBrushFromColor(flowDocument.Foreground.Value);
                }

                wpf = flowDocumente;
            }
            break;

            case Hyperlink hl:
            {
                var hle = new swd.Hyperlink();
                if (!string.IsNullOrEmpty(hl.NavigateUri))
                {
                    if (System.Uri.TryCreate(hl.NavigateUri, UriKind.RelativeOrAbsolute, out var uri))
                    {
                        hle.NavigateUri = uri;
                    }
                }
                if (!string.IsNullOrEmpty(hl.TargetName))
                {
                    hle.TargetName = hl.TargetName;
                }
                wpf = hle;
            }
            break;

            case Image image:
            {
                var imagee = new System.Windows.Controls.Image();
                if (!string.IsNullOrEmpty(image.Source))
                {
                    imagee.SetBinding(System.Windows.Controls.Image.SourceProperty, $"ImageProvider[{image.Source}]");
                }

                if (image.Width == null && image.Height == null)
                {
                    imagee.Stretch = System.Windows.Media.Stretch.Uniform;

                    var binding = new Binding()
                    {
                        RelativeSource = RelativeSource.Self, Path = new System.Windows.PropertyPath("Source")
                    };
                    binding.Converter = ImageToImageWidthConverter.Instance;
                    imagee.SetBinding(System.Windows.Controls.Image.WidthProperty, binding);
                }
                else
                {
                    imagee.Stretch = System.Windows.Media.Stretch.Uniform;
                }

                if (image.Width != null)
                {
                    if (image.Width.IsPurelyAbsolute(out var widthPx))
                    {
                        imagee.Width = widthPx;
                    }
                    else
                    {
                        var multibinding = new MultiBinding();
                        multibinding.Bindings.Add(new Binding()
                            {
                                Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path
                            });
                        multibinding.Bindings.Add(new Binding()
                            {
                                Source = TemplateBindingViewportHeight.Source, Path = TemplateBindingViewportHeight.Path
                            });
                        multibinding.Converter          = CompoundLengthConverter.Instance;
                        multibinding.ConverterParameter = GetCompoundLengthConverterParameters(image.Width);
                        imagee.SetBinding(System.Windows.Controls.Image.WidthProperty, multibinding);
                    }
                }

                if (image.Height != null)
                {
                    if (image.Height.IsPurelyAbsolute(out var heightPx))
                    {
                        imagee.Height = heightPx;
                    }
                    else
                    {
                        var multibinding = new MultiBinding();
                        multibinding.Bindings.Add(new Binding()
                            {
                                Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path
                            });
                        multibinding.Bindings.Add(new Binding()
                            {
                                Source = TemplateBindingViewportHeight.Source, Path = TemplateBindingViewportHeight.Path
                            });
                        multibinding.Converter          = CompoundLengthConverter.Instance;
                        multibinding.ConverterParameter = GetCompoundLengthConverterParameters(image.Height);
                        imagee.SetBinding(System.Windows.Controls.Image.HeightProperty, multibinding);
                    }
                }

                // set max-width and max-height
                if (image.MaxWidth != null && image.MaxWidth.Value.IsAbsolute)
                {
                    imagee.MaxWidth = image.MaxWidth.Value.ToPixel();
                }
                else if (image.MaxWidth == null || image.MaxWidth.Value.Type == ExCSS.Length.Unit.Vw)
                {
                    double vwValue = image.MaxWidth.HasValue ? image.MaxWidth.Value.Value : 100;

                    var binding = new Binding()
                    {
                        Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path
                    };
                    binding.Converter          = RelativeSizeConverter.Instance;
                    binding.ConverterParameter = vwValue;
                    imagee.SetBinding(System.Windows.Controls.Image.MaxWidthProperty, binding);
                }
                else
                {
                    throw new InvalidProgramException();
                }


                if (image.MaxHeight != null && image.MaxHeight.Value.IsAbsolute)
                {
                    imagee.MaxHeight = image.MaxHeight.Value.ToPixel();
                }
                else if (image.MaxHeight == null || image.MaxHeight.Value.Type == ExCSS.Length.Unit.Vh)
                {
                    double vhValue = image.MaxHeight.HasValue ? image.MaxHeight.Value.Value : 100;
                    var    binding = new Binding()
                    {
                        Source = TemplateBindingViewportWidth.Source, Path = TemplateBindingViewportWidth.Path
                    };
                    binding.Converter          = RelativeSizeConverter.Instance;
                    binding.ConverterParameter = vhValue;
                    imagee.SetBinding(System.Windows.Controls.Image.MaxHeightProperty, binding);
                }
                else
                {
                    throw new InvalidProgramException();
                }

                wpf = imagee;
            }
            break;

            case InlineUIContainer iuc:
            {
                var inlineuiContainere = new swd.InlineUIContainer();
                wpf = inlineuiContainere;
            }
            break;

            case LineBreak lb:
            {
                wpf = new swd.LineBreak();
            }
            break;

            case List list:
            {
                var liste = new swd.List();
                if (list.MarkerStyle.HasValue)
                {
                    liste.MarkerStyle = ToMarkerStyle(list.MarkerStyle.Value);
                }
                wpf = liste;
            }
            break;

            case ListItem li:
            {
                wpf = new swd.ListItem();
            }
            break;

            case Paragraph p:
            {
                var pe = new swd.Paragraph();
                if (p.TextDecorations.HasValue)
                {
                    pe.TextDecorations = ToTextDecorations(p.TextDecorations.Value);
                }
                if (p.TextIndent.HasValue)
                {
                    pe.TextIndent = p.TextIndent.Value.IsAbsolute ? p.TextIndent.Value.ToPixel() : 0;
                }
                wpf = pe;
            }
            break;

            case Run run:
            {
                if (SplitIntoWords)
                {
                    wpf = CreateTextElement_SeparateWords(run.Text);
                }
                else if (SplitIntoSentences)
                {
                    wpf = CreateTextElement_SeparateSentences(run.Text);
                }
                else
                {
                    wpf = new swd.Run(run.Text);
                }
            }
            break;

            case Section s:
            {
                wpf = new swd.Section();
            }
            break;

            case Span span:
            {
                wpf = new swd.Span();
            }
            break;

            case Table tb:
            {
                var tbe = new swd.Table();
                foreach (var c in tb.Columns)
                {
                    if (c.Width.HasValue)
                    {
                        tbe.Columns.Add(new swd.TableColumn()
                            {
                                Width = new System.Windows.GridLength(c.Width.Value)
                            });
                    }
                    else
                    {
                        tbe.Columns.Add(new swd.TableColumn());
                    }
                }
                wpf = tbe;
            }
            break;

            case TableCell tc:
            {
                var tce = new swd.TableCell();
                if (1 != tc.ColumnSpan)
                {
                    tce.ColumnSpan = tc.ColumnSpan;
                }

                if (1 != tc.RowSpan)
                {
                    tce.RowSpan = tc.RowSpan;
                }
                if (tc.BorderBrush.HasValue)
                {
                    tce.BorderBrush = new System.Windows.Media.SolidColorBrush(ToColor(tc.BorderBrush.Value));
                }
                if (tc.BorderThickness.HasValue)
                {
                    tce.BorderThickness = ToThickness(tc.BorderThickness.Value);
                }
                wpf = tce;
            }
            break;

            case TableRow trow:
            {
                wpf = new swd.TableRow();
            }
            break;

            case TableRowGroup trg:
            {
                wpf = new swd.TableRowGroup();
            }
            break;

            default:
            {
                wpf = null;
            }
            break;
            }

            // Render TextElement properties

            if (wpf is swd.TextElement te)
            {
                if (!string.IsNullOrEmpty(e.FontFamily))
                {
                    te.FontFamily = GetFontFamily(e.FontFamily);
                }

                if (e.FontSize.HasValue)
                {
                    var fs = e.FontSize.Value;
                    fs          = Math.Max(0.004, fs);
                    te.FontSize = fs;
                }

                if (e.FontStyle.HasValue)
                {
                    te.FontStyle = ToFontStyle(e.FontStyle.Value);
                }

                if (e.FontWeight.HasValue)
                {
                    te.FontWeight = ToFontWeight(e.FontWeight.Value);
                }

                if (e.Foreground.HasValue && e.Foreground != e.ForegroundInheritedOnly)
                {
                    te.Foreground = GetBrushFromColor(e.Foreground.Value);
                }

                if (e.Background.HasValue && e.Background != e.BackgroundInheritedOnly)
                {
                    te.Background = GetBrushFromColor(e.Background.Value);
                }
            }

            // now special properties

            if (e is Block b && wpf is swd.Block be)
            {
                if (b.Margin.HasValue)
                {
                    be.Margin = ToThickness(b.Margin.Value);
                }

                if (b.Padding.HasValue)
                {
                    be.Padding = ToThickness(b.Padding.Value);
                }

                if (b.BorderBrush.HasValue)
                {
                    be.BorderBrush = new System.Windows.Media.SolidColorBrush(ToColor(b.BorderBrush.Value));
                }

                if (b.BorderThickness.HasValue)
                {
                    be.BorderThickness = ToThickness(b.BorderThickness.Value);
                }

                if (b.TextAlignment.HasValue)
                {
                    be.TextAlignment = ToTextAlignment(b.TextAlignment.Value);
                }

                if (b.LineHeight.HasValue)
                {
                    be.LineHeight = b.LineHeight.Value;
                }
            }
            if (e is Inline i && wpf is swd.Inline ie)
            {
                if (i.VerticalAlignment.HasValue)
                {
                    ie.BaselineAlignment = ToBaselineAlignment(i.VerticalAlignment.Value);
                }
            }
            //  finished rendering the attributes


            // now, render all children
            foreach (var child in e.Childs)
            {
                var childe = RenderRecursively(child);

                switch (wpf)
                {
                case swd.Figure figure:
                    figure.Blocks.Add((swd.Block)childe);
                    break;

                case swd.Floater floater:
                    floater.Blocks.Add((swd.Block)childe);
                    break;

                case swd.FlowDocument flowDocument:
                    flowDocument.Blocks.Add((swd.Block)childe);
                    break;

                case swd.List list:
                    list.ListItems.Add((swd.ListItem)childe);
                    break;

                case swd.ListItem listItem:
                    listItem.Blocks.Add((swd.Block)childe);
                    break;

                case swd.Section section:
                    section.Blocks.Add((swd.Block)childe);
                    break;

                case swd.Table table:
                    table.RowGroups.Add((swd.TableRowGroup)childe);
                    break;

                case swd.TableCell tableCell:
                    tableCell.Blocks.Add((swd.Block)childe);
                    break;

                case swd.TableRow tableRow:
                    tableRow.Cells.Add((swd.TableCell)childe);
                    break;

                case swd.TableRowGroup tableRowGroup:
                    tableRowGroup.Rows.Add((swd.TableRow)childe);
                    break;

                // now elements that can contain inlines
                case swd.Paragraph paragraph:
                    paragraph.Inlines.Add((swd.Inline)childe);
                    break;

                case swd.Span span:
                    span.Inlines.Add((swd.Inline)childe);
                    break;

                // now some specialties
                case swd.InlineUIContainer inlineUIContainer:
                    if (inlineUIContainer.Child != null)
                    {
                        throw new InvalidOperationException($"{nameof(swd.InlineUIContainer)} can not contain more than one child");
                    }
                    inlineUIContainer.Child = (System.Windows.UIElement)childe;
                    break;

                case swd.BlockUIContainer blockUIContainer:
                    if (blockUIContainer.Child != null)
                    {
                        throw new InvalidOperationException($"{nameof(swd.BlockUIContainer)} can not contain more than one child");
                    }
                    blockUIContainer.Child = (System.Windows.UIElement)childe;
                    break;

                default:
                    throw new NotImplementedException();
                }
            }

            if (AttachDomAsTags)
            {
                if (wpf is System.Windows.FrameworkContentElement conEle)
                {
                    conEle.Tag = e;
                }
                else if (wpf is System.Windows.FrameworkElement uiEle)
                {
                    uiEle.Tag = e;
                }
            }

            return(wpf);
        }
Example #28
0
      private int _formatErrorLog(ErrorList errorList) {
         var header = new Paragraph(new Run(TEXT.FatalError_ErrorCount.Substitute(errorList.Summary)));
         header.FontWeight = FontWeights.Bold;
         header.Margin = new Thickness(5, 10, 0, 5);
         _detailsDoc.Blocks.Add(header);

         var table = new Table();
         table.Columns.Add(new TableColumn());
         table.Columns.Add(new TableColumn());
         table.RowGroups.Add(new TableRowGroup());
         table.Columns[0].Width = new GridLength(24);
         table.Margin = new Thickness(0);
         foreach (var msg in errorList.Items) {
            // build list item
            var icon = new BlockUIContainer(msg.Severity.ToImage(16, new Thickness(4, 0, 4, 3)));
            var para = new Paragraph(new Run(msg.Text));
            if (msg.Details.NotEmpty()) {
               var details = new Italic(new Run(msg.Details));
               details.Foreground = GRAY;
               para.Inlines.Add(new LineBreak());
               para.Inlines.Add(details);
               para.Margin = new Thickness(0, 0, 0, 4);
            }
            var row = new TableRow();
            row.Cells.Add(new TableCell(icon));
            row.Cells.Add(new TableCell(para));
            table.RowGroups[0].Rows.Add(row);
         }
         _detailsDoc.Blocks.Add(table);

         return table.RowGroups[0].Rows.Count;
      }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.rootBlock = ((System.Windows.Documents.BlockUIContainer)(target));
                return;

            case 2:
                this.rootBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.IDUnit = ((System.Windows.Documents.Run)(target));
                return;

            case 4:
                this.txtsampleNumber = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 5:
                this.txtidentTime = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.txtidentModel = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.txtscanType = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 8:
                this.txtidentThresold = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 9:
                this.txtidentValue = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 10:
                this.txtfilename = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:
                this.txtlicenseCode = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 12:
                this.txtproductUnit = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 13:
                this.txtchemicalName = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 14:
                this.txtcommercialName = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 15:
                this.txtform = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 16:
                this.txtspecification = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 17:
                this.txtbatchNumber = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 18:
                this.txtproductTime = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 19:
                this.txtvalidMonth = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 20:
                this.spectrumBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 21:
                this.borderComponents = ((System.Windows.Controls.Border)(target));
                return;

            case 22:
                this.imgAllResult = ((System.Windows.Controls.Image)(target));
                return;

            case 23:
                this.txtmemo = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 24:
                this.txtidentOperator = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }