AWSForm.cs

Description du code

AWSForm.cs est un fichier du projet BiblioBrol.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/src/.

Projet BiblioBrol :

Gestion de media en CSharp.

Pour plus d'infos, vous pouvez consulter la brève analyse.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using be.gaudry.bibliobrol.awsRef;
  9. using System.Collections;
  10. using be.gaudry.bibliobrol.model.aws;
  11. using be.gaudry.view;
  12. using be.gaudry.bibliobrol.model;
  13. using be.gaudry.bibliobrol.view.dialogs;
  14. using be.gaudry.bibliobrol.config;
  15.  
  16. namespace be.gaudry.bibliobrol.view
  17. {
  18. public partial class AWSForm : MDIChildForm
  19. {
  20. #region declarations and constructor
  21. private AWSSearchIndices awsSearchIndices;
  22. private AWSSearchResult<AWSFilm> searchResults;
  23. private AWSHelper awsHelper;
  24. private BrolType filmsType, bdType, bookType, musicType, softwareType;
  25. public AWSForm()
  26. {
  27. awsSearchIndices = new AWSSearchIndices();
  28. awsHelper = new AWSHelper();
  29. InitializeComponent();
  30. initSearchIndices();
  31. proxyTB.Text = Config.ProxyAddress;
  32. filmsType = new BrolType(1,"Films");
  33. bdType = new BrolType(2,"BD");
  34. bookType = new BrolType(3,"Livres");
  35. musicType = new BrolType(4, "Musiques");
  36. softwareType = new BrolType(5, "Applications");
  37. }
  38. #endregion
  39.  
  40. #region initializations
  41. private void initSearchIndices()
  42. {
  43. List<AWSSearchIndices.Indice> indices = awsSearchIndices.getIndices(AWSSearchIndices.CATEGORY.all);
  44. searchIndexCB.DisplayMember = "Display";
  45. //searchIndexCB.ValueMember = "Value";
  46. foreach (AWSSearchIndices.Indice indice in indices)
  47. {
  48. searchIndexCB.Items.Add(indice);
  49. }
  50. searchIndexCB.SelectedItem = awsSearchIndices.getDefaultIndice();
  51. }
  52. #endregion
  53.  
  54. #region search
  55. private void searchBtn_Click(object sender, EventArgs e)
  56. {
  57. performNewSearch();
  58. }
  59.  
  60. private void searchTB_KeyUp(object sender, KeyEventArgs e)
  61. {
  62. if (e.KeyCode == Keys.Enter)
  63. {
  64. performNewSearch();
  65. }
  66. }
  67. private void performNewSearch()
  68. {
  69. if (!proxyTB.Text.Equals(Config.ProxyAddress))
  70. Config.ProxyAddress = proxyTB.Text;
  71. AWSSearchIndices.Indice indice = searchIndexCB.SelectedItem as AWSSearchIndices.Indice;
  72. searchResults = new AWSSearchResult<AWSFilm>(searchTB.Text, indice.Value);
  73. performSearch();
  74. }
  75.  
  76.  
  77. private void performSearch()
  78. {
  79. resultsCountLbl.Text = "Recherche en cours...";
  80.  
  81. this.Cursor = Cursors.WaitCursor;
  82.  
  83. try
  84. {
  85. awsHelper.searchFilms(searchResults, proxyTB.Text);
  86. aWSFilmBindingSource.DataSource = searchResults.getDataSource();
  87. moreResultsBtn.Enabled = searchResults.Total - searchResults.Count > 0;
  88. resultsCountLbl.Text = String.Format("{0} résultats affichés sur {1}", searchResults.Count, searchResults.Total);
  89. }
  90. catch (System.Net.WebException we)
  91. {
  92. resultsCountLbl.Text = we.Message;
  93. }
  94. this.Cursor = Cursors.Default;
  95. }
  96. #endregion
  97.  
  98. private void moreResultsBtn_Click(object sender, EventArgs e)
  99. {
  100. performSearch();
  101. }
  102.  
  103. #region actors
  104. private void actorsLB_SelectedIndexChanged(object sender, EventArgs e)
  105. {
  106. checkActorCMS();
  107. }
  108.  
  109. private void checkActorCMS()
  110. {
  111. Actor actor = actorsLB.SelectedItem as Actor;
  112. if (actor != null)
  113. {
  114. addPersonTsMi.Text = String.Format("Ajouter {0} dans BiblioBrol", actor.Display);
  115. addPersonTsMi.Enabled = true;
  116. }
  117. else
  118. addPersonTsMi.Enabled = false;
  119. }
  120.  
  121. private void addPersonTsMi_Click(object sender, EventArgs e)
  122. {
  123. Actor actor = actorsLB.SelectedItem as Actor;
  124. actor.Id = ModelAdapter.insertPerson(actor);
  125.  
  126. ActorRole role = ModelAdapter.loadRole(actor.Role.Name);
  127. if (role == null)
  128. {
  129. SelectRoleForm selectRoleForm = new SelectRoleForm();
  130. selectRoleForm.setRoles(ModelAdapter.loadRoles(actor.Role.Name));
  131. if (selectRoleForm.ShowDialog() == DialogResult.OK)
  132. {
  133. role = selectRoleForm.getSelectedRole();
  134. if (role != null)
  135. actor.Role = role;
  136. }
  137. }
  138. else
  139. {
  140. actor.Role = role;
  141. }
  142. ModelAdapter.setDefaultRole(actor, actor.Role);
  143. }
  144.  
  145. private void actorsLB_DataSourceChanged(object sender, EventArgs e)
  146. {
  147. checkActorCMS();
  148. }
  149. #endregion
  150.  
  151. private void onSavePictureAs_Click(object sender, EventArgs e)
  152. {
  153. MessageBox.Show("Fonction en cours de développement...");
  154. }
  155.  
  156. private void onSaveBrol_Click(object sender, EventArgs e)
  157. {
  158. Brol brol = new Brol();
  159. brol.Title = titleTB.Text;
  160. brol.Synopsis = descriptionRTB.Text;
  161.  
  162. int year;
  163. Int32.TryParse(releaseDateTB.Text,out year);
  164. if (year > 0)
  165. brol.Date = new DateTime(year, 1, 1);
  166.  
  167. foreach (Actor actor in actorsLB.Items)
  168. {
  169. actor.Status = STATUS.toAdd;
  170. brol.addActor(actor);
  171. }
  172. /*
  173.   BrolPropertiesForm brolPropertiesForm = new BrolPropertiesForm();
  174.   brolPropertiesForm.Brol = brol;
  175.   brolPropertiesForm.ShowDialog(this);
  176.   * */
  177. EditBrolForm form = new EditBrolForm();
  178. BrolType brolType;
  179. AWSSearchIndices.Indice indice = searchIndexCB.SelectedItem as AWSSearchIndices.Indice;
  180. //MessageBox.Show("indice : " + indice.Display);
  181. switch(indice.Display)
  182. {
  183. case "DVD": brolType = filmsType; break;
  184. case "Livres": brolType = bookType; break;
  185. case "Musique classique": brolType = musicType; break;
  186. case "Musique (Numérique)": brolType = musicType; break;
  187. case "Livres étrangers": brolType = bookType; break;
  188. case "Hobby": brolType = softwareType; break;
  189. case "Magazines": brolType = bookType; break;
  190. case "Divers": brolType = softwareType; break;
  191. case "Musique": brolType = musicType; break;
  192. case "Musique (Pistes audio)": brolType = musicType; break;
  193. case "Matériel PC": brolType = softwareType; break;
  194. case "Programmes": brolType = softwareType; break;
  195. case "Jeux": brolType = softwareType; break;
  196. case "VHS": brolType = filmsType; break;
  197. case "Tous les films": brolType = filmsType; break;
  198. case "Jeux (Video)": brolType = softwareType; break;
  199. default: brolType = softwareType; break;
  200. }
  201. brol.BrolType = brolType;
  202. form.InnerControl.setBrol(brol, brolType);
  203. form.InnerControl.setCover(coverPB.ImageLocation);
  204.  
  205. form.MdiParent = this.MdiParent;
  206. form.WindowState = FormWindowState.Maximized;
  207. form.Show();
  208.  
  209. //form.ShowDialog(this);
  210. }
  211. }
  212. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/src/view/ 
IcôneNomTailleModification
IcôneNomTailleModification
| _ Répertoire parent0 octets1714799182 04/05/2024 07:06:22
| _wizards0 octets1541007184 31/10/2018 18:33:04
| _utils0 octets1541007184 31/10/2018 18:33:04
| _controls0 octets1541007178 31/10/2018 18:32:58
| _dialogs0 octets1541007183 31/10/2018 18:33:03
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/src/view/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .resx|.resxMediabrolForm.resx32.55 Ko31/10/2018 18:32:27-refusé-
Afficher le fichier .resx|.resxAWSForm.resx188.27 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .resx|.resxMainForm.resx6.07 Ko31/10/2018 18:32:27-refusé-
Afficher le fichier .resx|.resxConsoleForm.resx256.48 Ko31/10/2018 18:32:27-refusé-
Afficher le fichier .cs|.csAWSForm.Designer.cs23.45 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .cs|.csActorForm.cs9.09 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .cs|.csBiblioBrolAboutBox.Designer.cs11.22 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .cs|.csAWSForm.cs7.68 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .cs|.csBorrowsForm.cs1.66 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .cs|.csCopy of MainForm.Designer.cs16.91 Ko31/10/2018 18:32:27-refusé-
Afficher le fichier .cs|.csConsoleForm.Designer.cs2.71 Ko31/10/2018 18:32:26-refusé-
Afficher le fichier .cs|.csWebServiceForm.cs6.34 Ko31/10/2018 18:32:29-refusé-
Afficher le fichier .resx|.resxOldMainForm.resx58.06 Ko31/10/2018 18:32:28-refusé-
Afficher le fichier .cs|.csCopy of MainForm.cs30.81 Ko31/10/2018 18:32:26-refusé-
Afficher le fichier .resx|.resxActorForm.resx44.98 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .resx|.resxBorrowsForm.resx73.4 Ko31/10/2018 18:32:26-refusé-
Afficher le fichier .cs|.csMainForm.cs37.45 Ko31/10/2018 18:32:27-refusé-
Afficher le fichier .resx|.resxWebServiceForm.resx9.71 Ko31/10/2018 18:32:29-refusé-
Afficher le fichier .cs|.csMainForm.Designer.cs7.16 Ko31/10/2018 18:32:27-refusé-
Afficher le fichier .cs|.csBorrowsForm.Designer.cs10.51 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .cs|.csTasksForm.cs389 octets31/10/2018 18:32:28-refusé-
Afficher le fichier .resx|.resxBiblioBrolAboutBox.resx5.68 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .cs|.csBrolForm.cs25.87 Ko31/10/2018 18:32:26-refusé-
Afficher le fichier .cs|.csWebServiceForm.Designer.cs13.12 Ko31/10/2018 18:32:29-refusé-
Afficher le fichier .cs|.csMediabrolForm.Designer.cs142.05 Ko31/10/2018 18:32:27-refusé-
Afficher le fichier .cs|.csConsoleForm.cs2.79 Ko31/10/2018 18:32:26-refusé-
Afficher le fichier .cs|.csBrolForm.designer.cs41.73 Ko31/10/2018 18:32:26-refusé-
Afficher le fichier .cs|.csMediabrolForm.cs31.94 Ko31/10/2018 18:32:27-refusé-
Afficher le fichier .cs|.csStatsForm.Designer.cs11.59 Ko31/10/2018 18:32:28-refusé-
Afficher le fichier .cs|.csActorForm.Designer.cs28.26 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .cs|.csOldMainForm.Designer.cs83.98 Ko31/10/2018 18:32:28-refusé-
Afficher le fichier .cs|.csStatsForm.cs5 Ko31/10/2018 18:32:28-refusé-
Afficher le fichier .cs|.csBiblioBrolAboutBox.cs5.51 Ko31/10/2018 18:32:25-refusé-
Afficher le fichier .cs|.csOldMainForm.cs27.08 Ko31/10/2018 18:32:27-refusé-
Afficher le fichier .resx|.resxTasksForm.resx187.31 Ko31/10/2018 18:32:29-refusé-
Afficher le fichier .cs|.csTasksForm.Designer.cs2.26 Ko31/10/2018 18:32:28-refusé-
Afficher le fichier .resx|.resxBrolForm.resx45.52 Ko31/10/2018 18:32:26-refusé-
Afficher le fichier .resx|.resxCopy of MainForm.resx7.53 Ko31/10/2018 18:32:27-refusé-
Afficher le fichier .resx|.resxStatsForm.resx187.5 Ko31/10/2018 18:32:28-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

Document créé le 16/10/2009, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/cs-bibliobrol-source-rf-view/AWSForm.cs.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.