private void DisplayContent(Webresource resource)
        {
            if (resource == null)
            {
                return;
            }

            var existingContent = dpMain.Contents.OfType <BaseContentForm>().FirstOrDefault(c => c.Resource == resource);

            if (existingContent != null)
            {
                existingContent.Show(dpMain, existingContent.DockState);
                return;
            }

            BaseContentForm content = null;

            switch (resource.Type)
            {
            case (int)WebresourceType.Gif:
            case (int)WebresourceType.Jpg:
            case (int)WebresourceType.Png:
            case (int)WebresourceType.Vector:
            {
                content = new ImageContentForm(this, resource);
            }
            break;

            case (int)WebresourceType.Resx:
            {
                content = new ResxContentForm(this, resource);
            }
            break;

            case (int)WebresourceType.Data:
            case (int)WebresourceType.Xsl:
            case (int)WebresourceType.Css:
            case (int)WebresourceType.Script:
            case (int)WebresourceType.WebPage:
            {
                content = new CodeEditorForm(this, resource);
            }
            break;

            case (int)WebresourceType.Ico:
            case (int)WebresourceType.Silverlight:
            {
                MessageBox.Show(this, @"No visualization available for this webresource type", @"Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            break;
            }

            if (content != null)
            {
                content.TabPageContextMenuStrip = cmsTabs;
                content.Show(dpMain, DockState.Document);
            }
        }
        private void DisplayContentForm(Webresource resource)
        {
            BaseContentForm content = null;

            switch (resource.Type)
            {
            case (int)WebresourceType.Gif:
            case (int)WebresourceType.Jpg:
            case (int)WebresourceType.Png:
            case (int)WebresourceType.Vector:
            {
                content = new ImageContentForm(this, resource);
            }
            break;

            case (int)WebresourceType.Resx:
            {
                content = new ResxContentForm(this, resource);
            }
            break;

            case (int)WebresourceType.Data:
            case (int)WebresourceType.Xsl:
            case (int)WebresourceType.Css:
            case (int)WebresourceType.Script:
            case (int)WebresourceType.WebPage:
            {
                content = new CodeEditorForm(this, resource);
            }
            break;

            case (int)WebresourceType.Ico:
            case (int)WebresourceType.Silverlight:
            {
                MessageBox.Show(this, @"No visualization available for this webresource type", @"Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            break;
            }

            if (content != null)
            {
                content.Settings = settings;
                content.TabPageContextMenuStrip = cmsTabs;
                content.Show(dpMain, DockState.Document);
            }
        }
Exemple #3
0
 private void Ctvf_PortalItemSelected(object sender, PortalItemSelectedEventArgs e)
 {
     if (e.Item != null)
     {
         var content = dpMain.Contents.OfType <CodeEditorForm>().FirstOrDefault(c => c.Item == e.Item);
         if (content == null)
         {
             content = new CodeEditorForm(e.Item, mySettings, Service);
             content.UpdateRequested        += Content_UpdateRequested;
             content.TabPageContextMenuStrip = cmsTab;
             content.Show(dpMain, DockState.Document);
         }
         else
         {
             content.Show(dpMain, content.DockState);
         }
     }
 }