private void updateUIAfterJoystickEvent() { if( documentsTree.Nodes.Count > 0 ) { //documentsTree.Focus(); if( !_hasBeenFocused ) { documentsTree.Focus(); _hasBeenFocused = true; } int timeToWait = 200; int currentNodeIndex = 0; if( documentsTree.SelectedNode == null ) { documentsTree.SelectedNode = documentsTree.Nodes[0]; return; } else { currentNodeIndex = documentsTree.SelectedNode.Index; //Up if( _state.GetPointOfViewControllers()[0] == 0 ) { if( documentsTree.SelectedNode.Parent != null ) { if( currentNodeIndex > 0 ) { documentsTree.SelectedNode = documentsTree.SelectedNode.Parent.Nodes[currentNodeIndex - 1]; } WaitAfterJoystickEvent( timeToWait ); return; } if( currentNodeIndex > 0 ) { documentsTree.SelectedNode = documentsTree.Nodes[currentNodeIndex - 1]; } WaitAfterJoystickEvent( timeToWait ); return; } //Down if( _state.GetPointOfViewControllers()[0] == 18000 ) { if( documentsTree.SelectedNode.Parent != null ) { if( currentNodeIndex < documentsTree.SelectedNode.Parent.Nodes.Count - 1 ) { documentsTree.SelectedNode = documentsTree.SelectedNode.Parent.Nodes[currentNodeIndex + 1]; } WaitAfterJoystickEvent( timeToWait ); return; } if( documentsTree.SelectedNode.Index < documentsTree.Nodes.Count - 1 ) { documentsTree.SelectedNode = documentsTree.Nodes[documentsTree.SelectedNode.Index + 1]; } WaitAfterJoystickEvent( timeToWait ); return; } //Right if( _state.GetPointOfViewControllers()[0] == 9000 ) { if( documentsTree.SelectedNode.Nodes.Count > 0 ) { documentsTree.SelectedNode.Expand(); documentsTree.SelectedNode = documentsTree.SelectedNode.Nodes[0]; WaitAfterJoystickEvent( timeToWait ); return; } documentsTree_MouseDoubleClick( documentsTree.SelectedNode, null ); WaitAfterJoystickEvent( timeToWait * 2 ); return; } //Left if( _state.GetPointOfViewControllers()[0] == 27000 ) { if( documentsTree.SelectedNode.Parent != null ) { documentsTree.SelectedNode = documentsTree.SelectedNode.Parent; documentsTree.SelectedNode.Toggle(); WaitAfterJoystickEvent( timeToWait ); return; } this.Close(); } //Button B if( _state.GetButtons()[1] ) { if( _browser != null ) { _browser.Close(); _browser = null; WaitAfterJoystickEvent( timeToWait ); return; } } //Button Y if( _state.GetButtons()[3] ) { documentsTree.Focus(); } } } }
private void documentsTree_MouseDoubleClick( object o, MouseEventArgs e ) { TreeNode selectedNode = documentsTree.SelectedNode; if( selectedNode.Tag.ToString() == "type" ) return; if( selectedNode.Tag.GetType().Equals( typeof( DocumentVersion ) ) ) { DocumentVersion version = ( DocumentVersion )selectedNode.Tag; try { _browser = ( VRBrowserForm )SDKViewer.UI.OpenForm( typeof( VRBrowserForm ) ); _browser.TabText = selectedNode.Text; _browser.ShowUrl( version.Url ); } catch( Exception ex ) { MessageBox.Show( ex.Message ); } return; } else if( selectedNode.Tag.GetType().Equals( typeof( Document ) ) ) { Document doc = ( Document )selectedNode.Tag; try { selectedNode.Expand(); } catch( Exception ex ) { MessageBox.Show( ex.Message ); } return; } }