private void MoveFront()
        {
            if (this.Mode != ListViewSelectionMode.Single)
            {
                return;
            }

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

            this.ViewModel.HistoryPush(history);

            Layerage destination = this.SelectionViewModel.SelectionLayerage;
            Layerage parents     = LayerManager.GetParentsChildren(destination);

            if (parents.Children.Count < 2)
            {
                return;
            }

            parents.Children.Remove(destination);
            parents.Children.Insert(0, destination);

            LayerManager.ArrangeLayers();
            this.ViewModel.Invalidate(); // Invalidate
        }
Beispiel #2
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
        }
Beispiel #3
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;
        }
        private void ForwardOne()
        {
            if (this.Mode != ListViewSelectionMode.Single)
            {
                return;
            }

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

            this.ViewModel.HistoryPush(history);

            Layerage destination = this.SelectionViewModel.SelectionLayerage;
            Layerage parents     = LayerManager.GetParentsChildren(destination);

            if (parents.Children.Count < 2)
            {
                return;
            }

            int index = parents.Children.IndexOf(destination);

            index--;

            if (index < 0)
            {
                index = 0;
            }
            if (index > parents.Children.Count - 1)
            {
                index = parents.Children.Count - 1;
            }

            parents.Children.Remove(destination);
            parents.Children.Insert(index, destination);

            LayerManager.ArrangeLayers();
            this.ViewModel.Invalidate(); // Invalidate
        }