/// <summary>
        /// 从数据库得到对象的图片
        /// </summary>
        /// <param name="id"></param>
        /// <param name="propertyName"></param>
        /// <param name="timePoint"></param>
        /// <returns></returns>
        public SchemaObjectPhoto LoadObjectPhoto(string id, string propertyName, DateTime timePoint)
        {
            SchemaObjectPhoto result = null;
            SchemaObjectBase  obj    = SchemaObjectAdapter.Instance.Load(id, timePoint);

            if (obj != null)
            {
                if (obj.Properties.ContainsKey(propertyName))
                {
                    ImageProperty imgInfo = JSONSerializerExecute.Deserialize <ImageProperty>(obj.Properties[propertyName].StringValue);

                    if (imgInfo != null)
                    {
                        MaterialContent mc = MaterialContentAdapter.Instance.Load(builder => builder.AppendItem("CONTENT_ID", imgInfo.ID)).FirstOrDefault();

                        if (mc != null)
                        {
                            result = new SchemaObjectPhoto()
                            {
                                ImageInfo = imgInfo, ContentData = mc.ContentData
                            }
                        }
                        ;
                    }
                }
            }

            return(result);
        }
Example #2
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            List <ImageProperty> imagePropertyJson = serializer.Deserialize <List <ImageProperty> >(reader);
            List <ImageProperty> imageList         = new List <ImageProperty>();

            for (int i = 0; i < imagePropertyJson.Count; i++)
            {
                ImageProperty img = new ImageProperty();
                img.color    = imagePropertyJson[i].color;
                img.type     = imagePropertyJson[i].type;
                img.imageUrl = imagePropertyJson[i].imageUrl;

                if (!string.IsNullOrEmpty(imagePropertyJson[i].imageUrl))
                {
                    RuntimeLoading.Instance.LoadImage(imagePropertyJson[i].imageUrl, (Texture2D texture, Sprite sprite) =>
                    {
                        img.sprite = sprite;
                    });
                }

                imageList.Add(img);
            }

            return(imageList);
        }
Example #3
0
        private void ElementLV_ItemClick(object sender, ItemClickEventArgs e)
        {
            Elemento clicado = (Elemento)e.ClickedItem;

            ElementLB.Text = String.Format("{0} ({1})", clicado.Name, clicado.Symbol.Replace(" ", ""));

            // load UI elements
            PropLV.Items.Clear();
            IsotopesLV.Items.Clear();
            AtomImageLV.Items.Clear();

            PropLV.Items.Add(new ElementProperty("Atomic Number:", clicado.ANumber));
            PropLV.Items.Add(new ElementProperty("Atomic Mass:", clicado.AMass));
            PropLV.Items.Add(new ElementProperty("Boiling Point:", clicado.BP));
            PropLV.Items.Add(new ElementProperty("Melting Point:", clicado.MP));
            PropLV.Items.Add(new ElementProperty("Protons and Electrons:", clicado.NoPE));
            PropLV.Items.Add(new ElementProperty("Classification: ", clicado.Classification));
            PropLV.Items.Add(new ElementProperty("Density:", clicado.Density));
            PropLV.Items.Add(new ElementProperty("Color:", clicado.Color));
            PropLV.Items.Add(new ElementProperty("Crystal Structure:", clicado.CrystalGeo));

            // update isotopes
            IsotopesLV.Items.Add(new ElementProperty("Isotopes", clicado.Name));
            foreach (KeyValuePair <string, string> kv in clicado.Isotopes)
            {
                ElementProperty prop = new ElementProperty(kv.Key, " " + kv.Value);
                IsotopesLV.Items.Add(prop);
            }

            // update image
            ImageProperty ip = new ImageProperty(new BitmapImage(
                                                     new Uri(clicado.AtomicStructureImage, UriKind.Absolute)));

            AtomImageLV.Items.Add(ip);
        }
        /// <summary>
        /// 根据Image 的Fillmothed 设置fillorgin的值
        /// </summary>
        /// <param name="data"></param>
        private void SetImageFillOriginProperty(ref ImageProperty data)
        {
            switch (data.m_FillMethod)
            {
            case Image.FillMethod.Radial180:
                m_TargetImage.fillOrigin = (int)data.m_fillOrigin180;
                break;

            case Image.FillMethod.Radial360:
                m_TargetImage.fillOrigin = (int)data.m_fillOrigin360;
                break;

            case Image.FillMethod.Radial90:
                m_TargetImage.fillOrigin = (int)data.m_fillOrigin90;
                break;

            case Image.FillMethod.Horizontal:
                m_TargetImage.fillOrigin = (int)data.m_fillOriginHorizontal;
                break;

            case Image.FillMethod.Vertical:
                m_TargetImage.fillOrigin = (int)data.m_fillOriginVertical;
                break;
            }
        }
