示例#1
0
 public FloorIconUpdater(Building building, ListView floors)
 {
     _building = building;
     _lastSelectedFloor = _building.CurrentFloor;
     _bw = new BackgroundWorker();
     _bw.DoWork += Work;
     floors.SelectionChanged += new SelectionChangedEventHandler(OnFloorChanged);
     UpdateAll();
 }
示例#2
0
文件: Segment.cs 项目: OlekNg/AHMED
        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);
        }
示例#3
0
文件: Segment.cs 项目: OlekNg/AHMED
        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;
        }
示例#4
0
        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;
        }
示例#5
0
文件: Floor.cs 项目: OlekNg/AHMED
        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();
        }
示例#6
0
文件: Segment.cs 项目: OlekNg/AHMED
        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;
        }
示例#7
0
 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;
 }
示例#8
0
 private void ThreadProc(object obj)
 {
     var arg = obj as SelectionChangedEventArgs;
     UpdateLastSelected();
     _lastSelectedFloor = arg.AddedItems.Count > 0 ? arg.AddedItems[0] as Floor : null;
 }