﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Awesomium.Core;
using ProjectMarkdown.Annotations;

namespace ProjectMarkdown.Model
{
    public class DocumentModel : INotifyPropertyChanged
    {
        private string _header;
        private string _markdownText;
        private Uri _source;

        public string Header
        {
            get { return _header; }
            set
            {
                if (value == _header) return;
                _header = value;
                OnPropertyChanged(nameof(Header));
            }
        }

        public string MarkdownText
        {
            get { return _markdownText; }
            set
            {
                if (value == _markdownText) return;
                _markdownText = value;
                OnPropertyChanged(nameof(MarkdownText));
            }
        }

        public Uri Source
        {
            get { return _source; }
            set
            {
                if (Equals(value, _source)) return;
                _source = value;
                OnPropertyChanged(nameof(Source));
            }
        }

        public string MarkdownPath { get; set; }
        public string HtmlPath { get; set; }


        public event PropertyChangedEventHandler PropertyChanged;

        public DocumentModel(string documentName)
        {
            Header = documentName;
            MarkdownText = "";
            Source = "".ToUri();
        }

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Awesomium.Core;
using ProjectMarkdown.Annotations;

namespace ProjectMarkdown.Model
{
    public class DocumentModel : INotifyPropertyChanged
    {
        public DocumentMetadata Metadata
        {
            get { return _metadata; }
            set
            {
                if (Equals(value, _metadata)) return;
                _metadata = value;
                OnPropertyChanged(nameof(Metadata));
            }
        }

        public DocumentMarkdown Markdown
        {
            get { return _markdown; }
            set
            {
                if (Equals(value, _markdown)) return;
                _markdown = value;
                OnPropertyChanged(nameof(Markdown));
            }
        }

        public DocumentHtml Html
        {
            get { return _html; }
            set
            {
                if (Equals(value, _html)) return;
                _html = value;
                OnPropertyChanged(nameof(Html));
            }
        }

        
        private DocumentMetadata _metadata;
        private DocumentMarkdown _markdown;
        private DocumentHtml _html;


        public event PropertyChangedEventHandler PropertyChanged;

        public DocumentModel(string documentName)
        {
            Metadata = new DocumentMetadata(documentName);
            Markdown = new DocumentMarkdown("");
            Html = new DocumentHtml("".ToUri());
        }

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

Document model updated as per save document changes.
Document model updated as per save document changes.
