private async Task _newFromPicture(StorageFile copyFile)
        {
            this.LoadingControl.State    = LoadingState.Loading;
            this.LoadingControl.IsActive = true;

            //Photo
            if (copyFile == null)
            {
                this.LoadingControl.State    = LoadingState.None;
                this.LoadingControl.IsActive = false;
                return;
            }
            Photo photo = await Photo.CreatePhotoFromCopyFileAsync(this.ViewModel.CanvasDevice, copyFile);

            Photo.DuplicateChecking(photo);

            //Transformer
            string      name              = this.MainLayout.UntitledRenameByRecursive($"{photo.Name}");
            int         width             = (int)photo.Width;
            int         height            = (int)photo.Height;
            Transformer transformerSource = new Transformer(width, height, Vector2.Zero);

            //ImageLayer
            Photocopier photocopier = photo.ToPhotocopier();
            ImageLayer  imageLayer  = new ImageLayer(this.ViewModel.CanvasDevice)
            {
                Transform   = new Transform(transformerSource),
                Photocopier = photocopier,
            };
            Layerage imageLayerage = imageLayer.ToLayerage();

            LayerBase.Instances.Add(imageLayer);

            //Project
            {
                Project project = new Project
                {
                    Name      = name,
                    Width     = width,
                    Height    = height,
                    Layerages = new List <Layerage>
                    {
                        imageLayerage
                    }
                };
                this.ViewModel.LoadFromProject(project);
            }

            //Transition
            TransitionData data = new TransitionData
            {
                Type = TransitionType.Size
            };

            this.LoadingControl.State    = LoadingState.None;
            this.LoadingControl.IsActive = false;
            this.Frame.Navigate(typeof(DrawPage), data);//Navigate
        }
        private async Task NewFromPictureCore(StorageFile copyFile)
        {
            this.LoadingControl.State = LoadingState.Loading;

            // Photo
            if (copyFile is null)
            {
                this.LoadingControl.State = LoadingState.None;
                return;
            }
            Photo photo = await Photo.CreatePhotoFromCopyFileAsync(LayerManager.CanvasDevice, copyFile);

            Photo.DuplicateChecking(photo);

            // Transformer
            string      name              = this.UntitledRenameByRecursive($"{photo.Name}");
            int         width             = (int)photo.Width;
            int         height            = (int)photo.Height;
            Transformer transformerSource = new Transformer(width, height, Vector2.Zero);

            // ImageLayer
            Photocopier photocopier   = photo.ToPhotocopier();
            Layerage    imageLayerage = Layerage.CreateByGuid();
            ImageLayer  imageLayer    = new ImageLayer
            {
                Id          = imageLayerage.Id,
                Transform   = new Transform(transformerSource),
                Photocopier = photocopier,
            };

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

            // Project
            Project project = new Project
            {
                Width     = width,
                Height    = height,
                Layerages = new List <Layerage>
                {
                    imageLayerage
                }
            };

            // Item
            IProjectViewItem item = new ProjectViewItem
            {
                Name        = name,
                ImageSource = null,
                Project     = project,
            };

            this.Items.Insert(0, item);

            this.LoadingControl.State = LoadingState.None;
            this.Frame.Navigate(typeof(DrawPage), item); // Navigate
        }
Exemplo n.º 3
0
        //@Construct
        /// <summary>
        /// Initializes a LayersControl.
        /// </summary>
        public LayersControl()
        {
            this.InitializeComponent();
            //LayerageCollection
            this.ConstructLayerageCollection();
            this.ItemsControl.ItemsSource = this.ViewModel.LayerageCollection.RootControls;


            this.Tapped      += (s, e) => this.MethodViewModel.MethodSelectedNone();//Method
            this.RightTapped += (s, e) => this.ShowLayerMenu();
            this.Holding     += (s, e) => this.ShowLayerMenu();


            Retouch_Photo2.PhotosPage.AddImageCallBack += (photo) =>
            {
                if (photo == null)
                {
                    return;
                }

                //History
                LayeragesArrangeHistory history = new LayeragesArrangeHistory("Add layer", this.ViewModel.LayerageCollection);
                this.ViewModel.HistoryPush(history);

                //Transformer
                Transformer transformerSource = new Transformer(photo.Width, photo.Height, Vector2.Zero);

                //Layer
                Photocopier photocopier = photo.ToPhotocopier();
                ImageLayer  imageLayer  = new ImageLayer(this.ViewModel.CanvasDevice)
                {
                    Photocopier = photocopier,
                    IsSelected  = true,
                    Transform   = new Transform(transformerSource)
                };
                Layerage imageLayerage = imageLayer.ToLayerage();
                LayerBase.Instances.Add(imageLayer);

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

                    layer.IsSelected = false;
                });

                //Mezzanine
                LayerageCollection.Mezzanine(this.ViewModel.LayerageCollection, imageLayerage);

                this.SelectionViewModel.SetMode(this.ViewModel.LayerageCollection);//Selection
                LayerageCollection.ArrangeLayers(this.ViewModel.LayerageCollection);
                LayerageCollection.ArrangeLayersBackground(this.ViewModel.LayerageCollection);
                this.ViewModel.Invalidate();//Invalidate
            };
        }
        /// <summary>
        /// Change the brush's type.
        /// </summary>
        /// <param name="type"> The new type. </param>
        /// <param name="transformer"> The transformer. </param>
        /// <param name="color"> The color. </param>
        /// <param name="photo"> The photo. </param>
        public void TypeChanged(BrushType type, Transformer transformer, Color color, Photo photo = null)
        {
            switch (type)
            {
            case BrushType.None:
                break;

            case BrushType.Color:
                this.ChangeColorCore(color);
                break;

            case BrushType.LinearGradient:
            case BrushType.RadialGradient:
                this.ChangingStopsCore(color);
                this.ChangingLinearGradientPointsCore(transformer);
                break;

            case BrushType.EllipticalGradient:
                this.ChangingStopsCore(color);
                this.ChangingEllipticalGradientPointsCore(transformer);
                break;

            case BrushType.Image:
            {
                // Photo
                if (photo is null)
                {
                    return;
                }

                Photocopier photocopier = photo.ToPhotocopier();
                float       width       = photo.Width;
                float       height      = photo.Height;

                this.Photocopier = photocopier;

                Vector2 center = this.Center;
                Vector2 yPoint = this.YPoint;

                //this.Center = center;
                this.XPoint = BrushBase.YToX(yPoint, center, width, height);
                //this.YPoint = yPoint;
                this.ChangingEllipticalGradientPointsCore(transformer);
            }
            break;

            default:
                break;
            }

            this.Type = type;
        }
