예제 #1
0
        void InitializeView()
        {
            ImageList smalllist = new ImageList();
            ImageList imglist   = new ImageList();

            smalllist.ColorDepth = ColorDepth.Depth32Bit;
            imglist.ColorDepth   = ColorDepth.Depth32Bit;

            imglist.ImageSize   = new Size(32, 32);
            smalllist.ImageSize = new Size(16, 16);

            smalllist.Images.Add(IconService.GetBitmap("Icons.32x32.EmptyFileIcon"));
            imglist.Images.Add(IconService.GetBitmap("Icons.32x32.EmptyFileIcon"));

            int       i   = 0;
            Hashtable tmp = new Hashtable(icons);

            foreach (DictionaryEntry entry in icons)
            {
                Bitmap bitmap = IconService.GetBitmap(entry.Key.ToString());
                if (bitmap != null)
                {
                    smalllist.Images.Add(bitmap);
                    imglist.Images.Add(bitmap);
                    tmp[entry.Key] = ++i;
                }
                else
                {
                    LoggingService.Warn("NewFileDialog: can't load bitmap " + entry.Key.ToString() + " using default");
                }
            }

            icons = tmp;
            foreach (TemplateItem item in alltemplates)
            {
                if (item.Template.Icon == null)
                {
                    item.ImageIndex = 0;
                }
                else
                {
                    item.ImageIndex = (int)icons[item.Template.Icon];
                }
            }

            templateListView.LargeImageList = imglist;
            templateListView.SmallImageList = smalllist;

            InsertCategories(null, categories);

            categoryTreeView.TreeViewNodeSorter = new TemplateCategoryComparer();
            categoryTreeView.Sort();

            TreeViewHelper.ApplyViewStateString(PropertyService.Get("Dialogs.NewFileDialog.CategoryViewState", ""), categoryTreeView);
            categoryTreeView.SelectedNode = TreeViewHelper.GetNodeByPath(categoryTreeView, PropertyService.Get("Dialogs.NewFileDialog.LastSelectedCategory", "C#"));
        }
예제 #2
0
        void InitializeView()
        {
            ImageList smalllist = new ImageList();
            ImageList imglist   = new ImageList();

            smalllist.ColorDepth = ColorDepth.Depth32Bit;
            imglist.ColorDepth   = ColorDepth.Depth32Bit;

            imglist.ImageSize   = new Size(32, 32);
            smalllist.ImageSize = new Size(16, 16);

            smalllist.Images.Add(IconService.GetBitmap("Icons.32x32.EmptyFileIcon"));
            imglist.Images.Add(IconService.GetBitmap("Icons.32x32.EmptyFileIcon"));

            int i = 0;

            foreach (var image in icons.Keys.ToArray())
            {
                Bitmap bitmap = image.Bitmap;
                if (bitmap != null)
                {
                    smalllist.Images.Add(bitmap);
                    imglist.Images.Add(bitmap);
                    icons[image] = ++i;
                }
                else
                {
                    LoggingService.Warn("NewFileDialog: can't load bitmap " + image.ToString() + " using default");
                }
            }

            foreach (TemplateItem item in alltemplates)
            {
                if (item.Template.Icon == null)
                {
                    item.ImageIndex = 0;
                }
                else
                {
                    item.ImageIndex = (int)icons[item.Template.Icon];
                }
            }

            templateListView.LargeImageList = imglist;
            templateListView.SmallImageList = smalllist;

            TreeViewHelper.ApplyViewStateString(PropertyService.Get("Dialogs.NewFileDialog.CategoryViewState", ""), categoryTreeView);
            categoryTreeView.SelectedNode = TreeViewHelper.GetNodeByPath(categoryTreeView, PropertyService.Get("Dialogs.NewFileDialog.LastSelectedCategory", "C#"));
        }