Bibliobrol : Fenêtre principale

Le code qui suit est le code de la page principale de l'application Bibliobrol. Il nous permet d'utiliser les fenêtres Mdi, et de tester certaines notions comme par exemple le MdiLayout.

Cette page contiendra les explications nécessaires par la suite.

  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. using be.gaudry.bibliobrol.config;
  5. using be.gaudry.bibliobrol.model;
  6. using be.gaudry.bibliobrol.view.controls.toolBars;
  7. using be.gaudry.bibliobrol.view.dialogs;
  8. using be.gaudry.bibliobrol.view.wizards;
  9. using be.gaudry.explorer.view;
  10. using be.gaudry.model.config;
  11. using be.gaudry.model.exceptions;
  12. using be.gaudry.observer;
  13. using be.gaudry.view;
  14. using be.gaudry.view.controls;
  15. using be.gaudry.view.dialogs;
  16. using be.gaudry.model.enums;
  17. using be.gaudry.bibliobrol.model.enums;
  18.  
  19. namespace be.gaudry.bibliobrol.view
  20. {
  21. public partial class MainForm : MDIParentForm
  22. {
  23. #region declarations
  24. private String hideCons, dispCons;
  25. private ConsoleForm consoleForm;
  26. private ToolBarConsoleControl toolBarConsole;
  27. private IToolBarControl
  28. toolBarStart,
  29. toolBarPersonAndBrol;
  30.  
  31. private AboutBibliobrolDialog aboutBox;
  32.  
  33. private ToolStripMenuItem showHideQuickLaunchTsMi;
  34.  
  35. private ToolStripMenuItem
  36. personsTsMi,
  37. showPersonsFormTsMi,
  38. showAddUserFormTsMi;
  39.  
  40. private ToolStripMenuItem
  41. brolsTsMi,
  42. showBrolsFormTsMi,
  43. showEditSeriesFormTsMi;
  44.  
  45. private ToolStripMenuItem
  46. mediabrolsTsMi,
  47. showMediabrolsFormTsMi;
  48.  
  49. private ToolStripMenuItem
  50. findTsMi,
  51. showSearchOnDiscFormTsMi,
  52. showBrowserFormTsMi,
  53. showAwsFormTsMi;
  54.  
  55. private ToolStripMenuItem openOldApplicationTsMi;
  56.  
  57. private ToolStripMenuItem
  58. showImportedImagesFormTsMi,
  59. showStatsFormTsMi,
  60. //brolExplorerTSMenuItem,
  61. showTasksTsMi,
  62. consoleTSMenuItem,
  63. showConsoleCtlTsMi,
  64. showConsoleFormTsMi,
  65. clearConsoleTsMi,
  66. consoleOpacityTsMi,
  67. consoleOpacity50TsMi,
  68. consoleOpacity70TsMi,
  69. consoleOpacity90TsMi,
  70. consoleOpacity95TsMi,
  71. consoleOpacity100TsMi;
  72.  
  73.  
  74. private ToolStripMenuItem
  75. showUpdateFormTsMi,
  76. showWelcomeWizardTsMi;
  77. #endregion
  78.  
  79. #region constructors and initializations
  80. public MainForm()
  81. {
  82. //set console before any control because console to allow listening application events
  83. toolBarConsole = new ToolBarConsoleControl();
  84. consoleForm = new ConsoleForm();
  85. StaticObservable.hideErrors();
  86. InitializeComponent();
  87. Splasher.Status = "Initialisation des composants BiblioBrol";
  88. initMainFormFeatures();
  89. addMainFormToolBars();
  90. Splasher.Status = "Initialisation de la console";
  91. initConsoleForm();
  92.  
  93. Splasher.Status = "Initialisation de la config";
  94. testApplicationConfig();
  95. aboutBox = new AboutBibliobrolDialog();
  96. this.ResumeLayout(false);
  97. this.PerformLayout();
  98. //StaticObservable.showErrors();
  99. }
  100.  
  101. private void addMainFormToolBars()
  102. {
  103. toolBarManagerControl.addToolBar(toolBarConsole);
  104.  
  105. toolBarStart = new ToolBarHelpStartControl();
  106. toolBarManagerControl.addToolBar(toolBarStart);
  107.  
  108. toolBarPersonAndBrol = new ToolBarHelpPersonControl();
  109. toolBarManagerControl.addToolBar(toolBarPersonAndBrol);
  110.  
  111. leftPanel.Controls.Add( toolBarShortCuts);
  112. toolBarShortCuts.Dock = DockStyle.Fill;
  113.  
  114. this.AboutImage = global::be.gaudry.bibliobrol.Properties.Resources.AboutBoxBiblioBrol;
  115. }
  116.  
  117. private void initMainFormFeatures()
  118. {
  119.  
  120. personsTsMi = new ToolStripMenuItem();
  121. showPersonsFormTsMi = new ToolStripMenuItem();
  122. showAddUserFormTsMi = new ToolStripMenuItem();
  123.  
  124. showHideQuickLaunchTsMi = new ToolStripMenuItem();
  125.  
  126. brolsTsMi = new ToolStripMenuItem();
  127. showBrolsFormTsMi = new ToolStripMenuItem();
  128. showEditSeriesFormTsMi = new ToolStripMenuItem();
  129.  
  130. mediabrolsTsMi = new ToolStripMenuItem();
  131. showMediabrolsFormTsMi = new ToolStripMenuItem();
  132.  
  133. findTsMi = new ToolStripMenuItem();
  134. showSearchOnDiscFormTsMi = new ToolStripMenuItem();
  135. showBrowserFormTsMi = new ToolStripMenuItem();
  136. showAwsFormTsMi = new ToolStripMenuItem();
  137.  
  138. openOldApplicationTsMi = new ToolStripMenuItem();
  139.  
  140. showImportedImagesFormTsMi = new ToolStripMenuItem();
  141. showStatsFormTsMi = new ToolStripMenuItem();
  142. //brolExplorerTSMenuItem = new ToolStripMenuItem();
  143. showTasksTsMi = new ToolStripMenuItem();
  144. consoleTSMenuItem = new ToolStripMenuItem();
  145. showConsoleCtlTsMi = new ToolStripMenuItem();
  146. showConsoleFormTsMi = new ToolStripMenuItem();
  147. clearConsoleTsMi = new ToolStripMenuItem();
  148. consoleOpacityTsMi = new ToolStripMenuItem();
  149. consoleOpacity50TsMi = new ToolStripMenuItem();
  150. consoleOpacity70TsMi = new ToolStripMenuItem();
  151. consoleOpacity90TsMi = new ToolStripMenuItem();
  152. consoleOpacity95TsMi = new ToolStripMenuItem();
  153. consoleOpacity100TsMi = new ToolStripMenuItem();
  154.  
  155. showUpdateFormTsMi = new ToolStripMenuItem();
  156. showWelcomeWizardTsMi = new ToolStripMenuItem();
  157. //
  158. // personsTsMi
  159. //
  160. personsTsMi.DropDownItems.AddRange(
  161. new ToolStripItem[]
  162. {
  163. showPersonsFormTsMi,
  164. showAddUserFormTsMi
  165. });
  166. personsTsMi.MergeAction = MergeAction.MatchOnly;
  167. personsTsMi.Name = "personsTsMi";
  168. personsTsMi.Size = new System.Drawing.Size(73, 20);
  169. personsTsMi.Text = "&Personnes";
  170. personsTsMi.ToolTipText = "Gestion des personnes (utilisateurs de l\'application, acteurs, dessinateurs, écrivains, etc.)";
  171. //
  172. // showPersonsFormTsMi
  173. //
  174. showPersonsFormTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolUsrs;
  175. showPersonsFormTsMi.Name = "showPersonsFormTsMi";
  176. showPersonsFormTsMi.Size = new System.Drawing.Size(185, 22);
  177. showPersonsFormTsMi.Text = "&Gérer les personnes";
  178. showPersonsFormTsMi.Click += new System.EventHandler(personsTSB_Click);
  179. mainMenuStrip.Items.Insert(1, personsTsMi);
  180. //
  181. // showAddUserFormTsMi
  182. //
  183. showAddUserFormTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolUsrAddBtn;
  184. showAddUserFormTsMi.Name = "showAddUserFormTsMi";
  185. showAddUserFormTsMi.Size = new System.Drawing.Size(185, 22);
  186. showAddUserFormTsMi.Text = "Ajouter un utilisateur";
  187. showAddUserFormTsMi.Click += new System.EventHandler(openUserForm_Click);
  188.  
  189. //
  190. // displayMenuLeftTsB (declared in the MDIParentForm)
  191. //
  192. displayMenuLeftTsB.Visible = true;
  193. displayMenuLeftTsB.Checked = true;
  194. leftPanel.Visible = true;
  195. displayMenuLeftTsB.Text = "Afficher ou masquer la barre de lancement rapide";
  196. displayMenuLeftTsB.AutoToolTip = true;
  197.  
  198. //
  199. // showHideQuickLaunchTsMi
  200. //
  201. showHideQuickLaunchTsMi.Image = global::be.gaudry.Properties.Resources.displayMenuLeft;
  202. showHideQuickLaunchTsMi.Name = "showHideQuickLaunchTsMi";
  203. showHideQuickLaunchTsMi.Size = new System.Drawing.Size(185, 22);
  204. showHideQuickLaunchTsMi.Text = "Lancement rapide";
  205. showHideQuickLaunchTsMi.Click += new EventHandler(displayMenuLeftTsB_Click);
  206. displayToolBarTsMi.DropDownItems.Add(showHideQuickLaunchTsMi);
  207.  
  208.  
  209.  
  210. //
  211. // brolsTsMi
  212. //
  213. brolsTsMi.DropDownItems.AddRange(
  214. new ToolStripItem[]
  215. {
  216. showBrolsFormTsMi,
  217. showEditSeriesFormTsMi
  218. });
  219. brolsTsMi.Name = "brolsTsMi";
  220. brolsTsMi.Size = new System.Drawing.Size(69, 20);
  221. brolsTsMi.Text = "&Ouvrages";
  222. brolsTsMi.ToolTipText = "Gestion des ouvrages. "+
  223. "(Rappel : un ouvrage est un type générique, ce que vous possédez, ce sont des exemplaires)";
  224. mainMenuStrip.Items.Insert(1, brolsTsMi);
  225. //
  226. // showBrolsFormTsMi
  227. //
  228. showBrolsFormTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolSmall;
  229. showBrolsFormTsMi.MergeAction = MergeAction.Insert;
  230. showBrolsFormTsMi.Name = "showBrolsFormTsMi";
  231. showBrolsFormTsMi.Size = new System.Drawing.Size(170, 22);
  232. showBrolsFormTsMi.Text = "&Gérer les ouvrages";
  233. showBrolsFormTsMi.Click += new System.EventHandler(brolsTSB_Click);
  234. //
  235. // showEditSeriesFormTsMi
  236. //
  237. showEditSeriesFormTsMi.Name = "showEditSeriesFormTsMi";
  238. showEditSeriesFormTsMi.Size = new System.Drawing.Size(170, 22);
  239. showEditSeriesFormTsMi.Text = "Gérer les séries";
  240. showEditSeriesFormTsMi.Click += new System.EventHandler(openEditSeriesForm_Click);
  241.  
  242.  
  243. //
  244. // mediabrolsTsMi
  245. //
  246. mediabrolsTsMi.DropDownItems.Add(showMediabrolsFormTsMi);
  247. mediabrolsTsMi.Name = "mediabrolsTsMi";
  248. mediabrolsTsMi.Size = new System.Drawing.Size(81, 20);
  249. mediabrolsTsMi.Text = "E&xemplaires";
  250. mediabrolsTsMi.ToolTipText = "Gérer les exemplaires (localisation, état, propriétaire, emprunts)";
  251. mainMenuStrip.Items.Insert(1, mediabrolsTsMi);
  252. //
  253. // showMediabrolsFormTsMi
  254. //
  255. showMediabrolsFormTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.mediabrolSmall;
  256. showMediabrolsFormTsMi.MergeAction = MergeAction.MatchOnly;
  257. showMediabrolsFormTsMi.Name = "showMediabrolsFormTsMi";
  258. showMediabrolsFormTsMi.Size = new System.Drawing.Size(184, 22);
  259. showMediabrolsFormTsMi.Text = "&Gérer les exemplaires";
  260. showMediabrolsFormTsMi.Click += new System.EventHandler(mediabrolsTSB_Click);
  261.  
  262.  
  263. //
  264. // findTsMi
  265. //
  266. findTsMi.DropDownItems.AddRange(
  267. new ToolStripItem[]
  268. {
  269. showSearchOnDiscFormTsMi,
  270. showBrowserFormTsMi,
  271. showAwsFormTsMi
  272. });
  273. findTsMi.Name = "findTsMi";
  274. findTsMi.Size = new System.Drawing.Size(74, 20);
  275. findTsMi.Text = "&Recherche";
  276. mainMenuStrip.Items.Insert(1, findTsMi);
  277. //
  278. // showSearchOnDiscFormTsMi
  279. //
  280. showSearchOnDiscFormTsMi.Name = "showSearchOnDiscFormTsMi";
  281. showSearchOnDiscFormTsMi.Size = new System.Drawing.Size(222, 22);
  282. showSearchOnDiscFormTsMi.Text = "Sur le disque (Automatique)";
  283. showSearchOnDiscFormTsMi.Click += new System.EventHandler(brolXplorerTSB_Click);
  284. //
  285. // showBrowserFormTsMi
  286. //
  287. showBrowserFormTsMi.Name = "showBrowserFormTsMi";
  288. showBrowserFormTsMi.Size = new System.Drawing.Size(222, 22);
  289. showBrowserFormTsMi.Text = "Sur le disque (Explorer)";
  290. showBrowserFormTsMi.Click += new System.EventHandler(brolXplorerSearchTSB_Click);
  291. //
  292. // showAwsFormTsMi
  293. //
  294. showAwsFormTsMi.Name = "showAwsFormTsMi";
  295. showAwsFormTsMi.Size = new System.Drawing.Size(222, 22);
  296. showAwsFormTsMi.Text = "Bases de données Internet";
  297. showAwsFormTsMi.Click += new System.EventHandler(showAwsFormAction);
  298.  
  299. //
  300. // openOldApplicationTsMi
  301. //
  302. openOldApplicationTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolWindows;
  303. openOldApplicationTsMi.Name = "openOldApplicationTsMi";
  304. openOldApplicationTsMi.Size = new System.Drawing.Size(185, 22);
  305. openOldApplicationTsMi.Text = "Ancienne version";
  306. openOldApplicationTsMi.ToolTipText = "Fermer cette fenêtre et ouvrir l'ancienne version";
  307. openOldApplicationTsMi.Click += new System.EventHandler(openOldMainFormTsBtn_Click);
  308. windowTsMi.DropDownItems.Add(new ToolStripSeparator());
  309. windowTsMi.DropDownItems.Add(openOldApplicationTsMi);
  310.  
  311.  
  312. //
  313. // toolsTsMi (declared in the MDIParentForm)
  314. //
  315. toolsTsMi.DropDownItems.AddRange(
  316. new ToolStripItem[]
  317. {
  318. new ToolStripSeparator(),
  319. showStatsFormTsMi,
  320. //brolExplorerTSMenuItem,
  321. showTasksTsMi,
  322. showImportedImagesFormTsMi,
  323. new ToolStripSeparator(),
  324. consoleTSMenuItem
  325. });
  326. //
  327. // optionsTSMenuItem (declared in the MDIParentForm)
  328. //
  329. optionsTSMenuItem.Click += new EventHandler(showOptions_Click);
  330. //
  331. // showImportedImagesFormTsMi
  332. //
  333. showImportedImagesFormTsMi.Name = "showImportedImagesFormTsMi";
  334. showImportedImagesFormTsMi.Size = new System.Drawing.Size(185, 22);
  335. showImportedImagesFormTsMi.Text = "Gestion des BIF";
  336. showImportedImagesFormTsMi.ToolTipText = "Affichage des fichiers d'images brolDev (BIF)";
  337. showImportedImagesFormTsMi.Click += new System.EventHandler(openImportedImagesForm_Click);
  338. //
  339. // showStatsFormTsMi
  340. //
  341. showStatsFormTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.statsSmall;
  342. showStatsFormTsMi.Name = "showStatsFormTsMi";
  343. showStatsFormTsMi.Size = new System.Drawing.Size(185, 22);
  344. showStatsFormTsMi.Text = "Statistiques";
  345. showStatsFormTsMi.ToolTipText = "Affichage de certaines informations sous forme de tartes";
  346. showStatsFormTsMi.Click += new System.EventHandler(statsTSB_Click);
  347. //
  348. // showTasksTsMi
  349. //
  350. showTasksTsMi.Name = "showTasksTsMi";
  351. showTasksTsMi.Size = new System.Drawing.Size(185, 22);
  352. showTasksTsMi.Text = "Tâches";
  353. showTasksTsMi.Click += new System.EventHandler(showTasksFormAction);
  354. //
  355. // consoleTSMenuItem
  356. //
  357. consoleTSMenuItem.DropDownItems.AddRange(
  358. new ToolStripItem[]
  359. {
  360. showConsoleCtlTsMi,
  361. showConsoleFormTsMi,
  362. clearConsoleTsMi,
  363. consoleOpacityTsMi
  364. });
  365. consoleTSMenuItem.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsole;
  366. consoleTSMenuItem.Name = "consoleTSMenuItem";
  367. consoleTSMenuItem.Size = new System.Drawing.Size(185, 22);
  368. consoleTSMenuItem.Text = "&Console";
  369. consoleTSMenuItem.ToolTipText = "Gestion de la console locale";
  370. consoleTSMenuItem.Paint += new PaintEventHandler(consoleTSMenuItem_Paint);
  371. //
  372. // showConsoleCtlTsMi
  373. //
  374. showConsoleCtlTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsole;
  375. showConsoleCtlTsMi.Name = "showConsoleCtlTsMi";
  376. showConsoleCtlTsMi.Size = new System.Drawing.Size(215, 22);
  377. showConsoleCtlTsMi.Text = "Montrer/Cacher la console (Assistant)";
  378. showConsoleCtlTsMi.ToolTipText = "Afficher ou masquer la console dans le volet assistant.";
  379. showConsoleCtlTsMi.Click += new System.EventHandler(showHideConsoleCtl_Click);
  380. //
  381. // showConsoleFormTsMi
  382. //
  383. showConsoleFormTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleHide;
  384. showConsoleFormTsMi.Name = "showConsoleFormTsMi";
  385. showConsoleFormTsMi.Size = new System.Drawing.Size(215, 22);
  386. showConsoleFormTsMi.Text = dispCons;
  387. showConsoleFormTsMi.ToolTipText = "Afficher ou masquer la console dans une fenêtre indépendante.";
  388. showConsoleFormTsMi.Click += new System.EventHandler(showHideConsole_Click);
  389. //
  390. // clearConsoleTsMi
  391. //
  392. clearConsoleTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleClean;
  393. clearConsoleTsMi.Name = "clearConsoleTSMenuItem";
  394. clearConsoleTsMi.Size = new System.Drawing.Size(215, 22);
  395. clearConsoleTsMi.Text = "Vider la console";
  396. clearConsoleTsMi.ToolTipText = "Réinitialiser le contenu de la console";
  397. clearConsoleTsMi.Click += new System.EventHandler(clearConsole_Click);
  398. //
  399. // consoleOpacityTsMi
  400. //
  401. consoleOpacityTsMi.DropDownItems.AddRange(
  402. new ToolStripItem[]
  403. {
  404. consoleOpacity50TsMi,
  405. consoleOpacity70TsMi,
  406. consoleOpacity90TsMi,
  407. consoleOpacity95TsMi,
  408. consoleOpacity100TsMi
  409. });
  410. consoleOpacityTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp;
  411. consoleOpacityTsMi.Name = "consoleOpacityTsMi";
  412. consoleOpacityTsMi.Size = new System.Drawing.Size(215, 22);
  413. consoleOpacityTsMi.Text = "Opacité";
  414. consoleOpacityTsMi.Paint += new PaintEventHandler(consoleOpacityTsMi_Paint);
  415. //
  416. // consoleOpacity50TsMi
  417. //
  418. consoleOpacity50TsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp50;
  419. consoleOpacity50TsMi.Name = "consoleOpacity50TsMi";
  420. consoleOpacity50TsMi.Size = new System.Drawing.Size(105, 22);
  421. consoleOpacity50TsMi.Text = "50 %";
  422. consoleOpacity50TsMi.Click += new System.EventHandler(consoleOpacityValTSMenuItem_Click);
  423. //
  424. // consoleOpacity70TsMi
  425. //
  426. consoleOpacity70TsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp70;
  427. consoleOpacity70TsMi.Name = "consoleOpacity70TsMi";
  428. consoleOpacity70TsMi.Size = new System.Drawing.Size(105, 22);
  429. consoleOpacity70TsMi.Text = "70 %";
  430. consoleOpacity70TsMi.Click += new System.EventHandler(consoleOpacityValTSMenuItem_Click);
  431. //
  432. // consoleOpacity90TsMi
  433. //
  434. consoleOpacity90TsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp90;
  435. consoleOpacity90TsMi.Name = "consoleOpacity90TsMi";
  436. consoleOpacity90TsMi.Size = new System.Drawing.Size(105, 22);
  437. consoleOpacity90TsMi.Text = "90 %";
  438. consoleOpacity90TsMi.Click += new System.EventHandler(consoleOpacityValTSMenuItem_Click);
  439. //
  440. // consoleOpacity95TsMi
  441. //
  442. consoleOpacity95TsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp95;
  443. consoleOpacity95TsMi.Name = "consoleOpacity95TsMi";
  444. consoleOpacity95TsMi.Size = new System.Drawing.Size(105, 22);
  445. consoleOpacity95TsMi.Text = "95 %";
  446. consoleOpacity95TsMi.Click += new System.EventHandler(consoleOpacityValTSMenuItem_Click);
  447. //
  448. // consoleOpacity100TsMi
  449. //
  450. consoleOpacity100TsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleOp;
  451. consoleOpacity100TsMi.Name = "consoleOpacity100TsMi";
  452. consoleOpacity100TsMi.Size = new System.Drawing.Size(105, 22);
  453. consoleOpacity100TsMi.Text = "100 %";
  454. consoleOpacity100TsMi.Click += new System.EventHandler(consoleOpacityValTSMenuItem_Click);
  455.  
  456. //
  457. // helpTsMi (declared in the MDIParentForm)
  458. //
  459. helpTsMi.DropDownItems.AddRange(
  460. new System.Windows.Forms.ToolStripItem[]
  461. {
  462. showUpdateFormTsMi,
  463. showWelcomeWizardTsMi
  464. });
  465. //
  466. // showUpdateFormTsMi
  467. //
  468. showUpdateFormTsMi.Name = "showUpdateFormTsMi";
  469. showUpdateFormTsMi.Size = new System.Drawing.Size(201, 22);
  470. showUpdateFormTsMi.Text = "Mises à jour...";
  471. showUpdateFormTsMi.Click += new System.EventHandler(this.onShowUpdateForm_Click);
  472. //
  473. // showWelcomeWizardTsMi
  474. //
  475. showWelcomeWizardTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.wizardSmall;
  476. showWelcomeWizardTsMi.Name = "showWelcomeWizardTsMi";
  477. showWelcomeWizardTsMi.Size = new System.Drawing.Size(201, 22);
  478. showWelcomeWizardTsMi.Text = "Assistant de démarrage";
  479. showWelcomeWizardTsMi.ToolTipText = "Assistant pas à pas pour configurer l\'application (localisation des répertoires, " +
  480. "de la DB, etc.)";
  481. showWelcomeWizardTsMi.Click += new System.EventHandler(this.showWelcomeWizardAction);
  482. //
  483. // contentsTSMenuItem (declared in the MDIParentForm)
  484. //
  485. //contentsTSMenuItem.Click += new System.EventHandler(this.showWelcomeWizardAction);
  486. //
  487. // indexTSMenuItem (declared in the MDIParentForm)
  488. //
  489. //indexTSMenuItem.Click += new System.EventHandler(this.showWelcomeWizardAction);
  490. //
  491. // searchToolStripMenuItem (declared in the MDIParentForm)
  492. //
  493. //searchToolStripMenuItem.Click += new System.EventHandler(this.showWelcomeWizardAction);
  494.  
  495.  
  496. //
  497. // aboutTSMenuItem (declared in the MDIParentForm)
  498. //
  499. aboutTSMenuItem.Text = "À &propos de Bibliobrol...";
  500. //aboutTSMenuItem.Click += new System.EventHandler(this.openAbout_Click);
  501. }
  502. #endregion
  503.  
  504. #region open childs
  505. private void personsTSB_Click(object sender, EventArgs e)
  506. {
  507. StaticObservable.hideErrors();
  508. showMDIChild<ActorForm>("Chargement des personnes");
  509. StaticObservable.showErrors();
  510. }
  511.  
  512. private void openUserForm_Click(object sender, EventArgs e)
  513. {
  514. showMDIChild<UserForm>("Chargement du formulaire d'ajout d'utilisateur");
  515. }
  516.  
  517. private void brolsTSB_Click(object sender, EventArgs e)
  518. {
  519. showMDIChild<BrolForm>("Chargement des ouvrages");
  520. }
  521.  
  522. private void mediabrolsTSB_Click(object sender, EventArgs e)
  523. {
  524. showMDIChild<MediabrolForm>("Chargement des exemplaires");
  525. }
  526.  
  527. private void openImportedImagesForm_Click(object sender, EventArgs e)
  528. {
  529. showMDIChild<ImportedImagesForm>();
  530. }
  531. private void statsTSB_Click(object sender, EventArgs e)
  532. {
  533. showMDIChild<StatsForm>("Chargement des statistiques");
  534. }
  535.  
  536. private void openEditSeriesForm_Click(object sender, EventArgs e)
  537. {
  538. showMDIChild<EditSeriesForm>("Chargement des séries");
  539. }
  540.  
  541. private void showAwsFormAction(object sender, EventArgs e)
  542. {
  543. showMDIChild<AWSForm>("Chargement du service de recherche");
  544. }
  545.  
  546. private void showTasksFormAction(object sender, EventArgs e)
  547. {
  548. showMDIChild<TasksForm>("Chargement des tâches");
  549. }
  550.  
  551. private void brolXplorerTSB_Click(object sender, EventArgs e)
  552. {
  553. showBrolExplorerForm(true);
  554. }
  555.  
  556. private void brolXplorerSearchTSB_Click(object sender, EventArgs e)
  557. {
  558. showBrolExplorerForm(false);
  559. }
  560.  
  561. private void showBrolExplorerForm(bool explore)
  562. {
  563. ExplorerForm brolExplorerForm = createMDIChild<ExplorerForm>();
  564. if (explore)
  565. {
  566. brolExplorerForm.openExplorer();
  567. }
  568. else
  569. {
  570. brolExplorerForm.openMediaBrowser();
  571. }
  572. showMDIChild(brolExplorerForm);
  573.  
  574. }
  575.  
  576. private void showPhotobrolTSB_Click(object sender, EventArgs e)
  577. {
  578. if (PluginsManager.PhotoBrolPlugAvailable)
  579. {
  580. showMDIChild<be.gaudry.photobrol.view.PhotoBrolMainForm>("Chargement de l'éditeur d'images");
  581. }
  582. }
  583.  
  584. private void openOldMainFormTsBtn_Click(object sender, EventArgs e)
  585. {
  586. OldMainForm form = new OldMainForm();
  587. form.WindowState = this.WindowState;
  588. form.Location = this.Location;
  589. form.Width = this.Width;
  590. form.Height = this.Height;
  591. form.Show();
  592. }
  593.  
  594.  
  595. private void showWelcomeWizardAction(object sender, EventArgs e)
  596. {
  597. showMDIChild<WelcomeWizardForm>("Chargement des données pour l'assistant de démarrage");
  598. }
  599. private void onShowUpdateForm_Click(object sender, EventArgs e)
  600. {
  601. VersionForm versionForm = createMDIChild<VersionForm>("Chargement des données de version");
  602.  
  603. versionForm.addSystemInfoTitle("Persistance");
  604. versionForm.addSystemInfoItem("Version", String.Format("Version {0}", Config.DBVersion));
  605. versionForm.addSystemInfoItem("Type", EnumHelper.GetDescription(Config.PersistentType));
  606. versionForm.setAssembly(System.Reflection.Assembly.GetExecutingAssembly());
  607.  
  608. showMDIChild(versionForm);
  609. }
  610. protected override void showAboutBox_Click(object sender, EventArgs e)
  611. {
  612. aboutBox.ShowDialog(this);
  613. }
  614. protected override void showOptions_Click(object sender, EventArgs e)
  615. {
  616. OptionsForm optionForm = new OptionsForm();
  617. optionForm.Owner = this;
  618. optionForm.Show();
  619. }
  620. #endregion
  621.  
  622. #region Console
  623.  
  624. private void initConsoleForm()
  625. {
  626. hideCons = "Fermer la fenêtre de console";
  627. dispCons = "Ouvrir la fenêtre de console";
  628. if(!Config.Owner.Equals(new Person()))
  629. {
  630. setStatusMessage("Bibliobrol utilisé par " + Config.Owner + ", dans la session de " + Environment.UserName);
  631. }
  632. //consoleForm.setMDIParent(this);
  633. consoleForm.ClientSize = new System.Drawing.Size(this.Size.Width, 100);
  634. consoleForm.StartPosition = FormStartPosition.Manual;
  635. consoleForm.Location = new Point(this.Location.X, this.Location.Y + this.Size.Height);
  636. if (Config.ShowConsoleForm)
  637. {
  638. consoleForm.Show(this);
  639. showConsoleFormTsMi.Text = hideCons;
  640. }
  641. else
  642. {
  643. showConsoleFormTsMi.Text = dispCons;
  644. }
  645. //consoleForm.MdiParent = this;
  646. consoleOpacity50TsMi.Tag = 0.5;
  647. consoleOpacity70TsMi.Tag = 0.7;
  648. consoleOpacity90TsMi.Tag = 0.9;
  649. consoleOpacity95TsMi.Tag = 0.95;
  650. consoleOpacity100TsMi.Tag = 1.0;
  651. }
  652. private void consoleTSMenuItem_Paint(object sender, PaintEventArgs e)
  653. {
  654. bool disp = Config.ShowConsoleForm;
  655. consoleOpacityTsMi.Enabled = disp;
  656. //clearConsoleTSMenuItem.Enabled = disp;
  657. clearConsoleTsMi.Enabled = consoleForm!=null && (consoleForm.ConsoleCount > 0);
  658. setConsoleButtonsState();
  659. }
  660.  
  661. /// <summary>
  662. /// Set buttons images, toolstrip text, and enabled or not
  663. /// </summary>
  664. private void setConsoleButtonsState()
  665. {
  666. if (Config.ShowConsoleForm)
  667. {
  668. showConsoleFormTsMi.Text = hideCons;
  669. showConsoleFormTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleHide;
  670. dispConsTSB.ToolTipText = hideCons;
  671. dispConsTSB.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsoleHide;
  672. }
  673. else
  674. {
  675. showConsoleFormTsMi.Text = dispCons;
  676. showConsoleFormTsMi.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsole;
  677. dispConsTSB.ToolTipText = dispCons;
  678. dispConsTSB.Image = global::be.gaudry.bibliobrol.Properties.Resources.brolConsole;
  679. }
  680. cleanConsoleTSB.Enabled = clearConsoleTsMi.Enabled;
  681. }
  682.  
  683. private void clearConsole_Click(object sender, EventArgs e)
  684. {
  685. consoleForm.consoleClear();
  686. }
  687. /// <summary>
  688. /// Shows the console on an independant <code>Form</code>, or hides it if it's shown.
  689. /// Sets the console menu and buttons.
  690. /// </summary>
  691. /// <param name="sender"></param>
  692. /// <param name="e"></param>
  693. private void showHideConsole_Click(object sender, EventArgs e)
  694. {
  695. Config.ShowConsoleForm = !Config.ShowConsoleForm;
  696. setConsoleButtonsState();
  697. }
  698. /// <summary>
  699. /// Shows the console on the assistant panel.
  700. /// </summary>
  701. /// <param name="sender"></param>
  702. /// <param name="e"></param>
  703. private void showHideConsoleCtl_Click(object sender, EventArgs e)
  704. {
  705. showToolBar(toolBarConsole);
  706. }
  707. #region Console Opacity
  708. private void consoleOpacityValTSMenuItem_Click(object sender, EventArgs e)
  709. {
  710. consoleForm.Opacity = (double)((ToolStripItem)sender).Tag;
  711. }
  712.  
  713. private void consoleOpacityTsMi_Paint(object sender, PaintEventArgs e)
  714. {
  715. foreach (ToolStripItem item in consoleOpacityTsMi.DropDownItems)
  716. {
  717. item.Enabled = (!item.Tag.Equals(consoleForm.Opacity));
  718. }
  719. }
  720.  
  721. //Console Opacity
  722. #endregion
  723.  
  724. //Console
  725. #endregion
  726.  
  727. #region test application validity
  728. /// <summary>
  729. /// Try forms initializations.
  730. /// If no persistance available, a message is displayed, and the wizard is set as the first page.
  731. /// </summary>
  732. public void testApplicationConfig()
  733. {
  734. if (!System.IO.Directory.Exists(Config.DataDirectory))
  735. {
  736. /*StringBuilder str = new StringBuilder("Impossible de trouver le répertoire de données de l'application (");
  737.   str.Append(RefactoredConfig.DataDirectory);
  738.   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\"");
  739.   StaticObservable.notify(new Notification(Notification.VERBOSE.opsResult, "RefactoredConfiguration Bibliobrol", str.ToString(), this));
  740.   */
  741. enableApplication(false);
  742. }
  743. else
  744. {
  745. try
  746. {
  747. model.ModelAdapter.isAvailablePersistance();
  748. enableApplication(true);
  749. }
  750. catch (PersistanceNotFoundException)
  751. {
  752. /*StringBuilder str = new StringBuilder(e.Message);
  753.   str.AppendLine("\n\nIl est possible de modifier la RefactoredConfiguration dans le menu \"Outils/Options\", puis sélectionner \"Persistance\"...");
  754.   str.AppendLine("\nAucune fonctionnalité de l'application ne sera disponible tant que le système de persistance ne sera défini.");
  755.   str.AppendLine("Des messages d'erreur peuvent se présenter avant de RefactoredConfigurer le système de persistance, ignorez les.");
  756.   StaticObservable.notify(new Notification(Notification.VERBOSE.opsResult, "RefactoredConfiguration Bibliobrol", str.ToString(), this));
  757.   */
  758. enableApplication(false);
  759. }
  760. }
  761. }
  762. /// <summary>
  763. /// Allow to use application buttons if data dir path and persistant are found
  764. /// </summary>
  765. /// <param name="enable"></param>
  766. private void enableApplication(bool enable)
  767. {
  768. //borrowsTSMenuItem.Visible = enable;
  769. showBrolsFormTsMi.Visible = enable;
  770. showPersonsFormTsMi.Visible = enable;
  771. showMediabrolsFormTsMi.Visible = enable;
  772. showStatsFormTsMi.Visible = enable;
  773. if (!enable)
  774. {
  775. WelcomeWizardForm wwf = new WelcomeWizardForm();
  776. wwf.MdiParent = this;
  777. wwf.WindowState = FormWindowState.Maximized;
  778. wwf.Show();
  779. }
  780. }
  781. #endregion
  782.  
  783. #region form events
  784.  
  785. private void MainForm_Load(object sender, EventArgs e)
  786. {
  787. //// Allow to open this application by clicking on an other file than the executable file
  788. //// Before, you should launch once BrolDeploy to associate file extension and BiblioBrol application
  789. //try
  790. //{
  791. // /*
  792. // * For each application, Environment.GetCommandLineArgs().Length returns at least 1 (executable path)
  793. // * if we have a second arg, it will be the database path
  794. // */
  795. // if (Environment.GetCommandLineArgs().Length == 2)
  796. // {
  797. // /*StaticObservable.notify(
  798. // new Notification(
  799. // Notification.VERBOSE.advancedOperation,
  800. // "Chargement du fichier: " + Environment.GetCommandLineArgs()[1],
  801. // this
  802. // ));*/
  803. // string dbpath = Environment.GetCommandLineArgs()[1];
  804. // Splasher.Status = "Chargement du fichier " + dbpath;
  805. // //MessageBox.Show("path : " + dbpath);
  806. // // The file is an Access file; set the dao to use Access as persistence type
  807. // if (dbpath.EndsWith(".bdb") || dbpath.EndsWith(".bdb3") || dbpath.EndsWith(".bdb7"))
  808. // {
  809. // string dirPath = System.IO.Path.GetDirectoryName(dbpath);
  810. // /* todo :
  811. // * Now we can set only one storage directory for the database and the other bibliobrol directories.
  812. // * Use another executable arg to say if we must set only database directory
  813. // */
  814. // Config.saveDataDirectory(dirPath);
  815. // Config.savePersistenceType(PERSISTENCE_TYPE.Access);
  816.  
  817. // model.dao.config.AccessConfig dbConfig = new model.dao.config.AccessConfig();
  818.  
  819. // if (dbpath.EndsWith(".bdb7"))
  820. // {
  821. // dbConfig.AccessVersion = ACCESS_VERSION.Access07;
  822. // }
  823. // else
  824. // {
  825. // dbConfig.AccessVersion = ACCESS_VERSION.Access03;
  826. // }
  827. // dbConfig.DBPath = dirPath;
  828. // dbConfig.DBFileName = System.IO.Path.GetFileName(dbpath);
  829. // dbConfig.save();
  830. // be.gaudry.bibliobrol.model.dao.DAOFactory.resetDAO();
  831. // }
  832. // // The file is an broldev image file
  833. // else if (dbpath.EndsWith(".bif"))
  834. // {
  835. // //MessageBox.Show("bif : " + dbpath);
  836. // /*ImportedImagesForm form = createMDIChild<ImportedImagesForm>();
  837. // form.openBif(dbpath);
  838. // showMDIChild(form);*/
  839. // }
  840. // }
  841. //}
  842. //catch (Exception ex)
  843. //{
  844. // StaticObservable.notify(
  845. // new Notification(
  846. // Notification.VERBOSE.advancedOperation,
  847. // "Chargement du fichier: " + Environment.GetCommandLineArgs()[1],
  848. // ex,
  849. // this
  850. // ));
  851. //}
  852. }
  853.  
  854. private void MainForm_Shown(object sender, EventArgs e)
  855. {
  856. Splasher.close();
  857. StaticObservable.showErrors();
  858. }
  859.  
  860. private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
  861. {
  862. Config.save();
  863. }
  864. #endregion
  865. }
  866. }

