Exemplo n.º 1
0
        public bool AddBlog()
        {
            var blog = new BlogSetting {
                BlogName = "New", Language = "HTML"
            };

            blog.BeginEdit();

            var blogSettings = blogSettingsCreator();

            blogSettings.InitializeBlog(blog);

            var result = windowManager.ShowDialog(blogSettings);

            if (result != true)
            {
                blog.CancelEdit();
                return(false);
            }

            blog.EndEdit();

            Blogs.Add(blog);

            return(true);
        }
Exemplo n.º 2
0
 private void AddBlog()
 {
     if (!Repository.Add(NewBlog))
     {
         return;
     }
     Blogs.Add(NewBlog);
     NewBlog = new Blog();
 }
        /// <summary>
        /// Inserts a new blog to the current BlogProvider.
        /// </summary>
        protected override void DataInsert()
        {
            OnSaving(this, SaveAction.Insert);
            if (this.New)
            {
                BlogService.InsertBlog(this);
            }

            Blogs.Add(this);
            SortBlogs();
            OnSaved(this, SaveAction.Insert);
        }
        public bool AddBlog()
        {
            var blog = blogService.AddBlog();

            if (blog != null)
            {
                Blogs.Add(blog);
                return(true);
            }

            return(false);
        }
        public void AddBlogToStore(Blog newBlog)
        {
            if (!(Blogs.Contains(newBlog)))
            {
                Blogs.Add(newBlog);
            }

            if (string.IsNullOrEmpty(newBlog.ApiKey))
            {
                newBlog.showLoadingIndicator();
                GetApiKeyRPC rpc = new GetApiKeyRPC(newBlog, false);
                rpc.Completed += OnGetApiKeyRPCCompleted;
                rpc.ExecuteAsync();
            }
        }
        /// <summary>Asynchronously gets all the blogs.</summary>
        public async Task GetBlogsAsync()
        {
            var blogs = await repository.GetBlogsAsync();

            // Fill the blogs collection should be from the thread that created the collection.
            await UIUtils.InvokeFromUIThread(() =>
            {
                Blogs.Clear();
                foreach (var b in blogs)
                {
                    Blogs.Add(new BlogViewModel(repository)
                    {
                        Name = b.Name,
                        Id   = b.Id
                    });
                }
            });
        }
Exemplo n.º 7
0
        public async Task GetBlogs()
        {
            await AuthenticateAsync();

            var list = await _service.Blogs.ListByUser("self").ExecuteAsync();

            Blogs.Clear();
            if (list.Items == null)
            {
                return;
            }

            var blogs = from blog in list.Items
                        select new Blog
                        {
                            Id = blog.Id,
                            Name = blog.Name
                        };

            foreach (var blog in blogs)
            {
                Blogs.Add(blog);
            }
        }
Exemplo n.º 8
0
 public void CreateEntry(BlogEntry blogEntry)
 {
     Blogs.Add(blogEntry);
 }
Exemplo n.º 9
0
 public void AddBlog(Blog blog)
 {
     Blogs.Add(blog);
 }
        private static void Seed()
        {
            // Create random blogs.
            var numberOfBlogs = RandomData.GetInt(4, 8);

            for (var i = 1; i <= numberOfBlogs; i++)
            {
                var blog = new Blog
                {
                    BlogId = i,
                    Name   = RandomData.GetTitleWords()
                };
                Blogs.Add(blog);
            }

            // Create random people.
            var personNameGenerator = new PersonNameGenerator();
            var numberOfPersons     = RandomData.GetInt(16, 32);

            for (var i = 1; i <= numberOfPersons; i++)
            {
                var firstName = personNameGenerator.GenerateRandomFirstName();
                var lastName  = personNameGenerator.GenerateRandomLastName();
                var twitter   = String.Format("@{0}{1}", firstName.First(), lastName).ToLowerInvariant();
                var person    = new Person
                {
                    PersonId  = i,
                    FirstName = firstName,
                    LastName  = lastName,
                    Twitter   = twitter
                };
                People.Add(person);
            }

            // Create random articles.
            var numberOfArticles = RandomData.GetInt(8, 16);

            for (var i = 1; i <= numberOfArticles; i++)
            {
                var blogId   = RandomData.GetLong(1, numberOfBlogs);
                var authorId = RandomData.GetLong(1, numberOfPersons);
                var article  = new Article
                {
                    BlogId    = blogId,
                    AuthorId  = authorId,
                    ArticleId = i,
                    Title     = RandomData.GetTitleWords(),
                    Text      = RandomData.GetParagraphs()
                };
                Articles.Add(article);
            }

            // Create random comments.
            var numberOfComments = RandomData.GetInt(16, 32);

            for (var i = 1; i <= numberOfComments; i++)
            {
                var articleId = RandomData.GetLong(1, numberOfArticles);
                var authorId  = RandomData.GetLong(1, numberOfPersons);
                var comment   = new Comment
                {
                    ArticleId = articleId,
                    AuthorId  = authorId,
                    CommentId = i,
                    Body      = RandomData.GetSentence()
                };
                Comments.Add(comment);
            }
        }
Exemplo n.º 11
0
 private void InsertNewBlogAndArticleIntoDatabase()
 {
     Blogs.Add(App.EfService.InsertNewBlogAndArticleIntoDatabase());
 }