private void MakeModel() { UpdateTitle(); // Create new model with recursion prevention var model = new TypeInterfaceModel(myTypeElementEnvoy, myInstanceOnly) { RecursionPrevention = RecursionPreventionStyle.StopOnOccurence }; myModel = model; // Use our comparer, which sorts by member kind first myModel.Comparer = DelegatingComparer <TreeModelNode, object> .Create(source => source.DataValue, new TypeInterfaceModelComparer()); // Descriptor is finished configuring itself, so request updating visual representation, i.e. tree view RequestUpdate(UpdateKind.Structure, true); }
private void _activeFolderToolStripDropDownButton_DropDownOpening(object sender, EventArgs e) { var items = _activeFolderToolStripDropDownButton.DropDown.Items; items.Clear(); var item = new ToolStripMenuItem("アクティブクリアファイルなし"); if (_app.ActiveFolder == null) { item.Checked = true; } item.Click += HandleDeselectActiveFolderToolStripMenuItemClick; items.Add(item); items.Add("-"); var folders = _app.Workspace.Folders.ToArray(); var comparer = new DelegatingComparer <MemoFolder>( (x, y) => Comparer <string> .Default.Compare(x.FullName, y.FullName) ); Array.Sort(folders, comparer); var activeFolder = _app.ActiveFolder; foreach (var folder in folders) { var icon = folder == activeFolder? Resources.clear_folder_horizontal_open: Resources.clear_folder_horizontal; item = new ToolStripMenuItem(folder.FullName, icon); item.ImageTransparentColor = Color.Magenta; item.Tag = folder; if (_app.ActiveFolder == folder) { item.Checked = true; } item.Click += HandleSelectActiveFolderToolStripMenuItemClick; items.Add(item); } }