public FrameTree(dynamic frameTree) { Frame = new FramePayload { Id = frameTree.frame.id, ParentId = frameTree.frame.parentId, Name = frameTree.frame.name, Url = frameTree.frame.url }; LoadChilds(this, frameTree); }
internal FrameTree(dynamic frameTree) { Frame = new FramePayload { Id = frameTree.frame.id, ParentId = frameTree.frame.parentId, Name = frameTree.frame.name, Url = frameTree.frame.url }; Childs = new List <FrameTree>(); LoadChilds(this, frameTree); }
internal FrameTree(JToken frameTree) { var frame = frameTree[MessageKeys.Frame]; Frame = new FramePayload { Id = frame[MessageKeys.Id].AsString(), ParentId = frame[MessageKeys.ParentId].AsString(), Name = frame[MessageKeys.Name].AsString(), Url = frame[MessageKeys.Url].AsString() }; Childs = new List <FrameTree>(); LoadChilds(this, frameTree); }
private void OnFrameNavigated(FramePayload framePayload) { var isMainFrame = string.IsNullOrEmpty(framePayload.ParentId); var frame = isMainFrame ? MainFrame : Frames[framePayload.Id]; Contract.Assert(isMainFrame || frame != null, "We either navigate top level or have old version of the navigated frame"); // Detach all child frames first. if (frame != null) { while (frame.ChildFrames.Count > 0) { RemoveFramesRecursively(frame.ChildFrames[0]); } } // Update or create main frame. if (isMainFrame) { if (frame != null) { // Update frame id to retain frame identity on cross-process navigation. if (frame.Id != null) { Frames.Remove(frame.Id); } frame.Id = framePayload.Id; } else { // Initial main frame navigation. frame = new Frame(this, _client, null, framePayload.Id); } Frames[framePayload.Id] = frame; MainFrame = frame; } // Update frame payload. frame.Navigated(framePayload); FrameNavigated?.Invoke(this, new FrameEventArgs(frame)); }
private async Task OnFrameNavigatedAsync(FramePayload framePayload) { var isMainFrame = string.IsNullOrEmpty(framePayload.ParentId); var frame = isMainFrame ? MainFrame : await GetFrameAsync(framePayload.Id).ConfigureAwait(false); Contract.Assert(isMainFrame || frame != null, "We either navigate top level or have old version of the navigated frame"); // Detach all child frames first. if (frame != null) { while (frame.ChildFrames.Count > 0) { RemoveFramesRecursively(frame.ChildFrames[0]); } } // Update or create main frame. if (isMainFrame) { if (frame != null) { // Update frame id to retain frame identity on cross-process navigation. if (frame.Id != null) { _frames.TryRemove(frame.Id, out _); } frame.Id = framePayload.Id; } else { // Initial main frame navigation. frame = new Frame(this, null, framePayload.Id); } _asyncFrames.AddItem(framePayload.Id, frame); MainFrame = frame; } // Update frame payload. frame.Navigated(framePayload); FrameNavigated?.Invoke(this, new FrameEventArgs(frame)); }
internal void Navigated(FramePayload framePayload) { Name = framePayload.Name ?? string.Empty; NavigationURL = framePayload.Url; Url = framePayload.Url; }
internal void Navigated(FramePayload framePayload) { Name = framePayload.Name; Url = framePayload.Url; }