コード例 #1
0
        protected override async Task Do(FileInfo file)
        {
            Task haveLockObj = null, haventLockObj = null;

            try
            {
                if (HaveSize(EditImage.LoadBitmap(file.FullName)))
                {
                    if (!viewModel.Have.IsDo)
                    {
                        return;
                    }

                    haveLockObj = CopyMoveFiles.Current.ToFolder(file,
                                                                 viewModel.Have.Dest.FullName, viewModel.Have.IsCopy);
                }
                else if (viewModel.Havent.IsDo)
                {
                    haventLockObj = CopyMoveFiles.Current.ToFolder(file,
                                                                   viewModel.Havent.Dest.FullName, viewModel.Havent.IsCopy);
                }
            }
            catch { }

            await haveLockObj.ToNotNull();

            await haventLockObj.ToNotNull();
        }
コード例 #2
0
    private bool UpLoadImageFile(FileInfo info)
    {
        try
        {
            ///
            /// striming image
            ///
            byte[]     byteContent   = new byte[info.Length];
            FileStream objFileStream = info.OpenRead();
            objFileStream.Read(byteContent, 0, byteContent.Length);
            objFileStream.Close();

            ///
            /// Processing image
            ///

            byteContent = EditImage.GetThumbNail(byteContent, 124, 90, true);



            byteContent = EditImage.SetWatermark(byteContent, WebConfig.GetValues("FName"), 50, true, 36);

            ///
            /// DataBase operation starts
            ///
            HF_SSID.Value = getSucessID();
            //DateTime dateTemp = DateTime.Parse(DDL_dobMonth.SelectedIndex.ToString() + "/" + DDL_dobDay.SelectedValue + "/" + DDL_dobYear.SelectedValue);
            return(MatrimonialSuccessStoryManager.AddSuccessStory(HF_SSID.Value, TB_SucessStory.Text, L_MatID.Text, TB_Bride.Text, TB_Groom.Text, DateTime.Parse(DDL_dobMonth.SelectedIndex.ToString() + "/" + DDL_dobDay.SelectedValue + "/" + DDL_dobYear.SelectedValue), byteContent));
        }
        catch (Exception ex)
        {
            return(false);
        }
    }
