Ejemplo n.º 1
0
        //////////////////////////


        private async void ShowGalleryDialog()
        {
            Photo photo = await this.ShowGalleryDialogTask();

            if (photo is null)
            {
                return;
            }

            // History
            LayeragesArrangeHistory history = new LayeragesArrangeHistory(HistoryType.LayeragesArrange_AddLayer);

            this.ViewModel.HistoryPush(history);

            // Layer
            Layerage   imageLayerage = Layerage.CreateByGuid();
            ImageLayer imageLayer    = new ImageLayer(photo)
            {
                Id         = imageLayerage.Id,
                IsSelected = true,
            };

            LayerBase.Instances.Add(imageLayerage.Id, imageLayer);

            // Mezzanine
            LayerManager.Mezzanine(imageLayerage);

            this.SelectionViewModel.SetMode(); // Selection
            LayerManager.ArrangeLayers();
            LayerManager.ArrangeLayersBackground();
            this.ViewModel.Invalidate(); // Invalidate
        }
Ejemplo n.º 2
0
        public void MethodSelectedNone()
        {
            // History
            LayersPropertyHistory history = new LayersPropertyHistory(HistoryType.LayersProperty_SetIsSelected);

            // Selection
            this.SetValue((layerage) =>
            {
                ILayer layer = layerage.Self;

                if (layer.IsSelected == true)
                {
                    // History
                    var previous        = layer.IsSelected;
                    history.UndoAction += () =>
                    {
                        layer.IsSelected = previous;
                    };

                    layer.IsSelected = false;
                }
            });

            // History
            this.HistoryPush(history);

            this.SetModeNone(); // Selection
            LayerManager.ArrangeLayersBackground();
            this.Invalidate();  // Invalidate
        }
Ejemplo n.º 3
0
        public void MethodSelectedSubtract(Layerage selectedLayerage)
        {
            ILayer selectedLayer = selectedLayerage.Self;

            // History
            LayersPropertyHistory history = new LayersPropertyHistory(HistoryType.LayersProperty_SetIsSelected);

            if (selectedLayerage.Self.IsSelected == true)
            {
                // History
                var previous = selectedLayer.IsSelected;
                history.UndoAction += () =>
                {
                    selectedLayer.IsSelected = previous;
                };

                selectedLayer.IsSelected = false;
            }

            // History
            this.HistoryPush(history);

            this.SetMode();    // Selection
            LayerManager.ArrangeLayersBackground();
            this.Invalidate(); // Invalidate
        }
Ejemplo n.º 4
0
        private async Task CopyMultipleImageFilesAndCreateImageLayersAsync(IReadOnlyList <IStorageItem> items)
        {
            if (items is null)
            {
                return;
            }

            // History
            LayeragesArrangeHistory history = new LayeragesArrangeHistory(HistoryType.LayeragesArrange_AddLayer);

            this.ViewModel.HistoryPush(history);

            IList <Layerage> imageLayerages = new List <Layerage>();

            foreach (IStorageItem item in items)
            {
                // Photo
                StorageFile copyFile = await FileUtil.CopySingleImageFileAsync(item);

                if (copyFile is null)
                {
                    continue;
                }
                Photo photo = await Photo.CreatePhotoFromCopyFileAsync(LayerManager.CanvasDevice, copyFile);

                Photo.DuplicateChecking(photo);

                if (photo is null)
                {
                    continue;
                }

                // Layer
                Layerage   imageLayerage = Layerage.CreateByGuid();
                ImageLayer imageLayer    = new ImageLayer(photo)
                {
                    Id         = imageLayerage.Id,
                    IsSelected = true,
                };
                LayerBase.Instances.Add(imageLayerage.Id, imageLayer);
                imageLayerages.Add(imageLayerage);
            }

            // Mezzanine
            LayerManager.MezzanineRange(imageLayerages);

            this.SelectionViewModel.SetMode(); // Selection
            LayerManager.ArrangeLayers();
            LayerManager.ArrangeLayersBackground();
            this.ViewModel.Invalidate(); // Invalidate
        }
        private void LayerDragItemsCompleted()
        {
            // History
            LayeragesArrangeHistory history = new LayeragesArrangeHistory(HistoryType.LayeragesArrange_LayersArrange);

            this.ViewModel.HistoryPush(history);

            LayerManager.DragComplete(this.DragDestinationLayerage, this.DragSourceLayerage, this.DragLayerOverlayMode, this.DragLayerIsSelected);

            this.SelectionViewModel.SetMode(); // Selection
            LayerManager.ArrangeLayers();
            LayerManager.ArrangeLayersBackground();
            this.ViewModel.Invalidate(); // Invalidate

            this.DragSourceLayerage      = null;
            this.DragDestinationLayerage = null;
            this.DragLayerIsSelected     = false;
            this.DragLayerOverlayMode    = OverlayMode.None;
        }
Ejemplo n.º 6
0
        public void MethodSelectedNot(Layerage selectedLayerage)
        {
            ILayer selectedLayer = selectedLayerage.Self;

            // History
            LayersPropertyHistory history = new LayersPropertyHistory(HistoryType.LayersProperty_SetIsSelected);

            var previous = selectedLayer.IsSelected;

            history.UndoAction += () =>
            {
                selectedLayer.IsSelected = previous;
            };

            selectedLayer.IsSelected = !selectedLayer.IsSelected;

            // History
            this.HistoryPush(history);

            this.SetMode(); // Selection
            // LayerManager.ArrangeLayersBackgroundItemClick(selectedLayerage);
            LayerManager.ArrangeLayersBackground();
            this.Invalidate(); // Invalidate
        }