Пример #1
0
        void IVimBufferCreationListener.VimBufferCreated(IVimBuffer vimBuffer)
        {
            if (!_vim.VimRcState.IsLoadSucceeded)
            {
                return;
            }

            var wpfTextView = vimBuffer.TextView as IWpfTextView;

            if (wpfTextView == null)
            {
                return;
            }

            var state = ((VimRcState.LoadSucceeded)_vim.VimRcState);

            // If the notification has occured then there is nothing else to do.  We are done
            if (!_vimApplicationSettings.HaveNotifiedVimRcLoad && state.VimRcPath.VimRcKind == VimRcKind.VimRc)
            {
                var linkBanner = new LinkBanner
                {
                    LinkAddress = "https://github.com/jaredpar/VsVim/wiki/FAQ#vimrc",
                    LinkText    = "FAQ",
                    BannerText  = "VsVim automatically loaded an existing _vimrc file"
                };
                _toastNotificationServiceProvider.GetToastNoficationService(wpfTextView).Display(_notifyToastKey, linkBanner, OnNotifyClosed);
            }

            if (!_vimApplicationSettings.HaveNotifiedVimRcErrors && state.Errors.Length != 0)
            {
                var errorBanner = new ErrorBanner();
                errorBanner.ViewClick += (sender, e) => OnViewClick(state.Errors);
                _toastNotificationServiceProvider.GetToastNoficationService(wpfTextView).Display(_errorToastKey, errorBanner, OnErrorClosed);
            }
        }
        void IVimBufferCreationListener.VimBufferCreated(IVimBuffer vimBuffer)
        {
            // If the notification has occured then there is nothing else to do.  We are done
            if (_vimApplicationSettings.HaveNotifiedVimRcLoad)
            {
                return;
            }

            if (!_vim.VimRcState.IsLoadSucceeded)
            {
                return;
            }

            var vimRcPath = ((VimRcState.LoadSucceeded)_vim.VimRcState).Item;
            if (vimRcPath.VimRcKind != VimRcKind.VimRc)
            {
                return;
            }

            var wpfTextView = vimBuffer.TextView as IWpfTextView;
            if (wpfTextView == null)
            {
                return;
            }

            var linkBanner = new LinkBanner();
            linkBanner.LinkAddress = "https://github.com/jaredpar/VsVim/wiki/FAQ#vimrc";
            linkBanner.LinkText = "FAQ";
            linkBanner.BannerText = "VsVim automatically loaded an existing _vimrc file";
            _toastNotificationServiceProvider.GetToastNoficationService(wpfTextView).Display(_toastKey, linkBanner, OnToastNotificationClosed);
        }
        void IVimBufferCreationListener.VimBufferCreated(IVimBuffer vimBuffer)
        {
            // If the notification has occured then there is nothing else to do.  We are done
            if (_vimApplicationSettings.HaveNotifiedVimRcLoad)
            {
                return;
            }

            if (!_vim.VimRcState.IsLoadSucceeded)
            {
                return;
            }

            var vimRcPath = ((VimRcState.LoadSucceeded)_vim.VimRcState).Item;

            if (vimRcPath.VimRcKind != VimRcKind.VimRc)
            {
                return;
            }

            var wpfTextView = vimBuffer.TextView as IWpfTextView;

            if (wpfTextView == null)
            {
                return;
            }

            var linkBanner = new LinkBanner();

            linkBanner.LinkAddress = "https://github.com/jaredpar/VsVim/wiki/FAQ#vimrc";
            linkBanner.LinkText    = "FAQ";
            linkBanner.BannerText  = "VsVim automatically loaded an existing _vimrc file";
            _toastNotificationServiceProvider.GetToastNoficationService(wpfTextView).Display(_toastKey, linkBanner, OnToastNotificationClosed);
        }
        void IVimBufferCreationListener.VimBufferCreated(IVimBuffer vimBuffer)
        {
            if (!_vim.VimRcState.IsLoadSucceeded)
            {
                return;
            }

            var wpfTextView = vimBuffer.TextView as IWpfTextView;
            if (wpfTextView == null)
            {
                return;
            }

            var state = ((VimRcState.LoadSucceeded)_vim.VimRcState);

            // If the notification has occured then there is nothing else to do.  We are done
            if (!_vimApplicationSettings.HaveNotifiedVimRcLoad && state.Item1.VimRcKind == VimRcKind.VimRc)
            {
                var linkBanner = new LinkBanner();
                linkBanner.LinkAddress = "https://github.com/jaredpar/VsVim/wiki/FAQ#vimrc";
                linkBanner.LinkText = "FAQ";
                linkBanner.BannerText = "VsVim automatically loaded an existing _vimrc file";
                _toastNotificationServiceProvider.GetToastNoficationService(wpfTextView).Display(_notifyToastKey, linkBanner, OnNotifyClosed);
            }

            if (!_vimApplicationSettings.HaveNotifiedVimRcErrors && state.Item2.Length != 0)
            {
                var errorBanner = new ErrorBanner();
                errorBanner.ViewClick += (sender, e) => OnViewClick(state.Item2);
                _toastNotificationServiceProvider.GetToastNoficationService(wpfTextView).Display(_errorToastKey, errorBanner, OnErrorClosed);
            }
        }