/// <summary>
        ///     Called whenever the loaded image size changes
        /// </summary>
        /// <param name="pic">new image</param>
        public void LoadImage(IPic pic)
        {
            TranslationX = 0;
            TranslationY = 0;
            ResetImageBox();
            double xamScaleFactor;
            var    picHeight = pic.Size.Height;
            var    picWidth  = pic.Size.Width;

            if (picWidth >= picHeight)
            {
                xamScaleFactor = ImageBox.Width / picWidth;
            }
            else
            {
                xamScaleFactor = ImageBox.Height / picHeight;
            }

            var widthRatio  = picWidth * xamScaleFactor / ImageBox.Width;
            var heightRatio = picHeight * xamScaleFactor / ImageBox.Height;

            var minRatio = Math.Min(widthRatio, heightRatio);

            if (minRatio < 1)
            {
                Scale = 1 / minRatio;
            }
            else
            {
                Scale = 1;
            }
        }
Beispiel #2
0
 public Variable(int variableLevel, string variableName, IPic picture, Variable parentVariable)
 {
     VariableLevel  = variableLevel;
     VariableName   = variableName;
     Picture        = picture;
     ParentVariable = parentVariable;
     Variables      = new List <Variable>();
 }
        private GeneratedCodeTypes MapType(IPic pic)
        {
            if (pic is PicX)
            {
                if (pic.Length > 1)
                {
                    return(GeneratedCodeTypes.@string);
                }
                else
                {
                    return(GeneratedCodeTypes.@bool);
                }
            }

            if (pic is Pic88)
            {
                return(GeneratedCodeTypes.@bool);
            }

            if (pic is PicS9V9 || pic is Pic9V9)
            {
                return(GeneratedCodeTypes.@decimal);
            }

            if (pic is PicS9 || pic is Pic9)
            {
                if (pic.Length < 10)
                {
                    return(GeneratedCodeTypes.@int);
                }
                else
                {
                    return(GeneratedCodeTypes.@long);
                }
            }

            return(GeneratedCodeTypes.@object);
        }
Beispiel #4
0
		public static void DeletePic(IPic Pic)
		{
			try
			{
				if (!Pic.Equals(Guid.Empty))
				{
					Storage.RemoveFromStore(Storage.Stores.Pix, Pic.Pic, "jpg");
				}
			}
			catch { }

			try
			{
				if (Pic.PicMiscK > 0 && Pic.PicMisc != null)
					Pic.PicMisc.DeleteAll(null);
			}
			catch { }

			Pic.Pic = Guid.Empty;
			Pic.PicMiscK = 0;
			Pic.PicPhotoK = 0;
			Pic.PicState = "";
			((IBob)Pic).Update();
		}
Beispiel #5
0
		public static void CopyPic(IPic From, IPic To)
		{
			if (To.HasPic)
				Utilities.DeletePic(To);

			if (From.HasPic)
			{
				To.Pic = Guid.NewGuid();
				Storage.AddToStore(
					Storage.GetFromStore(Storage.Stores.Pix, From.Pic, "jpg"),
					Storage.Stores.Pix,
					To.Pic,
					"jpg",
					(IBob)To,
					"Pic");
				To.PicState = From.PicState;
				To.PicPhotoK = From.PicPhotoK;
				if (From.PicMiscK > 0)
				{
					Misc m = From.PicMisc.Duplicate();
					To.PicMiscK = m.K;
				}
				((IBob)To).Update();
			}
		}
Beispiel #6
0
 public PictureController(IPic db, Context _db)
 {
     this._db = _db;
     this.db  = db;
 }
Beispiel #7
0
        public static string PicHtml(IPic pic)
		{
			if (pic.HasPic)
				return "<img src=\"" + pic.PicPath + "\" width=\"30\" height=\"30\" border=\"0\" class=\"BorderBlack All\">";
			else
				return "<img src=\"/gfx/1pix.gif\" width=\"30\" height=\"30\" border=\"0\">";
		}