Ejemplo n.º 1
0
 public Flipbook(Color backgroundColor)
 {
     ColorHistory = new Color[]
     {
         Colors.Black, Colors.White, Colors.Gray,
         Colors.Blue, Colors.Green, Colors.Red,
         Colors.Pink, Colors.Orange, Colors.Orchid
     };
     _background = new SolidColorBrush();
     BackgroundColor = backgroundColor;
     _tools = new Dictionary<string, ITool>
     {
         {"Pencil", new Pencil()},
         {"Pen", new Pen()},
         {"Highlighter", new Highlighter()},
         {"Eraser", new Eraser(ref _background)},
     };
     CurrentTool = _tools["Pen"];
     CurrentPage = new Page(this);
     _pages = new List<Page> {CurrentPage};
 }
Ejemplo n.º 2
0
 public int GetPageNumber(Page page)
 {
     return _pages.IndexOf(page) + 1;
 }
Ejemplo n.º 3
0
 private Page GetPreviousPage(Page p)
 {
     Page prev = null;
     if (_pages != null)
     {
         int index = _pages.IndexOf(p);
         if (index > 0)
         {
             prev = _pages[index - 1];
         }
     }
     return prev;
 }
Ejemplo n.º 4
0
 public void DeletePage(Page page)
 {
     int pageIndex = _pages.IndexOf(page);
     if (page == CurrentPage)
     {
         if (PageCount == 1)
         {
             CurrentPage = new Page(this);
             _pages = new List<Page> { CurrentPage };
         }
         else
         {
             MoveToPage(pageIndex - 1);
         }
     }
     _pages.Remove(page);
     RefreshPage();
     HasUnsavedChanges = true;
 }