Explorar el Código

Refactored a tool system, still tools needed to be implemented

flabbet hace 5 años
padre
commit
95fb57dc24

+ 2 - 0
PixiEditorDotNetCore3/Models/MousePositionConverter.cs

@@ -11,6 +11,8 @@ namespace PixiEditorDotNetCore3.Models
 {
     public static class MousePositionConverter
     {
+        public static Coordinates CurrentCoordinates { get; set; }
+
         public static Coordinates MousePositionToCoordinates(Layer baseLayer, Point mousePosition)
         {
             int xCoord = (int)(mousePosition.X / baseLayer.Width);

+ 2 - 1
PixiEditorDotNetCore3/Models/Tools/Tool.cs

@@ -7,8 +7,9 @@ namespace PixiEditorDotNetCore3.Models.Tools
 {
     public abstract class Tool
     {
+        public bool IsShapeCreating = false;
         public abstract BitmapPixelChanges Use(Layer layer, Coordinates startingCoords, Color color, int toolSize);
-        public abstract ToolType GetToolType { get; }
+        public abstract ToolType ToolType { get; }
         public bool ExecutesItself = false;
     }
 }

+ 0 - 233
PixiEditorDotNetCore3/Models/Tools/ToolSet.cs

@@ -1,233 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Media;
-using System.Windows.Input;
-using System.Windows.Media.Imaging;
-
-namespace PixiEditorDotNetCore3.Models.Tools
-{
-    public class ToolSet
-    {
-        public List<Tool> Tools { get; set; } = new List<Tool>();
-        private Coordinates _activeCoordinates = new Coordinates();
-        private bool _toolIsExecuting;
-        private int _asyncDelay = 15;
-
-
-        public ToolSet(List<Tool> tools)
-        {
-            Tools = tools;
-        }
-
-        /// <summary>
-        /// Executes tool action
-        /// </summary>
-        /// <param name="layer">Layer to operate on.</param>
-        /// <param name="startingCoords">Click coordinates.</param>
-        /// <param name="color">Color that tool will use.</param>
-        /// <param name="toolSize">Size/thickness of tool</param>
-        /// <param name="tool">Tool to execute</param>
-        /// <returns></returns>
-        public void ExecuteTool(Layer layer, Coordinates startingCoords, Color color,int toolSize, ToolType tool)
-        {
-            if (toolSize < 1) return;
-            BitmapPixelChanges changes;
-
-
-            Tool selectedTool = Tools.Find(x => x.GetToolType == tool);
-            changes = selectedTool.Use(layer, startingCoords, color, toolSize);
-
-            if (tool != ToolType.ColorPicker)
-            {
-                UndoManager.RecordChanges("ActiveLightLayer", new LightLayer(layer.LayerBitmap.ToByteArray(), (int)layer.LayerBitmap.Height, (int)layer.LayerBitmap.Width),
-                    $"{tool.ToString()} Tool.");
-            }
-
-            if (selectedTool.ExecutesItself == false)
-            {
-                layer.ApplyPixels(changes, color);
-            }
-
-        }
-
-        /// <summary>
-        /// Updates coordinates in order to some tools work
-        /// </summary>
-        /// <param name="cords">Current coordinates</param>
-        public void UpdateCoordinates(Coordinates cords)
-        {
-            _activeCoordinates = cords;
-        }
-        
-
-        /// <summary>
-        /// Fills area with color (forest fire alghoritm)
-        /// </summary>
-        /// <param name="canvas">Bitmap to operate on</param>
-        /// <param name="pixelPosition">Position of starting pixel</param>
-        /// <param name="color">Fills area with this color</param>
-        private WriteableBitmap FloodFill(WriteableBitmap canvas, Coordinates pixelPosition, Color color)
-        {
-            WriteableBitmap bm = canvas;
-            Color colorToReplace = bm.GetPixel(pixelPosition.X, pixelPosition.Y);
-            var stack = new Stack<Tuple<int, int>>();
-            stack.Push(Tuple.Create(pixelPosition.X, pixelPosition.Y));
-
-            while (stack.Count > 0)
-            {
-                var point = stack.Pop();
-                if (point.Item1 < 0 || point.Item1 > bm.Height - 1) continue;
-                if (point.Item2 < 0 || point.Item2 > bm.Width - 1) continue;
-                if (bm.GetPixel(point.Item1, point.Item2) == color) continue;
-
-                if (bm.GetPixel(point.Item1, point.Item2) == colorToReplace)
-                {
-                    bm.SetPixel(point.Item1, point.Item2, color);
-                    stack.Push(Tuple.Create(point.Item1, point.Item2 - 1));
-                    stack.Push(Tuple.Create(point.Item1 + 1, point.Item2));
-                    stack.Push(Tuple.Create(point.Item1, point.Item2 + 1));
-                    stack.Push(Tuple.Create(point.Item1 - 1, point.Item2));
-                }
-            }
-            return bm;
-        }
-
-        /// <summary>
-        /// Draws line in canvas 
-        /// </summary>
-        /// <param name="layer">Layer to operate on</param>
-        /// <param name="coordinates">Starting coordinates, usually click point</param>
-        /// <param name="color">Does it really need a description?</param> 
-        private async void LineAsync(Layer layer, Coordinates coordinates, Color color, int size)
-        {
-            WriteableBitmap wb = layer.LayerBitmap;
-            _toolIsExecuting = true;
-            //clones bitmap before line
-            WriteableBitmap writeableBitmap = wb.Clone();
-            //While Mouse buttons are pressed, clears current bitmap, pastes cloned bitmap and draws line, on each iteration
-            while (Mouse.LeftButton == MouseButtonState.Pressed || Mouse.RightButton == MouseButtonState.Pressed)
-            {
-                wb.Clear();
-                wb.Blit(new Rect(new Size(layer.Width, layer.Height)), writeableBitmap, new Rect(new Size(layer.Width, layer.Height)), WriteableBitmapExtensions.BlendMode.Additive);
-                    wb.DrawLineBresenham(coordinates.X, coordinates.Y, _activeCoordinates.X, _activeCoordinates.Y, color);
-                await Task.Delay(_asyncDelay);
-            }           
-            _toolIsExecuting = false;
-        }
-
-        /// <summary>
-        /// Draws circle on bitmap.
-        /// </summary>
-        /// <param name="layer">Layer to operate on.</param>
-        /// <param name="coordinates">Starting pixel coordinates.</param>
-        /// <param name="color">Circle color.</param>
-        private async void CircleAsync(Layer layer, Coordinates coordinates, Color color)
-        {
-            WriteableBitmap wb = layer.LayerBitmap;
-            //Basically does the same like rectangle method, but with different shape
-            _toolIsExecuting = true;
-            WriteableBitmap bitmap = wb.Clone();
-            while (Mouse.LeftButton == MouseButtonState.Pressed || Mouse.RightButton == MouseButtonState.Pressed)
-            {
-                wb.Clear();
-                wb.Blit(new Rect(new Size(layer.Width, layer.Height)), bitmap, new Rect(new Size(layer.Width, layer.Height)), WriteableBitmapExtensions.BlendMode.Additive);
-                if (coordinates.X > _activeCoordinates.X && coordinates.Y > _activeCoordinates.Y)
-                {
-                    wb.DrawEllipse(_activeCoordinates.X, _activeCoordinates.Y, coordinates.X, coordinates.Y, color);
-                }
-                else if (coordinates.X < _activeCoordinates.X && coordinates.Y < _activeCoordinates.Y)
-                {
-                    wb.DrawEllipse(coordinates.X, coordinates.Y, _activeCoordinates.X, _activeCoordinates.Y, color);
-                }
-                else if (coordinates.Y > _activeCoordinates.Y)
-                {
-                    wb.DrawEllipse(coordinates.X, _activeCoordinates.Y, _activeCoordinates.X, coordinates.Y, color);
-                }
-                else
-                {
-                    wb.DrawEllipse(_activeCoordinates.X, coordinates.Y, coordinates.X, _activeCoordinates.Y, color);
-                }
-                await Task.Delay(_asyncDelay);
-            }
-            _toolIsExecuting = false;
-        }
-
-        /// <summary>
-        /// Draws rectangle on bitmap
-        /// </summary>
-        /// <param name="layer">Layer to operate on</param>
-        /// <param name="coordinates">Starting pixel coordinate</param>
-        /// <param name="color">Rectangle color</param>
-        private async void RectangleAsync(Layer layer, Coordinates coordinates, Color color)
-        {
-            WriteableBitmap wb = layer.LayerBitmap;
-            _toolIsExecuting = true;
-            WriteableBitmap writeableBitmap = wb.Clone();
-            while (Mouse.LeftButton == MouseButtonState.Pressed || Mouse.RightButton == MouseButtonState.Pressed)
-            {
-                //Two lines below are responsible for clearing last rectangle (on mouse move), to live show rectangle on bitmap
-                wb.Clear();
-                wb.Blit(new Rect(new Size(layer.Width, layer.Height)), writeableBitmap, new Rect(new Size(layer.Width, layer.Height)), WriteableBitmapExtensions.BlendMode.Additive);
-                //Those ifs are changing direction of rectangle. In other words: flips rectangle on X and Y axis when needed
-                if (coordinates.X > _activeCoordinates.X && coordinates.Y > _activeCoordinates.Y)
-                {
-                    wb.DrawRectangle(_activeCoordinates.X, _activeCoordinates.Y, coordinates.X, coordinates.Y, color);
-                }
-                else if (coordinates.X < _activeCoordinates.X && coordinates.Y < _activeCoordinates.Y)
-                {
-                    wb.DrawRectangle(coordinates.X, coordinates.Y, _activeCoordinates.X, _activeCoordinates.Y, color);
-                }
-                else if (coordinates.Y > _activeCoordinates.Y)
-                {
-                    wb.DrawRectangle(coordinates.X, _activeCoordinates.Y, _activeCoordinates.X, coordinates.Y, color);
-                }
-                else
-                {
-                    wb.DrawRectangle(_activeCoordinates.X, coordinates.Y, coordinates.X, _activeCoordinates.Y, color);
-                }
-                await Task.Delay(_asyncDelay);
-            }            
-            _toolIsExecuting = false;
-        }
-        /// <summary>
-        /// Returns color of pixel.
-        /// </summary>
-        /// <param name="layer">Layer in which bitmap with pixels are stored.</param>
-        /// <param name="coordinates">Pixel coordinate.</param>
-        /// <returns></returns>
-        public static Color ColorPicker(Layer layer, Coordinates coordinates)
-        {
-            return layer.LayerBitmap.GetPixel(coordinates.X, coordinates.Y);
-        }
-        /// <summary>
-        /// Ligtens pixel color.
-        /// </summary>
-        /// <param name="bitmap">Bitmap to work on.</param>
-        /// <param name="coordinates">Pixel coordinates.</param>
-        /// <returns></returns>
-        private WriteableBitmap Lighten(WriteableBitmap bitmap, Coordinates coordinates)
-        {
-            WriteableBitmap wb = bitmap;
-            Color pixel = wb.GetPixel(coordinates.X, coordinates.Y);
-            Color newColor = ExColor.ChangeColorBrightness(System.Drawing.Color.FromArgb(pixel.R, pixel.G, pixel.B), 0.1f);
-            wb.SetPixel(coordinates.X, coordinates.Y, newColor);
-            return wb;
-        }
-        /// <summary>
-        /// Darkens pixel color.
-        /// </summary>
-        /// <param name="bitmap">Bitmap to work on.</param>
-        /// <param name="coordinates">Pixel coordinates.</param>
-        /// <returns></returns>
-        private WriteableBitmap Darken(WriteableBitmap bitmap, Coordinates coordinates)
-        {
-            WriteableBitmap wb = bitmap;
-            Color pixel = wb.GetPixel(coordinates.X, coordinates.Y);
-            Color newColor = ExColor.ChangeColorBrightness(System.Drawing.Color.FromArgb(pixel.R,pixel.G,pixel.B), -0.06f);
-            wb.SetPixel(coordinates.X, coordinates.Y, newColor);
-            return wb;
-        }
-    }
-}

+ 1 - 1
PixiEditorDotNetCore3/Models/Tools/Tools/FloodFill.cs

@@ -7,7 +7,7 @@ namespace PixiEditorDotNetCore3.Models.Tools.Tools
 {
     public class FloodFill : Tool
     {
-        public override ToolType GetToolType => ToolType.Bucket;
+        public override ToolType ToolType => ToolType.Bucket;
 
         public FloodFill()
         {

+ 37 - 0
PixiEditorDotNetCore3/Models/Tools/Tools/LineTool.cs

@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+
+namespace PixiEditorDotNetCore3.Models.Tools.Tools
+{
+    public class LineTool : Tool
+    {
+        public override ToolType ToolType => ToolType.Line;
+
+        public LineTool()
+        {
+            ExecutesItself = true;
+            IsShapeCreating = true;
+        }
+
+        public override BitmapPixelChanges Use(Layer layer, Coordinates startingCoords, Color color, int toolSize)
+        {
+            Line(layer, startingCoords, color, toolSize);
+            return new BitmapPixelChanges();
+        }
+
+        public void Line(Layer layer, Coordinates coordinates, Color color, int size)
+        {           
+            layer.LayerBitmap.DrawLineBresenham(coordinates.X, coordinates.Y, MousePositionConverter.CurrentCoordinates.X,
+                MousePositionConverter.CurrentCoordinates.Y, color);
+
+
+        }
+    }
+}

+ 1 - 1
PixiEditorDotNetCore3/Models/Tools/Tools/Pen.cs

@@ -7,7 +7,7 @@ namespace PixiEditorDotNetCore3.Models.Tools.Tools
 {
     public class Pen : Tool
     {
-        public override ToolType GetToolType => ToolType.Pen;
+        public override ToolType ToolType => ToolType.Pen;
 
 
         public override BitmapPixelChanges Use(Layer layer, Coordinates startingCoords, Color color, int toolSize)

+ 155 - 0
PixiEditorDotNetCore3/Models/Tools/ToolsManager.cs

@@ -0,0 +1,155 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Input;
+using System.Windows.Media.Imaging;
+using PixiEditor.ViewModels;
+using System.Timers;
+using System.Windows.Threading;
+using System.Threading;
+
+namespace PixiEditorDotNetCore3.Models.Tools
+{
+    public class ToolsManager
+    {
+        public List<Tool> Tools { get; set; } = new List<Tool>();
+        public Tool SelectedTool { get; private set; }
+        private bool _toolRecievedData = false;
+
+        private System.Timers.Timer _loopTimer;
+        private Layer _layer;
+        private WriteableBitmap _clonedBitmap;
+        private Coordinates _startCoordinates;
+        private Color _color;
+        private int _toolSzie;
+
+        public ToolsManager(List<Tool> tools)
+        {
+            Tools = tools;
+            _loopTimer = new System.Timers.Timer
+            {
+                Interval = 15,
+                Enabled = false,
+                AutoReset = true
+            };
+            _loopTimer.Elapsed += LoopTimer_Elapsed;
+        }
+
+        private void LoopTimer_Elapsed(object sender, ElapsedEventArgs e)
+        {
+            Application.Current.Dispatcher.Invoke(() =>
+            {              
+                if(_clonedBitmap != null)
+                {
+                    _layer.LayerBitmap.Clear();
+                    _layer.LayerBitmap.Blit(new Rect(new Size(_layer.Width, _layer.Height)), _clonedBitmap, new Rect(new Size(_layer.Width, _layer.Height)), WriteableBitmapExtensions.BlendMode.Additive);
+                }
+                BitmapPixelChanges changes = SelectedTool.Use(_layer, _startCoordinates, _color, _toolSzie);
+                if (!SelectedTool.ExecutesItself)
+                {
+                    _layer.ApplyPixels(changes, _color);
+                }
+            });
+        }
+
+        public void SetTool(ToolType tool)
+        {
+              SelectedTool = Tools.Find(x => x.ToolType == tool);
+        }
+
+        public void StopExectuingTool()
+        {
+            _loopTimer.Enabled = false;
+            _toolRecievedData = false;
+            _clonedBitmap = null;
+        }
+
+        private void StartTimer()
+        {
+            _toolRecievedData = true;
+            _loopTimer.Enabled = true;
+        }
+
+        private void CloneBitmapIfToolIsShape()
+        {
+            if (SelectedTool.IsShapeCreating == true)
+            {
+                _clonedBitmap = _layer.LayerBitmap.Clone();                
+            }
+        }
+
+        /// <summary>
+        /// Executes tool action
+        /// </summary>
+        /// <param name="layer">Layer to operate on.</param>
+        /// <param name="startingCoords">Click coordinates.</param>
+        /// <param name="color">Color that tool will use.</param>
+        /// <param name="toolSize">Size/thickness of tool</param>
+        /// <param name="tool">Tool to execute</param>
+        /// <returns></returns>
+        public void ExecuteTool(Layer layer, Coordinates startingCoords, Color color, int toolSize)
+        {
+            if (toolSize < 1)
+                return;
+
+            if(_toolRecievedData == false || (_toolRecievedData == true && !SelectedTool.IsShapeCreating))
+            {
+                _startCoordinates = startingCoords;
+                _layer = layer;
+                _color = color;
+                _toolSzie = toolSize;
+            }
+                     
+
+            if (_loopTimer.Enabled == false)
+            {
+                StartTimer();
+                CloneBitmapIfToolIsShape();
+            }
+        }
+
+      
+
+       
+        /// <summary>
+        /// Returns color of pixel.
+        /// </summary>
+        /// <param name="layer">Layer in which bitmap with pixels are stored.</param>
+        /// <param name="coordinates">Pixel coordinate.</param>
+        /// <returns></returns>
+        public static Color ColorPicker(Layer layer, Coordinates coordinates)
+        {
+            return layer.LayerBitmap.GetPixel(coordinates.X, coordinates.Y);
+        }
+        /// <summary>
+        /// Ligtens pixel color.
+        /// </summary>
+        /// <param name="bitmap">Bitmap to work on.</param>
+        /// <param name="coordinates">Pixel coordinates.</param>
+        /// <returns></returns>
+        private WriteableBitmap Lighten(WriteableBitmap bitmap, Coordinates coordinates)
+        {
+            WriteableBitmap wb = bitmap;
+            Color pixel = wb.GetPixel(coordinates.X, coordinates.Y);
+            Color newColor = ExColor.ChangeColorBrightness(System.Drawing.Color.FromArgb(pixel.R, pixel.G, pixel.B), 0.1f);
+            wb.SetPixel(coordinates.X, coordinates.Y, newColor);
+            return wb;
+        }
+        /// <summary>
+        /// Darkens pixel color.
+        /// </summary>
+        /// <param name="bitmap">Bitmap to work on.</param>
+        /// <param name="coordinates">Pixel coordinates.</param>
+        /// <returns></returns>
+        private WriteableBitmap Darken(WriteableBitmap bitmap, Coordinates coordinates)
+        {
+            WriteableBitmap wb = bitmap;
+            Color pixel = wb.GetPixel(coordinates.X, coordinates.Y);
+            Color newColor = ExColor.ChangeColorBrightness(System.Drawing.Color.FromArgb(pixel.R,pixel.G,pixel.B), -0.06f);
+            wb.SetPixel(coordinates.X, coordinates.Y, newColor);
+            return wb;
+        }
+    }
+}

+ 33 - 44
PixiEditorDotNetCore3/ViewModels/ViewModelMain.cs

@@ -1,26 +1,15 @@
-using Microsoft.Win32;
-using PixiEditor.Helpers;
+using PixiEditor.Helpers;
 using PixiEditorDotNetCore3.Models.Enums;
 using PixiEditorDotNetCore3.Models.Tools;
-using PixiEditor.Views;
 using PixiEditorDotNetCore3.Models;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
 using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
-using Xceed.Wpf.Toolkit.Zoombox;
 using PixiTools = PixiEditorDotNetCore3.Models.Tools.Tools;
 
 namespace PixiEditor.ViewModels
@@ -122,14 +111,28 @@ namespace PixiEditor.ViewModels
             get { return _secondaryColor; }
             set { if (_secondaryColor != value) { _secondaryColor = value; RaisePropertyChanged("SecondaryColor"); } }
         }
-       
 
+        private Color _selectedColor = Colors.White;
+
+        public Color SelectedColor
+        {
+            get { return _selectedColor; }
+            set 
+            { 
+                if(_selectedColor != value) 
+                    _selectedColor = value;
+                RaisePropertyChanged("SelectedColor");
+            }
+        }
+
+
+
         private ToolType _selectedTool = ToolType.Pen;
 
         public ToolType SelectedTool
         {
             get { return _selectedTool; }
-            set { if (_selectedTool != value) { _selectedTool = value; RaisePropertyChanged("SelectedTool"); } }
+            set { if (_selectedTool != value) { _selectedTool = value; primaryToolSet.SetTool(SelectedTool); RaisePropertyChanged("SelectedTool"); } }
         }
 
 
@@ -141,7 +144,7 @@ namespace PixiEditor.ViewModels
             set { if (_toolSize != value) { _toolSize = value; RaisePropertyChanged("ToolSize"); } }
         }
 
-        private ToolSet primaryToolSet;
+        private ToolsManager primaryToolSet;
 
         public ViewModelMain()
         {
@@ -156,8 +159,9 @@ namespace PixiEditor.ViewModels
             MouseUpCommand = new RelayCommand(MouseUp);
             RecenterZoomboxCommand = new RelayCommand(RecenterZoombox);
             OpenFileCommand = new RelayCommand(OpenFile);
-            primaryToolSet = new ToolSet(new List<Tool> { new PixiTools.Pen(), new PixiTools.FloodFill() });
+            primaryToolSet = new ToolsManager(new List<Tool> { new PixiTools.Pen(), new PixiTools.FloodFill(), new PixiTools.LineTool() });
             UndoManager.SetMainRoot(this);
+            primaryToolSet.SetTool(SelectedTool);
         }
 
         #region Undo/Redo
@@ -213,6 +217,7 @@ namespace PixiEditor.ViewModels
         private void MouseUp(object parameter)
         {
             UndoManager.StopRecording();
+            primaryToolSet.StopExectuingTool();
         }
 
         /// <summary>
@@ -221,39 +226,23 @@ namespace PixiEditor.ViewModels
         /// <param name="parameter"></param>
         private void MouseMoveOrClick(object parameter)
         {
-            Color color;
             Coordinates cords = new Coordinates((int)MouseXOnCanvas, (int)MouseYOnCanvas);
-            if (Mouse.LeftButton == MouseButtonState.Pressed)
-            {
-                color = PrimaryColor;
-            }
-            else if(Mouse.RightButton == MouseButtonState.Pressed)
-            {
-                color = SecondaryColor;
+            MousePositionConverter.CurrentCoordinates = cords;
 
+            if (Mouse.LeftButton == MouseButtonState.Pressed)
+            {
+                SelectedColor = PrimaryColor;
             }
-            else
-            {
-                return;
+            else if(Mouse.RightButton == MouseButtonState.Pressed)
+            {
+                SelectedColor = SecondaryColor;
             }
-
-            if (SelectedTool != ToolType.ColorPicker)
-            {
-                primaryToolSet.UpdateCoordinates(cords);
-                primaryToolSet.ExecuteTool(ActiveLayer, cords, color, ToolSize,SelectedTool);
-                RefreshImage();
-            }
-            else
-            {
-                if (Mouse.LeftButton == MouseButtonState.Pressed)
-                {
-                    PrimaryColor = ToolSet.ColorPicker(ActiveLayer, cords);
-                }
-                else
-                {
-                    SecondaryColor = ToolSet.ColorPicker(ActiveLayer, cords);
-                }
+            else
+            {
+                return;
             }
+            primaryToolSet.ExecuteTool(ActiveLayer, cords, SelectedColor, ToolSize);
+            RefreshImage();
         }
 
         private void RefreshImage()

+ 1 - 1
PixiEditorDotNetCore3/Views/MainWindow.xaml

@@ -11,7 +11,7 @@
         xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
         xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
         mc:Ignorable="d"
-        Title="Pixi" Height="1000" Width="1600" Background="#FF252424" WindowStartupLocation="CenterScreen" WindowState="Maximized" DataContext="{DynamicResource ViewModelMain}">
+        Title="Pixi" Height="1000" Width="1600" Background="#FF252424" WindowStartupLocation="CenterScreen"  WindowState="Maximized" DataContext="{DynamicResource ViewModelMain}">
     <Window.Resources>
         <vm:ViewModelMain x:Key="ViewModelMain"/>
         <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>