Esempio n. 1
0
        public bool IsDropEnabled(DragDropInfo dragDropInfo)
        {
            _filename = FontDropHandler.GetImageFilename(dragDropInfo);

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

            return(this._allowedFileExtensions.Contains(Path.GetExtension(_filename)));
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        private static string GetFontFromFile(string text, IWpfTextView view, out string fontFamily)
        {
            lock (_syncRoot)
            {
                fontFamily = text;
                using (OpenFileDialog dialog = new OpenFileDialog())
                {
                    dialog.InitialDirectory = Path.GetDirectoryName(WebEssentialsPackage.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));
                }
            }
        }
        private static string GetFontFromFile(string text, IWpfTextView view, out string fontFamily)
        {
            lock (_syncRoot)
            {
                fontFamily = text;
                using (OpenFileDialog dialog = new OpenFileDialog())
                {
                    dialog.InitialDirectory = Path.GetDirectoryName(WebEssentialsPackage.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);
                }
            }
        }