示例#1
0
        private void UpdateForUser(string username)
        {
            if (username == last_user)
            {
                return;
            }

            last_user = username;

            while (main_box.Children.Length != 0)
            {
                main_box.Remove(main_box.Children[0]);
            }

            recently_loved  = new NumberedList(lastfm, Catalog.GetString("Recently Loved Tracks"));
            recently_played = new NumberedList(lastfm, Catalog.GetString("Recently Played Tracks"));
            top_artists     = new NumberedList(lastfm, Catalog.GetString("My Top Artists"));
            //recommended_artists = new NumberedList (Catalog.GetString ("Recommended Artists"));

            main_box.PackStart(recently_loved, false, false, 0);
            main_box.PackStart(new HSeparator(), false, false, 5);
            main_box.PackStart(recently_played, false, false, 0);
            main_box.PackStart(new HSeparator(), false, false, 5);
            main_box.PackStart(top_artists, false, false, 0);
            //PackStart (recommended_artists, true, true, 0);

            user = new LastfmUserData(username);
            recently_loved.SetList(user.RecentLovedTracks);
            recently_played.SetList(user.RecentTracks);
            top_artists.SetList(user.GetTopArtists(TopType.Overall));

            ShowAll();
        }
 public NumberedListCommand(WordprocessingDocument wordDocument, NumberedList numberedList,
                            int depth, RenderData renderData)
 {
     this.renderData = renderData;
     Depth           = depth;
     WordDocument    = wordDocument;
     NumberedList    = numberedList;
 }
示例#3
0
        public void TestLongListItemsAreAutomaticallyWrappedAt80CharactersByDefault()
        {
            var list = new NumberedList(
                "Every body persists in its state of being at rest or of moving uniformly straight forward, except insofar as it is compelled to change its state by force impressed.",
                "The change of momentum of a body is proportional to the impulse impressed on the body, and happens along the straight line on which that impulse is impressed.",
                "To every action there is always opposed an equal reaction: or the mutual actions of two bodies upon each other are always equal, and directed to contrary parts.");

            list.WriteToTrace();
        }
示例#4
0
        public void TestWordWrapColumnCanBeSpecified()
        {
            var list = new NumberedList(
                "A straight line segment can be drawn joining any two points.",
                "Any straight line segment can be extended indefinitely in a straight line.",
                "Given any straight line segment, a circle can be drawn having the segment as radius and one endpoint as center.",
                "All right angles are congruent.",
                "If two lines are drawn which intersect a third in such a way that the sum of the inner angles on one side is less than two right angles, then the two lines inevitably must intersect each other on that side if extended far enough. This postulate is equivalent to what is known as the parallel postulate.")
            {
                WordWrapColumn = 40
            };

            list.WriteToTrace();
        }
