private List <ViewModelNode> FullMoveAllSelectedNode(MyPoint delta, List <ViewModelNode> nodes = null) { MyPoint myPoint = delta.Copy(); if (nodes == null) { nodes = Nodes.Where(x => x.Selected).ToList(); myPoint.Clear(); } nodes.ForEach(node => node.CommandMove.Execute(myPoint)); return(nodes); }
public void SetAllMessagesRead() { // capture point of time view List <ChatMessageViewModel> unseenMessages = _messages.Where(x => !x.HasBeenSeen).ToList(); foreach (ChatMessageViewModel chatMessageViewModel in unseenMessages) { chatMessageViewModel.HasBeenSeen = true; } }
private static void ReorderRecentFiles(IObservableCollection <RecentFileInfo> target) { if (target == null) { return; } var orderedItem = new List <RecentFileInfo>(); orderedItem.AddRange(target.Where(p => p.FixedAt.HasValue).OrderByDescending(p => p.FixedAt)); orderedItem.AddRange(target.Where(p => !p.FixedAt.HasValue).OrderByDescending(p => p.LastOpenedAt)); target.IsNotifying = false; target.Clear(); target.IsNotifying = true; target.AddRange(orderedItem); }
private void CutterIntersect() { MyPoint cutterStartPointDiagonal = MyUtils.GetStartPointDiagonal(Cutter.StartPoint, Cutter.EndPoint) / Scale.Value; MyPoint cutterEndPointDiagonal = MyUtils.GetEndPointDiagonal(Cutter.StartPoint, Cutter.EndPoint) / Scale.Value; var connects = Connects.Where(x => MyUtils.Intersect(MyUtils.GetStartPointDiagonal(x.StartPoint, x.EndPoint), MyUtils.GetEndPointDiagonal(x.StartPoint, x.EndPoint), cutterStartPointDiagonal, cutterEndPointDiagonal)); foreach (var connect in Connects) { connect.Selected = false; } foreach (var connect in connects) { connect.Selected = MyUtils.ComputeIntersections(connect.StartPoint, connect.Point1, connect.Point2, connect.EndPoint, Cutter.StartPoint, Cutter.EndPoint); } }
private void CutterIntersect() { //MyPoint cutterStartPoint = Cutter.StartPoint / Scale.Value; //MyPoint cutterEndPoint = Cutter.EndPoint / Scale.Value; MyPoint cutterStartPoint = Cutter.StartPoint; MyPoint cutterEndPoint = Cutter.EndPoint; //some optimizations var connects = Connects.Where(x => MyUtils.Intersect(MyUtils.GetStartPointDiagonal(x.StartPoint, x.EndPoint), MyUtils.GetEndPointDiagonal(x.StartPoint, x.EndPoint), MyUtils.GetStartPointDiagonal(Cutter.StartPoint, Cutter.EndPoint), MyUtils.GetEndPointDiagonal(Cutter.StartPoint, Cutter.EndPoint))); //var connects = Connects; foreach (var connect in Connects) { connect.Selected = false; } foreach (var connect in connects) { connect.Selected = MyUtils.ComputeIntersections(connect.StartPoint, connect.Point1, connect.Point2, connect.EndPoint, Cutter.StartPoint, Cutter.EndPoint); } }
public static void RemoveWhere <T>(this IObservableCollection <T> source, Predicate <T> p) { var itemsToRemove = source.Where(t => p(t)).ToList(); source.RemoveRange(itemsToRemove); }
public void Run(IFormRenderer <HTMLElement> renderer, Action atExit) { renderer.AddPopup(_layoutChoice); _layoutChoice.Ended += (x, outcome) => { renderer.Remove(x); switch (outcome) { case CompletedOrCanceled.Canceled: atExit(); break; case CompletedOrCanceled.Completed: switch (x.ChosenValue) { case LayoutChoice.Horizontal: { var panel = TwoPanelsWithResizerBuilder.BuildHorizontal( Hideability.None, false, renderer, SpacingPolicy.FirstWins); panel.First.ReplaceMaster(_headers); panel.Second.ReplaceMaster(_details); renderer.ReplaceMasterWithAdapter(panel.Panel); break; } case LayoutChoice.Vertical: { var panel = TwoPanelsWithResizerBuilder.BuildVertical( Hideability.None, false, renderer, SpacingPolicy.Proportional); panel.First.ReplaceMaster(_headers); panel.Second.ReplaceMaster(_details); renderer.ReplaceMasterWithAdapter(panel.Panel); break; } } renderer.AddPopup(_fetchData); break; default: throw new Exception("unsupported EnumChoiceFormOutcome"); } }; _fetchData.Ended += (x, outcome) => { switch (outcome) { case RemoteActionsCallerForm.Outcome.Succeeded: renderer.Remove(x); break; case RemoteActionsCallerForm.Outcome.Canceled: case RemoteActionsCallerForm.Outcome.Interrupted: renderer.Remove(x); renderer.ClearMaster(); break; default: throw new Exception("unsupported outcome"); } }; _headers.Ended += (_, outcome) => { switch (outcome) { case HeadersForm.Outcome.ChoosenHeader: var headerId = _headers.ChoosenHeader.Id; _details.Details.Items.Replace(_detailItems.Where(x => headerId == x.ParentId)); break; case HeadersForm.Outcome.Canceled: renderer.ClearMaster(); break; default: throw new Exception("unsupported outcome"); } }; }