internal override ExtensionRecord ToRecord() { var head = new ExtensionHeadRecord { ExtensionBuilderUid = ExtensionBuilder.Uid, Id = Head.Id, RelativePosition = Head.RelativePosition, SiblingId = Head.SiblingId, ParentPath = Head.ParentPath }; var data = new ExtensionDataRecord(Data.Items); var result = new ExtensionRecord { Head = head, Data = data }; if (Children != null) { foreach (var child in Children) { var childItem = child.ToRecord(); result.AddChild(childItem); } } return(result); }
private void OnModelChanged(ExtensionRecord sender, ExtensionRecordEventArgs e) { switch (e.Action) { case ExtensionRecordAction.GetView: e.View = this; break; } }
internal ExtensionLoader CreateExtensionLoader(ExtensionRecord exRecord) { ExtensionLoaderFactory factory; if (!_uid2ExLoaderFactories.TryGetValue(exRecord.Head.ExtensionBuilderUid, out factory)) { throw new InvalidOperationException(); } return(factory.CreateExtensionLoader(exRecord)); }
public ExtensionRecordViewModel(ExtensionRecordsViewModel records, ExtensionRecord model) { this.records = records; this.model = model; icon = IconCache.FileIcon; if (IsEmptyExtension) { name = "File"; } else { name = model.Extension.TrimStart('.').ToUpper() + " File"; records.Icons.CacheFileTypeAsync(model.Extension, OnCacheIcon); } model.Changed += OnModelChanged; }
private void OnModelCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { Debug.Assert(isScanning, "Cannot change collection while not scanning!"); switch (e.Action) { case NotifyCollectionChangedAction.Reset: sortedRecords.Clear(); records.Clear(); for (int i = 0; i < model.Count; i++) { ExtensionRecord newRecord = (ExtensionRecord)model[i]; ExtensionRecordViewModel newRecordViewModel = new ExtensionRecordViewModel(this, newRecord); sortedRecords.Add(newRecordViewModel); records.Add(newRecord.Extension, newRecordViewModel); } break; case NotifyCollectionChangedAction.Add: for (int i = 0; i < e.NewItems.Count; i++) { ExtensionRecord newRecord = (ExtensionRecord)e.NewItems[i]; ExtensionRecordViewModel newRecordViewModel = new ExtensionRecordViewModel(this, newRecord); sortedRecords.Add(newRecordViewModel); records.Add(newRecord.Extension, newRecordViewModel); } break; case NotifyCollectionChangedAction.Remove: for (int i = 0; i < e.OldItems.Count; i++) { ExtensionRecord oldRecord = (ExtensionRecord)e.OldItems[i]; ExtensionRecordViewModel oldRecordViewModel = records[oldRecord.Extension]; sortedRecords.Remove(oldRecordViewModel); records.Remove(oldRecord.Extension); } break; } }
private ExtensionRecordViewModel() { model = ExtensionRecord.Empty; name = "Not a File"; }
void LoadExtensionsRecursively(IAddinContext adnContext, ICompositeExtensionLoader parentLoader, ExtensionRecord exRecord) { var exLoader = _loaderFactory.CreateExtensionLoader(exRecord); parentLoader.AddChild(exLoader); _path2Loaders.Add(exLoader.Path, exLoader); exLoader.Load(adnContext); // do load the extension object here. if (exRecord.Children != null) { foreach (var child in exRecord.Children) { LoadExtensionsRecursively(adnContext, exLoader as ICompositeExtensionLoader, child); } } }
internal UnaffectedExtensionResolution(AddinResolution declaringAddin, ExtensionRecord old) : base(declaringAddin, old) { //_resolutionStatus = ResolutionStatus.Success; }
internal IndirectlyAffectedExtensionResolution(AddinResolution declaringAddin, ExtensionRecord old) : base(declaringAddin) { _old = old; }
protected ExtensionLoader(ExtensionRecord exRecord) { _exRecord = exRecord; }
protected CompositeExtensionLoader(ExtensionRecord exRecord) : base(exRecord) { }
internal abstract ExtensionLoader CreateExtensionLoader(ExtensionRecord exRecord);