Beispiel #1
0
        public virtual void Resume(IConceptUsecase usecase)
        {
            if (XmlUsecase == null || usecase.FavoriteManager == null)
            {
                return;
            }

            ComposeContentViewers();

            Mesh.ClearDisplays();

            var backHandler = Mesh.BackHandler <IThing, ILink>();
            var backGraphs  = backHandler.BackGraphs.ToArray();

            var ser = new UsecaseXmlSerializer();

            ser.Read(XmlUsecase, usecase);

            var graphChanged = backGraphs.Distinct().Any();

            // close others
            foreach (var g in backHandler.BackGraphs
                     //.Where(g=>backGraphs.Contains(g)
                     .Select(g => new { iori = ThingMeshHelper.GetIori(g), graph = g })
                     .Where(g => g.iori == null || !ser.FileNames.Contains(g.iori.ToString()))
                     .Select(j => j.graph)
                     .ToArray())
            {
                backHandler.UnregisterBackGraph(g);

                usecase.GraphSceneUiManager.SetContent(ThingMeshHelper.GetContent(g));
                usecase.GraphSceneUiManager.Close();
            }

            if (graphChanged)
            {
                usecase.FavoriteManager.Clear();
                usecase.SceneManager.Clear();
                usecase.VisualsDisplayHistory.Clear();

                foreach (var d in Mesh.Displays)
                {
                    if (d.Info.Id != usecase.FavoriteManager.HomeId)
                    {
                        usecase.VisualsDisplayHistory.Store(d, usecase.SceneManager);
                    }
                }
            }
            var thingGraph = backHandler.BackGraphs.FirstOrDefault() as IThingGraph;

            if (thingGraph != null)
            {
                usecase.GraphSceneUiManager.SetContent(ThingMeshHelper.GetContent(thingGraph));
            }

            var focused = usecase.SplitView.Display1.Data.Focused;

            usecase.SplitView.Display1.Data.FocusChanged?.Invoke(usecase.SplitView.Display1.Data, focused);
            usecase.SplitView.Display1.OnSceneFocusChanged();
        }
Beispiel #2
0
        public virtual void Save(IConceptUsecase usecase)
        {
            if (usecase.SplitView == null || usecase.GraphSceneUiManager == null)
            {
                return;
            }

            var displays = Mesh.Displays;

            usecase.VisualsDisplayHistory.SaveChanges(displays, usecase.SceneManager, false);
            usecase.FavoriteManager.SaveChanges(displays);
            usecase.GraphSceneUiManager.Save();

            usecase.SplitView.ContentViewManager.SaveContentOfViewers();

            XmlUsecase = new UsecaseXmlSerializer()
                         .Write(usecase);

            StoreContentViewerTypes();
        }