Example #5
0
        /// <summary>
        /// Retrurns true if the Images version of the property has not been customised, or contains one of our images. Returns false
        /// if the image has been customised and we don't own the image that has been used. All other plugins have priority over us.
        /// </summary>
        /// <param name="imageProperty"></param>
        /// <returns></returns>
        private bool CanOverwriteImagesVersion(ImageProperty imageProperty)
        {
            var result = true;

            if (imageProperty.HasBeenCustomised)
            {
                object theirImage = null;
                object ourImage   = null;

                switch (imageProperty.FileImageType)
                {
                case FileImageType.Bitmap:
                    theirImage = imageProperty.Bitmap;
                    ourImage   = _CustomBitmaps.ContainsKey(imageProperty.Name) ? _CustomBitmaps[imageProperty.Name] : null;
                    break;

                case FileImageType.Icon:
                    theirImage = imageProperty.Icon;
                    ourImage   = _CustomIcons.ContainsKey(imageProperty.Name) ? _CustomIcons[imageProperty.Name] : null;
                    break;

                default:
                    throw new NotImplementedException();
                }

                result = Object.ReferenceEquals(theirImage, ourImage);
            }

            return(result);
        }
Example #6
0
        protected void bT_Click(object sender, EventArgs e)
        {
            var imgProStr = propertyGrid.Properties.GetValue("Image1", "");

            if (imgProStr != "")
            {
                ImageProperty imgPro = JSONSerializerExecute.Deserialize <ImageProperty>(imgProStr);
                if (imgPro.Changed)
                {
                    ImagePropertyAdapter.Instance.UpdateWithContent(imgPro);
                    propertyGrid.Properties.SetValue("Image1", JSONSerializerExecute.Serialize(imgPro));
                }
            }

            imgProStr = propertyGrid.Properties.GetValue("Image2", "");
            if (imgProStr != "")
            {
                ImageProperty imgPro = JSONSerializerExecute.Deserialize <ImageProperty>(imgProStr);
                if (imgPro.Changed)
                {
                    ImagePropertyAdapter.Instance.UpdateWithContent(imgPro);
                    propertyGrid.Properties.SetValue("Image2", JSONSerializerExecute.Serialize(imgPro));
                }
            }
        }
Example #7
0
        /// <summary>
        /// Writes the image comments to the stream.
        /// </summary>
        /// <typeparam name="TPixel">The pixel format.</typeparam>
        /// <param name="image">The <see cref="ImageBase{TPixel}"/> to be encoded.</param>
        /// <param name="writer">The stream to write to.</param>
        private void WriteComments <TPixel>(Image <TPixel> image, EndianBinaryWriter writer)
            where TPixel : struct, IPixel <TPixel>
        {
            if (this.options.IgnoreMetadata == true)
            {
                return;
            }

            ImageProperty property = image.MetaData.Properties.FirstOrDefault(p => p.Name == GifConstants.Comments);

            if (property == null || string.IsNullOrEmpty(property.Value))
            {
                return;
            }

            byte[] comments = this.options.TextEncoding.GetBytes(property.Value);

            int count = Math.Min(comments.Length, 255);

            this.buffer[0] = GifConstants.ExtensionIntroducer;
            this.buffer[1] = GifConstants.CommentLabel;
            this.buffer[2] = (byte)count;

            writer.Write(this.buffer, 0, 3);
            writer.Write(comments, 0, count);
            writer.Write(GifConstants.Terminator);
        }
