public FloorIconUpdater(Building building, ListView floors) { _building = building; _lastSelectedFloor = _building.CurrentFloor; _bw = new BackgroundWorker(); _bw.DoWork += Work; floors.SelectionChanged += new SelectionChangedEventHandler(OnFloorChanged); UpdateAll(); }
public Segment(Floor owner, Common.DataModel.Segment segment) : this(owner) { Danger = segment.Danger; Type = segment.Type; Orientation = segment.Orientation; Capacity = segment.Capacity; PeopleCount = segment.PeopleCount; LeftSide = new SideElement(segment.LeftSide); TopSide = new SideElement(segment.TopSide); RightSide = new SideElement(segment.RightSide); BottomSide = new SideElement(segment.BottomSide); }
public Segment(Floor owner, Segment segment) : this(owner) { Danger = segment.Danger; DangerValue = segment.DangerValue; Capacity = segment.Capacity; PeopleCount = segment.PeopleCount; Type = segment.Type == SegmentType.NONE ? SegmentType.NONE : SegmentType.FLOOR; LeftSide = new SideElement(segment.LeftSide); TopSide = new SideElement(segment.TopSide); RightSide = new SideElement(segment.RightSide); BottomSide = new SideElement(segment.BottomSide); Fenotype = segment.Fenotype; FenotypeIndex = segment.FenotypeIndex; }
protected void CreateIcon(Floor floor) { ItemsControl control = new ItemsControl(); Canvas canvas = new Canvas(); control.ItemTemplate = Application.Current.FindResource("SegmentRowTemplate") as DataTemplate; canvas.Children.Add(control); control.ItemsSource = floor.Segments; control.UpdateLayout(); canvas.Measure(new Size(1000, 1000)); canvas.Arrange(new Rect(new Size(1000, 1000))); RenderTargetBitmap bmp = new RenderTargetBitmap((int)control.DesiredSize.Width, (int)control.DesiredSize.Height, 96, 96, PixelFormats.Pbgra32); bmp.Render(control); floor.Icon = bmp; }
public Floor(Floor floor) : this() { Level = floor.Level + 1; for (int row = 0; row < floor.Segments.Count; row++) { ObservableCollection<Segment> segmentRow = new ObservableCollection<Segment>(); for (int col = 0; col < floor.Segments[row].Count; col++) { segmentRow.Add(new Segment(this, floor.Segments[row][col])); } Segments.Add(segmentRow); } ConnectSegments(); RecalculateIndexes(); UpdateRender(); }
public Segment(Floor owner) { Floor = owner; LeftSide = new SideElement(); TopSide = new SideElement(); RightSide = new SideElement(); BottomSide = new SideElement(); TopLeftCorner = new SideElement(); TopRightCorner = new SideElement(); BottomRightCorner = new SideElement(); BottomLeftCorner = new SideElement(); // Default type and capacity. Type = SegmentType.FLOOR; Capacity = 10; FlowValue = Int32.MaxValue; }
private void Work(object sender, DoWorkEventArgs e) { var arg = e.Argument as SelectionChangedEventArgs; UpdateLastSelected(); _lastSelectedFloor = arg.AddedItems.Count > 0 ? arg.AddedItems[0] as Floor : null; }
private void ThreadProc(object obj) { var arg = obj as SelectionChangedEventArgs; UpdateLastSelected(); _lastSelectedFloor = arg.AddedItems.Count > 0 ? arg.AddedItems[0] as Floor : null; }