Réseaux sociaux

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.

 

Nuage de mots clés

6 mots clés dont 0 définis manuellement (plus d'information...).

Avertissement

Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.

Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.

 

Astuce pour imprimer les couleurs des cellules de tableaux : http://www.gaudry.be/ast-rf-450.html
Aucun commentaire pour cette page

© Ce document issu de l′infobrol est enregistré sous le certificat Cyber PrInterDeposit Digital Numbertection. Enregistrement IDDN n° 5329-9682
Document créé le 17/12/06 03:19, dernière modification le Mercredi 28 Juin 2017, 15:26
Source du document imprimé : http:///www.gaudry.be/bibliobrol-view-mainform.html
St.Gaudry©07.01.02
Outils (masquer)
||
Recherche (afficher)
Recherche :

Utilisateur (masquer)
Apparence (afficher)
Stats (afficher)
15838 documents
455 astuces.
550 niouzes.
3107 definitions.
447 membres.
8121 messages.

Document genere en :
0,29 seconde

Mises à jour :
Mises à jour du site
Citation (masquer)
Il a été donné à la volonté de modifier le monde, comme il a appartenu à la PAROLE de le créer.

Alexandre Vinet
 
l'infobrol
Nous sommes le Samedi 19 Août 2017, 00:04, toutes les heures sont au format GMT+1.00 Heure, heure d'été (+1)