Esempio n. 1
0
 public override void OnNavigating(object parameter)
 {
     base.OnNavigating(parameter);
     if ((parameter != null) && (parameter is Guid))
     {
         Guid guid = (Guid)parameter;
         if (guid != Guid.Empty)
         {
             _dataService.GetImage(guid, new Action <FullImage, Exception>((image, ex) =>
             {
                 _image = image;
                 if (_image != null)
                 {
                     ImageData = _image.FullImageData;
                     ImageName = _image._imageName;
                     CanSave   = false;
                 }
             }));
         }
         else
         {
             _image = new FullImage {
                 _id = guid
             };
         }
     }
     else
     {
         GoBack.Execute(null);
     }
 }
Esempio n. 2
0
        public FullImage PutImage(FullImage image)
        {
            FullImageWithThumbnail imageWT = new FullImageWithThumbnail(image);
            bool      resultUpdate         = _dataService.UpdateImage(imageWT);
            FullImage result = _dataService.GetImage(image.Id);

            return(result);
        }
Esempio n. 3
0
 private void Writer_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (view == View.FullImage)
     {
         FullImage.MouseDoubleClick(e.Location);
     }
     this.Invalidate();
 }
Esempio n. 4
0
 private void EnterDown()
 {
     if (SelectedThumbIndex != -1)
     {
         view = View.FullImage;
         FullImage.LoadEntity(Entities[SelectedThumbIndex], ActivePath);
         this.Invalidate();
     }
 }
Esempio n. 5
0
 public Form1()
 {
     InitializeComponent();
     this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
     this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
     this.SetStyle(ControlStyles.ResizeRedraw, true);
     FullImage.ParentBoundry = new Size(this.Width, this.Height);
     // Enter the image path  
     FullImage.LoadImage(Image.FromFile(@"D:\a.jpg"));
 }
Esempio n. 6
0
 private void Writer_MouseDown(object sender, MouseEventArgs e)
 {
     if (view == View.Note)
     {
         drag             = true;
         initialmouseDown = e.Location;
         initial          = e.Location;
     }
     else if (view == View.FullImage)
     {
         FullImage.MouseDown(e.Location);
     }
 }
Esempio n. 7
0
        /// <summary>
        ///     Returns true if OrderMarketChange instances are equal
        /// </summary>
        /// <param name="other">Instance of OrderMarketChange to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrderMarketChange other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((AccountId == other.AccountId || AccountId != null && AccountId.Equals(other.AccountId)) &&
                   (Orc == other.Orc || Orc != null && Orc.SequenceEqual(other.Orc)) &&
                   (Closed == other.Closed || Closed != null && Closed.Equals(other.Closed)) &&
                   (Id == other.Id || Id != null && Id.Equals(other.Id)) &&
                   (FullImage == other.FullImage || FullImage != null && FullImage.Equals(other.FullImage)));
        }
Esempio n. 8
0
        public FullImage PostImage(FullImage image)
        {
            FullImageWithThumbnail imageWT = new FullImageWithThumbnail(image);
            bool resultCreate = _dataService.CreateImage(imageWT);

            if (resultCreate)
            {
                FullImage result = _dataService.GetImage(image.Id);
                return(result);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 9
0
 private void Writer_MouseUp(object sender, MouseEventArgs e)
 {
     if (view == View.Note)
     {
         drag = false;
     }
     if (e.Location == initialmouseDown)
     {
         EnterDown();
     }
     if (view == View.FullImage)
     {
         FullImage.MouseUp(e.Location);
     }
 }
Esempio n. 10
0
        /// <summary>
        ///     Returns true if OrderRunnerChange instances are equal
        /// </summary>
        /// <param name="other">Instance of OrderRunnerChange to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrderRunnerChange other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((Mb == other.Mb || Mb != null && Mb.SequenceEqual(other.Mb)) &&
                   (Uo == other.Uo || Uo != null && Uo.SequenceEqual(other.Uo)) &&
                   (Id == other.Id || Id != null && Id.Equals(other.Id)) &&
                   (Hc == other.Hc || Hc != null && Hc.Equals(other.Hc)) &&
                   (FullImage == other.FullImage || FullImage != null && FullImage.Equals(other.FullImage)) &&
                   (Ml == other.Ml || Ml != null && Ml.SequenceEqual(other.Ml)));
        }
