Esempio n. 1
0
        public void SB_ExportColorIndexToDB()
        {
            Logger.Log.StartCommand(nameof(SB_ExportColorIndexToDB));
            Document doc = Application.DocumentManager.MdiActiveDocument;

            if (doc == null)
            {
                return;
            }

            try
            {
                if (!Access.Success())
                {
                    doc.Editor.WriteMessage("\nОтказано в доступе.");
                    return;
                }

                Inspector.Clear();

                ExportColor exportColor = new ExportColor();
                exportColor.Export();

                if (Inspector.HasErrors)
                {
                    Inspector.Show();
                }
            }
            catch (System.Exception ex)
            {
                doc.Editor.WriteMessage($"\nОшибка экспорта колористических индексов: {ex.Message}");
                if (!ex.Message.Contains("Отменено пользователем"))
                {
                    Logger.Log.Error(ex, $"{nameof(SB_ExportColorIndexToDB)}. {doc.Name}");
                }
            }
        }
Esempio n. 2
0
        public async Task ExportImg(int i)
        {
            int _cateLogId = (MyListView.SelectedItem as NewsListItemModel).CateLogId;
            List <IamgeSaveInfo> IamgeSaveInfoList = await SqliteUtil.Current.QueryIamgeSaveInfoByCateLogId(_cateLogId);

            var imageIdGroupList = IamgeSaveInfoList
                                   .GroupBy(x => new { x.ImageID, x.CateLogId, x.Imagebuffer })
                                   .Select(group => new
            {
                Keys = group.Key
            }).ToList();

            List <CataLogInfo> cataloginfo = await SqliteUtil.Current.QueryCataLogInfoByCateLogId(imageIdGroupList[0].Keys.CateLogId);

            List <ImageColorInfo> ImageColorInfoList = await SqliteUtil.Current.QueryImageColorInfoByImageID(imageIdGroupList[0].Keys.ImageID);

            ExportCSV exportinof = new ExportCSV();

            exportinof.Title     = cataloginfo[0].Title;
            exportinof.Folder    = cataloginfo[0].Folder;
            exportinof.ImagePath = IamgeSaveInfoList[0].ImagePath;

            exportinof.ColorList = new List <ExportColor>();

            foreach (ImageColorInfo color in ImageColorInfoList)
            {
                ExportColor exportcolor = new ExportColor();

                exportcolor.XValue       = color.XValue;
                exportcolor.YValue       = color.YValue;
                exportcolor.RGBValue     = color.RGBValue;
                exportcolor.HEXValue     = color.HEXValue;
                exportcolor.HSLValue     = color.HSLValue;
                exportcolor.HSVValue     = color.HSVValue;
                exportcolor.CMYKValue    = color.CMYKValue;
                exportcolor.LABValue     = color.LABValue;
                exportcolor.MUNSELLValue = color.MUNSELLValue;
                exportcolor.PCCSValue    = color.PCCSValue;
                exportcolor.JISValue     = color.JISValue;
                exportcolor.ScaledRatio  = color.ScaledRatio;
                exportcolor.XPis         = color.XPis;
                exportcolor.YPis         = color.YPis;
                exportcolor.DefX         = color.DefX;
                exportcolor.DefY         = color.DefY;

                exportinof.ColorList.Add(exportcolor);
            }

            var json = JsonConvert.SerializeObject(exportinof);

            string strreturnpath = string.Empty;

            if (i == 2)
            {
                await DependencyService.Get <IPhotoLibrary>().ShareAsync(exportinof.Title, json, System.Convert.FromBase64String(imageIdGroupList[0].Keys.Imagebuffer));
            }
            else
            {
                int result = await DependencyService.Get <IPhotoLibrary>().SaveAsync(exportinof.Title, json, System.Convert.FromBase64String(imageIdGroupList[0].Keys.Imagebuffer));
            }
        }