コード例 #1
0
 /// <summary>
 /// Chargement du formulaire de paramétrage
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void paramMenuItem_Click(object sender, EventArgs e)
 {
     Log.Debug("Ouverture du Formulaire [Paramétrage]");
     frmParam frmParametrage = new frmParam(p_applClass);
     if (frmParametrage.ShowDialog() == DialogResult.OK)
     {
         p_applClass.ImgParam = new PhotoControl.ImgParam() { RotateAuto = p_applClass.Param.RotateAuto, RotateValue = p_applClass.Param.RotateValue, LoadingDelay=p_applClass.Param.LoadingDelay };
         ClassOutils.SetParamIntoRegistry(p_applClass.Param);
     }
 }
コード例 #2
0
        /// <summary>
        /// Initializes the Watcher object. In the interest of providing a complete 
        /// demonstration, all change events are monitored. This will unlikely be a 
        /// real-world requirement in most cases.
        /// </summary>
        private bool InitWatcher()
        {
            bool result = false;
            if (Directory.Exists(p_applClass.Param.ScanDirectory))
            {
                WatcherInfo info = new WatcherInfo();
                info.ChangesFilters = NotifyFilters.Attributes |
                                      NotifyFilters.CreationTime |
                                      NotifyFilters.DirectoryName |
                                      NotifyFilters.FileName |
                                      NotifyFilters.LastAccess |
                                      NotifyFilters.LastWrite |
                                      NotifyFilters.Security |
                                      NotifyFilters.Size;
                info.FileFilter = p_applClass.Param.getFileExtension();
                info.IncludeSubFolders = false;
                info.WatchesFilters = WatcherChangeTypes.Created | WatcherChangeTypes.Deleted;
                info.WatchForDisposed = false;
                info.WatchForError = false;
                info.WatchPath = p_applClass.Param.ScanDirectory;
                info.BufferKBytes = 32;
                info.MonitorPathInterval = 0;
                fileWatcher = new WatcherEx(info);
                ManageEventHandlers(true);
                result = true;
            }
            else
            {
                MessageBox.Show("Le répertoire Source n'existe pas.\nMerci de vérifier le paramétrage.");
                frmParam frmParametrage = new frmParam(p_applClass);
                if (frmParametrage.ShowDialog() == DialogResult.OK)
                {
                    ClassOutils.SetParamIntoRegistry(p_applClass.Param);
                    if (Directory.Exists(p_applClass.Param.ScanDirectory))
                    {
                        scanDirLabel.Text = "Source : " + p_applClass.Param.ScanDirectory;
                        return this.InitWatcher();
                    }
                    else
                    {
                        scanDirLabel.Text = "Source : " + p_applClass.Param.ScanDirectory;
                    }
                }

            }
            return result;
        }
コード例 #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))
     {
         MessageBox.Show("Attention, aucun paramétrage n'a été défini !");
         frmParam frmParametrage = new frmParam(p_applClass);
         if (frmParametrage.ShowDialog() == DialogResult.OK) { ClassOutils.SetParamIntoRegistry(p_applClass.Param); }
     }
 }