Beispiel #1
0
 private void UpdateStyleSelectionPreview(Styles.Style style)
 {
     Task.Factory.StartNew(obj =>
     {
         var targetStyle = (Styles.Style)obj;
         var imageBuffer = StyleHelper.GetImageBufferFromStyle(targetStyle);
         if (Application.Current != null)
         {
             Application.Current.Dispatcher.BeginInvoke(new Action(() =>
             {
                 var imageSource       = ThinkGeo.MapSuite.GisEditor.Plugins.StyleHelper.ConvertToImageSource(imageBuffer);
                 SelectionStylePreview = imageSource;
             }), DispatcherPriority.Background, null);
         }
     }, style);
 }
        public void UpdateEditStylePreviewASync()
        {
            var editOverlay = SharedViewModel.Instance.EditOverlay;

            if (editOverlay != null)
            {
                editOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle  = null;
                editOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle  = null;
                editOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = null;
                editOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle  = null;
                if (EditCompositeStyle != null)
                {
                    foreach (var tempStyle in EditCompositeStyle?.Styles)
                    {
                        editOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(tempStyle);
                    }
                }
            }

            if (Application.Current != null)
            {
                Task.Factory.StartNew(obj =>
                {
                    var targetStyle = (Style)obj;
                    var imageBuffer = StyleHelper.GetImageBufferFromStyle(targetStyle);
                    if (Application.Current != null)
                    {
                        Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                        {
                            var imageSource  = StyleHelper.ConvertToImageSource(imageBuffer);
                            EditStylePreview = imageSource;
                        }), DispatcherPriority.Background, null);
                    }
                }, EditCompositeStyle);
            }
        }