Example #8
0
        private void AddPicToEdit()
        {
            try
            {
                //设置纸张 印刷区域大小
                userControlPicEdit.SetArea(new Size(1024, 1024), new Size(900, 900));

                List <string> listPath = GetImagePath();

                List <ImageProperty> listImageInfo = new List <ImageProperty>();
                foreach (string path in listPath)
                {
                    ImageProperty imageInfo = new ImageProperty()
                    {
                        Name = path
                    };
                    Bitmap image = new Bitmap(path, true);
                    imageInfo.EditImage = image;
                    //设定图片显示时 初始大小
                    imageInfo.DrawSize = new Size(280, 280);
                    //显示比例 大小锁定
                    imageInfo.LockSizeRate = true;
                    listImageInfo.Add(imageInfo);
                }
                userControlPicEdit.SetImage(listImageInfo);
            }
            catch (Exception ex)
            {
            }
        }
Example #9
0
 private void AddPicToEditNew()
 {
     try
     {
         var printSize = new SizeParam(this.Request.PrintSize);
         var paperSize = new SizeParam(this.Request.PaperSize);
         //设置纸张 印刷区域大小
         userControlPicEdit.SetArea(new Size(paperSize.Width, paperSize.Height), new Size(printSize.Width, printSize.Height));
         List <ImageProperty> listImageInfo = new List <ImageProperty>();
         if (this.Request.Images != null)
         {
             this.Request.Images.ForEach(x => {
                 ImageProperty imageInfo = new ImageProperty()
                 {
                     Name = x.Path
                 };
                 imageInfo.EditImage = x.Image;
                 //设定图片显示时 初始大小
                 imageInfo.DrawSize = new Size(280, 280);
                 //显示比例 大小锁定
                 imageInfo.LockSizeRate = true;
                 listImageInfo.Add(imageInfo);
             });
         }
         userControlPicEdit.SetImage(listImageInfo);
     }
     catch (Exception ex)
     {
     }
 }
Example #10
0
        void executor_SaveApplicationData(WfExecutorDataContext dataContext)
        {
            if (Scene.Current.SceneID == "First_Default")
            {
                var process    = dataContext.CurrentProcess;
                var properties = this.propertyForm.Properties;

                var imgProStr = properties.GetValue("Image", "");
                if (imgProStr != "")
                {
                    ImageProperty imgPro = JSONSerializerExecute.Deserialize <ImageProperty>(imgProStr);
                    if (imgPro.Changed)
                    {
                        ImagePropertyAdapter.Instance.UpdateWithContent(imgPro);
                        properties.SetValue("Image", JSONSerializerExecute.Serialize(imgPro));
                    }
                }

                var deltaData = MaterialControl.GetCommonDeltaMaterials();
                MaterialAdapter.Instance.SaveCommonDeltaMaterials(deltaData);

                //DynamicFormDataAdapter.Instance.Update(this.ViewData.Data);
                this.ViewData.Data.Properties          = properties;
                process.RootProcess.Context["appData"] = SerializationHelper.SerializeObjectToString(this.ViewData.Data, SerializationFormatterType.Binary);
            }
        }
    public void AddAttribute(string p_name, string p_value)
    {
        string        nodeName = "";
        ImageProperty imgProp  = new ImageProperty();

        Debug.Log("AddAttribute " + p_name + " " + p_value);
        if (0 == ATTRIBUTE_NAME.CompareTo(p_name.ToLower()))
        {
            if (0 < m_counter)
            {
                bool flag = m_properties.TryGetValue(m_counter - 1, out imgProp);
                nodeName = flag ? imgProp.m_name : "";
            }

            if (0 != nodeName.CompareTo(p_value))
            {
                imgProp        = new ImageProperty();
                imgProp.m_name = p_value;
                m_properties.Add(m_counter, imgProp);
                m_counter++;
            }
        }

        return;
    }
