Exemple #1
0
        public void View(string path, ContextObject context)
        {
            _tvp = new TextViewerPanel(path);

            context.ViewerContent = _tvp;
            context.Title         = $"{Path.GetFileName(path)}";

            context.IsBusy = false;
        }
Exemple #2
0
        public void View(string path, ContextObject context)
        {
            if (path.ToLower().EndsWith(".rtf"))
            {
                var        rtfBox = new RichTextBox();
                FileStream fs     = File.OpenRead(path);
                rtfBox.Selection.Load(fs, DataFormats.Rtf);
                rtfBox.IsReadOnly = true;
                rtfBox.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
                rtfBox.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;

                context.ViewerContent = rtfBox;
                context.IsBusy        = false;
            }
            else
            {
                _tvp = new TextViewerPanel(path, context);
                context.ViewerContent = _tvp;
            }
            context.Title = $"{Path.GetFileName(path)}";
        }
Exemple #3
0
 public void Cleanup()
 {
     _tvp = null;
 }
Exemple #4
0
 public void Cleanup()
 {
     _tvp?.Dispose();
     _tvp = null;
 }
Exemple #5
0
        private void AssignHighlightingManager(TextViewerPanel tvp, ContextObject context)
        {
            var isDark = (context.Theme == Themes.Dark) | OSThemeHelper.AppsUseDarkTheme() | false;

            tvp.HighlightingManager = isDark ? _hlmDark : _hlmLight;
        }