protected virtual 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(WinFormsResourceService.GetBitmap("Icons.32x32.EmptyProjectIcon")); imglist.Images.Add(WinFormsResourceService.GetBitmap("Icons.32x32.EmptyProjectIcon")); // load the icons and set their index from the image list in the hashtable int i = 0; Dictionary <string, int> tmp = new Dictionary <string, int>(icons); foreach (KeyValuePair <string, int> entry in icons) { Bitmap bitmap = IconService.GetBitmap(entry.Key); if (bitmap != null) { smalllist.Images.Add(bitmap); imglist.Images.Add(bitmap); tmp[entry.Key] = ++i; } else { LoggingService.Warn("NewProjectDialog: can't load bitmap " + entry.Key.ToString() + " using default"); } } // set the correct imageindex for all templates icons = tmp; foreach (TemplateItem item in alltemplates) { if (item.Template.Icon == null) { item.ImageIndex = 0; } else { item.ImageIndex = icons[item.Template.Icon]; } } templateListView.LargeImageList = imglist; templateListView.SmallImageList = smalllist; InsertCategories(null, categories); categoryTreeView.TreeViewNodeSorter = new TemplateCategoryComparer(); categoryTreeView.Sort(); string initialSelectedCategory = StringParser.Parse("C#\\${res:Templates.File.Categories.WindowsApplications}"); TreeViewHelper.ApplyViewStateString(PropertyService.Get("Dialogs.NewProjectDialog.CategoryTreeState", ""), categoryTreeView); categoryTreeView.SelectedNode = TreeViewHelper.GetNodeByPath(categoryTreeView, PropertyService.Get("Dialogs.NewProjectDialog.LastSelectedCategory", initialSelectedCategory)); }
protected virtual 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(SD.ResourceService.GetBitmap("Icons.32x32.EmptyProjectIcon")); imglist.Images.Add(SD.ResourceService.GetBitmap("Icons.32x32.EmptyProjectIcon")); // load the icons and set their index from the image list in the hashtable int i = 0; foreach (IImage icon in icons.Keys.ToArray()) { Bitmap bitmap = icon.Bitmap; if (bitmap != null) { smalllist.Images.Add(bitmap); imglist.Images.Add(bitmap); icons[icon] = ++i; } else { LoggingService.Warn("NewProjectDialog: can't load bitmap " + icon + " using default"); } } // set the correct imageindex for all templates foreach (TemplateItem item in alltemplates) { if (item.Template.Icon == null) { item.ImageIndex = 0; } else { item.ImageIndex = icons[item.Template.Icon]; } } templateListView.LargeImageList = imglist; templateListView.SmallImageList = smalllist; string initialSelectedCategory = StringParser.Parse("C#\\${res:Templates.File.Categories.WindowsApplications}"); TreeViewHelper.ApplyViewStateString(ICSharpCode.Core.PropertyService.Get("Dialogs.NewProjectDialog.CategoryTreeState", ""), categoryTreeView); categoryTreeView.SelectedNode = TreeViewHelper.GetNodeByPath(categoryTreeView, ICSharpCode.Core.PropertyService.Get("Dialogs.NewProjectDialog.LastSelectedCategory", initialSelectedCategory)); }
/// <summary> /// Restores the node state of the tree. /// </summary> public void RestoreViewState(Properties properties) { TreeViewHelper.ApplyViewStateString(properties.Get(ViewStatePropertyName, string.Empty), this); }
/// <summary> /// Reads the view state from the memento. /// </summary> public void ReadViewState(Properties memento) { TreeViewHelper.ApplyViewStateString(memento.Get("ProjectBrowserState", ""), treeView); }