Example #1
0
        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);
            }
        }
Example #2
0
        public virtual WebContent GetContentFromThing(IThingGraph graph, IThing thing)
        {
            var info = graph.ContentOf(thing);
            var uri  = GetUri(thing);

            return(GetContentFromContent(info, uri));
        }
Example #3
0
        public IEnumerable <Content <Stream> > PageStreams(IThingGraph graph, IThing document)
        {
            if (graph == null || document == null)
            {
                return(new Content <Stream> [0]);
            }

            return(Pages(graph, document)
                   .Where(page => page is IStreamThing)
                   .Select(page => graph.ContentOf(page)));
        }
Example #4
0
        protected virtual bool DisplaySheet(IGraphSceneDisplay <IVisual, IVisualEdge> display, IThing thing, IThingGraph thingGraph)
        {
            var streamThing = thing as IStreamThing;

            try {
                if (streamThing != null && streamThing.StreamType == ContentTypes.LimadaSheet)
                {
                    var content = thingGraph.ContentOf(streamThing);
                    content.Source = streamThing.Id;
                    DisplaySheet(display, content);
                    return(true);
                }
            } catch (Exception e) {
                Trace.WriteLine("Error on displaying sheet {0}", e.Message);
                Debug.WriteLine(e.StackTrace);
            }
            return(false);
        }