public override void Reload() { FTreeView.BeginUpdate(); if (FRootMapper != null) { FRootMapper.Dispose(); } FRootMapper = new ModelMapper(Input, Registry); if (ShowRoot) { var rootNode = new MapperTreeNode(FRootMapper); rootNode.Expand(); FTreeView.Nodes.Add(rootNode); } else { var items = FRootMapper.Map <IParent>(); if (FSynchronizer != null) { FSynchronizer.Dispose(); } FSynchronizer = FTreeView.Nodes.SyncWith(items.Childs, item => new MapperTreeNode(FRootMapper.CreateChildMapper(item))); } FTreeView.EndUpdate(); }
public override void Reload() { //clean up FCanvas.Clear(); Foreground.Clear(); Background.Clear(); DepthOffsets.Clear(); if (FRootMapper != null) { FRootMapper.Dispose(); } FRootMapper = new ModelMapper(Input, Registry); FCanvas.Root.Add(Background); FCanvas.Root.Add(Foreground); //start building the tree from the root if (FRootNode != null) { FRootNode.Dispose(); } FRootNode = new MapperHierarchyNode(FRootMapper, FCanvas, Background, this); UpdateView(); ViewAll(); }
public void Dispose() { if (FMapper != null) { FMapper.Dispose(); } FInstanceMappings.Clear(); }
public void Dispose() { FProject.Loaded -= HandleProjectLoaded; FProject.Unloaded -= HandleProjectUnloaded; FProject.Documents.Added -= FProject_Documents_Added; FProject.Documents.Removed -= FProject_Documents_Removed; FProject.Documents.ItemRenamed -= FProject_ItemRenamed; FRootFolder.Added -= FRootFolder_Added; FRootFolder.Removed -= FRootFolder_Removed; FRootFolder.OrderChanged -= FRootFolder_OrderChanged; FRootFolder.Dispose(); if (FDocumentsMapper != null) { FDocumentsMapper.Dispose(); } }
public override void Reload() { FDataGridView.Rows.Clear(); FDataGridView.Columns.Clear(); if (FMapper != null) { FMapper.Dispose(); } if (FRowSynchronizer != null) { FRowSynchronizer.Dispose(); } FMapper = new ModelMapper(Input, Registry); if (FMapper.CanMap <IEnumerable <Column> >()) { try { var columns = FMapper.Map <IEnumerable <Column> >(); foreach (var col in columns) { var column = new DataGridViewColumn(new DataGridViewTextBoxCell()); column.Name = col.Name; switch (col.AutoSizeMode) { case AutoSizeColumnMode.AllCells: column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; break; case AutoSizeColumnMode.ColumnHeader: column.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader; break; case AutoSizeColumnMode.DisplayedCells: column.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; break; case AutoSizeColumnMode.Fill: column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; break; default: column.AutoSizeMode = DataGridViewAutoSizeColumnMode.NotSet; break; } FDataGridView.Columns.Add(column); } if (FDataGridView.Columns.Count > 0) { var entries = FMapper.Map <IEnumerable>(); FRowSynchronizer = FDataGridView.Rows.SyncWith(entries, CreateRow, (r) => {}); } } catch (Exception e) { Shell.Instance.Logger.Log(e); } } }