示例#5
0
 public static BranchNode GetEmptyNode(DocumentElementType type, IDateService dateService,
                                       ObjectId creatorID, string nodeName, string comment)
 {
     return(new BranchNode()
     {
         BranchNodeID = ObjectId.GenerateNewId(),
         Comment = comment,
         CreatedAt = dateService.Now,
         UpdatedAt = dateService.Now,
         CreatorID = creatorID,
         DocumentElement = type switch
         {
             DocumentElementType.Image => new Image(),
             DocumentElementType.NumberedList => NumberedList.GetDefaultList(),
             DocumentElementType.Paragraph => new Paragraph(),
             DocumentElementType.Table => Table.GetDefaultTable(),
             _ => null
         },
        private void UpdateForUser(string username)
        {
            if (username == last_user)
            {
                return;
            }

            last_user = username;

            while (main_box.Children.Length != 0)
            {
                main_box.Remove(main_box.Children[0]);
            }

            recently_loved  = new NumberedList(lastfm, Catalog.GetString("Recently Loved Tracks"));
            recently_played = new NumberedList(lastfm, Catalog.GetString("Recently Played Tracks"));
            top_artists     = new NumberedList(lastfm, Catalog.GetString("My Top Artists"));
            //recommended_artists = new NumberedList (Catalog.GetString ("Recommended Artists"));

            main_box.PackStart(recently_loved, false, false, 0);
            main_box.PackStart(new HSeparator(), false, false, 5);
            main_box.PackStart(recently_played, false, false, 0);
            main_box.PackStart(new HSeparator(), false, false, 5);
            main_box.PackStart(top_artists, false, false, 0);
            //PackStart (recommended_artists, true, true, 0);

            try {
                user = new LastfmUserData(username);
                recently_loved.SetList(user.RecentLovedTracks);
                recently_played.SetList(user.RecentTracks);
                top_artists.SetList(user.GetTopArtists(TopType.Overall));
            } catch (Exception e) {
                lastfm.SetStatus("Failed to get information from your Last.fm profile", true, ConnectionState.InvalidAccount);
                Log.Exception(String.Format("LastfmUserData query failed for {0}", username), e);
            }

            ShowAll();
        }
示例#7
0
        public void TestListsCanBeNumbered()
        {
            var list = new NumberedList(
                "The Beatles",
                "Elvis Presley",
                "Michael Jackson",
                "Madonna",
                "Elton John");

            list.AssertOutputEquals(
                "   1. The Beatles" + Environment.NewLine +
                "   2. Elvis Presley" + Environment.NewLine +
                "   3. Michael Jackson" + Environment.NewLine +
                "   4. Madonna" + Environment.NewLine +
                "   5. Elton John" + Environment.NewLine
                ,
                "<ol>\n" +
                "<li>The Beatles</li>\n" +
                "<li>Elvis Presley</li>\n" +
                "<li>Michael Jackson</li>\n" +
                "<li>Madonna</li>\n" +
                "<li>Elton John</li>\n" +
                "</ol>\n");
        }
        private void UpdateForUser (string username)
        {
            if (username == last_user) {
                return;
            }

            last_user = username;

            while (main_box.Children.Length != 0) {
                main_box.Remove (main_box.Children[0]);
            }

            recently_loved = new NumberedList (lastfm, Catalog.GetString ("Recently Loved Tracks"));
            recently_played = new NumberedList (lastfm, Catalog.GetString ("Recently Played Tracks"));
            top_artists = new NumberedList (lastfm, Catalog.GetString ("My Top Artists"));
            //recommended_artists = new NumberedList (Catalog.GetString ("Recommended Artists"));

            main_box.PackStart (recently_loved, false, false, 0);
            main_box.PackStart (new HSeparator (), false, false, 5);
            main_box.PackStart (recently_played, false, false, 0);
            main_box.PackStart (new HSeparator (), false, false, 5);
            main_box.PackStart (top_artists, false, false, 0);
            //PackStart (recommended_artists, true, true, 0);

            user = new LastfmUserData (username);
            recently_loved.SetList (user.RecentLovedTracks);
            recently_played.SetList (user.RecentTracks);
            top_artists.SetList (user.GetTopArtists (TopType.Overall));

            ShowAll ();
        }
示例#9
0
        private void compileDocument()
        {
            //doc.LineSpacing = 12;

            /*
             * Paragraph paragraph1 = new Paragraph();
             * Stream stream = Application.GetResourceStream(new Uri(@"/RadRichTextBox-Getting-Started;component/Images/RadRichTextBox.png", UriKind.RelativeOrAbsolute)).Stream;
             * Size size = new Size(236, 50);
             * ImageInline imageInline = new ImageInline(stream, size, "png");
             * paragraph1.Inlines.Add(imageInline);
             * section.Blocks.Add(paragraph1);
             */
            // вид документа:
            // предыстория, на отдельной странице (потом разрыв)
            // имя персонажа большими буквами посередине страницы
            // описание, сюжет
            // список целей, ненумерованным списком
            // список предметов (если есть), нумерованным списком
            // правила игры


            doc = new RadDocument();
            doc.MergeSpansWithSameStyles();
            doc.ParagraphDefaultSpacingAfter  = 0;
            doc.ParagraphDefaultSpacingBefore = 0;
            Padding padding = new System.Windows.Forms.Padding(0, 20, 100, 60);

            doc.SectionDefaultPageMargin = padding;
            //doc.SectionDefaultPageMargin.
            //doc.DefaultPageLayoutSettings.Width = 200;
            //doc.DefaultPageLayoutSettings.Height = 250;
            RadDocument tempDoc = new RadDocument();

            // **** Prehistory***********
            tempDoc = htmlProvider.Import(prehistory.writtenText);
            mergeDocuments(tempDoc);
            doc.CaretPosition.MoveToLastPositionInDocument();
            doc.InsertPageBreak();

            // **** Person Name ***********
            Section   section    = new Section();
            Paragraph paragraph1 = new Paragraph();

            paragraph1.TextAlignment = Telerik.WinControls.RichTextBox.Layout.RadTextAlignment.Center;
            Span span1 = new Span(chosenPerson.getName());

            span1.FontSize      = 24;
            span1.FontStyle     = TextStyle.Bold;
            span1.UnderlineType = Telerik.WinControls.RichTextBox.UI.UnderlineType.Wave;
            paragraph1.Inlines.Add(span1);
            section.Blocks.Add(paragraph1);
            doc.Sections.Add(section);

            // **** Person's description***********
            tempDoc = htmlProvider.Import(chosenPerson.description);
            mergeDocuments(tempDoc, section);

            // **** Aim list***********
            BulletedList aimList  = new BulletedList(char.ConvertFromUtf32(0x25CF)[0], doc);
            Section      section2 = new Section();
            Paragraph    par2     = new Paragraph();

            doc.CaretPosition.MoveToLastPositionInDocument();
            doc.InsertLineBreak();
            Span span2 = new Span("Your Aims:");

            par2.Inlines.Add(span2);
            section2.Blocks.Add(par2);

            foreach (int aimID in chosenPerson.aimsId)
            {
                CAim      aim  = aimManager.getAim(aimID);
                Paragraph par  = new Paragraph();
                Span      span = new Span(aim.getName());
                if (aim.description != "")
                {
                    span.Text += " (" + aim.description + ")";
                }
                par.Inlines.Add(span);
                par.LineSpacingType = LineSpacingType.AtLeast;
                aimList.AddParagraph(par);
                section2.Blocks.Add(par);
            }
            doc.Sections.Add(section2);

            // **** Item list***********
            if (chosenPerson.itemsId.Count > 0)
            {
                NumberedList itemList = new NumberedList(doc);
                Section      section3 = new Section();
                Paragraph    par3     = new Paragraph();
                Span         span3    = new Span("Your Items:");
                par3.Inlines.Add(span3);
                section3.Blocks.Add(par3);

                foreach (int itemID in chosenPerson.itemsId)
                {
                    CItem     item = itemManager.getItem(itemID);
                    Paragraph par  = new Paragraph();
                    Span      span = new Span(item.getName());
                    if (item.description != "")
                    {
                        span.Text += " (" + item.description + ")";
                    }
                    par.Inlines.Add(span);
                    par.LineSpacingType = LineSpacingType.AtLeast;
                    itemList.AddParagraph(par);
                    section3.Blocks.Add(par);
                }
                doc.Sections.Add(section3);
            }

            // **** Rules***********
            doc.CaretPosition.MoveToLastPositionInDocument();
            doc.InsertLineBreak();
            tempDoc = htmlProvider.Import(rules.writtenText);
            mergeDocuments(tempDoc, doc.Sections.Last);
        }
示例#10
0
        private void compileDocument()
        {
            //doc.LineSpacing = 12;
            /*
            Paragraph paragraph1 = new Paragraph();
            Stream stream = Application.GetResourceStream(new Uri(@"/RadRichTextBox-Getting-Started;component/Images/RadRichTextBox.png", UriKind.RelativeOrAbsolute)).Stream;
            Size size = new Size(236, 50);
            ImageInline imageInline = new ImageInline(stream, size, "png");
            paragraph1.Inlines.Add(imageInline);
            section.Blocks.Add(paragraph1);
            */
            // вид документа:
            // предыстория, на отдельной странице (потом разрыв)
            // имя персонажа большими буквами посередине страницы
            // описание, сюжет
            // список целей, ненумерованным списком
            // список предметов (если есть), нумерованным списком
            // правила игры

            doc = new RadDocument();
            doc.MergeSpansWithSameStyles();
            doc.ParagraphDefaultSpacingAfter = 0;
            doc.ParagraphDefaultSpacingBefore = 0;
            Padding padding = new System.Windows.Forms.Padding(0, 20, 100, 60);
            doc.SectionDefaultPageMargin = padding;
            //doc.SectionDefaultPageMargin.
            //doc.DefaultPageLayoutSettings.Width = 200;
            //doc.DefaultPageLayoutSettings.Height = 250;
            RadDocument tempDoc = new RadDocument();

            // **** Prehistory***********
            tempDoc = htmlProvider.Import(prehistory.writtenText);
            mergeDocuments(tempDoc);
            doc.CaretPosition.MoveToLastPositionInDocument();
            doc.InsertPageBreak();

            // **** Person Name ***********
            Section section = new Section();
            Paragraph paragraph1 = new Paragraph();
            paragraph1.TextAlignment = Telerik.WinControls.RichTextBox.Layout.RadTextAlignment.Center;
            Span span1 = new Span(chosenPerson.getName());
            span1.FontSize = 24;
            span1.FontStyle = TextStyle.Bold;
            span1.UnderlineType = Telerik.WinControls.RichTextBox.UI.UnderlineType.Wave;
            paragraph1.Inlines.Add(span1);
            section.Blocks.Add(paragraph1);
            doc.Sections.Add(section);

            // **** Person's description***********
            tempDoc = htmlProvider.Import(chosenPerson.description);
            mergeDocuments(tempDoc, section);

            // **** Aim list***********
            BulletedList aimList = new BulletedList(char.ConvertFromUtf32(0x25CF)[0] , doc);
            Section section2 = new Section();
            Paragraph par2 = new Paragraph();
            doc.CaretPosition.MoveToLastPositionInDocument();
            doc.InsertLineBreak();
            Span span2 = new Span("Your Aims:");
            par2.Inlines.Add(span2);
            section2.Blocks.Add(par2);

            foreach (int aimID in chosenPerson.aimsId)
            {
                CAim aim = aimManager.getAim(aimID);
                Paragraph par = new Paragraph();
                Span span = new Span(aim.getName());
                if (aim.description != "")
                    span.Text += " (" + aim.description + ")";
                par.Inlines.Add(span);
                par.LineSpacingType = LineSpacingType.AtLeast;
                aimList.AddParagraph(par);
                section2.Blocks.Add(par);
            }
            doc.Sections.Add(section2);

            // **** Item list***********
            if (chosenPerson.itemsId.Count > 0)
            {
                NumberedList itemList = new NumberedList(doc);
                Section section3 = new Section();
                Paragraph par3 = new Paragraph();
                Span span3 = new Span("Your Items:");
                par3.Inlines.Add(span3);
                section3.Blocks.Add(par3);

                foreach (int itemID in chosenPerson.itemsId)
                {
                    CItem item = itemManager.getItem(itemID);
                    Paragraph par = new Paragraph();
                    Span span = new Span(item.getName());
                    if (item.description != "")
                        span.Text += " (" + item.description + ")";
                    par.Inlines.Add(span);
                    par.LineSpacingType = LineSpacingType.AtLeast;
                    itemList.AddParagraph(par);
                    section3.Blocks.Add(par);
                }
                doc.Sections.Add(section3);
            }

            // **** Rules***********
            doc.CaretPosition.MoveToLastPositionInDocument();
            doc.InsertLineBreak();
            tempDoc = htmlProvider.Import(rules.writtenText);
            mergeDocuments(tempDoc, doc.Sections.Last);
        }
示例#11
0
        private void UpdateForUser (string username)
        {
            if (username == last_user) {
                return;
            }

            last_user = username;

            while (main_box.Children.Length != 0) {
                main_box.Remove (main_box.Children[0]);
            }

            recently_loved = new NumberedList (lastfm, Catalog.GetString ("Recently Loved Tracks"));
            recently_played = new NumberedList (lastfm, Catalog.GetString ("Recently Played Tracks"));
            top_artists = new NumberedList (lastfm, Catalog.GetString ("My Top Artists"));
            //recommended_artists = new NumberedList (Catalog.GetString ("Recommended Artists"));

            main_box.PackStart (recently_loved, false, false, 0);
            main_box.PackStart (new HSeparator (), false, false, 5);
            main_box.PackStart (recently_played, false, false, 0);
            main_box.PackStart (new HSeparator (), false, false, 5);
            main_box.PackStart (top_artists, false, false, 0);
            //PackStart (recommended_artists, true, true, 0);

            try {
                user = new LastfmUserData (username);
                recently_loved.SetList (user.RecentLovedTracks);
                recently_played.SetList (user.RecentTracks);
                top_artists.SetList (user.GetTopArtists (TopType.Overall));
            } catch (Exception e) {
                lastfm.SetStatus ("Failed to get information from your Last.fm profile", true, ConnectionState.InvalidAccount);
                Log.Exception (String.Format ("LastfmUserData query failed for {0}", username), e);
            }

            ShowAll ();
        }