Пример #1
0
        public void GetBillOfMaterials_Textbox_OutputAsExpected()
        {
            //Arrange
            Textbox textbox = Textbox.Create(5, 5, 200, 100, "sample text");

            StringBuilder expectation = new StringBuilder();

            expectation.AppendLine("----------------------------------------------------------------");
            expectation.AppendLine("Bill of Materials");
            expectation.AppendLine("----------------------------------------------------------------");
            expectation.AppendLine($"{nameof(Textbox)} ({textbox.PositionX},{textbox.PositionY}) width={textbox.Width} height={textbox.Height} text={textbox.Text}");
            expectation.AppendLine("----------------------------------------------------------------");

            IEnumerable <Shape> shapes = new Shape[] { textbox };

            var settings = Mock.Create <ISettings>();
            var legacyBuilderMaterialGenerator = Mock.Create(() => new LegacyBuilderMaterialGenerator(settings));

            Mock.Arrange(() => settings.LegacyBuilderErrorCode).Returns("+++++Abort+++++").OccursNever();

            //Act
            var result = legacyBuilderMaterialGenerator.GetBillOfMaterials(shapes);

            //Assert
            Assert.Equal(expectation.ToString(), result);
            Mock.Assert(settings);
        }
Пример #2
0
    void HandleDisplayingTextbox()
    {
        // Create and initialize the textbox
        Debug.Log(this.name + " displaying textbox.");
        GameController.S.RequestGamePause();
        textbox      = Textbox.Create(textboxPrefab.gameObject);
        tbController = textbox.GetComponent <TextboxController>();

        tbController.ApplyTextSettings(dialogueUI.textSettings);

        // Make sure the textbox shows up
        dialogueUI.needsDialogueCanvas.Add(this.gameObject);

        tbController.rectTransform.SetParent(dialogueCanvas.transform, false);

        tbController.nameTagText = "System";
        HidePortrait();

        PrepareForTextboxEnd();

        tbController.gameObject.SetActive(false);
        // ^ Need to do this to avoid a weird visual effect. Don't worry, the textbox gets reenabled
        // right before it's time for it to display the text.

        StartCoroutine(DisplayTextDelayed(Time.deltaTime * 2));
    }
Пример #3
0
 public IEnumerable <Shape> GetShapesData()
 {
     return(new Shape[]
     {
         Rectangle.Create(10, 10, 30, 40),
         Square.Create(500, 30, 35),
         Ellipse.Create(100, 150, 300, 200),
         Circle.Create(1, 1, 300),
         Textbox.Create(5, 5, 200, 100, "sample text")
     });
 }
Пример #4
0
        public static void Enable()
        {
            var commands = new KeyboardCommands();
            var textbox  = Textbox.Create(new Transform2 {
                Location = new Vector2(400, 25), Size = new Size2(300, 50), ZIndex = ZIndex.Max - 8
            });
            var panel = Entity.Create("Scene Navigation Console", new Transform2 {
                Size = new Size2(1920, 100), ZIndex = ZIndex.Max - 10
            })
                        .Add((o, r) => new Texture(r.CreateRectangle(Color.DarkGray, o)))
                        .AttachTo(CurrentViewport.Position)
                        .Add(commands);

            textbox
            .AttachTo(panel);
            var sceneNavigator = new SceneNavigatorConsole(textbox, panel);

            commands.Add(Keys.Back, () => textbox.With <TypingInput>(x => x.Clear()));
            commands.Add(Keys.Enter, () => textbox.With <TypingInput>(
                             t => t.Value.If(v => !string.IsNullOrEmpty(v), () =>
            {
                var sceneName = t.Value;
                if (Navigate.SceneExists(sceneName))
                {
                    Navigate.To(sceneName);
                    t.Clear();
                    sceneNavigator.Toggle();
                }
                else
                {
                    t.Value = "Scene Not Found";
                }
            })));

            Entity.Create("Scene Navigation Console Commands", Transform2.Zero)
            .Add(new KeyboardCommand {
                Key = Keys.OemTilde, Command = () => sceneNavigator.Toggle()
            });
        }
