public AddressBar(Func <string, bool> openPath, FilesystemModel filesystemModel) { this.openPath = openPath; this.filesystemModel = filesystemModel; Layout = new StackLayout(); state = AddressBarState.PathBar; CreatePathBar(); CreateEditor(); Updating += (float delta) => { if ( editor.IsFocused() && state != AddressBarState.Editor ) { state = AddressBarState.Editor; editor.Text = filesystemModel.CurrentPath; RemovePathBar(); } if ( state == AddressBarState.Editor && !editor.IsFocused() ) { FlipState(); } }; }
private void FlipState() { if (state == AddressBarState.Editor) { state = AddressBarState.PathBar; editor.Text = ""; CreatePathBar(); } else { state = AddressBarState.Editor; RemovePathBar(); editor.Text = filesystemModel.CurrentPath; } }