Esempio n. 1
0
        private void ReportPlayer(object sender, RoutedEventArgs routedEventArgs)
        {
            ServiceReportMisConduct serviceReportMisConduct = new ServiceReportMisConduct();

            serviceReportMisConduct.IdReportedPlayer  = nicknameReported;
            serviceReportMisConduct.IdReportingPlayer = nickname;
            string dataContext = ValidationData.DeleteSpaceWord(tbContext.Text);

            if (dataContext.Length > Number.NumberValue(NumberValues.ZERO))
            {
                serviceReportMisConduct.AdditionalContext = dataContext;
            }
            string typeReport = null;

            if (rbTypeOne.IsChecked == true)
            {
                typeReport = Properties.Resources.VerbalMotive;
            }
            else
            {
                if (rbTypeTwo.IsChecked == true)
                {
                    typeReport = Properties.Resources.OffensiveMotive;
                }
                else
                {
                    if (rbTypeThree.IsChecked == true)
                    {
                        typeReport = Properties.Resources.HateMotive;
                    }
                }
            }
            if (!string.IsNullOrEmpty(typeReport))
            {
                serviceReportMisConduct.TypeReport = typeReport;
                try
                {
                    InstanceContext    instanceContext    = new InstanceContext(this);
                    ReportPlayerClient reportPlayerClient = new ReportPlayerClient(instanceContext);
                    reportPlayerClient.ReportPlayer(serviceReportMisConduct);
                    if (isReportPlayer)
                    {
                        OpenMessageBox(Properties.Resources.ReportPlayerMessage, Properties.Resources.TitleRegisterReportMessage, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Information);
                    }
                    else
                    {
                        OpenMessageBox(Properties.Resources.ReportPlayerErrorMessage, Properties.Resources.TitleRegisterReportMessage, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Error);
                    }
                    Play.ReportPlayerReceived(isReportPlayer);
                    this.Close();
                }
                catch (EndpointNotFoundException exception)
                {
                    TelegramBot.SendToTelegram(exception);
                    LogException.Log(this, exception);
                    LogException.ErrorConnectionService();
                }
            }
            else
            {
                OpenMessageBox(Properties.Resources.TypeReportErrorMessage, Properties.Resources.IncorrectDataMessageTitle, (MessageBoxImage)System.Windows.Forms.MessageBoxIcon.Error);
            }
        }