private void LoadCustomization(object sender, MouseButtonEventArgs e) { string[] urlformat = tb_url.Text.Split('.'); if (urlformat[urlformat.Length - 1] != "png") { tb_url.Text = "Une erreur s'est produite. Veuillez vérifier votre URL. FORMAT PNG OBLIGATOIRE."; FormExecution.Client_PopMessageBox("Une erreur s'est produite. Veuillez vérifier votre URL. FORMAT PNG OBLIGATOIRE.", "Erreur"); return; } try { using (WebClient wc = new WebClient()) { wc.DownloadFileAsync( new System.Uri(tb_url.Text), Path.Combine(FormExecution.path, "Assets", "temp.png") ); wc.DownloadFileCompleted += LoadDownloadedCustom; } } catch (Exception ex) { logger.Error("ERROR WHEN LOADING CUSTOM CUSTOMIZATION {0}", ex.ToString()); tb_url.Text = "Une erreur s'est produite. Veuillez vérifier votre URL. FORMAT PNG OBLIGATOIRE."; } }
private void BP_bet(string obj) { int pts; if (int.TryParse(obj, out pts)) { switch (_bettype) { case BetType.BPs: _bet = new BPsBet(pts); btnChoose.ButtonText = pts + " BPs"; btnChoose.Update(); break; case BetType.Mute: case BetType.Ban: _bet = new SanctionBet(_bettype, pts); btnChoose.ButtonText = pts + " h"; btnChoose.Update(); break; } AllowToSend(); } else { FormExecution.Client_PopMessageBox("Vous n'avez pas indiqué un nombre valable de BPs.", "Erreur"); } }
private void Client_DataRetrievalInfos(bool success, LoginFailReason reason, bool end) { if (success) { if (end) { EndLoading?.Invoke(); FormExecution.Client_PopMessageBox("La récupération de données est terminée !", "Récupération de données"); } else { StartLoading?.Invoke(); } } else { EndLoading?.Invoke(); string error = "Une erreur s'est produite lors de la récupération : "; switch (reason) { case LoginFailReason.InvalidCombinaison: error += "La combinaison pseudo/mot de passe n'est pas bonne. Mauvais mot de passe ou pseudo inexistant sur la v1"; break; case LoginFailReason.DataRetrievalAlreadyMade: error += "Tu as déjà récupéré tes données !"; break; } FormExecution.Client_PopMessageBox(error, "Récupération de données"); } }
public BitmapImage GetTeamEmblem(int teamID, string emblem) { if (!Directory.Exists(Path.Combine(FormExecution.path, "Assets", "Team"))) { Directory.CreateDirectory(Path.Combine(FormExecution.path, "Assets", "Team")); } if (!TeamEmblemsURL.ContainsKey(teamID) || TeamEmblemsURL[teamID] != emblem || !File.Exists(Path.Combine(FormExecution.path, "Assets", "Team", teamID + ".png"))) { try { using (WebClient wc = new WebClient()) { wc.DownloadFile( new System.Uri(emblem), Path.Combine(FormExecution.path, "Assets", "Team", teamID + ".png") ); } TeamEmblemsURL[teamID] = emblem; SaveTeamEmblem(); } catch (Exception ex) { logger.Error(ex.ToString()); FormExecution.Client_PopMessageBox("Une erreur s'est produite lors du chargement de votre image.", "Erreur"); } } return(GetImage("Team", teamID.ToString())); }
private void Client_ChangeDailyQuest(bool success, DailyQuestType dqtype, string quest) { if (success) { ChangeQuest?.Invoke(dqtype, quest); } else { FormExecution.Client_PopMessageBox("Tu as déjà utilisé ton changement de quête aujourd'hui ! (Un seul changement par jour)", "Quête journalière !"); } }
private void PicDownloaded(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { progressBar_update.Value++; tb_update_count.Text = progressBar_update.Value.ToString(); if (tb_update_count.Text == tb_update_total.Text) { btnDownloadPics.IsEnabled = true; FormExecution.ClientConfig.BCA_Card_Design = bca_design.IsChecked == true; FormExecution.Client_PopMessageBox("Le changement de style de cartes est terminé et effectif !", "Changement style de carte"); Close(); } }
public BitmapImage GetCustom(Customization custom) { string d = ""; switch (custom.CustomizationType) { case CustomizationType.Avatar: d = "Avatars"; break; case CustomizationType.Sleeve: d = "Sleeves"; break; case CustomizationType.Border: d = "Borders"; break; case CustomizationType.Partner: d = "Partners"; break; } if (!File.Exists(Path.Combine(FormExecution.path, "Assets", d, custom.Id + ".png"))) { string url = custom.IsHost ? custom.URL : string.Format("http://raw.githubusercontent.com/Battle-City-Alpha/BattleCityAlpha-v2-Assets/master/{0}/{1}.png", d, custom.Id); try { using (WebClient wc = new WebClient()) { wc.DownloadFile( new System.Uri(url), Path.Combine(FormExecution.path, "Assets", d, custom.Id + ".png") ); } } catch (Exception ex) { logger.Error(ex.ToString()); FormExecution.Client_PopMessageBox("Une erreur s'est produite lors du chargement de votre image.", "Erreur"); } } return(GetImage(d, custom.Id.ToString())); }
private void ValidURL(object sender, MouseButtonEventArgs e) { if (tb_url.Text == string.Empty || tb_url.Text == "Une erreur s'est produite. Veuillez vérifier votre URL (web non local)") { return; } string[] urlformat = tb_url.Text.Split('.'); if (urlformat[urlformat.Length - 1] != "png" || (!tb_url.Text.StartsWith("http://") && !tb_url.Text.StartsWith("https://"))) { tb_url.Text = "Une erreur s'est produite. Veuillez vérifier votre URL. FORMAT PNG OBLIGATOIRE."; FormExecution.Client_PopMessageBox("Une erreur s'est produite. Veuillez vérifier votre URL. FORMAT PNG OBLIGATOIRE ET HEBERGEMENT SUR LE WEB.", "Erreur"); return; } SelectedURL?.Invoke(tb_url.Text); Close(); }
private void Client_DailyQuestReward(bool success, DailyQuestType dqtype, int amount, bool allquest) { if (allquest) { FormExecution.Client_PopMessageBox("Félicitations ! Tu as rempli toutes les quêtes possible aujourd'hui ! Tu remportes un bonus de 400 BPs supplémentaire !", "Quête journalière !"); } else { if (success) { ChangeQuestState?.Invoke(dqtype, success); FormExecution.Client_PopMessageBox("Félicitations ! La quête est complétée ! Tu remportes " + amount + " BPs." + Environment.NewLine + "Reviens demain pour de nouveaux défis !", "Quête journalière !"); } else { FormExecution.Client_PopMessageBox("La quête n'est pas encore terminée ! Encore un petit effort...", "Quête journalière !"); } } }
private void BCA_ColorButton_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e) { if (lb_choice.Items.Count <= 0) { FormExecution.Client_PopMessageBox("Il faut proposer au moins une carte !", "Echange"); return; } if (!validate) { btnProposition.IsEnabled = false; btnValidate.IsEnabled = false; validate = true; _admin.SendTradeProposition(_id, GlobalTools.GetDictionnaryValues(_cardsToOffer)); } else { btnProposition.IsEnabled = false; btnValidate.IsEnabled = false; _admin.SendTradeAnswer(_id, true); } }