Пример #1
0
        public ImageSource GetLayerPreviewSource(Layer layer)
        {
            ImageSource imageSource = null;

            GettingLayerPreviewSourceLayerPluginEventArgs arg1 = new GettingLayerPreviewSourceLayerPluginEventArgs(null, layer);

            OnGettingLayerPreview(arg1);

            if (arg1.Cancel)
            {
                imageSource = arg1.ImageSource ?? new BitmapImage();
            }
            else
            {
                imageSource = GetLayerPreviewSourceCore(layer);

                GottenLayerPreviewSourceLayerPluginEventArgs arg2 = new GottenLayerPreviewSourceLayerPluginEventArgs(imageSource, layer);
                OnGottenLayerPreview(arg2);

                if (arg2 != null)
                {
                    imageSource = arg2.ImageSource;
                }
            }

            return(imageSource);
        }
Пример #2
0
        protected virtual void OnGettingLayerPreview(GettingLayerPreviewSourceLayerPluginEventArgs e)
        {
            EventHandler <GettingLayerPreviewSourceLayerPluginEventArgs> handler = GettingLayerPreviewSource;

            if (handler != null)
            {
                handler(this, e);
            }
        }