프로젝트

일반

사용자정보

개정판 3b938959

ID3b9389598593358f5f751e2d612ec6bb3960a522
상위 a8aec13a
하위 5639752b

김태성이(가) 11달 전에 추가함

issue #000000 검색 수정

Change-Id: I7ac25e17a0b62f753c52f52b8a77b73bb3bbe2bf

차이점 보기:

KCOM/Controls/Symbol.xaml.cs
120 120
                foreach (var item in symbol_Private)
121 121
                {
122 122
                    Custom.Name = item.NAME;
123
                    Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL, App.isExternal);
123
                    Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL.Replace("//","/").Replace(":/", "://"), App.isExternal);
124 124
                    Custom.ID = item.ID;
125 125
                    Custom_List.Add(Custom);
126 126
                    Custom = new Symbol_Custom();
......
154 154
                foreach (var item in symbol_Public)
155 155
                {
156 156
                    Custom.Name = item.NAME;
157
                    Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL, App.isExternal);
157
                    Custom.ImageUri = CommonLib.Common.IPReplace(item.IMAGE_URL.Replace("//", "/").Replace(":/", "://"), App.isExternal);
158 158
                    Custom.ID = item.ID;
159 159
                    Custom_List.Add(Custom);
160 160
                    Custom = new Symbol_Custom();
......
164 164
            }
165 165
        }
166 166

  
167
        public async Task<PngBitmapEncoder> symImageAsync(string data,double PageAngle)
167
        public async Task<PngBitmapEncoder> symImageAsync_old(string data,double PageAngle)
168 168
        {
169 169

  
170 170
            Canvas _canvas = new Canvas();
......
214 214

  
215 215
        }
216 216

  
217
        public async Task<PngBitmapEncoder> symImageAsync(string data, double PageAngle)
218
        {
219

  
220
            Canvas _canvas = new Canvas();
221
            _canvas.Background = Brushes.White;
222

  
223
            List<Rect> rects = new List<Rect>();
224

  
225
            finalItem.Members.ForEach(member =>
226
            {
227
                if(member?.DrawingData is MarkupToPDF.ICommentRect comment)
228
                {
229
                    rects.Add(comment.GetCommentRect());
230
                }
231
            });
232

  
233
            var rect = MathHelper.CombineRects(rects);
234

  
235
            _canvas.Width = rect.Width;
236
            _canvas.Height = rect.Height;
237

  
238
            await MarkupParser.ParseAsync(App.BaseAddress, App.ViewInfo.ProjectNO, data, _canvas, PageAngle, "#FFFF0000", "", ViewerDataModel.Instance.NewMarkupCancelToken());
239

  
240
            BitmapEncoder encoder = new PngBitmapEncoder();
241
            RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)rect.Width, (int)rect.Height, 96d, 96d, PixelFormats.Pbgra32);
242

  
243
            DrawingVisual dv = new DrawingVisual();
244
            //Window window = new Window();
245
            //window.Content = _canvas;
246
            //var result = window.ShowDialog();
247
            //if(result.GetValueOrDefault())
248
            //{
249

  
250
            //}
251

  
252
            _canvas.Measure(rect.Size);
253
            _canvas.Arrange(new Rect(new System.Windows.Point { X = -rect.X + 35, Y = -rect.Y + 35 }, new Point(rect.Width + 35, rect.Height + 35)));
254

  
255
            using (DrawingContext ctx = dv.RenderOpen())
256
            {
257
                VisualBrush vb = new VisualBrush(_canvas);
258
                ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -rect.X, Y = -rect.Y }, new Point(rect.Width, rect.Height)));
259
            }
260
            Window window2 = new Window();
261
            window2.Content = _canvas;
262
            var result2 = window2.ShowDialog();
263
            if (result2.GetValueOrDefault())
264
            {
265

  
266
            }
267
            try
268
            {
269
                renderBitmap.Render(dv);
270

  
271
                GC.Collect();
272
                GC.WaitForPendingFinalizers();
273
                GC.Collect();
274
                //bitmap.Render(controlToConvert);
275
                // encode png data
276
                PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
277
                // puch rendered bitmap into it
278
                pngEncoder.Interlace = PngInterlaceOption.Off;
279
                pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap));
280
                return pngEncoder;
281

  
282
            }
283
            catch //(Exception ex)
284
            {
285
                return null;
286
            }
287

  
288
        }
289

  
217 290
        public void DialogMessage_Alert(string content, string header)
218 291
        {
219 292
            App.splashScreen.Close();
......
291 364
                {
292 365
                    if (args.DialogResult.Value)
293 366
                    {
294
                        PngBitmapEncoder _Encoder = await symImageAsync(data,ViewerDataModel.Instance.MarkupAngle);
367
                        PngBitmapEncoder _Encoder = null;
368
                        
369
                        if (finalItem.Members.Any(x=> x.DrawingData is MarkupToPDF.ICommentRect comment))
370
                        {
371
                            _Encoder = await symImageAsync(data, ViewerDataModel.Instance.MarkupAngle);
372
                        }
373
                        else
374
                        {
375
                            _Encoder = await symImageAsync_old(data, ViewerDataModel.Instance.MarkupAngle);
376
                        }
295 377

  
296 378
                        System.IO.MemoryStream fs = new System.IO.MemoryStream();
297 379
                        _Encoder.Save(fs);

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)