コード例 #3
0
        /* Mode édition */
        private void modeEdition_CheckedChanged(object sender, System.EventArgs e)
        {
            if (modeEdition.Checked)
            {
                if (editImage == null)
                {
                    editImage = new EditImage();
                }

                editImage.Show();
                editImage.evtChangeZoom += ChangeZoom;
                editImage.evtChangePen  += ChangePen;
                editImage.evtClose      += CloseEditImage;
                editImage.SetPenColor(bitmapCpc.GetPaletteColor(numCol));
            }
            else
            {
                if (editImage != null)
                {
                    editImage.Hide();
                    editImage.evtChangeZoom -= ChangeZoom;
                    editImage.evtChangePen  -= ChangePen;
                    editImage.evtClose      -= CloseEditImage;
                    editImage = null;
                    ChangeZoom(1);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// 添加图片
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addImage_Click(object sender, RoutedEventArgs e)
        {
            //添加图片控件
            EditImage img = new EditImage();

            img.Width = img.Height = 40;
            this.container.Children.Add(img);
        }
コード例 #5
0
        private void EditMapping(object obj)
        {
            var typeImageRecord = ImageMappings.ElementAt(SelectedIndex);

            if (typeImageRecord != null)
            {
                EditImage.Edit(typeImageRecord);
            }
        }
コード例 #6
0
 void MessageControl_Observers(object sender, EditImage msg)
 {
     if (IsActive)
     {
         if (msg.CurrentShapImage == null)
         {
             EditImage();
         }
         else
         {
             shapeControl.Invalidate();
         }
     }
 }
コード例 #7
0
 public string editImage(EditImage model)
 {
     try
     {
         using (var client = new WebClient())
         {
             //CONVERTO IL BASE64 IN IMMAGINE
             StringBuilder sbText = new StringBuilder(model.Image, model.Image.Length);
             sbText.Replace("\r\n", String.Empty);
             sbText.Replace(" ", String.Empty);
             Byte[]       bitmapData   = Convert.FromBase64String(sbText.ToString().Replace("data:image/jpeg;base64,", String.Empty));
             MemoryStream streamBitmap = new MemoryStream(bitmapData);
             Bitmap       bitImage     = new Bitmap((Bitmap)Image.FromStream(streamBitmap));
             //SCALO LE DIMENSIONI DELL'IMMAGINE
             Bitmap   b = new Bitmap(256, 256);
             Graphics g = Graphics.FromImage((Image)b);
             g.InterpolationMode = InterpolationMode.HighQualityBicubic;
             g.DrawImage(bitImage, 0, 0, 256, 256);
             g.Dispose();
             MemoryStream ms = new MemoryStream();
             b.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
             byte[] byteImage = ms.ToArray();
             var    SigBase64 = Convert.ToBase64String(byteImage);
             //CARICO L'IMMAGINE RIMPICCIOLITA
             var values = new NameValueCollection();
             values["api_method"] = "setImage";
             values["api_data"]   = JsonConvert.SerializeObject(new { mobile = model.Mobile, img = SigBase64 });
             var     response       = client.UploadValues(model.ip, values);
             var     responseString = Encoding.Default.GetString(response);
             dynamic result         = JsonConvert.DeserializeObject(responseString);
             if (!(bool)result.IsError)
             {
                 this.isError      = false;
                 this.errorMessage = result.Message;
             }
             else
             {
                 this.isError      = true;
                 this.errorMessage = result.Message;
             }
         }
     }
     catch (Exception e)
     {
         this.isError      = true;
         this.errorMessage = e.Message;
     }
     return(JsonConvert.SerializeObject(new { isError = this.isError, errorMessage = this.errorMessage }));
 }
コード例 #8
0
        protected override Task Do(FileInfo src)
        {
            try
            {
                string    destPath = Path.Combine(viewModel.Dest.FullName, src.Name);
                EditImage img      = viewModel.CreateEditImage(src.FullName);

                SavePicture(img.GetEditBitmap(), destPath);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Editor.Do");
                System.Diagnostics.Debug.WriteLine(e.ToString());
            }

            return(Task.CompletedTask);
        }
コード例 #9
0
    private bool UpLoadImageFile()
    {
        /// striming image
        try
        {
            byte[] byteContent = File_Upload.FileBytes;
            //Insert Image into session

            Session.Add("ImageToCrop", EditImage.GetThumbNail(byteContent, 600, 600, true));
            byteContent = null;
            //retruning Values
            return(true);
        }
        catch (Exception)
        {
            return(false);
        }
    }
コード例 #10
0
    protected void IB_Crop_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            ///GetImage
            byte[] byteArray = (byte[])Session["ImageToCrop"];

            // Removing image from session
            Session.Remove("ImageToCrop");

            /// Get Application String

            HttpCookieCollection objHttpCookieCollection = Request.Cookies;
            HttpCookie           objHttpCookie           = objHttpCookieCollection.Get("MatRegInfo");
            string strApplicationID = Crypto.DeCrypto(objHttpCookie.Values["ApplicationID"]);


            /// crop image
            byteArray = EditImage.CropImageFile(byteArray, Convert.ToInt32(HiddenW.Value), Convert.ToInt32(HiddenH.Value), Convert.ToInt32(HiddenX.Value), Convert.ToInt32(HiddenY.Value));

            /// make thumbnail
            byteArray = EditImage.GetThumbNail(byteArray, 128, 128, false);

            /// water mark image


            byteArray = EditImage.SetWatermark(byteArray, WebConfig.GetValues("FName"), 80, true, 16);

            /// upload into database
            if (MatrimonialAlbumManager.InsertPhoto(strApplicationID, byteArray, MatrimonialAlbumManager.ImageType.Photo))
            {
                Response.Redirect("../Extras/Sucess.aspx");
            }
            else
            {
                Response.Redirect("image.aspx?id=Error");
            }
        }
        catch (Exception)
        {
        }
    }
コード例 #11
0
ファイル: PreloadImage.cs プロジェクト: ShelbyBoss/Editure
        private async Task <Tuple <string, BitmapImage> > GetTupleAsync(int index, int offset)
        {
            int startIndex = index;

            if (pictures.Count == 0)
            {
                return(null);
            }

            index = (index + offset + pictures.Count) % pictures.Count;

            try
            {
                string      path = pictures[index].FullName;
                BitmapImage bmp  = await EditImage.LoadBitmapAsync(path);

                return(new Tuple <string, BitmapImage>(path, bmp));
            }
            catch { }

            return(null);
        }
コード例 #12
0
ファイル: PreloadImage.cs プロジェクト: ShelbyBoss/Editure
        public async Task <BitmapImage> TryGetImageAsync(string path)
        {
            if (path == CurrentPath)
            {
                return(Current);
            }
            if (path == PreviousPath)
            {
                return(Previous);
            }
            if (path == NextPath)
            {
                return(Next);
            }

            try
            {
                return(await EditImage.LoadBitmapAsync(path));
            }
            catch { }

            return(null);
        }
コード例 #13
0
    private bool UpLoadImageFile(FileInfo info)
    {
        /*
         * UserAlbum_UpdateHoroscope
         * UserAlbum_InsertImage
         *
         *  @ApplicationID varchar(15)
         *  @Horoscope image
         *  @HoroPassword Varchar(25)
         */


        try
        {
            ///
            /// striming image
            ///
            byte[]     byteContent   = new byte[info.Length];
            FileStream objFileStream = info.OpenRead();
            objFileStream.Read(byteContent, 0, byteContent.Length);
            objFileStream.Close();

            ///
            /// Processing image
            ///

            byteContent = EditImage.GetThumbNail(byteContent, 600, 600, true);



            byteContent = EditImage.SetWatermark(byteContent, WebConfig.GetValues("FName"), 50, true, 36);

            ///
            /// DataBase operation starts
            ///

            HttpCookieCollection objHttpCookieCollection = Request.Cookies;
            HttpCookie           objHttpCookie           = objHttpCookieCollection.Get("MatCookie5639sb");

            string strApplicationID = Crypto.DeCrypto(objHttpCookie.Values["ApplicationID"]);



            using (SqlConnection objConnection = DBConnection.GetSqlConnection())
            {
                SqlCommand objCommand = new SqlCommand("UserAlbum_InsertImage", objConnection);

                if (MatrimonialAlbumManager.IsAlbumExists(strApplicationID))
                {
                    objCommand = new SqlCommand("UserAlbum_UpdateHoroscope", objConnection);
                }

                objCommand.CommandType = CommandType.StoredProcedure;
                /// Inserting parameters

                objCommand.Parameters.Add(new SqlParameter("@ApplicationID", SqlDbType.VarChar));
                objCommand.Parameters["@ApplicationID"].Value = strApplicationID;

                objCommand.Parameters.Add(new SqlParameter("@Horoscope", SqlDbType.Image));
                objCommand.Parameters["@Horoscope"].Value = byteContent;

                if (!RB_H_No.Checked)
                {
                    objCommand.Parameters.Add(new SqlParameter("@HoroPassword", SqlDbType.VarChar));
                    objCommand.Parameters["@HoroPassword"].Value = TB_Password.Text;
                }
                /// Execute Sql Query

                objConnection.Open();
                objCommand.ExecuteNonQuery();
                objConnection.Close();
            }
            return(true);
        }
        catch (Exception ex)
        {
            // ErrorLog
            return(false);
        }
    }
コード例 #14
0
    private bool UpLoadImageFile(FileInfo info)
    {
        /*
         * UserAlbum_UpdateHoroscope
         * UserAlbum_InsertImage
         *
         *  @ApplicationID varchar(15)
         *  @Horoscope image
         */


        try
        {
            ///
            /// striming image
            ///
            byte[]     byteContent   = new byte[info.Length];
            FileStream objFileStream = info.OpenRead();
            objFileStream.Read(byteContent, 0, byteContent.Length);
            objFileStream.Close();

            ///
            /// Processing image
            ///

            byteContent = EditImage.GetThumbNail(byteContent, 600, 600, true);


            byteContent = EditImage.SetWatermark(byteContent, WebConfig.GetValues("FName"), 50, true, 36);

            ///
            /// DataBase operation starts
            ///

            string strApplicationID = MatrimonialMemberShip.GetApplicationID(TB_MatrimonialID.Text);


            using (SqlConnection objConnection = DBConnection.GetSqlConnection())
            {
                SqlCommand objCommand = new SqlCommand("UserAlbum_InsertImage", objConnection);

                if (MatrimonialAlbumManager.IsAlbumExists(strApplicationID))
                {
                    objCommand = new SqlCommand("UserAlbum_UpdateHoroscope", objConnection);
                }

                objCommand.CommandType = CommandType.StoredProcedure;
                /// Inserting parameters

                objCommand.Parameters.Add(new SqlParameter("@ApplicationID", SqlDbType.VarChar));
                objCommand.Parameters["@ApplicationID"].Value = strApplicationID;

                objCommand.Parameters.Add(new SqlParameter("@Horoscope", SqlDbType.Image));
                objCommand.Parameters["@Horoscope"].Value = byteContent;

                /// Execute Sql Query

                objConnection.Open();
                objCommand.ExecuteNonQuery();
                objConnection.Close();
            }
            return(true);
        }
        catch (Exception Ex)
        {
            ErrorLog.WriteErrorLog("Admin_Protected_DeleteHoroscope", Ex);
            return(false);
        }
    }
コード例 #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request.QueryString["matid"] == null) || (Request.QueryString["id"] == null))
        {
            Server.Transfer("../extras/ErrorReport.aspx");
        }
        else
        {
            string strApplicationID;


            //get image
            byte[] byteImageArray = null;

            switch (Request.QueryString["id"])
            {
            case "1":    // member photo
                strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]);
                if (strApplicationID != null)
                {
                    byteImageArray = MatrimonialAlbumManager.GetImage(strApplicationID, MatrimonialAlbumManager.ImageType.Photo);
                }
                break;

            case "2":    //Album1
                strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]);
                if (strApplicationID != null)
                {
                    byteImageArray = MatrimonialAlbumManager.GetImage(strApplicationID, MatrimonialAlbumManager.ImageType.Album1);
                }
                break;

            case "3":    //Album2
                strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]);
                if (strApplicationID != null)
                {
                    byteImageArray = MatrimonialAlbumManager.GetImage(strApplicationID, MatrimonialAlbumManager.ImageType.Album2);
                }
                break;

            case "4":    //Album3
                strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]);
                if (strApplicationID != null)
                {
                    byteImageArray = MatrimonialAlbumManager.GetImage(strApplicationID, MatrimonialAlbumManager.ImageType.Album3);
                }
                break;

            case "5":    //Horoscope
                strApplicationID = MatrimonialMemberShip.GetApplicationID(Request.QueryString["matid"]);
                if (strApplicationID != null)
                {
                    byteImageArray = MatrimonialAlbumManager.GetImage(strApplicationID, MatrimonialAlbumManager.ImageType.Horoscope);
                }
                break;

            case "6":    //SucessStory
                byteImageArray = MatrimonialAlbumManager.GetImage(Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.SucessStory);
                break;

            default:
                byteImageArray = null;
                return;
            }

            // if image present

            if (byteImageArray != null)
            {
                //resize image if needed

                switch (Request.QueryString["type"])
                {
                case "124":
                    byteImageArray = EditImage.GetThumbNail(byteImageArray, 124, 124, false);
                    break;

                case "98":
                    byteImageArray = EditImage.GetThumbNail(byteImageArray, 98, 98, false);
                    break;

                case "75":
                    byteImageArray = EditImage.GetThumbNail(byteImageArray, 75, 75, false);
                    break;
                }
                //displaying image
                Response.ContentType = "text/HTML";
                Response.BinaryWrite(byteImageArray);
            }
            else
            {
                DisplayError();
            }
        }
    }
