public void SetPath(string path) { if (!path.StartsWith("/")) { path = CurrentPath + "/" + path; } var parts = new List <string>(); foreach (var part in path.Split('/')) { if (part == "..") { if (parts.Count() > 0) { parts.RemoveAt(parts.Count - 1); } continue; } parts.Add(part); } path = string.Join("/", parts); CurrentPath = path; CurrentObject = World.QuerySingle(path, out var prettyPath); CurrentPrettyPath = prettyPath; PathChanged?.Invoke(this, CurrentObject, CurrentPath, prettyPath); }
public void GoUp() { var folder = Manager.GoUp(); PathChanged?.Invoke(Current); PutFilesOnPanel(folder.EnumerateFiles()); }
private void PostLevelStackMutate() { ViewModel.BackEnabled = _levels.Count > 0; if (_currentLevel != null) { var jObject = _currentLevel as JObject; if (jObject != null) { ViewModel.CurrentPath = jObject.Path; PathChanged?.Invoke(this, new PathChangedEventArgs { NewPath = jObject.Path }); return; } var jArray = _currentLevel as JArray; if (jArray != null) { ViewModel.CurrentPath = jArray.Path; PathChanged?.Invoke(this, new PathChangedEventArgs { NewPath = jArray.Path }); return; } } }
void Fill() { comboProtocol.Sensitive = true; if (repo.Uri != null && repo.Uri.IsAbsoluteUri) { if (repo.Name == repositoryServerEntry.Text) { repo.Name = repo.Uri.Host; } repositoryServerEntry.Text = repo.Uri.Host; repositoryPortSpin.Value = repo.Uri.Port; repositoryPathEntry.Text = repo.Uri.PathAndQuery; repositoryUserEntry.Text = repo.Uri.UserInfo; comboProtocol.Active = protocols.IndexOf(repo.Uri.Scheme); PathChanged?.Invoke(this, EventArgs.Empty); } else if (!ParseSSHUrl(repo.Url)) { // The url may have a scheme, but it may be an incomplete or incorrect url. Do the best to select // the correct value in the protocol combo string prot = repo.SupportedProtocols.FirstOrDefault(p => repo.Url.StartsWith(p + "://", StringComparison.Ordinal)); if (prot != null) { repositoryServerEntry.Text = string.Empty; repositoryPortSpin.Value = 0; repositoryPathEntry.Text = string.Empty; repositoryUserEntry.Text = string.Empty; comboProtocol.Active = protocols.IndexOf(prot); } else { comboProtocol.Active = protocols.IndexOf(repo.Protocol); } } }
public void GoToFolder(MyPath path) { var folder = Manager.Go(path); PutFilesOnPanel(folder.EnumerateFiles()); PathChanged?.Invoke(Current); }
bool ParseSSHUrl(string url) { if (!url.Contains(':')) { return(false); } var tokens = url.Split(new [] { ':' }, 2); if (!Uri.IsWellFormedUriString(tokens [0], UriKind.RelativeOrAbsolute) || !Uri.IsWellFormedUriString(tokens [1], UriKind.RelativeOrAbsolute)) { return(false); } var userAndHost = tokens [0].Split('@'); repositoryUserEntry.Text = userAndHost [0]; repositoryServerEntry.Text = userAndHost [1]; repositoryPortSpin.Value = 22; string path = tokens [1]; if (!path.StartsWith("/", StringComparison.Ordinal)) { path = "/" + path; } repositoryPathEntry.Text = path; comboProtocol.Active = protocols.IndexOf("ssh"); comboProtocol.Sensitive = false; PathChanged?.Invoke(this, EventArgs.Empty); return(true); }
public override void OnClick() { base.OnClick(); movePath = new LinkedList <Vector2Int>(); movePath.AddLast(location); PathChanged?.Invoke(movePath.ToArray()); }
private void tvwMain_AfterSelect(object sender, TreeViewEventArgs e) { try { // ignore some special locations - it doesn't make sense to show files then these. All these just report as path "" TreeNode node = e.Node; if (string.Compare((string)node.Tag, "My Network Places") == 0) { } else if (string.Compare((string)node.Tag, "Microsoft Windows Network") == 0) { } else if (node == m_MyComputerNode) { } else if (string.Compare((string)node.Tag, "Entire Network") == 0) { } else if (node.Parent != null && string.Compare((string)node.Parent.Tag, "Microsoft Windows Network") == 0) { } else { SelectedPath = (string)node.Tag; PathChanged?.Invoke(this, EventArgs.Empty); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
// Constructor public AppSystem(IForegroundWindowHook fgHook, IWindowUpdateHook winHook, IMouseHook msHook) { _state = new InitialState(); _stateContext = new AppStateContext { PathModeLocksToHandle = false, ForegroundHook = fgHook, WindowHook = winHook, MouseHook = msHook, SetCurrentState = (next) => SetCurrentState(next), SendLockStateChange = () => LockStateChanged.Invoke(this, new Events.LockStateChangedEventArgs { IsLocked = IsLocked }), SendPathChange = (path) => PathChanged.Invoke(this, new Events.PathChangedEventArgs { Path = path }), SendTitleChange = (title) => TitleChanged.Invoke(this, new Events.TitleChangedEventArgs { Title = title }), SendDimensionsChange = (dimensions) => DimensionsChanged.Invoke(this, new Events.DimensionsChangedEventArgs { Dimensions = dimensions }), SendForegroundChange = (inForeground) => ForegroundChanged.Invoke(this, new Events.ForegroundStateChangedEventArgs { InForeground = inForeground }) }; fgHook.ForegroundWindowChanged += ForegroundHook_ForegroundWindowChanged; winHook.WindowClosed += WindowHook_WindowClosed; winHook.DimensionsChanged += WindowHook_DimensionsChanged; winHook.TitleChanged += WindowHook_TitleChanged; }
protected void OnPathChanged(string oldPath, string newPath) { PathChanged?.Invoke(this, new PathChangedArgs() { OldPath = oldPath, NewPath = newPath }); }
public void OnExitState() { _path?.Clear(); PathChanged?.Invoke(); _currentPathIdx = 0; _elapsedPathUpdate = 0.0f; _currentStateTimeUnitsElapsed = 0.0f; }
public void RecalculatePath() { if (_path == null) { _path = new List <Vector2Int>(); } PathUtils.FindPath(_mapController, Coords, _entityController.Player.Coords, ref _path, ValidNavigationCoords); PathChanged?.Invoke(); _currentPathIdx = 0; _elapsedPathUpdate = 0.0f; }
void OnPathChanged(FilePath oldPath, FilePath oldLink) { PathChanged?.Invoke(this, CreateEventArgs()); ProjectFilePathChangedEventArgs CreateEventArgs() { var oldVirtualPath = GetProjectVirtualPath(oldLink, oldPath, Project); return(new ProjectFilePathChangedEventArgs(this, oldPath, filename, oldVirtualPath, ProjectVirtualPath)); } }
public void GoForward() { try { var folder = Manager.GoForward(); PathChanged?.Invoke(Current); PutFilesOnPanel(folder.EnumerateFiles()); } catch (EmptyHistoryException) { } }
protected async void PathChangedHandler(UIChangeEventArgs e) { if (IsMultiple) { InternalValue = await JSRunner.GetFilePaths(ElementRef); } else { InternalValue = new string[] { e?.Value?.ToString() } }; PathChanged?.Invoke(InternalValue); }
public TreeNode <IDataPath> chdir(string path) { PathName pathName = new PathName(path); TreeNode <IDataPath> node = mgr.Navigate(pathName); if (node != null) { mgr.current = node; PathChanged?.Invoke(this, new EventArgs <TreeNode <IDataPath> >(node)); } return(node); }
protected async void PathChangedHandler(UIChangeEventArgs e) { if (IsMultiple) { var files = await JSRunner.GetFilePaths(ElementRef); PathChanged?.Invoke(files); } else { PathChanged?.Invoke(new string[] { e?.Value?.ToString() }); } }
private void FileTree_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { var node = (TreeNode)e.NewValue; if (!(node.File is Folder)) { return; } var dir = (Folder)node.File; Manager.Go(dir); PutFilesOnPanel(dir.EnumerateFiles()); PathChanged?.Invoke(Current); }
private void FolderViewOnMouseDoubleClick(MyFile file) { if (file is Folder) { var folder = (Folder)file; PutFilesOnPanel(folder.EnumerateFiles()); Manager.Go(folder); PathChanged?.Invoke(Current); } if (file is TextFile) { file = (TextFile)file; object result; if (Repo.TryGet(file.Path.GetExt(), out result)) { } } }
public void OpenExe() { var fd = new OpenFileDialog { Filters = { new FileDialogFilter("Enter the Gungeon executable", Autodetector.ExeName) } }; fd.ShowDialog(this); if (fd.FileName == null) { return; } PathBox.Text = fd.FileName; PathBox.CaretIndex = PathBox.Text.Length; PathChanged.Invoke(this, new EventArgs()); }
protected override void ContextClickedItem(int id) { base.ContextClickedItem(id); var clickedItem = FindItem(id, _root); if (clickedItem == null || clickedItem.depth > 0 || clickedItem.displayName.Equals(NO_CURRENT_KINDS_AND_ACTIONS_SELECTED) || clickedItem.displayName.Equals(NO_CURRENT_ACTIONS_LOADED) || clickedItem.displayName.Equals(NO_RECORDS_SAVED) || clickedItem.displayName.Equals(NO_PATHS_ACCEPTED)) { return; } switch (TreePurpose) { case TreePurpose.DRAW_CURRENT_NAMES: RecordNameChanged?.Invoke(clickedItem.displayName, this); Recorder.SetCurrentRecordName(clickedItem.displayName); break; case TreePurpose.DRAW_SAVED_NAMES: RecordNameUsedInLoad?.Invoke(clickedItem.displayName, this); Storage.SetCurrentRecordName(clickedItem.displayName); break; case TreePurpose.PATHS: PathChanged?.Invoke(clickedItem.displayName, this); Integrator.SetCurrentRecordName(clickedItem.displayName); break; case TreePurpose.DRAW_SAVED_KINDS_AND_ACTIONS: case TreePurpose.DRAW_CURRENT_KINDS_AND_ACTIONS: break; case TreePurpose.NONE: throw new System.ArgumentOutOfRangeException(string.Empty, "Tree purpose is NONE!"); default: throw new System.ArgumentOutOfRangeException(); } }
private void BuildPath() { var list = new List <Point>(); Action <PointF?> tryAdd = (point) => { if (point == null) { return; } list.Add(new Point( (int)(point.Value.X / Board.TileSize.Width), (int)(point.Value.Y / Board.TileSize.Height))); }; tryAdd(_start); tryAdd(_finish); CurrentPath = new Path(list); Board.Path = CurrentPath; PathChanged?.Invoke(this, EventArgs.Empty); }
protected virtual void SendPathUpdate() { OnPropertyChanged(nameof(Path)); PathChanged?.Invoke(this, EventArgs.Empty); }
private void OnPathChanged() => PathChanged?.Invoke(this, EventArgs.Empty);
protected virtual void OnPathChanged(EventArgs e) { PathChanged?.Invoke(this, e); }
void OnPathChanged(DocumentPathChangedEventArgs e) => PathChanged?.Invoke(this, e);
private void OnPathChange() { PathChanged?.Invoke(this, new EventArgs()); }
private void textBoxPath_TextChanged(object sender, EventArgs e) { PathChanged?.Invoke(); }
protected virtual void RaiseFolderChangedEvent() { PathChanged?.Invoke(this, new EventArgs()); }