Exemplo n.º 1
0
        private void ApplyImageDecorator(ImageDecorator decorator, Bitmap bitmap, ref bool borderNeedsReset)
        {
            if (_embedType != ImageEmbedType.Embedded &&
                (decorator.IsBorderDecorator || decorator.Id == TiltDecorator.Id))
            {
                return;
            }

            if (borderNeedsReset &&
                _embedType == ImageEmbedType.Embedded &&
                (decorator.IsBorderDecorator || decorator.Id == TiltDecorator.Id))
            {
                borderNeedsReset = false;
                //BorderMargin = ImageBorderMargin.Empty;
            }

            try
            {
                using (ApplicationPerformance.LogEvent("ApplyDecorator: " + decorator.DecoratorName))
                    using (new WaitCursor())
                    {
                        _currImage    = bitmap;
                        _currSettings = _decoratorsList.GetImageDecoratorSettings(decorator);
                        decorator.Decorate(this);
                    }
            }
            catch (Exception e)
            {
                Trace.Fail(String.Format(CultureInfo.InvariantCulture, "Failed to apply image decorator [{0}]: {1}", decorator.DecoratorName, e.ToString()));
            }
        }
Exemplo n.º 2
0
 void _blogPostHtmlEditorControl_KeyPress(object o, HtmlEventArgs e)
 {
     using (ApplicationPerformance.LogEvent("PostEditorKeyPress"))
     {
         // These are important for helping to find bugs with autoreplace, but cause to much
         // noise with tests and testers even in debug mode.  They can have many 'false positives' hits
         if (Debugger.IsAttached)
         {
             Debug.Assert(_delayedAutoReplaceAction == null, "Delayed autoreplace operation wasn't null!");
             Debug.Assert(_typographicCharacterHandler == null, "Delayed typographic character operation wasn't null!");
         }
         _delayedAutoReplaceAction    = null;
         _typographicCharacterHandler = null;
         _lastActionWasReplace        = 0;
         _ignoreNextSelectionChange   = false;
         if (MaybeHandleKey(Convert.ToChar(e.htmlEvt.keyCode)))
         {
             e.Cancel();
         }
     }
 }
Exemplo n.º 3
0
        void _blogPostHtmlEditorControl_KeyDown(object o, HtmlEventArgs e)
        {
            try
            {
                using (ApplicationPerformance.LogEvent("PostEditorKeyDown"))
                {
                    if (HandleKey && Convert.ToChar(e.htmlEvt.keyCode) == 8)
                    {
                        _linkIgnoreWord = null;
                        if (AutoLinkEnabled)
                        {
                            MarkupPointer blockBoundary;
                            string        htmlText = GetHtmlText(out blockBoundary);

                            if (blockBoundary == null)
                            {
                                return;
                            }

                            MatchUrl(htmlText, IgnoreSuggestedUrl);
                        }

                        if (_lastActionWasReplace > 0)
                        {
                            _lastActionWasReplace--;
                            _ignoreNextSelectionChange = true;
                            _blogPostHtmlEditorControl.Undo();
                            e.Cancel();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.Fail("Error while handling backspace key, suppressing autocomplete " + ex);
                _haltAutoReplace = true;
                throw;
            }
        }