Example #12
0
        public void UpdateUserImage()
        {
            var userImagePropName = "PhotoKey";

            SCUser user = SCObjectGenerator.PrepareUserObject();

            SCObjectOperations.Instance.AddUser(user, SCOrganization.GetRoot());

            ImageProperty image = ImageGenerator.PrepareImage();

            image.ResourceID = user.ID;

            Assert.IsTrue(CanSerialize(image));

            SCObjectOperations.Instance.UpdateObjectImageProperty(user, userImagePropName, image);

            SCUser userLoad = (SCUser)SchemaObjectAdapter.Instance.Load(user.ID);

            Assert.IsNotNull(userLoad);

            var imageLoad = JSONSerializerExecute.Deserialize <ImageProperty>(userLoad.Properties[userImagePropName].StringValue);
            MaterialContentCollection mcc = MaterialContentAdapter.Instance.Load(builder => builder.AppendItem("CONTENT_ID", imageLoad.ID));

            Assert.AreEqual(image.Name, imageLoad.Name);
            Assert.IsNotNull(mcc);
            Assert.AreEqual(1, mcc.Count);
            Assert.AreEqual(image.Content.ContentData.Length, mcc[0].ContentData.Length);

            SCObjectOperations.Instance.UpdateObjectImageProperty(user, userImagePropName, null);
            userLoad = (SCUser)SchemaObjectAdapter.Instance.Load(user.ID);

            Assert.AreEqual("", userLoad.Properties[userImagePropName].StringValue);
        }
Example #13
0
        public void ConstructorImageMetaData()
        {
            ImageMetaData metaData = new ImageMetaData();

            ExifProfile   exifProfile   = new ExifProfile();
            ImageProperty imageProperty = new ImageProperty("name", "value");

            metaData.ExifProfile          = exifProfile;
            metaData.FrameDelay           = 42;
            metaData.HorizontalResolution = 4;
            metaData.VerticalResolution   = 2;
            metaData.Properties.Add(imageProperty);
            metaData.Quality        = 24;
            metaData.RepeatCount    = 1;
            metaData.DisposalMethod = DisposalMethod.RestoreToBackground;

            ImageMetaData clone = new ImageMetaData(metaData);

            Assert.Equal(exifProfile.ToByteArray(), clone.ExifProfile.ToByteArray());
            Assert.Equal(42, clone.FrameDelay);
            Assert.Equal(4, clone.HorizontalResolution);
            Assert.Equal(2, clone.VerticalResolution);
            Assert.Equal(imageProperty, clone.Properties[0]);
            Assert.Equal(24, clone.Quality);
            Assert.Equal(1, clone.RepeatCount);
            Assert.Equal(DisposalMethod.RestoreToBackground, clone.DisposalMethod);
        }
Example #14
0
 protected override void LoadClientState(string clientState)
 {
     if (string.IsNullOrEmpty(clientState) == false)
     {
         this.imgProp = JSONSerializerExecute.Deserialize <ImageProperty>(clientState);
     }
 }