Пример #5
0
        private Shape ConstructShape(ShapeDto shape)
        {
            switch (shape.ShapeType)
            {
            case ShapeType.Square:
                return(Square.Create(int.Parse(shape.PositionX), int.Parse(shape.PositionY), int.Parse(shape.Width)));

            case ShapeType.Rectangle:
                return(Rectangle.Create(int.Parse(shape.PositionX), int.Parse(shape.PositionY), int.Parse(shape.Width), int.Parse(shape.Height)));

            case ShapeType.Textbox:
                return(Textbox.Create(int.Parse(shape.PositionX), int.Parse(shape.PositionY), int.Parse(shape.Width), int.Parse(shape.Height), shape.Text));

            case ShapeType.Circle:
                return(Circle.Create(int.Parse(shape.PositionX), int.Parse(shape.PositionY), int.Parse(shape.HorizontalDiameter)));

            case ShapeType.Ellipse:
                return(Ellipse.Create(int.Parse(shape.PositionX), int.Parse(shape.PositionY), int.Parse(shape.HorizontalDiameter), int.Parse(shape.VerticalDiameter)));

            default:
                return(null);
            }
        }
    void CreateTextbox()
    {
        if (textbox == null)
        {
            textbox           = Textbox.Create(textboxPrefab);
            textboxController = textbox.GetComponent <TextboxController> ();
            textboxController.DoneDisplayingText.AddListener(ResumeDialogueRunning);
            EndedDialogue.AddListener(textboxController.Close);
            textbox.transform.SetParent(dialogueCanvas.transform, false);
            textboxController.PlaceOnScreen(new Vector2(0.5f, 0.0f));
            if (textSettings.font != null)
            {
                textboxController.font = textSettings.font;
            }

            textSettings.Initialize(textboxController);
            textboxController.ApplyTextSettings(textSettings);

            // Have the textbox be invisible until it is time to show it
            CanvasGroup cGroup = textbox.AddComponent <CanvasGroup>();
            cGroup.alpha          = 0;
            cGroup.blocksRaycasts = false;
        }
    }
Пример #7
0
        private Rdl.TextboxType CreateTextbox(string fieldName,bool hidden)
        {
            Textbox box = new Textbox();
            var style = new Style
            {
                FontSize = "9pt",
                FontWeight = "Bold",
                FontFamily = "宋体"
            };
            box.Paragraphs = Common.Report.RdlGenerator.CreateParagraphs(fieldName, style.Create());
            if (hidden)
            {
                box.Visibility = new Visibility() { Hidden = "true" }.Create();
            }

            box.Style = new Style
            {
                Border = new Border { Style = "Solid" }.Create()
            }.Create();
            box.CanGrow = true;
            string name = "Header_" + Seed;
            Seed++;
            return box.Create(name);
        }
Пример #8
0
        private Rdl.TextboxType CreateTableCellTextbox(int i,string fieldName)
        {
            var cellStyle = CreateStyle();
            var fontStyle = CreateStyle();

            Border bd = new Border();
            bd.Style = "Solid";
            cellStyle.Border = bd.Create();

            string value = "=Fields!" + fieldName + ".Value";
            if (Parent.TableCellRenderer != null)
            {
                Parent.TableCellRenderer(fieldName, cellStyle, fontStyle,value);
            }

            Textbox box = new Textbox();
            box.Paragraphs = RdlGenerator.CreateParagraphs(value, fontStyle.Create());
            box.Style = cellStyle.Create();
            box.CanGrow = true;
            return box.Create(fieldName);
        }
Пример #9
0
        private Rdl.TextboxType CreateHeaderTableCellTextbox(string fieldName)
        {
            Textbox box = new Textbox();
            var style=new Style
            {
                FontSize = "9pt",
                FontWeight = "Bold",
                FontFamily="����"
            };
            box.Paragraphs = RdlGenerator.CreateParagraphs(fieldName, style.Create());

            box.Style = new Style
            {
                Border = new Border { Style = "Solid" }.Create()
            }.Create();
            box.CanGrow = true;
            return box.Create(m_fields[fieldName] + "_Header");
        }
