OldMainForm.cs
Description du code
OldMainForm.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# (OldMainForm.cs) (739 lignes)
using System; using System.Drawing; using System.Windows.Forms; using be.gaudry.bibliobrol.config; using be.gaudry.bibliobrol.view.dialogs; using be.gaudry.bibliobrol.view.wizards; using be.gaudry.explorer.view; using be.gaudry.model.exceptions; using be.gaudry.observer; using be.gaudry.view; using be.gaudry.view.dialogs; using be.gaudry.view.style; using be.gaudry.model.config; namespace be.gaudry.bibliobrol.view { public partial class OldMainForm : Form, IMDIParent { #region Constructor and declarations private MDIChildForm borrowsForm, brolForm, actorForm, mediabrolForm, statsForm, brolExplorerForm, photobrolForm, tasksForm, awsForm, userForm, wsForm, startWizardForm, commentForm, infobrolForm; private ConsoleForm consoleForm = null; private ToolStripRenderer defaultRenderer, controlRenderer, blueRenderer, systemRenderer; private AboutBibliobrolDialog aboutBox; String hideCons,dispCons; public OldMainForm() { Splasher.Status = "Initialisation des styles"; initRenderers(); Splasher.Status = "Initialisation des composants"; InitializeComponent(); this.SuspendLayout(); Splasher.Status = "Initialisation de la console"; initConsoleForm(); StaticObservable.hideErrors(); Splasher.Status = "Initialisation de la config"; testApplicationConfig(); this.ResumeLayout(false); this.PerformLayout(); StaticObservable.showErrors(); } #endregion #region Initialisations private void initRenderers() { } private void initConsoleForm() { hideCons = "Cacher la console"; dispCons = "Afficher la console"; toolStripStatusLabel.Text = String.Format("Bibliobrol utilisé par {0}, dans la session de {1}", Config.Owner, Environment.UserName); consoleForm.StartPosition = FormStartPosition.Manual; if (Config.ShowConsoleForm) { consoleForm.Show(this); hideConsoleTSMenuItem.Text = hideCons; } else { hideConsoleTSMenuItem.Text = dispCons; } //consoleForm.MdiParent = this; consoleOpacity50TSMenuItem.Tag = 0.5; consoleOpacity70TSMenuItem.Tag = 0.7; consoleOpacity90TSMenuItem.Tag = 0.9; consoleOpacity95TSMenuItem.Tag = 0.95; consoleOpacity100TSMenuItem.Tag = 1.0; } private void initChildForm(Form childForm) { childForm.MdiParent = this; childForm.WindowState = FormWindowState.Maximized; } #endregion #region MDIchilds menus private void showOnLineHelpFormAction(object sender, EventArgs e) { if (infobrolForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement de la page infobrol"); infobrolForm.FormClosing += delegate { infobrolForm = null; }; initChildForm(infobrolForm); infobrolForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else infobrolForm.Activate(); } private void showBrolFormAction(object sender, EventArgs e) { if (brolForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement des ouvrages"); brolForm.FormClosing += delegate { brolForm = null; }; initChildForm(brolForm); brolForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else brolForm.Activate(); //manageMediaTSMenuItem.Enabled = false; } private void borrowsTSMenuItem_Click(object sender, EventArgs e) { if (borrowsForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement des emprunts"); borrowsForm.FormClosing += delegate { borrowsForm = null; }; initChildForm(borrowsForm); borrowsForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else borrowsForm.Activate(); } private void showActorFormAction(object sender, EventArgs e) { if (actorForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement des personnes"); actorForm.FormClosing += delegate { actorForm = null; }; initChildForm(actorForm); actorForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else actorForm.Activate(); } private void showUserFormAction(object sender, EventArgs e) { if (userForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement de l'éditeur avancé de personnes"); userForm.FormClosing += delegate { userForm = null; }; initChildForm(userForm); //((UserForm)userForm).setUser(new User()); userForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else { //((UserForm)userForm).setUser(new User()); userForm.Activate(); } } private void showMediabrolFormAction(object sender, EventArgs e) { if (mediabrolForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement des exemplaires"); mediabrolForm.FormClosing += delegate { mediabrolForm = null; }; initChildForm(mediabrolForm); mediabrolForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else mediabrolForm.Activate(); } private void showAwsFormAction(object sender, EventArgs e) { if (awsForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement du service de recherche"); awsForm.FormClosing += delegate { awsForm = null; }; initChildForm(awsForm); awsForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else awsForm.Activate(); } private void showTasksFormAction(object sender, EventArgs e) { if (tasksForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement des tâches"); tasksForm.FormClosing += delegate { tasksForm = null; }; initChildForm(tasksForm); tasksForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else tasksForm.Activate(); } #region explorer form private void showBrolExplorerFormAction(object sender, EventArgs e) { showBrolExplorerForm(true); } private void showBrolExplorerSearchFormAction(object sender, EventArgs e) { showBrolExplorerForm(false); } private void showBrolExplorerForm(bool search) { if (PluginsManager.BrolExplorerPlugAvailable) { if (brolExplorerForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement de l'explorateur"); brolExplorerForm.FormClosing += delegate { brolExplorerForm = null; }; initChildForm(brolExplorerForm); ((ExplorerForm)brolExplorerForm).setMenuStripDock(DockStyle.None); if(search)((ExplorerForm)brolExplorerForm).openMediaBrowser(); else ((ExplorerForm)brolExplorerForm).openExplorer(); brolExplorerForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else { if (search) ((ExplorerForm)brolExplorerForm).openMediaBrowser(); else ((ExplorerForm)brolExplorerForm).openExplorer(); brolExplorerForm.Activate(); } } else { MessageBox.Show( this, "Le plugin BrolExplorer n'est pas installé. Vous pouvez le télécharger sur l'infobrol.", "Plugin non installé", MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); } } #endregion private void showPhotobrolFormAction(object sender, EventArgs e) { if (PluginsManager.PhotoBrolPlugAvailable) { if (photobrolForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement de PhotoBrol"); photobrolForm.FormClosing += delegate { photobrolForm = null; }; initChildForm(photobrolForm); ((be.gaudry.photobrol.view.PhotoBrolMainForm)photobrolForm).setMenuStripDock(DockStyle.None); photobrolForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else photobrolForm.Activate(); } else { MessageBox.Show( this, "Le plugin PhotoBrol n'est pas installé. Vous pouvez le télécharger sur l'infobrol.", "Plugin non installé", MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); } } private void wsTSMenuItem_Click(object sender, EventArgs e) { if (wsForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement du service Web"); wsForm.FormClosing += delegate { wsForm = null; }; initChildForm(wsForm); wsForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else wsForm.Activate(); } private void showStatsFormAction(object sender, EventArgs e) { if (statsForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement des données pour les statistiques"); statsForm.FormClosing += delegate { statsForm = null; }; initChildForm(statsForm); statsForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else statsForm.Activate(); } private void showWelcomeWizardAction(object sender, EventArgs e) { if (startWizardForm == null) { StaticObservable.hideErrors(); Splasher.show("Chargement des données pour l'assistant de démarrage"); startWizardForm.FormClosing += delegate { startWizardForm = null; }; initChildForm(startWizardForm); startWizardForm.Show(); StaticObservable.showErrors(); Splasher.close(); } else startWizardForm.Activate(); } private void bugsTSMenuItem_Click(object sender, EventArgs e) { if (commentForm == null) { commentForm.FormClosing += delegate { commentForm = null; }; initChildForm(commentForm); commentForm.Show(); } else commentForm.Activate(); } #endregion #region Windows layout menu private void dispWinCTSMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.Cascade); } private void dispWinHTSMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileHorizontal); } private void dispWinVTSMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileVertical); } private void dispWinAIconsTSMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.ArrangeIcons); } #endregion #region test application validity /// <summary> /// Try forms initializations. /// If no persistance available, a message is displayed, and the wizard is set as the first page. /// </summary> public void testApplicationConfig() { if (!System.IO.Directory.Exists(Config.DataDirectory)) { /*StringBuilder str = new StringBuilder("Impossible de trouver le répertoire de données de l'application ("); str.Append(RefactoredConfig.DataDirectory); str.Append(").\n\nIl est possible de modifier la RefactoredConfiguration dans l'écran de RefactoredConfiguration qui va s'afficher, ou dans le menu \"Outils/Options\""); StaticObservable.notify(new Notification(Notification.VERBOSE.opsResult, "RefactoredConfiguration Bibliobrol", str.ToString(), this)); */enableApplication(false); } else { try { model.ModelAdapter.isAvailablePersistance(); enableApplication(true); } catch (PersistanceNotFoundException) { /*StringBuilder str = new StringBuilder(e.Message); str.AppendLine("\n\nIl est possible de modifier la RefactoredConfiguration dans le menu \"Outils/Options\", puis sélectionner \"Persistance\"..."); str.AppendLine("\nAucune fonctionnalité de l'application ne sera disponible tant que le système de persistance ne sera défini."); str.AppendLine("Des messages d'erreur peuvent se présenter avant de RefactoredConfigurer le système de persistance, ignorez les."); StaticObservable.notify(new Notification(Notification.VERBOSE.opsResult, "RefactoredConfiguration Bibliobrol", str.ToString(), this)); */enableApplication(false); } } } /// <summary> /// Allow to use application buttons if data dir path and persistant are found /// </summary> /// <param name="enable"></param> private void enableApplication(bool enable) { borrowsTSMenuItem.Visible = enable; brolsFormTSMenuItem.Visible = enable; personsFormMenuItem.Visible = enable; mediabrolsFormTSMenuItem.Visible = enable; statsTSMenuItem.Visible = enable; if (!enable) { wwf.MdiParent = this; wwf.WindowState = FormWindowState.Maximized; wwf.Show(); } } #endregion private void optionsTSMenuItem_Click(object sender, EventArgs e) { optionForm.Owner = this; optionForm.Show(); } #region Console private void consoleTSMenuItem_Paint(object sender, PaintEventArgs e) { bool disp = Config.ShowConsoleForm; consoleOpacityTSMenuItem.Enabled = disp; //clearConsoleTSMenuItem.Enabled = disp; clearConsoleTSMenuItem.Enabled = (consoleForm.ConsoleCount > 0); setConsoleButtonsState(); } /// <summary> /// Set buttons images, toolstrip text, and enabled or not /// </summary> private void setConsoleButtonsState() { if (Config.ShowConsoleForm) { hideConsoleTSMenuItem.Text = hideCons; hideConsoleTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleHide; dispConsTSB.ToolTipText = hideCons; dispConsTSB.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleHide; } else { hideConsoleTSMenuItem.Text = dispCons; hideConsoleTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsole; dispConsTSB.ToolTipText = dispCons; dispConsTSB.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsole; } cleanConsoleTSB.Enabled = clearConsoleTSMenuItem.Enabled; } private void clearConsoleTSMenuItem_Click(object sender, EventArgs e) { consoleForm.consoleClear(); } private void hideConsoleTSMenuItem_Click(object sender, EventArgs e) { Config.ShowConsoleForm = !Config.ShowConsoleForm; setConsoleButtonsState(); } #region Console Opacity private void consoleOpacityValTSMenuItem_Click(object sender, EventArgs e) { consoleForm.Opacity = (double)((ToolStripItem)sender).Tag; } private void consoleOpacityTSMenuItem_Paint(object sender, PaintEventArgs e) { foreach (ToolStripItem item in consoleOpacityTSMenuItem.DropDownItems) { item.Enabled = (!item.Tag.Equals(consoleForm.Opacity)); } } //Console Opacity #endregion //Console #endregion #region main form events /// <summary> /// Set previous windows state if it is possible /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_Load(object sender, EventArgs e) { Splasher.Status = "Lecture des paramètres de la fenêtre"; /*try { WindowState = (FormWindowState)Enum.Parse( typeof(FormWindowState), System.RefactoredConfiguration.RefactoredConfigurationManager.AppSettings["mainFormState"] ); } catch (Exception) { WindowState = FormWindowState.Normal; }*/ this.Size = Properties.Settings.Default.mainFormSize; this.Location = Properties.Settings.Default.mainFormLocation; this.WindowState = Properties.Settings.Default.mainFormState; ToolStripManager.Renderer = systemRenderer; setConsoleButtonsState(); resetStatusStrip(); Splasher.close(); } /// <summary> /// Save windows state on close /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { //RefactoredConfig.saveAppSetting("mainFormState", Enum.GetName(typeof(FormWindowState), WindowState)); Properties.Settings.Default.mainFormState = this.WindowState; if (this.WindowState == FormWindowState.Normal) { Properties.Settings.Default.mainFormSize = this.Size; Properties.Settings.Default.mainFormLocation = this.Location; } else { Properties.Settings.Default.mainFormSize = this.RestoreBounds.Size; Properties.Settings.Default.mainFormLocation = this.RestoreBounds.Location; } Properties.Settings.Default.Save(); } #endregion private void exitTSMenuItem_Click(object sender, EventArgs e) { this.Close(); } #region ToolStrip private void statsTSB_Click(object sender, EventArgs e) { showStatsFormAction(sender, e); } private void dispConsTSB_Click(object sender, EventArgs e) { hideConsoleTSMenuItem_Click(sender, e); } private void cleanConsoleTSB_Click(object sender, EventArgs e) { clearConsoleTSMenuItem_Click(sender, e); } #endregion #region styles private void styleSystemTsMi_Click(object sender, EventArgs e) { ToolStripManager.Renderer = systemRenderer; } private void defaultStyleTsMi_Click(object sender, EventArgs e) { ToolStripManager.Renderer = defaultRenderer; } private void controlStyleTsMi_Click(object sender, EventArgs e) { ToolStripManager.Renderer = controlRenderer; } private void blueStyleTsMi_Click(object sender, EventArgs e) { ToolStripManager.Renderer = blueRenderer; } #endregion private void aboutTsMi_Click(object sender, EventArgs e) { aboutBox.ShowDialog(this); } #region IMDIParent Membres public bool joinToolStrip(ToolStrip ts) { this.topTSP.Join(ts, 0); return true; }/* /// <summary> /// Merge the MDIChild MenuStrip with the MDIParent MenuStrip /// </summary> /// <param name="ms"></param> /// <returns></returns> public bool merge(MenuStrip ms, ToolStrip ts) { //this.topTSP.Join(ts, 0); ToolStripManager.Merge(ts, mainTS); bool merged = ToolStripManager.Merge(ms, mainMenuStrip); //ms.Dock = DockStyle.None; return merged; } /// <summary> /// Revertb Merge the MDIChild MenuStrip from the MDIParent MenuStrip /// </summary> /// <param name="ms"></param> /// <returns></returns> public bool revertMerge(MenuStrip ms, ToolStrip ts) { ToolStripManager.RevertMerge(ts, mainTS); bool merged = ToolStripManager.RevertMerge(ms, mainMenuStrip); //ms.Dock = DockStyle.Top; return merged; }*/ public void setStatusMessage(string copyright, string version, string message) { toolStripStatusLabel.Image = null; copyrightTsLbl.Text = copyright; versionTsLbl.Text = version; toolStripStatusLabel.Text = message; } public void setStatusMessage(string message) { toolStripStatusLabel.Image = null; toolStripStatusLabel.Text = message; } public void setStatusMessage(Image image, string message, string tooltip) { toolStripStatusLabel.Image = image; toolStripStatusLabel.Text = message; toolStripStatusLabel.ToolTipText = tooltip; } public void resetStatusStrip() { setStatusMessage( "Copyright © 2006 BrolDev", Application.ProductName + " " + Application.ProductVersion, String.Format("Bibliobrol utilisé par {0}, dans la session de {1}", Config.Owner, Environment.UserName) ); } public void startProgress() { toolStripProgressBar.Style = ProgressBarStyle.Marquee; toolStripProgressBar.Visible = true; } public void stopProgress() { toolStripProgressBar.Visible = false; toolStripProgressBar.Style = ProgressBarStyle.Blocks; } #endregion private void onShowUpdateForm_Click(object sender, EventArgs e) { } private void sourcesTsMi_Click(object sender, EventArgs e) { sourcesForm.MdiParent = this; sourcesForm.WindowState = FormWindowState.Maximized; sourcesForm.Show(); } private void openEditSeriesForm_Click(object sender, EventArgs e) { form.MdiParent = this; form.WindowState = FormWindowState.Maximized; form.Show(); } private void openNewApplicationTsMi_Click(object sender, EventArgs e) { form.WindowState = this.WindowState; form.Location = this.Location; form.Width = this.Width; form.Height = this.Height; form.Show(); this.Close(); } } }
Structure et Fichiers du projet
Afficher/masquer...Icône | Nom | Taille | Modification |
Icône | Nom | Taille | Modification |
| _ | Répertoire parent | 0 octets | 1731642750 15/11/2024 04:52:30 |
| _ | wizards | 0 octets | 1541007184 31/10/2018 18:33:04 |
| _ | utils | 0 octets | 1541007184 31/10/2018 18:33:04 |
| _ | controls | 0 octets | 1541007178 31/10/2018 18:32:58 |
| _ | dialogs | 0 octets | 1541007183 31/10/2018 18:33:03 |
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.
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 16/10/2009 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/cs-bibliobrol-source-rf-view//OldMainForm.cs.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.