Example #15
0
        protected override void FillPropertiesToTable(SCObjectAndRelation obj, DataRow row)
        {
            base.FillPropertiesToTable(obj, row);

            row["FIRST_NAME"] = obj.Detail.Properties.GetValue("FirstName", string.Empty);
            row["LAST_NAME"]  = obj.Detail.Properties.GetValue("LastName", string.Empty);

            row["AccountDisabled"]     = obj.Detail.Properties.GetValue("AccountDisabled", false);
            row["PasswordNotRequired"] = obj.Detail.Properties.GetValue("PasswordNotRequired", false);
            row["DontExpirePassword"]  = obj.Detail.Properties.GetValue("DontExpirePassword", false);

            row["AccountInspires"] = obj.Detail.Properties.GetValue("AccountInspires", DateTime.MinValue);
            row["AccountExpires"]  = obj.Detail.Properties.GetValue("AccountExpires", DateTime.MinValue);

            row["Address"] = obj.Detail.Properties.GetValue("Address", string.Empty);
            row["MP"]      = obj.Detail.Properties.GetValue("MP", string.Empty);
            row["WP"]      = obj.Detail.Properties.GetValue("WP", string.Empty);
            row["Sip"]     = obj.Detail.Properties.GetValue("Sip", string.Empty);

            row["OtherMP"]        = obj.Detail.Properties.GetValue("OtherMP", string.Empty);
            row["CompanyName"]    = obj.Detail.Properties.GetValue("CompanyName", string.Empty);
            row["DepartmentName"] = obj.Detail.Properties.GetValue("DepartmentName", string.Empty);

            string photoKey   = obj.Detail.Properties.GetValue("PhotoKey", string.Empty);
            string photoStamp = string.Empty;

            if (string.IsNullOrEmpty(photoKey) == false)
            {
                ImageProperty ip = (ImageProperty)MCS.Web.Library.Script.JSONSerializerExecute.Deserialize <ImageProperty>(photoKey);
                photoStamp = ip.UpdateTime.ToString("yyyyMMddHHmmss") + "|" + ip.ID;
            }

            row["PhotoTimestamp"] = photoStamp;
        }
Example #16
0
 public static void CreateImg(List <ImageProperty> target, ref int[] id)
 {
     for (int i = 0; i < target.Count; i++)
     {
         ImageProperty temp = target[i];
         id[i] = CreateImg(ref temp);
     }
 }
        public void AreEqual()
        {
            var property1 = new ImageProperty("Foo", "Bar");
            var property2 = new ImageProperty("Foo", "Bar");

            Assert.Equal(property1, property2);
            Assert.True(property1 == property2);
        }
        private void PART_ComboBoxMedia_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((string)PART_ComboBoxMedia.SelectedItem == resources.GetString("LOCGameIconTitle"))
            {
                LmImageToolsSelected = LmImageToolsIcon;
            }
            if ((string)PART_ComboBoxMedia.SelectedItem == resources.GetString("LOCGameCoverImageTitle"))
            {
                LmImageToolsSelected = LmImageToolsCover;
            }
            if ((string)PART_ComboBoxMedia.SelectedItem == resources.GetString("LOCGameBackgroundTitle"))
            {
                LmImageToolsSelected = LmImageToolsBackground;
            }

            ImageProperty imageProperty = LmImageToolsSelected.GetOriginalImageProperty();

            PART_ImageOriginalSize.Content = imageProperty.Width + " x " + imageProperty.Height;

            PART_GridOriginalContener.Children.Clear();
            cropToolControl           = new CropToolControl();
            cropToolControl.Name      = "PART_ImageOriginal";
            cropToolControl.MaxWidth  = PART_GridOriginalContener.ActualWidth;
            cropToolControl.MaxHeight = PART_GridOriginalContener.ActualHeight;

            cropToolControl.SetImage(LmImageToolsSelected.GetOriginalBitmapImage());
            PART_GridOriginalContener.Children.Add(cropToolControl);

            cropToolControl.ShowText(false);

            if (LmImageToolsSelected.GetEditedBitmapImage() != null)
            {
                PART_ImageEditedSize.Content = LmImageToolsSelected.GetEditedBitmapImage().PixelWidth + " x " + LmImageToolsSelected.GetEditedBitmapImage().PixelHeight;
                PART_ImageEdited.Source      = LmImageToolsSelected.GetEditedBitmapImage();

                if ((string)PART_ComboBoxMedia.SelectedItem == resources.GetString("LOCGameIconTitle"))
                {
                    PART_BtSetIcon.IsEnabled = false;
                }
                else
                {
                    PART_BtSetIcon.IsEnabled = !((string)PART_ComboBoxMedia.SelectedItem).IsNullOrEmpty();
                }
            }
            else
            {
                PART_ImageEditedSize.Content = string.Empty;
                PART_ImageEdited.Source      = null;

                PART_BtSetIcon.IsEnabled = false;
            }


            // Reset crop area
            PART_CropWishedWidth.Text  = string.Empty;
            PART_CropWishedHeight.Text = string.Empty;
        }
