Ejemplo n.º 1
0
        private void Open()
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "Xml File (*.xml)|*.xml|PNG File|*.png";

            if (dlg.ShowDialog() == true)
            {
                if (dlg.FilterIndex == 1)
                {
                    New();
                    layerSystem = LayerManager.Load(dlg.FileName);
                    for (int i = 0; i < layerSystem.CountLayer(); i++)
                    {
                        layerDisplay = layerSystem.GetLayerDisplay(i);
                        grdLayer.Children.Add(layerDisplay.Get());
                        curLayerIndex = i;

                        RowDefinition rowDefinition = new RowDefinition();
                        rowDefinition.Height = new GridLength(LayerDisplay.distance);
                        grdLayer.RowDefinitions.Add(rowDefinition);
                        Grid.SetRow(layerDisplay.Get(), i);

                        UpdateLayerImage();
                    }
                }
                else
                {
                    AddNewAction(new Actions.Drawing(layerSystem.GetLayer(curLayerIndex),
                                                     new GraphicElement.Image(dlg.FileName)));
                }
            }
        }
Ejemplo n.º 2
0
        private void NewLayer()
        {
            layerSystem.NewLayer();
            curLayerIndex = layerSystem.CurrentLayer;
            layerDisplay  = layerSystem.GetLayerDisplay(curLayerIndex);
            UpdateLayerImage();
            grdLayer.Children.Add(layerDisplay.Get());

            if (curLayerIndex > grdLayer.RowDefinitions.Count - 1)
            {
                RowDefinition rowDefinition = new RowDefinition();
                rowDefinition.Height = new GridLength(LayerDisplay.distance);
                grdLayer.RowDefinitions.Add(rowDefinition);
            }

            Grid.SetRow(layerDisplay.Get(), curLayerIndex);
        }
Ejemplo n.º 3
0
 private LayerDisplay Find(int index)
 {
     foreach (LayerDisplay layerDisplay in layerSystem.LayerDisplays)
     {
         if (Grid.GetRow(layerDisplay.Get()) == index)
         {
             return(layerDisplay);
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
 private int FindLayerIndex(LayerDisplay layerDisplay)
 {
     return(Grid.GetRow(layerDisplay.Get()));
 }