コード例 #1
0
        private void Edit(ParticipantDisplayModel participantDisplayModel, IEnumerable <string> countries, IEnumerable <string> sports)
        {
            ParticipantInfoViewModel viewModel = new ParticipantInfoViewModel(participantDisplayModel, sports, countries);
            ParticipantInfoControl   control   = new ParticipantInfoControl(viewModel);
            Window window = WindowFactory.CreateByContentsSize(control);

            viewModel.ParticipantEdited += (s, e) =>
            {
                ParticipantEditModel participantEditModel = e.Participant;
                ParticipantEditDTO   participantEditDTO   = Mapper.Map <ParticipantEditModel, ParticipantEditDTO>(participantEditModel);

                using (IParticipantService service = factory.CreateParticipantService())
                {
                    ServiceMessage serviceMessage = service.Update(participantEditDTO);
                    RaiseReceivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);

                    if (serviceMessage.IsSuccessful)
                    {
                        window.Close();
                        Notify();
                    }
                }
            };

            window.Show();
        }
コード例 #2
0
        private void RaiseParticipantDeleteRequestEvent(ParticipantDisplayModel participant)
        {
            var handler = ParticipantDeleteRequest;

            if (handler != null)
            {
                ParticipantDisplayEventArgs e = new ParticipantDisplayEventArgs(participant);
                handler(this, e);
            }
        }
コード例 #3
0
        public ParticipantInfoViewModel(ParticipantDisplayModel participant, IEnumerable <string> sports, IEnumerable <string> countries)
        {
            this.participant = new ParticipantEditModel
            {
                Name = participant.Name,
                NewParticipantName = participant.Name,

                CountryName = participant.CountryName,
                SportName   = participant.SportName,
            };

            this.Sports    = new ObservableCollection <string>(sports);
            this.Countries = new ObservableCollection <string>(countries);

            this.SaveParticipantCommand = new DelegateCommand(() => RaiseParticipantEditedEvent(this.participant), CanSave);
            this.UndoCommand            = new DelegateCommand(() => Undo(), IsDirty);
        }
コード例 #4
0
 public ParticipantDisplayEventArgs(ParticipantDisplayModel participant)
 {
     this.Participant = participant;
 }