コード例 #16
0
    protected void IB_Crop_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            MatrimonialAlbumManager.ImageType enuImageType = MatrimonialAlbumManager.ImageType.Photo;

            switch (Convert.ToSByte(Session["ImageID"]))
            {
            case 1:
                enuImageType = MatrimonialAlbumManager.ImageType.Photo;
                break;

            case 2:
                enuImageType = MatrimonialAlbumManager.ImageType.Album1;
                break;

            case 3:
                enuImageType = MatrimonialAlbumManager.ImageType.Album2;
                break;

            case 4:
                enuImageType = MatrimonialAlbumManager.ImageType.Album3;
                break;

            default:
                Response.Redirect("image.aspx?id=Error");
                break;
            }

            ///GetImage
            byte[] byteArray = (byte[])Session["ImageToCrop"];

            // Removing image from session
            Session.Remove("ImageToCrop");

            /// Get Application String

            HttpCookieCollection objHttpCookieCollection = Request.Cookies;
            HttpCookie           objHttpCookie           = objHttpCookieCollection.Get("MatCookie5639sb");
            string strApplicationID = Crypto.DeCrypto(objHttpCookie.Values["ApplicationID"]);


            /// crop image
            byteArray = EditImage.CropImageFile(byteArray, Convert.ToInt32(HiddenW.Value), Convert.ToInt32(HiddenH.Value), Convert.ToInt32(HiddenX.Value), Convert.ToInt32(HiddenY.Value));

            /// make thumbnail
            if (enuImageType == MatrimonialAlbumManager.ImageType.Photo)
            {
                byteArray = EditImage.GetThumbNail(byteArray, 128, 128, false);
            }
            else
            {
                byteArray = EditImage.GetThumbNail(byteArray, 600, 600, true);
            }

            /// water mark image


            byteArray = EditImage.SetWatermark(byteArray, WebConfig.GetValues("FName"), 80, true, 16);

            //Which image is to be uploaded ?



            /// Add new image(Insert) or change newimage (Update) ?


            switch (MatrimonialAlbumManager.IsAlbumExists(strApplicationID))
            {
            case false:
                // Insert Image into database

                if (MatrimonialAlbumManager.InsertPhoto(strApplicationID, byteArray, enuImageType))
                {
                    Response.Redirect("../Extras/Sucess.aspx");
                }
                else
                {
                    Response.Redirect("image.aspx?id=Error");
                }
                break;

            case true:     // Update Image
                if (MatrimonialAlbumManager.InsertPhoto(strApplicationID, byteArray, enuImageType))
                {
                    Response.Redirect("../Extras/Sucess.aspx");
                }
                else
                {
                    Response.Redirect("image.aspx?id=Error");
                }
                break;

            default:
                Response.Redirect("imaxge.aspx?id=Error");
                break;
            }
        }
        catch (Exception)
        {
        }
    }
