Ejemplo n.º 1
0
        public bool EditBlog(BlogSetting currentBlog)
        {
            var blogs        = GetBlogs();
            var blogToUpdate = blogs.SingleOrDefault(b => SameBlog(currentBlog, b));

            currentBlog.BeginEdit();

            var blogSettings = blogSettingsCreator();

            blogSettings.InitializeBlog(currentBlog);

            var result = windowManager.ShowDialog(blogSettings);

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

            var index = blogs.IndexOf(blogToUpdate);

            blogs[index] = currentBlog;

            currentBlog.EndEdit();
            SaveBlogs(blogs);
            return(true);
        }
Ejemplo n.º 2
0
        public BlogSetting 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(null);
            }

            blog.EndEdit();
            var blogs = GetBlogs();

            blogs.Add(blog);
            SaveBlogs(blogs);

            return(blog);
        }
Ejemplo n.º 3
0
        public BlogSetting 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 null;
            }

            blog.EndEdit();
            var blogs = GetBlogs();
            blogs.Add(blog);
            SaveBlogs(blogs);

            return blog;
        }
Ejemplo n.º 4
0
        public bool EditBlog(BlogSetting currentBlog)
        {
            var blogs = GetBlogs();
            var blogToUpdate = blogs.SingleOrDefault(b => SameBlog(currentBlog, b));
            currentBlog.BeginEdit();

            var blogSettings = blogSettingsCreator();
            blogSettings.InitializeBlog(currentBlog);

            var result = windowManager.ShowDialog(blogSettings);

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

            var index = blogs.IndexOf(blogToUpdate);
            blogs[index] = currentBlog;

            currentBlog.EndEdit();
            SaveBlogs(blogs);
            return true;
        }