Ejemplo n.º 1
0
        public bool IsDropEnabled(DragDropInfo dragDropInfo)
        {
            _imageFilename = FontDropHandler.GetImageFilename(dragDropInfo);

            if (!string.IsNullOrEmpty(_imageFilename))
            {
                string fileExtension = Path.GetExtension(_imageFilename).ToLowerInvariant();
                if (this._imageExtensions.Contains(fileExtension))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        public bool IsDropEnabled(DragDropInfo dragDropInfo)
        {
            _imageFilename = FontDropHandler.GetImageFilename(dragDropInfo);

            if (string.IsNullOrEmpty(_imageFilename))
            {
                return(false);
            }

            if (_imageExtensions.Contains(Path.GetExtension(_imageFilename)))
            {
                return(true);
            }

            return(false);
        }
        private string GetFontFromFile(string text, IWpfTextView view, out string fontFamily)
        {
            lock (_syncRoot)
            {
                fontFamily = text;
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.InitialDirectory = Path.GetDirectoryName(EditorExtensionsPackage.DTE.ActiveDocument.FullName);
                dialog.Filter           = "Fonts (*.woff;*.eot;*.ttf;*.otf;*.svg)|*.woff;*.eot;*.ttf;*.otf;*.svg";
                dialog.DefaultExt       = ".woff";

                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return(null);
                }

                FontDropHandler fdh = new FontDropHandler(view);
                return(fdh.GetCodeFromFile(dialog.FileName, out fontFamily));
            }
        }
Ejemplo n.º 4
0
        public bool IsDropEnabled(DragDropInfo dragDropInfo)
        {
            _draggedFilename = FontDropHandler.GetImageFilename(dragDropInfo);

            return(true);
        }
        private static string GetFontFromFile(string text, IWpfTextView view, out string fontFamily)
        {
            lock (_syncRoot)
            {
                fontFamily = text;
                using (OpenFileDialog dialog = new OpenFileDialog())
                {
                    dialog.InitialDirectory = Path.GetDirectoryName(EditorExtensionsPackage.DTE.ActiveDocument.FullName);
                    dialog.Filter = "Fonts (*.woff;*.eot;*.ttf;*.otf;*.svg)|*.woff;*.eot;*.ttf;*.otf;*.svg";
                    dialog.DefaultExt = ".woff";

                    if (dialog.ShowDialog() != DialogResult.OK)
                        return null;

                    FontDropHandler fdh = new FontDropHandler(view);
                    return fdh.GetCodeFromFile(dialog.FileName, out fontFamily);
                }
            }
        }