コード例 #17
0
    private bool UpLoadImageFile(FileInfo info)
    {
        /*
         * UserSuccessStory_InsertStory
         *
         *  @SStoryID varchar(15) = NULL,
         *  @MatrimonialID varchar(10) = NULL,
         *  @Bride varchar(50) = NULL,
         *  @Groom varchar(50) = NULL,
         *  @WeddingDate smalldatetime = NULL,
         *  @Photo image = NULL
         */


        try
        {
            ///
            /// striming image
            ///
            byte[]     byteContent   = new byte[info.Length];
            FileStream objFileStream = info.OpenRead();
            objFileStream.Read(byteContent, 0, byteContent.Length);
            objFileStream.Close();

            ///
            /// Processing image
            ///

            byteContent = EditImage.GetThumbNail(byteContent, 124, 90, true);



            byteContent = EditImage.SetWatermark(byteContent, WebConfig.GetValues("FName"), 50, true, 36);

            ///
            /// DataBase operation starts
            ///



            using (SqlConnection objConnection = DBConnection.GetSqlConnection())
            {
                SqlCommand objCommand = new SqlCommand("UserSuccessStory_InsertStory", objConnection);
                objCommand.CommandType = CommandType.StoredProcedure;

                /// Inserting parameters

                string strTemp = getSucessID();

                objCommand.Parameters.Add(new SqlParameter("@SStoryID", SqlDbType.VarChar));
                objCommand.Parameters["@SStoryID"].Value = strTemp;


                objCommand.Parameters.Add(new SqlParameter("@SucessStory", SqlDbType.VarChar));
                objCommand.Parameters["@SucessStory"].Value = TB_SucessStory.Text;

                objCommand.Parameters.Add(new SqlParameter("@MatrimonialID", SqlDbType.VarChar));
                objCommand.Parameters["@MatrimonialID"].Value = TB_MatID.Text;


                objCommand.Parameters.Add(new SqlParameter("@Bride", SqlDbType.VarChar));
                objCommand.Parameters["@Bride"].Value = TB_Bride.Text;


                objCommand.Parameters.Add(new SqlParameter("@Groom", SqlDbType.VarChar));
                objCommand.Parameters["@Groom"].Value = TB_Groom.Text;

                /// <<<<<<<<<<<< ForTesting >>>>>>>>>>>>
                objCommand.Parameters.Add(new SqlParameter("@WeddingDate", SqlDbType.SmallDateTime));
                objCommand.Parameters["@WeddingDate"].Value = DateTime.Parse(TB_Date.Text);


                objCommand.Parameters.Add(new SqlParameter("@Photo", SqlDbType.Image));
                objCommand.Parameters["@Photo"].Value = byteContent;

                /// Execute Sql Query

                objConnection.Open();
                objCommand.ExecuteNonQuery();
                objConnection.Close();

                //Setting SuccessPannel
                PN_Success.Visible = true;
                SuccessPannel1.Bind(strTemp);
            }
            return(true);
        }
        catch (Exception)
        {
            // ErrorLog
            return(false);
        }
    }
