public Direct2DTextMatrixView() { host.Child = d2d = new D2DView() { parent = this }; }
public D2DView ShowView(string pViewName) { _viewChanging.Reset(); try { if (_currentView != null) { // View is showing, hide this view } // Create view if (_loadedViews.ContainsKey(pViewName)) { _currentView = _loadedViews[pViewName]; } else { // Create view var view = _viewFactory.CreateView(pViewName); if (view == null) { DebugHandler.DebugPrint("Tried to create view, but view not found " + pViewName); return(null); } _currentView = view; _loadedViews.Add(pViewName, _currentView); if (_currentView is ISkinable) { System.Xml.XmlNode viewSkinNode = AppMain.Settings.CurrentSkin.GetViewNodeSkin(pViewName); if (viewSkinNode != null) { (_currentView as ISkinable).ApplySkin(viewSkinNode, AppMain.Settings.CurrentSkin.CurrentSkinPath); } } } //_currentView.StartRender(); } finally { _viewChanging.Set(); } return(_currentView); }
public WindowManager() { _viewChanging = new ManualResetEvent(false); _fpsCalcFramesTotal = 0; _fpsCalcDate = DateTime.Now; _window = new WindowFactory().GetWindow(AppMain.Settings.RenderingEngine); _inputProcessor = new InputProcessor(_window); _inputProcessor.ObservableActions.ObsTouchGesture.Subscribe((tg) => RouteTouchEvents(tg)); _inputProcessor.ObservableActions.ObsTouchMove.Subscribe((tm) => RouteTouchEvents(tm)); _inputProcessor.ObservableActions.ObsKeyInput.Subscribe((ki) => RouteKeyInputEvents(ki)); _viewFactory = new D2DViewFactory(new Size(AppMain.Settings.ScreenResolution.Width, AppMain.Settings.ScreenResolution.Height)); _loadedViews = new Dictionary <string, D2DView>(); _overlayViewControls = _viewFactory.CreateView(D2DViewFactory.OVERLAY); ApplySkin(); new Action(RenderingLoop).BeginInvoke(null, null); }
public void ApplySkin() { AppMain.Settings.CurrentSkin.ReloadCurrent(); foreach (KeyValuePair <string, D2DView> kv in _loadedViews) { D2DView view = kv.Value; if (view is ISkinable) { System.Xml.XmlNode viewSkinNode = AppMain.Settings.CurrentSkin.GetViewNodeSkin(view.Name); if (viewSkinNode != null) { (view as ISkinable).ApplySkin(viewSkinNode, AppMain.Settings.CurrentSkin.CurrentSkinPath); } } } //_overlayViewControls.ForEach((vc) => vc.Dispose()); _overlayViewControls.Clear(); foreach (XmlNode node in AppMain.Settings.CurrentSkin.OverlayNodes) { var viewControl = ViewControlFactory.GetViewControlAndApplySkin( node.Name, AppMain.Settings.CurrentSkin.CurrentSkinPath, node); //if (viewControl is IMessageObserver) // AppMain.Messanger.AddMessageObserver(viewControl as IMessageObserver); if (viewControl != null) { _overlayViewControls.AddViewControl(viewControl); } } }
public Form1() { InitializeComponent(); var scene = new Scene(); var view0 = new DrawableView(new SceneCameraView(scene)) { ClearColor = new Color4(0.4f, 0.2f, 0.2f, 1) }; var view1 = new D2DView() { ClearColor = new Color4(0.2f, 0.4f, 0.2f, 1) }; var splitter = new VerticalSplitter(view0, view1); _disposable.Add(splitter); // setup docks var hierarchy = new SceneHierarchyContent(node => { Logger.Debug("Selected: {0}", node.Name); scene.Selected = node; }); AddContent("scene hierarchy", hierarchy, DockState.DockRight); var selected = new SelectedNodeContent(scene.SelectedObservable); AddContent("selected node", selected, DockState.DockRight); selected.DockTo(hierarchy.Pane, DockStyle.Bottom, 1); var d3d = new D3DContent(splitter); _disposable.Add(d3d); AddContent("selected", d3d, DockState.Document); var json = new JsonContent(); AddContent("json", json, DockState.DockLeft); var jsonNode = new JsonNodeContent(); AddContent("jsonnode", jsonNode, DockState.DockLeft); jsonNode.Selected.Subscribe(x => { if (x.IsValid) { var p = x.Pointer(); toolStripStatusLabel1.Text = $"{p}"; } else { toolStripStatusLabel1.Text = ""; } }); // setup scene _loader.SourceObservableOnCurrent.Subscribe(async source => { json.SetAssetSource(source); jsonNode.SetAssetSource(source); //LoadAsset(x); if (source.GLTF == null) { this.Text = ""; return; } var path = Path.GetFileName(source.Path); this.Text = $"[{path}] {source.GLTF.TriangleCount} tris"; var asset = await Task.Run(() => AssetContext.Load(source)); // update treeview hierarchy.SetTreeNode(asset); // update scene scene.Asset = asset; }); scene.Updated .ObserveOn(SynchronizationContext.Current) .Subscribe(_ => { d3d.Invalidate(); }) ; }