void UpdatePartView()
        {
            var    uri = new UriBuilder();
            string viewType;

            PartModel.DirtyChanged += PartModel_DirtyChanged;
            var part = PartModel.Part;

            if (ContentTypes.IsMonacoSupportedType(part.ContentType))
            {
                uri      = new UriBuilder(Data.WebHost.GetUrl(part.GetMonacoEditorUrl()));
                viewType = "⚡";

                if (Data.Settings.EditorDarkMode)
                {
                    uri.Query += "&theme=dark";
                }

                if (Data.Settings.EditorReadOnlyMode)
                {
                    uri.Query += "&readonly=true";
                }
            }
            else if (ContentTypes.IsSupportedAudioType(part.ContentType))
            {
                uri      = new UriBuilder(Data.WebHost.GetUrl($"part/{part.Uri}"));
                viewType = "🎵";
            }
            else if (ContentTypes.IsSupportedImageType(part.ContentType))
            {
                uri      = new UriBuilder(Data.WebHost.GetUrl($"part/{part.Uri}"));
                viewType = "🎨";
            }
            else if (ContentTypes.IsSupportedVideoType(part.ContentType))
            {
                uri      = new UriBuilder(Data.WebHost.GetUrl($"part/{part.Uri}"));
                viewType = "🖥";
            }
            else
            {
                uri      = new UriBuilder("about:blank");
                viewType = "?";
            }

            var header = ((CloseButtonTabHeader)Header);

            header.Text     = $"{part.Uri}";
            header.ViewType = viewType;

            Browser.Source = uri.Uri;
        }
Exemple #2
0
        void UpdatePartView()
        {
            var    uri = new UriBuilder();
            string viewType;

            if (ContentTypes.IsMonacoSupportedType(PackageItem.Part.Left?.ContentType ?? PackageItem.Part.Right?.ContentType))
            {
                uri      = new UriBuilder(Data.WebHost.GetUrl(PackageItem.Part.GetMonacoDiffUrl()));
                viewType = "⚡";

                if (Data.Settings.EditorDarkMode)
                {
                    uri.Query += "&theme=dark";
                }
            }

            // TODO: other types
            //else if (ContentTypes.IsSupportedAudioType(part.ContentType))
            //{
            //	uri = new UriBuilder(Data.WebHost.GetUrl($"part/{part.Uri}"));
            //	viewType = "🎵";
            //}
            //else if (ContentTypes.IsSupportedImageType(part.ContentType))
            //{
            //	uri = new UriBuilder(Data.WebHost.GetUrl($"part/{part.Uri}"));
            //	viewType = "🎨";
            //}
            //else if (ContentTypes.IsSupportedVideoType(part.ContentType))
            //{
            //	uri = new UriBuilder(Data.WebHost.GetUrl($"part/{part.Uri}"));
            //	viewType = "🖥";
            //}
            else
            {
                uri      = new UriBuilder("about:blank");
                viewType = "?";
            }

            var header = ((CloseButtonTabHeader)Header);

            header.Text     = $"{PackageItem.Part.Uri}";
            header.ViewType = viewType;

            Browser.Source = uri.Uri;
        }