OptionsForm.cs
Description du code
OptionsForm.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
Code c# (OptionsForm.cs) (200 lignes)
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using be.gaudry.bibliobrol.view.controls; using be.gaudry.bibliobrol.view.utils; using be.gaudry.bibliobrol.config; using be.gaudry.model.enums; namespace be.gaudry.bibliobrol.view.dialogs { /// <summary> /// Class used to set the application Configuration /// </summary> public partial class OptionsForm : Form { #region declarations and constructor private List<UserControl> optionPanels; private String availableDB; public OptionsForm() { InitializeComponent(); initOptionsValues(); initOptionsControls(); } #endregion #region initializations private void initOptionsValues() { availableDB = getAvailableDbTypes(); } private void initOptionsControls() { dataDirCtl.Info = "Ce r�pertoire sert � stocker les donn�es de l'application."; dataDirCtl.DirTitle = "donn�es"; sysInfoCtl.addTitle("Persistance"); sysInfoCtl.addItem("Version", String.Format("Version {0}", Config.DBVersion)); sysInfoCtl.addItem("Type", EnumHelper.GetDescription(Config.PersistentType)); sysInfoCtl.setAssembly(System.Reflection.Assembly.GetExecutingAssembly()); optionPanels.Add(dbSelCtl); optionPanels.Add(infosCtl); optionPanels.Add(persCtl); optionPanels.Add(persSelCtl); optionPanels.Add(dataDirCtl); optionPanels.Add(persImgCtl); optionPanels.Add(brolImgCtl); optionPanels.Add(appImgCtl); optionPanels.Add(prefsCtl); optionPanels.Add(todoCtl); optionPanels.Add(versionCtl); optionPanels.Add(sysInfoCtl); mainSC.Panel2.Controls.AddRange(optionPanels.ToArray()); hidePanels(); } #endregion #region private methods private void hidePanels() { foreach (UserControl c in optionPanels) { c.Visible = false; } } private void displayPanel(UserControl uc) { if (uc.Visible == false) foreach (UserControl c in optionPanels) { c.Visible = c.Equals(uc); } } private string getAvailableDbTypes() { DataTable dt = System.Data.Common.DbProviderFactories.GetFactoryClasses(); str.Append(dt.Rows.Count.ToString()); str.Append(" bases de donn�es suivantes sont pr�sentes sur la machine :\n"); foreach (DataRow row in dt.Rows) { str.Append("\n\t- "); //Object[] columns = row.ItemArray; //for (int i = 0; i < columns.Length; i++) //{ // str.Append("\t"); // str.Append(columns[i] + "("+ dt.Columns[i].ColumnName +")"); //} str.Append(row["Name"]); str.Append("\t("); str.Append(row["InvariantName"]); str.Append(")"); } return str.ToString(); } private void optionsTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { StringBuilder str; switch (e.Node.Name) { case "brolDirNode": dataDirCtl.Path = Config.DataDirectory; displayPanel(dataDirCtl); break; case "storageNode": infosCtl.InfosTitle = "Syst�me de persistance"; str = new StringBuilder("Le syst�me de persistance est le moyen utilis� par biblioBrol pour sauver les informations."); str.Append("\n\nPar exemple, nous pouvons d�cider d'utiliser un des moyens de persistance suivants :"); str.Append("\n- une base de donn�es MS Access"); str.Append("\n- une base de donn�es MySQL"); str.Append("\n- une base de donn�es Oracle"); str.Append("\n- une s�rie de fichiers XML"); infosCtl.Infos = str.ToString(); displayPanel(infosCtl); break; case "storageSelectionNode": displayPanel(dbSelCtl); break; case "availableStoragesNode": infosCtl.InfosTitle = "Bases de donn�es"; infosCtl.Infos = availableDB; displayPanel(infosCtl); break; case "storageOpsNode": infosCtl.InfosTitle = "Op�rations sur la persistance"; infosCtl.Infos = "todo :\n\nCr�ation de la db\nRAZ des exemplaires\nRAZ des ouvrages\nRAZ des personnes\nBackup\nPartage d'infos\n\timportation\n\texportation\nParam�tres des serveurs WebService"; displayPanel(infosCtl); break; case "ownerNode": infosCtl.InfosTitle = "Propri�taire de l'application"; str = new StringBuilder("D�finir un propri�taire pour biblioBrol permet par exemple de d�terminer"); str.Append(" la personne par d�faut lors de l'ajout de nouveaux ouvrages."); infosCtl.Infos = str.ToString(); displayPanel(infosCtl); break; case "ownerInfosNode": persCtl.setPerson(Config.Owner); displayPanel(persCtl); break; case "ownerSelectNode": persSelCtl.CurrentPerson = Config.Owner; displayPanel(persSelCtl); break; case "prefsNode": displayPanel(prefsCtl); break; case "todoNode": displayPanel(todoCtl); break; case "updateNode": displayPanel(versionCtl); break; case "sysInfoNode": displayPanel(sysInfoCtl); break; default: hidePanels(); break; } } #endregion #region events private void okBtn_Click(object sender, EventArgs e) { Config.save(); this.Close(); } private void cancelBtn_Click(object sender, EventArgs e) { this.Close(); } private void onOwnerSelected(object sender, PersonSelectedEventArgs e) { Config.Owner = e.Person; Config.save(); } private void onDataDirPathModified(object sender, DirPathModifiedEventArgs e) { Config.saveDataDirectory(e.Path); } #endregion } }
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Pas de sous-répertoires. | |||
Icône | Nom | Taille | Modification |
![]() | Répertoire parent | 0 octets | 1745158067 20/04/2025 16:07:47 |
×
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.
×
If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 16/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-bibliobrol-source-rf-view/dialogs//OptionsForm.cs.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.