Example #19
0
        static OkSticker()
        {
            // Enable Themes for this Control
            DefaultStyleKeyProperty.OverrideMetadata(typeof(OkSticker), new FrameworkPropertyMetadata(typeof(OkSticker)));

            DescriptionProperty.OverrideMetadata(typeof(OkSticker), new FrameworkPropertyMetadata("Ok"));

            ImageProperty.OverrideMetadata(typeof(OkSticker), new FrameworkPropertyMetadata(new BitmapImage(new Uri("pack://application:,,,/WPF-Kanban;component/Res/ok.png"))));
        }
Example #20
0
        public SCUpdateObjectImageExecutor(SCOperationType opType, SchemaObjectBase obj, string propertyName, ImageProperty image)
            : base(opType)
        {
            obj.NullCheck("obj");
            propertyName.IsNullOrEmpty().TrueThrow("propertyName不能为空!");

            this._Object       = obj;
            this._PropertyName = propertyName;
            this._Image        = image;
        }
Example #21
0
        public void AreEqual()
        {
            ImageProperty property1 = new ImageProperty("Foo", "Bar");
            ImageProperty property2 = new ImageProperty("Foo", "Bar");
            ImageProperty property3 = null;

            Assert.Equal(property1, property2);
            Assert.True(property1 == property2);
            Assert.Null(property3);
        }
		public SCUpdateObjectImageExecutor(SCOperationType opType, SchemaObjectBase obj, string propertyName, ImageProperty image)
			: base(opType)
		{
			obj.NullCheck("obj");
			propertyName.IsNullOrEmpty().TrueThrow("propertyName不能为空!");

			this._Object = obj;
			this._PropertyName = propertyName;
			this._Image = image;
		}
Example #23
0
        /// <summary>
        /// Removes the icon that we currently hold for <paramref name="imageProperty"/> (if any) from the custom dictionary and
        /// adds it to the unused image list.
        /// </summary>
        /// <param name="imageProperty"></param>
        private void MarkExistingIconAsUnused(ImageProperty imageProperty)
        {
            Icon existingIcon;

            if (_CustomIcons.TryGetValue(imageProperty.Name, out existingIcon))
            {
                _CustomIcons.Remove(imageProperty.Name);
                _UnusedImages.Add(new UnusedImage(existingIcon));
            }
        }
Example #24
0
        /// <summary>
        /// Removes the bitmap that we currently hold for <paramref name="imageProperty"/> (if any) from the custom dictionary
        /// and adds it to the unused image list.
        /// </summary>
        /// <param name="imageProperty"></param>
        private void MarkExistingBitmapAsUnused(ImageProperty imageProperty)
        {
            Bitmap existingBitmap;

            if (_CustomBitmaps.TryGetValue(imageProperty.Name, out existingBitmap))
            {
                _CustomBitmaps.Remove(imageProperty.Name);
                _UnusedImages.Add(new UnusedImage(existingBitmap));
            }
        }
Example #25
0
        public void ConstructorAssignsProperties()
        {
            ImageProperty property = new ImageProperty("Foo", null);

            Assert.Equal("Foo", property.Name);
            Assert.Null(property.Value);

            property = new ImageProperty("Foo", string.Empty);
            Assert.Equal(string.Empty, property.Value);
        }
        public CroppedBitmap GetCroppedImage(ImageProperty result)
        {
            // Cut the rectangular area where the raidboss icons are
            var iconsArea = result.IconsArea;
            var iconsList = result.IconsList;

            _raidbossIconsOnly = new CroppedBitmap(
                _screenshot,
                new System.Windows.Int32Rect(iconsArea.Left, iconsArea.Top, iconsArea.Width, iconsArea.Height));

            return(_raidbossIconsOnly);
        }
