コード例 #1
0
 /// <summary>
 /// Ouverture du Formulaire de Paramétrage
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void paramToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Log.Debug("Accès au paramétrage...");
     frmParam frmParametrage = new frmParam(p_applClass);
     frmParametrage.ShowDialog(this);
 }
コード例 #2
0
        /// <summary>
        /// Chargement du formulaire principal
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmAppli_Load(object sender, EventArgs e)
        {
            frmLoading _frmLoad = new frmLoading();
            _frmLoad.Show();
            _frmLoad.SetAction("Initialisation...");
            
            keyShiftPressed = false;
            p_listEcole.Changed += new EventHandler<EcoleChangedEventArgs>(p_listEcole_Changed);
            p_numColSort = 5;
            p_sortOrder = SortOrder.Ascending;
            p_isModified = false;

            // Affichage par défaut du Calendrier (Vue Smaine |Vue Mois)
            cmbViewType.SelectedIndex = 0;

            // Initialisation du Timer servant à gérer l'affichage de la Status Bar
            this.initTimer();

            #region Subdivision du calendrier
            int ts = (int)objCalendar.TimeScale;
            objCalendar.TimeUnitsOffset = -8 * (60 / ts);
            #endregion

            // Initialisation du Paramétrage
            _frmLoad.SetAction("Paramétrage...");
            this.initParam();

            // Initialisation de la base de données
            _frmLoad.SetAction("Initialisation de la Base de Données...");
            p_applClass.initDabase();

            #region Liste des Photographes
            String registryKey = @"SOFTWARE\PixVert\PlanningLab\Param\ListPhotos";
            using (Microsoft.Win32.RegistryKey key = Registry.CurrentUser.OpenSubKey(registryKey))
            {
                if (key != null)
                {
                    foreach (String subkeyName in key.GetSubKeyNames())
                    {
                        Log.Info("Id Photographe : " + subkeyName);
                        using (RegistryKey subkey = key.OpenSubKey(subkeyName))
                        {
                            int _argbValue;
                            Int32.TryParse((string)subkey.GetValue("Argb", 0), out _argbValue);

                            p_applClass.Param.ListPhotographe.Add(new Photographe()
                            {
                                IdPhotographe = subkeyName,
                                Nom = (string)(subkey.GetValue("Nom", String.Empty)),
                                ARGB = _argbValue,
                                IdGoogleCalendar = (string)(subkey.GetValue("IdCal", String.Empty)),
                                EMailPhotograph = (string)(subkey.GetValue("Email", String.Empty)),
                                Adresse = (string)(subkey.GetValue("Adresse", String.Empty)),
                                CodePostal = (string)(subkey.GetValue("CodePostal", String.Empty)),
                                Localite = (string)(subkey.GetValue("Localite", String.Empty)),
                            }
                            );
                        }
                    }
                }
            }
            #endregion

            #region Liste des Périodes
            String registryKeyPeriodes = @"SOFTWARE\PixVert\PlanningLab\Param\ListPeriodes";
            using (Microsoft.Win32.RegistryKey key = Registry.CurrentUser.OpenSubKey(registryKeyPeriodes))
            {
                if (key != null)
                {
                    foreach (String subkeyName in key.GetSubKeyNames())
                    {
                        Log.Info("Id Periode : " + subkeyName);
                        using (RegistryKey subkey = key.OpenSubKey(subkeyName))
                        {
                            DateTime _startDate; DateTime.TryParse((string)subkey.GetValue("StartDate"), out _startDate);
                            DateTime _endDate; DateTime.TryParse((string)subkey.GetValue("EndDate"), out _endDate);

                            p_applClass.Param.ListPeriode.Add(new Periode()
                            {
                                StartDate = _startDate,
                                EndDate = _endDate
                            }
                            );
                        }
                    }
                }
            }
            #endregion

            #region Liste des Models
            String registryKeyModels = @"SOFTWARE\PixVert\PlanningLab\Param\ListMailContents";
            using (Microsoft.Win32.RegistryKey key = Registry.CurrentUser.OpenSubKey(registryKeyModels))
            {
                if (key != null)
                {
                    foreach (String subkeyName in key.GetSubKeyNames())
                    {
                        using (RegistryKey subkey = key.OpenSubKey(subkeyName))
                        {
                            p_applClass.Param.MailContents.ListModels.Add(new InfosModels()
                            {
                                Id = subkeyName,
                                Type = (string)(subkey.GetValue("Type", String.Empty)),
                                Object = (string)(subkey.GetValue("Object", String.Empty)),
                                Path = (string)(subkey.GetValue("Path", String.Empty))
                            });
                        }
                    }
                }
            }
            #endregion

            _frmLoad.SetAction("Périodes...");
            this.refreshLstPeriode();

            _frmLoad.SetAction("Vérification de la mise à jour automatique...");
            LabCommonLab.frmNewVersion.CheckForUpdate(Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Version, p_applClass.InfoReg.RType.ToString());

            _frmLoad.SetAction("Chargement Planning...");
            // Si le fichier par défaut est vide, on propose la création ou l'ouverture
            if (String.IsNullOrEmpty(p_applClass.Param.DefaultFile))
            {
                frmChooseAction _frmChoose = new frmChooseAction();
                DialogResult _dR = _frmChoose.ShowDialog();
                if (_dR == System.Windows.Forms.DialogResult.OK)
                {   // Création
                    this.saveFile();
                }
                else
                {   // Ouverture 
                    this.openPlanning(true);
                }
            }
            else { this.loadPlanning(); }            // Chargement du Planning 

            if (p_applClass.Param.ListPeriode.Count() == 0)
            {
                if (MessageBox.Show("Aucune période n'a été définie.\r\nVeuiller créer un paramétrage initial.", "Aucune période définie !", MessageBoxButtons.OK, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.OK)
                {
                    frmParam frmParametrage = new frmParam(p_applClass, 2);
                    frmParametrage.ShowDialog(this);
                }
            }
            this.setFileSaison();           // Sélectionner la dernière Saison consultée
                        
            // On traite maintenant la liste des écoles
            this.p_filterType = FilterType.All;
            _frmLoad.SetAction("Création liste des écoles...");

            #region Init GOOGLE
            if (p_applClass.IsFctAuthorize("Google"))
            {
                _frmLoad.SetAction("Initialisation de la connexion GOOGLE...");
                this.initGoogleCnx();
                statusImgGoogle.Visible = true;
                statusLabelGoogle.Visible = true;
                btnSynchro.Visible = true;
            }
            else { btnSynchro.Visible = false;
            statusImgGoogle.Visible = false;
            statusLabelGoogle.Visible = false;
            }

            #endregion

            this.defineMonthOfView();       // On définit le mois par défaut
            this.cmbViewType.SelectedIndex = 0;

            if (!p_applClass.IsFctAuthorize("Mailing")) { mailingToolStripMenuItem.Visible = false; }

            if (!p_applClass.IsFctAuthorize("Compta")) { comptaMenuItem.Visible = false; }
            
            _frmLoad.Close();
        }
コード例 #3
0
 /// <summary>
 /// Initialisation du Paramétrage
 /// </summary>
 private void initParam()
 {
     Log.Debug("Initialisation du Paramétrage");
     p_applClass.Param = new Parametrage();
     if (!ClassOutils.GetParamFromRegistry(p_applClass.Param))
     {
         Log.Debug("Aucun paramétrage défini. Chargement par défaut !");
         MessageBox.Show("Attention, aucun paramétrage n'a été défini !");
         frmParam frmParametrage = new frmParam(p_applClass);
         if (frmParametrage.ShowDialog(this) == DialogResult.OK) { ClassOutils.SetParamIntoRegistry(p_applClass.Param); }
     } 
 }