protected void LoadStreamThing(ContentStreamViewer viewer, IThingGraph graph, IStreamThing thing) { try { viewer.IsStreamOwner = IsStreamOwner; if (viewer.ContentId != thing.Id) { SaveStream(graph, viewer); var content = graph.ContentOf(thing); if (viewer is SheetViewer) { content.Source = thing.Id; } if (viewer is HtmlContentViewer) { var htmlViewr = (HtmlContentViewer)viewer; htmlViewr.ContentThing = thing; htmlViewr.ThingGraph = graph; } viewer.SetContent(content); viewer.ContentId = thing.Id; } } catch (Exception ex) { ExceptionHandler.Catch(ex, MessageType.OK); } finally { thing.ClearRealSubject(!IsStreamOwner); } }
public void SaveStream(IGraph <IVisual, IVisualEdge> graph, ContentStreamViewer viewer) { if (viewer == null || graph == null || viewer.ContentId == 0 || !viewer.CanSave()) { return; } SaveStream(graph.ThingGraph(), viewer); }
protected void SaveStream(IThingGraph thingGraph, ContentStreamViewer viewer) { if (thingGraph == null || !viewer.CanSave()) { return; } var thing = thingGraph.GetById(viewer.ContentId) as IStreamThing; if (thing != null) { var content = new Content <Stream> (); viewer.Save(content); new ThingContentFacade().AssignContent(thingGraph, thing, content); if (content.Data != null) { content.Data.Dispose(); } content.Data = null; content = null; thing.State.Clean = true; } }