Пример #1
0
        private async void btnAddRequest_Click(object sender, RoutedEventArgs e)
        {
            var l = await Lookup.reversegeocode(pinLocation.Latitude, pinLocation.Longitude);

            RequestWindow rw = new RequestWindow(model);

            rw.RequestLocation = l;
            if (rw.ShowDialog() == true)
            {
                Request r = new Request(rw.Duration, rw.RequestLocation);
                AddLocationIfNew(rw.RequestLocation);
                r.PossibleStartDays = rw.PossibleStartDays;
                r.SkillsRequested   = rw.Skills;
                model.Requests.Add(r);

                UpdateViewModel(new GreedySolver(model).Optimize());
            }
        }
Пример #2
0
        private void btnEditRequest_Click(object sender, RoutedEventArgs e)
        {
            if (lstRequests.SelectedItem != null)
            {
                var request = model.Requests[mvm.Requests.IndexOf((RequestViewModel)lstRequests.SelectedItem)];

                RequestWindow rw = new RequestWindow(model);
                rw.RequestLocation   = request.RequestLocation;
                rw.Skills            = request.SkillsRequested;
                rw.Duration          = request.Duration;
                rw.PossibleStartDays = request.PossibleStartDays;
                if (rw.ShowDialog() == true)
                {
                    request.RequestLocation   = rw.RequestLocation;
                    request.SkillsRequested   = rw.Skills;
                    request.Duration          = rw.Duration;
                    request.PossibleStartDays = rw.PossibleStartDays;

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