Example #27
0
 private bool CanSerialize(ImageProperty image)
 {
     try
     {
         SerializationHelper.SerializeObjectToString(image, SerializationFormatterType.Binary);
         SerializationHelper.SerializeObjectToString(image, SerializationFormatterType.Soap);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Example #28
0
        private void UploadImage()
        {
            HttpResponse response = HttpContext.Current.Response;

            try
            {
                ImageProperty imageProperty = GetPostedImageProperty();
                string        opText        = WebUtility.GetRequestFormString("clientOPHidden", string.Empty);
                string        op            = !string.IsNullOrEmpty(opText) ? opText.Split(',')[0] : "";      //WebUtility.GetRequestFormString("clientOPHidden", string.Empty).Split(',')[0];
                string        inputName     = !string.IsNullOrEmpty(opText) ? opText.Split(',')[2] : "";      //WebUtility.GetRequestFormString("clientOPHidden", string.Empty).Split(',')[1];

                HttpPostedFile file = GetPostFile(inputName);

                if (file != null)
                {
                    if (this.FileMaxSize > 0 && file.ContentLength > this.FileMaxSize)
                    {
                        response.Write(GetResponseTextScript(string.Format("您上传的文件超过了{0}字节。", this.FileMaxSize)));
                        response.Write(GetClientControlInvokeStript(GetPostedControlID(), "uploadFail", "document.getElementById('responseInfo').value", ""));
                        return;
                    }

                    string filePath = string.Empty;

                    ImageUploadHelper.UploadFile(this, file, imageProperty.OriginalName, imageProperty.NewName, out filePath);
                    imageProperty.FilePath = filePath.Encrypt();

                    string imgPropJsonStr = JSONSerializerExecute.Serialize(imageProperty);

                    string uploadImageShowenUrl = CurrentPageUrl + string.Format("?imagePropID={0}&filePath={1}", imageProperty.ID, filePath.Encrypt());

                    response.Write(GetResponseTextScript(imgPropJsonStr));

                    response.Write(GetUploadImageUrlByFile(uploadImageShowenUrl));

                    string paramsData = string.Format("['{0}','{1}']", "document.getElementById('responseInfo').value", uploadImageShowenUrl);

                    response.Write(GetClientControlInvokeStript(GetPostedControlID(), "uploadSuccess", "document.getElementById('responseInfo').value", "document.getElementById('uploadImageUrlByFile').value"));
                }
            }
            catch (System.Exception ex)
            {
                response.Write(GetResponseTextScript(ex.Message));
                response.Write(GetClientControlInvokeStript(GetPostedControlID(), "uploadFail", "document.getElementById('responseInfo').value", ""));
            }
            finally
            {
                response.End();
            }
        }
Example #29
0
        /// <summary>
        /// Fills the <see cref="_ImageProperties"/> collection.
        /// </summary>
        private void BuildImagePropertiesCache()
        {
            _ImageProperties.Clear();
            var propertyInfos = typeof(Images).GetProperties(BindingFlags.Public | BindingFlags.Static)
                                .Where(r => r.PropertyType == typeof(Bitmap) || r.PropertyType == typeof(Icon))
                                .ToArray();

            foreach (var propertyInfo in propertyInfos)
            {
                var imageProperty = new ImageProperty(propertyInfo);
                var propertyName  = NormalisePropertyName(imageProperty.Name);
                _ImageProperties.Add(propertyName, imageProperty);
            }
        }
        public void AreNotEqual()
        {
            var property1 = new ImageProperty("Foo", "Bar");
            var property2 = new ImageProperty("Foo", "Foo");
            var property3 = new ImageProperty("Bar", "Bar");
            var property4 = new ImageProperty("Foo", null);

            Assert.False(property1.Equals("Foo"));

            Assert.NotEqual(property1, property2);
            Assert.True(property1 != property2);

            Assert.NotEqual(property1, property3);
            Assert.NotEqual(property1, property4);
        }
        private RectangleGeometry GenerateRectangleGeometryFull(ImageProperty imageProperty)
        {
            var scaleX = imgPhoto.ActualWidth / imageProperty.Resolution.Width;
            var scaleY = imgPhoto.ActualHeight / imageProperty.Resolution.Height;
            var rect   = new Rect
            {
                X      = imageProperty.IconsArea.Left * scaleX + offsetX,
                Y      = imageProperty.IconsArea.Top * scaleY,
                Width  = imageProperty.IconsArea.Width * scaleX,
                Height = imageProperty.IconsArea.Height * scaleY
            };
            var rg = new RectangleGeometry(rect);

            return(rg);
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImagePropertyDialog));
        this.imagePropertyControl = new Emgu.CV.UI.ImageProperty();
        this.SuspendLayout();
        //
        // imageProperty1
        //
        resources.ApplyResources(this.imagePropertyControl, "imageProperty1");
        this.imagePropertyControl.ImageBox = null;
        this.imagePropertyControl.Name = "imageProperty1";
        //
        // PropertyDialog
        //
        resources.ApplyResources(this, "$this");
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.Controls.Add(this.imagePropertyControl);
        this.Name = "PropertyDialog";
        this.ResumeLayout(false);
 }
