Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            _places = new PlaceContainer();
            foreach (var pers in Persons.Users)
            {
                _places.AddPerson(pers.Schedule[Time.T0]);
            }

            _layout = new Layout(cvs.Width, cvs.Height, _places.GetPlaces);
            cvs.Children.Add(_layout.Visuals);

            _way = new Way(_places.GetWay(0, 0));
            _layout.Drawables.Add(_way);
            _layout.Refresh();

            foreach (var i in Places.Names)
            {
                FromBox.Items.Add(i);
                ToBox.Items.Add(i);
            }

            FromBox.SelectedIndex = 0;
            ToBox.SelectedIndex   = 0;
        }
Exemplo n.º 2
0
        private void FromBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            start  = FromBox.SelectedIndex;
            finish = ToBox.SelectedIndex;

            if (start == -1 || finish == -1)
            {
                return;
            }

            var way = _places.GetWay(start, finish);

            _layout.Drawables.Remove(_way);
            _way = new Way(way);
            _layout.Drawables.Add(_way);
            _layout.Refresh();
        }