Esempio n. 11
0
 public bool CreateImage(FullImage image)
 {
     try
     {
         using (ImageServiceClient client = new ImageServiceClient())
         {
             var item = client.PostImage(image);
             client.Close();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
        private void CreateThumbnail(HttpPostedFileBase uploadedFile)
        {
            ThumbnailImage = new WebImage(FullImage.GetBytes());

            // transform to a square by cropping
            if (ThumbnailImage.Width > ThumbnailImage.Height)
            {
                int cropAmount = (ThumbnailImage.Width - ThumbnailImage.Height) / 2;
                ThumbnailImage = ThumbnailImage.Crop(0, cropAmount, 0, cropAmount);
            }
            else
            {
                int cropAmount = (ThumbnailImage.Height - ThumbnailImage.Width) / 2;
                ThumbnailImage = ThumbnailImage.Crop(cropAmount, 0, cropAmount, 0);
            }

            ThumbnailImage.Resize(200, 200, true);
        }
Esempio n. 13
0
 protected override void OnMouseWheel(MouseEventArgs e)
 {
     if (view == View.Note)
     {
         if (e.Delta > 0)
         {
             ShiftIndex = new Point(ShiftIndex.X, ShiftIndex.Y + GlobalClass.ThumbnailSize.Width);
         }
         else
         {
             ShiftIndex = new Point(ShiftIndex.X, ShiftIndex.Y - GlobalClass.ThumbnailSize.Width);
         }
     }
     else if (view == View.FullImage)
     {
         FullImage.MouseWheel(e.Delta);
     }
     this.Invalidate();
 }
Esempio n. 14
0
 public FullImage GetImage(Guid imageId)
 {
     try
     {
         using (ImagesDatabaseEntities context = new ImagesDatabaseEntities())
         {
             FullImage result = context.Images.Where(i => i.Id == imageId)
                                .Select(i => new FullImage {
                 Id = i.Id, ImageName = i.ImageName, FullImageData = i.Data
             })
                                .FirstOrDefault();
             return(result);
         }
     }
     catch (Exception ex)
     {
         //logger
         return(null);
     }
 }
Esempio n. 15
0
 private void Writer_MouseMove(object sender, MouseEventArgs e)
 {
     if (view == View.Note)
     {
         if (drag)
         {
             ShiftIndex = new Point(ShiftIndex.X, ShiftIndex.Y + e.Location.Y - initial.Y);
             initial    = e.Location;
         }
         else
         {
             SelectedThumbIndex = FindSelection(e.Location);
         }
     }
     else if (view == View.FullImage)
     {
         FullImage.MouseMove(e.Location);
     }
     this.Invalidate();
 }
Esempio n. 16
0
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (Mb != null)
                {
                    hash = hash * 59 + Mb.GetHashCode();
                }

                if (Uo != null)
                {
                    hash = hash * 59 + Uo.GetHashCode();
                }

                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (Hc != null)
                {
                    hash = hash * 59 + Hc.GetHashCode();
                }

                if (FullImage != null)
                {
                    hash = hash * 59 + FullImage.GetHashCode();
                }

                if (Ml != null)
                {
                    hash = hash * 59 + Ml.GetHashCode();
                }

                return(hash);
            }
        }
Esempio n. 17
0
        private void Writer_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.Clear(Color.Black);
            if (view == View.Note)
            {
                for (int i = 1; i < ContentRects.Count; i++)
                {
                    // e.Graphics.SetClip(new Rectangle(0, 0, this.Width, this.Height));
                    if (ContentRects[i].Y + ShiftIndex.Y < this.Height && ShiftIndex.Y + ContentRects[i].Y + ContentRects[i].Height > 0)
                    {
                        e.Graphics.DrawString(TitleContents[i], this.Font, Brushes.White, GetShiftedRect(ContentRects[i]));
                    }
                }
                for (int i = 0; i < EntityRects.Count; i++)
                {
                    if (EntityRects[i].Y + ShiftIndex.Y < this.Height && ShiftIndex.Y + EntityRects[i].Y + EntityRects[i].Height > 0)
                    {
                        if (i == SelectedThumbIndex)
                        {
                            e.Graphics.DrawImage(SD.Images.ChangeImage.ApplyColorMatrix(Entities[i].GetThumbnail(), SD.Images.ChangeImage.ImageProperty.Negative), GetShiftedRect(EntityRects[i]));
                        }
                        else
                        {
                            e.Graphics.DrawImage(Entities[i].GetThumbnail(), GetShiftedRect(EntityRects[i]));
                        }
                    }
                }

                if (TitleContents.Count > 0)
                {
                    e.Graphics.FillRectangle(Brushes.Gold, new RectangleF(0, 0, this.Width, 30));
                    e.Graphics.DrawString(TitleContents[0], fontTitle, Brushes.Black, ContentRects[0]);
                }
            }
            else if (view == View.FullImage)
            {
                FullImage.Paint(e.Graphics);
            }
        }
Esempio n. 18
0
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (AccountId != null)
                {
                    hash = hash * 59 + AccountId.GetHashCode();
                }

                if (Orc != null)
                {
                    hash = hash * 59 + Orc.GetHashCode();
                }

                if (Closed != null)
                {
                    hash = hash * 59 + Closed.GetHashCode();
                }

                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (FullImage != null)
                {
                    hash = hash * 59 + FullImage.GetHashCode();
                }

                return(hash);
            }
        }
Esempio n. 19
0
 private void GoBackExecute()
 {
     _image    = null;
     ImageData = null;
     _navigationService.GoBack();
 }
Esempio n. 20
0
 /// <summary>
 /// Releases the image resources back to the pool.
 /// </summary>
 public void Dispose()
 {
     FullImage?.Dispose();
 }
Esempio n. 21
0
 //Create a paint event
 private void Form1_Paint(object sender, PaintEventArgs e)
 {
     FullImage.Paint(e.Graphics);
 }
Esempio n. 22
0
 public bool UpdateImage(FullImage image)
 {
     return(true);
 }
Esempio n. 23
0
 public bool CreateImage(FullImage _image)
 {
     return(true);
 }
Esempio n. 24
0
        public FullImage GetImageById(Guid imageId)
        {
            FullImage result = _dataService.GetImage(imageId);

            return(result);
        }