Example #33
0
 protected override void LoadClientState(string clientState)
 {
     if (string.IsNullOrEmpty(clientState) == false)
         this.imgProp = JSONSerializerExecute.Deserialize<ImageProperty>(clientState);
 }
Example #34
0
		protected override void LoadClientState(string clientState)
		{
			object[] state = (object[])JSONSerializerExecute.DeserializeObject(clientState);

            object tempState;

            if (state[0] is object[])
            {
                object[] tempResult = (object[])state[0];
                tempState = tempResult[0];
            }
            else
            {
                tempState = state[0];
            }
            this.imgProp = JSONSerializerExecute.Deserialize<ImageProperty>(tempState);

			string postedControlID = GetPostedControlID();

			if (postedControlID.IsNullOrEmpty())
				postedControlID = ((string)state[1]).Replace('_', '$');

			HttpPostedFile file = GetPostFile(postedControlID);

			if (file != null)
			{
				if (this.imgProp.ID.IsNullOrEmpty())
					this.imgProp.ID = UuidHelper.NewUuidString();

				this.imgProp.NewName = UuidHelper.NewUuidString() + Path.GetExtension(imgProp.OriginalName);
				this.imgProp.Changed = true;

                string filePath;

                ImageUploadHelper.UploadFile(this, file, this.imgProp.OriginalName, this.imgProp.NewName, out filePath);
			}
		}
		/// <summary>
		/// 替换对象的图片属性
		/// </summary>
		/// <param name="obj"></param>
		/// <param name="propertyName"></param>
		/// <param name="image"></param>
		/// <returns></returns>
		public SchemaObjectBase UpdateObjectImageProperty(SchemaObjectBase obj, string propertyName, ImageProperty image)
		{
			SCUpdateObjectImageExecutor executor = new SCUpdateObjectImageExecutor(SCOperationType.UpdateObjectImage, obj, propertyName, image) { NeedStatusCheck = true };

			string ownerID = obj.Properties.GetValue("OwnerID", string.Empty);

			if (ownerID.IsNotEmpty())
			{
				if (this._NeedCheckPermissions)
					CheckPermissions(SCOperationType.UpdateObjectImage, SchemaDefine.GetSchema("Organizations"), "UpdateChildren", ownerID);
			}
			else
			{
				if (this._NeedCheckPermissions)
					CheckOrganizationChildrenPermissions(SCOperationType.UpdateObjectImage, "UpdateChildren", obj);
			}

			SchemaObjectBase result = null;

			ExecuteWithActions(SCOperationType.UpdateObjectImage, () => SCActionContext.Current.DoActions(() => result = (SchemaObjectBase)executor.Execute()));

			return result;
		}
		private bool CanSerialize(ImageProperty image)
		{
			try
			{
				SerializationHelper.SerializeObjectToString(image, SerializationFormatterType.Binary);
				SerializationHelper.SerializeObjectToString(image, SerializationFormatterType.Soap);
				return true;
			}
			catch
			{
				return false;
			}
		}
Example #37
0
 static extern Error _camera_set_photovf_property(IntPtr handle, ImageProperty property, ref string value, ImageProperty end);