Exemplo n.º 1
0
        private async void btnAddEngineer_Click(object sender, RoutedEventArgs e)
        {
            var l = await Lookup.reversegeocode(pinLocation.Latitude, pinLocation.Longitude);

            EngineerWindow ew = new EngineerWindow(model);

            ew.HomeOfficeLocation = l;
            if (ew.ShowDialog() == true)
            {
                Engineer engineer = new Engineer(ew.EngineerName, ew.HomeOfficeLocation, model);
                AddLocationIfNew(ew.HomeOfficeLocation);

                engineer.Skills = ew.Skills;
                model.Engineers.Add(engineer);

                UpdateViewModel(new GreedySolver(model).Optimize());
            }
        }
Exemplo n.º 2
0
        private void btnEditEngineer_Click(object sender, RoutedEventArgs e)
        {
            if (Schedule.SelectedItem != null)
            {
                //var engineer = ((EngineerViewModel)Schedule.SelectedItem).EngineerEntity;
                var            engineer = model.Engineers[mvm.Engineers.IndexOf((EngineerViewModel)Schedule.SelectedItem)];
                EngineerWindow ew       = new EngineerWindow(model);
                ew.HomeOfficeLocation = engineer.HomeOffice;
                ew.Skills             = engineer.Skills;
                ew.EngineerName       = engineer.Name;

                if (ew.ShowDialog() == true)
                {
                    engineer.HomeOffice = ew.HomeOfficeLocation;
                    engineer.Skills.Clear();
                    engineer.Skills.AddRange(ew.Skills);
                    engineer.Name = ew.EngineerName;

                    UpdateViewModel(new GreedySolver(model).Optimize());
                }
            }
        }