Пример #1
0
        private async void EditEventButton_Click(object sender, RoutedEventArgs e)
        {
            Event updatedEvent = new Event()
            {
                EventID               = Int32.Parse(eventID.Text),
                Name                  = eventName.Text,
                EventType             = eventType.Text,
                Location              = eventLocation.Text,
                Date                  = eventDateTime.DisplayDate,
                Description           = eventDescription.Text,
                MaxNumberOfCharacters = (int)eventMaxParticipants.Value,
                GuildID               = localEvent.GuildID,
                RowId                 = localEvent.RowId
            };

            var response = await client.PostAsJsonAsync("api/Guild/events/update", updatedEvent);

            if (response.IsSuccessStatusCode)
            {
                DataGrid.FillDataGrid();
                WpfMessageBox.Show("Event updated", "Successfully updated event information.", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                WpfMessageBox.Show("Error", "Error Code" +
                                   response.StatusCode + " : Message - " + response.ReasonPhrase, MessageBoxButton.OK, MessageBoxImage.Error);
            }
            Close();
        }
Пример #2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (sender == btnOk)
     {
         _result = MessageBoxResult.OK;
     }
     else if (sender == btnYes)
     {
         _result = MessageBoxResult.Yes;
     }
     else if (sender == btnNo)
     {
         _result = MessageBoxResult.No;
     }
     else if (sender == btnCancel)
     {
         _result = MessageBoxResult.Cancel;
     }
     else
     {
         _result = MessageBoxResult.None;
     }
     _messageBox.Close();
     _messageBox = null;
 }
Пример #3
0
        private void JoinEventButton_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(characterRoleBox.Text))
            {
                EventCharacter newEventCharacter = new EventCharacter()
                {
                    EventID        = int.Parse(eventIDBox.Text),
                    CharacterName  = (string)App.Current.Properties["SelectedCharacter"],
                    CharacterRole  = characterRoleBox.Text,
                    SignUpDateTime = DateTime.Now,
                };

                var response = client.PostAsJsonAsync("api/Guild/events/join", newEventCharacter).Result;

                if (response.IsSuccessStatusCode)
                {
                    WpfMessageBox.Show("Successfully joined event", "You have successfully joined this event!", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    WpfMessageBox.Show("Something went wrong", "An error has occured while joining the event\n Error code : " + response.ReasonPhrase, MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                WpfMessageBox.Show("No role specified", "Please fill in your role for this event!", MessageBoxButton.OK, MessageBoxImage.Question);
            }
            DataGrid.FillDataGrid();
            Close();
        }
Пример #4
0
 public static MessageBoxResult Show(string caption, string text, MessageBoxButton button, MessageBoxImage image)
 {
     if (_messageBox != null)
     {
         _messageBox.Close();
         _messageBox = null;
     }
     _messageBox = new WpfMessageBox {
         txtMsg = { Text = text }, MessageTitle = { Text = caption }
     };
     SetVisibilityOfButtons(button);
     SetImageOfMessageBox(image);
     _messageBox.ShowDialog();
     return(_result);
 }