示例#1
0
文件: Note.cs 项目: reddenx/web_notes
 public void SetBackgroundColor(BrushColor newColor)
 {
     if (BackgroundColor != newColor)
     {
         BackgroundColor = newColor;
         OnChanged.SafeInvoke(this);
     }
 }
示例#2
0
文件: Note.cs 项目: reddenx/web_notes
 public void Rename(string newName)
 {
     if (Name.Name != newName && !string.IsNullOrWhiteSpace(newName))
     {
         Name = new NoteName(newName, Name.Description, Name.DateCreated, DateTime.Now, Name.DateLastOpened);
         OnChanged.SafeInvoke(this);
     }
 }
示例#3
0
文件: Note.cs 项目: reddenx/web_notes
        public LineElement AddLine(Vector2 start, Vector2 end, BrushSize size, BrushColor color)
        {
            if (start != null && end != null && size != null && color != null)
            {
                var line = new LineElement(this, start, end, color, size);
#warning change concat addition to lists eventually
                LineElements = LineElements.Concat(new LineElement[] { line }).ToArray();
                OnChanged.SafeInvoke(this);
                return(line);
            }
            else
            {
                throw new ArgumentException("AddLine input arguments not valid");
            }
        }
示例#4
0
文件: Note.cs 项目: reddenx/web_notes
        public Stroke AddStroke(BrushColor color, BrushSize size, Vector2[] path)
        {
            if (color != null && size != null && path != null && path.Length > 1)
            {
                var stroke = new Stroke(this, color, size, path);
#warning change concat addition to lists eventually
                Strokes = Strokes.Concat(new Stroke[] { stroke }).ToArray();
                OnChanged.SafeInvoke(this);
                return(stroke);
            }
            else
            {
                throw new ArgumentException("AddStroke input arguments are not valid");
            }
        }
示例#5
0
文件: Note.cs 项目: reddenx/web_notes
        public TextElement AddText(string text, int size, BrushColor color, Vector2 position)
        {
            if (!string.IsNullOrWhiteSpace(text) && size > 0 && color != null)
            {
                var element = new TextElement(this, position, size, color);
#warning change concat addition to lists eventually
                TextElements = TextElements.Concat(new TextElement[] { element }).ToArray();
                OnChanged.SafeInvoke(this);
                return(element);
            }
            else
            {
                throw new ArgumentException("AddText input arguments not valid");
            }
        }