1. Список говнокодов пользователя Gru

    Всего: 1

  2. C# / Говнокод #1676

    +132.8

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    //------------------------------------------------------------
    // Copyright (c) Microsoft Corporation.  All rights reserved.
    //------------------------------------------------------------
    
       private void AddDesigner()
            {
                Lazy<HostSurfaceFactory, IDesignerMetadataView> exportSurfaceFactory = fileNewDialog.GetHostFactory();
                HostControl hc = new HostControl();
                if (designerCounts.ContainsKey(exportSurfaceFactory.Metadata.ItemType))
                    designerCounts[exportSurfaceFactory.Metadata.ItemType]++;
                else
                    designerCounts.Add(exportSurfaceFactory.Metadata.ItemType, 1);
                string siteName = exportSurfaceFactory.Metadata.ItemType + designerCounts[exportSurfaceFactory.Metadata.ItemType].ToString();
                HostSurface hostSurface = exportSurfaceFactory.Value.CreateNew(siteName);
                hc.InitializeHost(hostSurface);
                string fileName = siteName + "." + exportSurfaceFactory.Metadata.FileExtension;
                TabPage tabpage = new TabPage(fileName + " - Design");
                tabpage.Tag = exportSurfaceFactory.Metadata.Language;
                hc.Parent = tabpage;
                hc.Dock = DockStyle.Fill;
                this.tabControl1.TabPages.Add(tabpage);
                this.tabControl1.SelectedIndex = this.tabControl1.TabPages.Count - 1;
                this.outputWindow.Writeline("Opened new host.");
                this.toolbox.DesignerHost = hostSurface.DesignerHost;
                this.solutionExplorer.AddFileNode(fileName);
                SetupMenus(hostSurface);
            }

    Пример из MEF. Написан неким Dinesh Chandnani.

    Gru, 25 Августа 2009

    Комментарии (8)