Exemplo n.º 5
0
        private IEnumerator WaitForProviderAndRender()
        {
            while (Provider == null)
            {
                yield return(WaitFor.EndOfFrame);
            }

            registerObject = Provider.GetComponent <RegisterObject>();
            Photocopier    = Provider.GetComponent <Photocopier>();
            Photocopier.GuiRenderRequired += HandleGuiRenderRequired;
            RenderStatusLabel();
            RenderScannerLabel();
            RenderTrayLabel();
        }
Exemplo n.º 6
0
        public void Started(Vector2 startingPoint, Vector2 point)
        {
            Photocopier photocopier = this.SelectionViewModel.Photocopier;

            if (photocopier.FolderRelativeId == null)
            {
                this.ImagePage.TipSelect();
                return;
            }

            Photo photo = Photo.FindFirstPhoto(photocopier);

            if (photo == null)
            {
                this.ImagePage.TipSelect();
                return;
            }

            //History
            LayeragesArrangeHistory history = new LayeragesArrangeHistory("Add layer", this.ViewModel.LayerageCollection);

            this.ViewModel.HistoryPush(history);

            //Transformer
            this._sizeWidth  = photo.Width;
            this._sizeHeight = photo.Height;
            Transformer transformerSource      = new Transformer(photo.Width, photo.Height, Vector2.Zero);
            Transformer transformerDestination = this.CreateTransformer(startingPoint, point, photo.Width, photo.Height);

            //Mezzanine
            ImageLayer imageLayer = new ImageLayer(this.ViewModel.CanvasDevice)
            {
                Photocopier = photocopier,
                IsSelected  = true,
                Transform   = new Transform(transformerSource, transformerDestination),
                Style       = this.SelectionViewModel.StandGeometryStyle
            };
            Layerage imageLayerage = imageLayer.ToLayerage();

            LayerBase.Instances.Add(imageLayer);


            this.MezzanineLayerage = imageLayerage;
            LayerageCollection.Mezzanine(this.ViewModel.LayerageCollection, this.MezzanineLayerage);

            this.SelectionViewModel.Transformer = transformerDestination; //Selection

            this.ViewModel.Invalidate(InvalidateMode.Thumbnail);          //Invalidate
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a ImageBrush.
        /// </summary>
        /// <param name="center"> The center. </param>
        /// <param name="width"> The photocopier width. </param>
        /// <param name="height"> The photocopier height. </param>
        /// <param name="photocopier"> The photocopier. </param>
        /// <returns> The product <see cref="IBrush"/>. </returns>
        public static IBrush ImageBrush(Vector2 center, float width, float height, Photocopier photocopier)
        {
            Vector2 xPoint = new Vector2(center.X + width / 2, center.Y);
            Vector2 yPoint = new Vector2(center.X, center.Y + height / 2);

            return(new BrushBase
            {
                Type = BrushType.Image,

                Photocopier = photocopier,

                Center = center,
                XPoint = xPoint,
                YPoint = yPoint,
            });
        }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a ImageBrush.
        /// </summary>
        /// <param name="transformer"> The transformer. </param>
        /// <param name="photocopier"> The photocopier. </param>
        /// <returns> The product <see cref="IBrush"/>. </returns>
        public static IBrush ImageBrush(Transformer transformer, Photocopier photocopier)
        {
            Vector2 center = transformer.Center;
            Vector2 xPoint = transformer.CenterRight;
            Vector2 yPoint = transformer.CenterBottom;

            return(new BrushBase
            {
                Type = BrushType.Image,

                Photocopier = photocopier,

                Center = center,
                XPoint = xPoint,
                YPoint = yPoint,
            });
        }
Exemplo n.º 9
0
    static void Main(string[] args)
    {
        Dog dog1 = new Dog();
        // TODO: Przypisz dowolne warto±ci tym skªadowym i wypisz je na ekranie konsoli za pomoc¡ metody WriteLine
        typu Console.

        dog.WagItsTail();

        // Animal myAnimal = new Dog();
        // Dog myDog = new Animal();


        Dog myDog = new Dog();

        // Animal a = myDog; // rzutowanie w gore
        Console.WriteLine(a.Name);
        // a.WagItsTail(); // blad kompilacji
        Dog d = (Dog)a;
        // a.WagItsTail(); // wywolanie metody sie uda


        Dog   dog2   = new Dog("dog2");
        Snake snake2 = new Snake("snake2");

        // Animal animal2 = new Animal("animal2");

        dog2.SayHello();
        snake2.SayHello();
        // animal2.SayHello();

        IPrintable photocopier = new Photocopier();
        IPrintable printer     = new Printer();
        // Print()
        ICopiable copier = new Photocopier();
        // Copy() i Print()

        var pcbBom1 = new PCBBom(printer);
        var pcbBom2 = new PCBBom(photocopier);

        pcbBomA.Print();
        pcbBomB.Print();
    }