コード例 #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request.QueryString["matid"] == null) || (Request.QueryString["id"] == null))
        {
        }
        else
        {
            HttpCookieCollection objHttpCookieCollection = Request.Cookies;
            HttpCookie           objHttpCookie           = objHttpCookieCollection.Get("MatCookie5639sb");

            string strMatID = Crypto.DeCrypto(objHttpCookie.Values["MatrimonialID"]);



            //get image
            byte[] byteImageArray = null;

            switch (Request.QueryString["id"])
            {
            case "1":    // member photo

                if (strMatID != null)
                {
                    byteImageArray = MatrimonialAlbumManager.GetProtectedImage(strMatID, Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.Photo);
                }
                break;

            case "2":    //Album1

                if (strMatID != null)
                {
                    byteImageArray = MatrimonialAlbumManager.GetProtectedImage(strMatID, Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.Album1);
                }
                break;

            case "3":    //Album2

                if (strMatID != null)
                {
                    byteImageArray = MatrimonialAlbumManager.GetProtectedImage(strMatID, Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.Album2);
                }
                break;

            case "4":    //Album3

                if (strMatID != null)
                {
                    byteImageArray = MatrimonialAlbumManager.GetProtectedImage(strMatID, Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.Album3);
                }
                break;

            case "5":    //Horoscope

                if (strMatID != null)
                {
                    byteImageArray = MatrimonialAlbumManager.GetProtectedImage(strMatID, Request.QueryString["matid"], MatrimonialAlbumManager.ImageType.Horoscope);
                }
                break;

            default:
                byteImageArray = null;
                return;
            }

            // if image present

            if (byteImageArray != null)
            {
                //resize image if needed

                if (Request.QueryString["type"] == "124")
                {
                    byteImageArray = EditImage.GetThumbNail(byteImageArray, 124, 124, false);
                }
                //displaying image
                Response.ContentType = "text/HTML";
                Response.BinaryWrite(byteImageArray);
            }
            else
            {
                DisplayError();
                //Write ErrorLog
                ErrorLog.WriteLog("ImagePro byteImageArray=Null");
            }
        }
    }