Пример #10
0
        //创建页眉
        private PageSectionType CreatPageHeader()
        {
            var height = 0.91;
            var lrHeigth = 0.0;
            const double tableHeaderHeigth = 0.0;
            var items = new ArrayList();

            var ctb = new Textbox
            {
                Height = "0.9cm",
                Left = LeftMargin + "mm",
                Width = (A4Width - LeftMargin - RightMargin) + "mm",
                Paragraphs = CreateParagraphs(PageHeaderText, new Style { FontFamily = "宋体", FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create()),
                CanGrow = true,
                Style = new Style { FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create()
            };

            TextboxType headerTextbox = ctb.Create("Page_HeaderText");
            items.Add(headerTextbox);

            ctb.Width = ((A4Width - LeftMargin - RightMargin) / 2) + "mm";
            ctb.Height = "0.5cm";
            ctb.Paragraphs = CreateParagraphs(PageHeaderLeftText);
            ctb.Style = new Style { FontSize = "9pt", TextAlign = "Left" }.Create();
            ctb.Top = "0.92cm";
            TextboxType headerLeftTextbox = ctb.Create("Page_HeaderLeftText");
            if (!string.IsNullOrEmpty(PageHeaderLeftText))
            {
                items.Add(headerLeftTextbox);
                lrHeigth = 0.5;
            }

            ctb.Style = new Style { FontSize = "9pt", TextAlign = "Right" }.Create();
            ctb.Left = ((A4Width) / 2) + "mm";
            ctb.Paragraphs = CreateParagraphs(PageHeaderRightText);

            TextboxType headerRightTextbox = ctb.Create("Page_HeaderRightText");
            if (!string.IsNullOrEmpty(PageHeaderRightText))
            {
                items.Add(headerRightTextbox);
                lrHeigth = 0.5;
            }

            var reportItems = new ReportItemsType {Items = items.ToArray()};

            var header = new PageSection {ReportItems = reportItems};
            height = height + tableHeaderHeigth + lrHeigth;
            header.Height = height + "cm";
            header.PrintOnFirstPage = true;
            header.PrintOnLastPage = true;
            return header.Create();
        }
Пример #11
0
        //创建页脚
        private PageSectionType CreatPageFooter()
        {
            string height = "0.65cm";
            string top = "0mm";
            var items = new ArrayList();

            var style = new Style {FontSize = "9pt", TextAlign = "Left"};
            var ctb = new Textbox
                          {
                              Width = ((A4Width - LeftMargin - RightMargin)/2) + "mm",
                              Height = "0.63cm",
                              Paragraphs = CreateParagraphs(PageFooterLeftText, style.Create()),
                              Style = style.Create(),
                              CanGrow = true,
                              Left = LeftMargin + "mm"
                          };
            TextboxType headerLeftTextbox = ctb.Create("Page_FooterLeftText");
            if (!string.IsNullOrEmpty(PageFooterLeftText))
            {
                items.Add(headerLeftTextbox);
                height = "1.1cm";
                top = "0.6cm";
            }

            style.TextAlign = "Right";
            ctb.Style = style.Create();
            ctb.Left = ((A4Width) / 2) + "mm";
            ctb.Paragraphs = CreateParagraphs(PageFooterRightText, style.Create());
            TextboxType headerRightTextbox = ctb.Create("Page_FooterRightText");
            if (!string.IsNullOrEmpty(PageFooterRightText))
            {
                items.Add(headerRightTextbox);
                height = "1.1cm";
                top = "0.6cm";
            }

            style.TextAlign = "Center";
            ctb = new Textbox
            {
                Top = top,
                Height = "0.6cm",
                //Left = LeftMargin + "mm",
                Width = (A4Width - LeftMargin - RightMargin) + "mm",
                Paragraphs = CreateParagraphs(string.Format("=" + _pageFooterText, "Globals!PageNumber", "Globals!TotalPages"), style.Create()),
                //Value = string.Format("=" + pageFooterText, "Globals!PageNumber", "Globals!TotalPages"),
                Style = style.Create()
            };
            TextboxType headerTextbox = ctb.Create("Page_FooterText");
            items.Add(headerTextbox);

            var reportItems = new ReportItemsType { Items = items.ToArray() };
            var header = new PageSection
                             {
                                 ReportItems = reportItems,
                                 Height = height,
                                 PrintOnFirstPage = true,
                                 PrintOnLastPage = true
                             };
            return header.Create();
        }
Пример #12
0
        //����ҳü
        private PageSectionType CreatPageHeader()
        {
            double height = 0.91;
            double LRHeigth = 0.0;
            double tableHeaderHeigth = 0.0;
            ArrayList Items = new ArrayList();

            Textbox ctb = new Textbox
            {
                Height = "0.9cm",
                Left = LeftMargin.ToString() + "mm",
                Width = (A4Width - LeftMargin - RightMargin).ToString() + "mm",
                Paragraphs = CreateParagraphs(PageHeaderText, new Style { FontFamily="����", FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create()),
                CanGrow = true ,
                Style = new Style { FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create()
            };

            TextboxType headerTextbox = ctb.Create("Page_HeaderText");
            Items.Add(headerTextbox);

            ctb.Width = ((A4Width - LeftMargin - RightMargin) / 2).ToString() + "mm";
            ctb.Height = "0.5cm";
            ctb.Paragraphs = CreateParagraphs(PageHeaderLeftText);
            ctb.Style = new Style { FontSize = "9pt", TextAlign = "Left" }.Create();
            ctb.Top = "0.92cm";
            TextboxType headerLeftTextbox = ctb.Create("Page_HeaderLeftText");
            if (!string.IsNullOrEmpty(this.PageHeaderLeftText))
            {
                Items.Add(headerLeftTextbox);
                LRHeigth = 0.5;
            }

            ctb.Style = new Style { FontSize = "9pt", TextAlign = "Right" }.Create();
            ctb.Left = ((A4Width) / 2).ToString() + "mm";
            ctb.Paragraphs = CreateParagraphs(PageHeaderRightText);

            TextboxType headerRightTextbox = ctb.Create("Page_HeaderRightText");
            if (!string.IsNullOrEmpty(this.PageHeaderRightText))
            {
                Items.Add(headerRightTextbox);
                LRHeigth = 0.5;
            }

            ReportItemsType reportItems = new ReportItemsType();
            reportItems.Items = Items.ToArray();

            PageSection header = new PageSection();
            header.ReportItems = reportItems;
            height = height+tableHeaderHeigth + LRHeigth;
            header.Height = height.ToString()+"cm";
            header.PrintOnFirstPage = true;
            header.PrintOnLastPage = true;
            return header.Create();
        }
Пример #13
0
        //����ҳ��
        private PageSectionType CreatPageFooter()
        {
            Style style = new Style();
            Textbox ctb = new Textbox();

            string height = "0.65cm";
            string top = "0mm";
            ArrayList Items = new ArrayList();

            style.FontSize = "9pt";
            style.TextAlign = "Left";
            ctb.Width = ((A4Width - LeftMargin - RightMargin) / 2).ToString() + "mm";
            ctb.Height = "0.63cm";
            ctb.Paragraphs = CreateParagraphs(PageFooterLeftText,style.Create());
            ctb.Style = style.Create();
            ctb.CanGrow = true;
            ctb.Left = LeftMargin.ToString() + "mm";
            TextboxType headerLeftTextbox = ctb.Create("Page_FooterLeftText");
            if (!string.IsNullOrEmpty(this.PageFooterLeftText))
            {
                Items.Add(headerLeftTextbox);
                height = "1.1cm";
                top = "0.6cm";
            }

            style.TextAlign = "Right";
            ctb.Style = style.Create();
            ctb.Left = ((A4Width) / 2).ToString() + "mm";
            ctb.Paragraphs = CreateParagraphs(PageFooterRightText, style.Create());
            TextboxType headerRightTextbox = ctb.Create("Page_FooterRightText");
            if (!string.IsNullOrEmpty(this.PageFooterRightText))
            {
                Items.Add(headerRightTextbox);
                height = "1.1cm";
                top = "0.6cm";
            }

            style.TextAlign = "Center";
            ctb = new Textbox
            {
                Top = top,
                Height = "0.6cm",
                Left = LeftMargin.ToString() + "mm",
                Width = (A4Width - LeftMargin - RightMargin).ToString() + "mm",
                Paragraphs = CreateParagraphs(string.Format("=" + pageFooterText, "Globals!PageNumber", "Globals!TotalPages"), style.Create()),
                //Value = string.Format("=" + pageFooterText, "Globals!PageNumber", "Globals!TotalPages"),
                Style = style.Create()
            };
            TextboxType headerTextbox = ctb.Create("Page_FooterText");
            Items.Add(headerTextbox);

            ReportItemsType reportItems = new ReportItemsType();
            reportItems.Items = Items.ToArray();
            PageSection header = new PageSection();
            header.ReportItems = reportItems;
            header.Height = height;
            header.PrintOnFirstPage = true;
            header.PrintOnLastPage = true;
            return header.Create();
        }