Example #1
0
        public InsertGeFileCommand(string fileName, GraphicContent graphicContent)
        {
            f_layers = new List<Layer>();
            Canvas loadedCanvas;
            using (FileStream fileStream = new FileStream(fileName, FileMode.Open))
            {
                try
                {
                    loadedCanvas = XamlReader.Load(fileStream) as Canvas;
                }
                catch (XamlParseException exception)
                {
                    MessageBox.Show(exception.ToString(), @"Error adding layer");
                    return;
                }
                catch (ArgumentException exception)
                {
                    MessageBox.Show(exception.ToString(), @"Error adding layer");
                    return;
                }
            }

            if (loadedCanvas == null) return;

            foreach (Layer layer in loadedCanvas.Children)
                f_layers.Add(layer.Clone(false));

            f_graphicContent = graphicContent;
        }
Example #2
0
 public void InsertGeFile(string filename, GraphicContent graphicContent)
 {
     f_command = new InsertGeFileCommand(filename, graphicContent);
     f_undoCommands.Push(f_command);
     f_redoCommands.Clear();
     f_command.Execute();
 }
Example #3
0
 public Tool(GraphicContent graphicContent)
 {
     f_graphicContent = graphicContent;
     f_graphicContent.WorkSpace.MouseMove += MouseMoveHandler;
     f_graphicContent.WorkSpace.MouseLeftButtonDown += MouseDownHandler;
     f_graphicContent.WorkSpace.MouseLeftButtonUp += MouseUpHandler;
 }
Example #4
0
 public BrushTool(GraphicContent graphicContent)
     : base(graphicContent)
 {
     f_thickness = 2;
     f_opacity = 1;
     f_softness = 10;
     Name = "Brush";
 }
Example #5
0
 public LineTool(GraphicContent graphicContent)
     : base(graphicContent)
 {
     f_thickness = 10;
     f_opacity = 1;
     f_softness = 10;
     Name = "Line";
 }
 public LayersChildWindowFactory(GraphicContent graphicContent)
 {
     GraphicContent = graphicContent;
     ChildWindow = new LayersViewChildWindow { Header = "Layers" };
     ChildWindow.Move(-20, 10);
     ((LayersViewViewModel)ChildWindow.ViewModel).AddLayer(GraphicContent.SelectedLayer);
     ((LayersViewViewModel)ChildWindow.ViewModel).OnLayerCreate += LayerWindowViewModel_OnLayerCreate;
     ((LayersViewViewModel)ChildWindow.ViewModel).OnLayerDelete += LayerWindowViewModel_OnLayerDelete;
     ((LayersViewViewModel)ChildWindow.ViewModel).OnLayerDublicate += LayerWindowViewModel_OnLayerDublicate;
     GraphicContent.OnLayerCreate += GraphicContentOnOnLayerCreate;
     GraphicContent.OnLayerRemove += GraphicContentOnOnLayerRemove;
 }
Example #7
0
 public MainWindowViewModel()
 {
     SubscribeToCommands();
     GraphicContent = new GraphicContent();
     GraphicContent.WorkSpace.MouseMove += GraphicContentWorkSpaceMouseMove;
     ConfigureWorkSpace();
     f_layersChildWindowFactory = new LayersChildWindowFactory(GraphicContent);
     f_colorPickerChildWindowFactory = new ColorPickerChildWindowFactory();
     f_zoomBoxChildWindowFactory = new ZoomBoxChildWindowFactory();
     ((ZoomBoxChildWindow)f_zoomBoxChildWindowFactory.ChildWindow).ScrollViewer = ScrollViewer;
     ((ColorPickerViewModel)f_colorPickerChildWindowFactory.ChildWindow.ViewModel).Subscribe(GraphicContent.GraphicToolProperties);
     f_childWindows = new List<IChildWindowFactory>()
     {
         f_layersChildWindowFactory,
         f_colorPickerChildWindowFactory,
         f_zoomBoxChildWindowFactory
     };
 }
Example #8
0
 public FillTool(GraphicContent graphicContent) : base(graphicContent)
 {
     Name = "Fill";
 }
Example #9
0
 public NoTool(GraphicContent graphicContent)
     : base(graphicContent)
 {
 }
Example #10
0
 public PointerTool(GraphicContent graphicContent)
     : base(graphicContent)
 {
     Name = "Pointer";
 }