Esempio n. 1
0
 public async Task UpdateImage(Model.IamgeSaveInfo model)
 {
     try
     {
         await db.UpdateAsync(model);
     }
     catch (Exception ex)
     {
         Crashes.TrackError(ex);
     }
 }
Esempio n. 2
0
        public async Task <int> InsertImageInfo(Model.IamgeSaveInfo model)
        {
            int ret = -1;

            try
            {
                ret = await db.InsertAsync(model);
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
            return(ret);
        }
Esempio n. 3
0
        private async void btn_SaveImageInfo(object sender, EventArgs e)
        {
            if (seletedimg == null)
            {
                return;
            }

            string docDir = DirectoryUtil.Current.GetDir();

            int ret = -1;

            if (_imageID == -1)
            {
                using (SKImage image = SKImage.FromBitmap(bitmap))
                {
                    SKData   data     = image.Encode();
                    DateTime dt       = DateTime.Now;
                    string   filename = String.Format("{0:D4}{1:D2}{2:D2}-{3:D2}{4:D2}{5:D2}{6:D3}.png",
                                                      dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, dt.Millisecond);

                    Model.IamgeSaveInfo imageinfo = new IamgeSaveInfo();

                    imageinfo.CateLogId = -1;
                    //_ImagePath = Path.Combine(Path.Combine(docDir, "Iroai"), filename);
                    imageinfo.ImagePath      = _fullFilePath;
                    imageinfo.Createdatetime = DateTime.Now;
                    imageinfo.Imagebuffer    = Convert.ToBase64String(data.ToArray());

                    ret = await SqliteUtil.Current.InsertImageInfo(imageinfo);

                    if (ret == 1)
                    {
                        Model.IamgeSaveInfo savedInfo = await SqliteUtil.Current.QueryImageByFileName(imageinfo.ImagePath);

                        if (savedInfo == null)
                        {
                            await DisplayAlert("Iroai", "Save Color infomation error. Sorry!", "OK");
                        }
                        else
                        {
                            _imageID = savedInfo.ImageID;
                        }
                    }
                    else
                    {
                        await DisplayAlert("Iroai", "Save Color infomation error. Sorry!", "OK");

                        return;
                    }
                }
            }

            // save color info
            ImageColorInfo colorinfo = new ImageColorInfo();

            colorinfo.ImageID      = _imageID;
            colorinfo.HEXValue     = this.lblHex.Text;
            colorinfo.RGBValue     = this.lblRgb.Text;
            colorinfo.HSLValue     = this.lblHsl.Text;
            colorinfo.HSVValue     = this.lblHsv.Text;
            colorinfo.CMYKValue    = this.lblCmyk.Text;
            colorinfo.LABValue     = this.lblLab.Text;
            colorinfo.MUNSELLValue = this.lblMunsell.Text;
            colorinfo.PCCSValue    = this.lblPccs.Text;
            colorinfo.JISValue     = this.lblJis.Text;
            colorinfo.XValue       = (int)_point.X;

            colorinfo.YValue = (int)_point.Y;
            ret = await SqliteUtil.Current.InsertImageColorInfo(colorinfo);

            if (ret != 1)
            {
                await DisplayAlert("Iroai", "Save Color infomation error. Sorry!", "OK");

                return;
            }
            else
            {
                //await Navigation.PushModalAsync(new MainStoreList(_imageID));
            }
        }