Exemple #1
0
        public CHelpData GetHelpToView(Control ctrl)
        {
            CHelpData help = CHelpData.GetHelp(ctrl, "");

            while (!help.DejaEnregistre)
            {
                Type tp = ctrl.GetType();
                if (ctrl is CHelpData.CtrlPartiel)
                {
                    tp = ((CHelpData.CtrlPartiel)ctrl).Type;
                }
                while (tp != null)
                {
                    help = CHelpData.GetHelp(tp, "");
                    if (help.DejaEnregistre)
                    {
                        return(help);
                    }
                    tp = tp.BaseType;
                }
                ctrl = ctrl.Parent;
                if (ctrl == null)
                {
                    return(null);
                }
                help = CHelpData.GetHelp(ctrl, "");
            }
            return(help);
        }
Exemple #2
0
        public List <CHelpData> GetVoirAussiHeritages(bool modeCreation)
        {
            List <CHelpData> lst = new List <CHelpData>();

            Type t = GetTypeSelonLiaison();

            if (t == null)
            {
                return(lst);
            }

            Type tparent = t.BaseType;

            while (tparent != null)
            {
                CHelpData hlp = GetVoirAussiType(tparent, modeCreation);
                if (hlp != null)
                {
                    lst.Add(hlp);
                }
                tparent = tparent.BaseType;
            }

            return(lst);
        }
Exemple #3
0
        public void Initialiser(CHelpData hlp, string preselec)
        {
            txt_nom.Text = preselec;
            _hlp         = hlp;
            _initialise  = false;
            string[] props = Enum.GetNames(typeof(EProprieteSourcePourNom));
            foreach (string prop in props)
            {
                cmb_prop.Items.Add(prop);
            }

            if (preselec == "")
            {
                rbt_perso.Checked = false;
                txt_nom.Enabled   = false;
                cmb_prop.Enabled  = true;
            }
            else
            {
                rbt_perso.Checked = true;
                txt_nom.Enabled   = true;
                cmb_prop.Enabled  = false;
            }

            _initialise = true;
        }
Exemple #4
0
        public CHelpData GetHelp(string strCle)
        {
            CResultAErreur result = CResultAErreur.True;
            CHelpData      help   = null;

            if (m_tableAides.Contains(strCle))
            {
                return((CHelpData)m_tableAides[strCle]);
            }


            string strFile = RepertoireDeBase + GetFileTitle(strCle);

            if (!File.Exists(strFile))
            {
                return(null);
            }


            help                 = new CHelpData();
            help.HelpKey         = strCle;
            m_tableAides[strCle] = help;
            result               = CSerializerObjetInFile.ReadFromFile(help, c_cleFichier, strFile);

            return(help);
        }
Exemple #5
0
        //---------------------------------------------------------
        public CResultAErreur SaveHelp(CHelpData help)
        {
            CResultAErreur result       = CResultAErreur.True;
            string         strFileTitle = GetFileTitle(help);     // >> Créé une instance au niveau de l'index

            if (!help.HasData)
            {
                try
                {
                    if (File.Exists(RepertoireDeBase + strFileTitle))
                    {
                        File.Delete(RepertoireDeBase + strFileTitle);
                        m_tableAides.Remove(help.HelpKey);
                    }
                }
                catch
                {
                }
                return(result);
            }


            //S'assure que le chemin du fichier existe
            string strFichier = RepertoireDeBase + strFileTitle;

            m_tableAides[help.HelpKey] = help;
            SaveFichierIndex();

            return(CSerializerObjetInFile.SaveToFile(help, c_cleFichier, strFichier));
        }
Exemple #6
0
        public List <CHelpData> GetVoirAussiAttributs(bool modeCreation)
        {
            List <CHelpData> lst = new List <CHelpData>();

            Type t = GetTypeSelonLiaison();

            if (t == null)
            {
                return(lst);
            }

            object[]    atts = t.GetCustomAttributes(false);
            List <Type> tps  = new List <Type>();

            foreach (object att in atts)
            {
                tps.Add(att.GetType());
            }

            foreach (Type tatt in tps)
            {
                CHelpData hlp = GetVoirAussiType(tatt, modeCreation);
                if (hlp != null)
                {
                    lst.Add(hlp);
                }
            }

            return(lst);
        }
Exemple #7
0
        private static int OnHook(int nCode, int wParam, int lParam)
        {
            try
            {
                if (nCode == 0)
                {
                    if (wParam == (int)Keys.F1)
                    {
                        if (lParam < 0)
                        {
                            Process process = Process.GetProcessById(m_nIdProcess);
                            Control ctrl    = null;
                            if (process != null)
                            {
                                ctrl = System.Windows.Forms.Form.ActiveForm;
                            }
                            if (ctrl != null)
                            {
                                m_lastControl = ctrl;
                                ctrl          = FindFocused(ctrl);
                                m_nNbFormvisible++;
                                try
                                {
                                    if (m_nNbFormvisible == 1)
                                    {
                                        Control pere = ctrl;
                                        while (pere != null)
                                        {
                                            //if (pere.GetType() == typeof(MdiClient))
                                            //    pere = null;
                                            //else
                                            //{
                                            CHelpData.FenetreActive = pere;

                                            pere = pere.Parent;
                                            //}
                                        }

                                        CHelpData help = CHelpData.GetHelp(ctrl, "");
                                        CFormAide.ShowHelp(help, ctrl);
                                    }
                                }
                                catch
                                {
                                    //MessageBox.Show(e.Message);
                                }
                                finally
                                {
                                    m_nNbFormvisible--;
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
            }
            return(0);
        }
Exemple #8
0
        private void PopupHelp(CHelpData help)
        {
            Point pt = Cursor.Position;

            pt.Offset(0, 5);
            CWebViewerPopup.Popup(pt, help);
        }
Exemple #9
0
 void Navigation(object sender, WebBrowserNavigatingEventArgs e)
 {
     if (_navigationEnCour)
     {
         e.Cancel = true;
     }
     else
     {
         string strURL = e.Url.ToString();
         if (strURL.Length > 6 && strURL.Substring(0, 6).ToUpper() == "HLP://")
         {
             string strKey = strURL.Substring(6);
             if (strKey[strKey.Length - 1] == '/')
             {
                 strKey = strKey.Substring(0, strKey.Length - 1);
             }
             CHelpData hlp = CHelpData.SourceAide.GetHelp(strKey);
             if (hlp != null)
             {
                 _navigationEnCour = true;
                 if (ClickLienVersAide != null)
                 {
                     ClickLienVersAide(sender, new ArgumentsEvenementNavigationVersAide(hlp));
                 }
                 if (_liensVersHelpActifs)
                 {
                     DocumentText = hlp.FullTexteHtml;
                 }
                 _navigationEnCour = false;
                 e.Cancel          = true;
             }
         }
     }
 }
Exemple #10
0
        private void EditeHelp(CHelpData help)
        {
            CFormEditHelp form = new CFormEditHelp();

            form.Initialiser(help);
            form.ShowDialog();
            m_helpData = form.HelpSelectionne;
        }
Exemple #11
0
 public void Initialiser(CHelpData hlp, bool editionPossible)
 {
     m_hlp = hlp;
     m_bModeClignotement = true;
     m_bEdition          = editionPossible;
     m_bPlusDeSeparateur = false;
     ConstruireMenu();
 }
Exemple #12
0
        private void ctrl_voirAussi_ClicSurElement(object sender, EventArgs e)
        {
            CHelpData hlp = ctrl_voirAussi.HelpSelectionne;

            if (hlp != null)
            {
                Initialiser(hlp);
            }
        }
Exemple #13
0
 private void SetHelpAssociee(CHelpData help)
 {
     m_lblHelpLiee.Text = help == null ? "" : help.NomCourt;
     if (help != null)
     {
         txt_nom.Text = help.NomCourt;
     }
     m_helpAssociee = help;
 }
Exemple #14
0
 private void Initialiser()
 {
     m_strNom     = "";
     m_strDescrip = "";
     m_strID      = "";
     m_strHelpId  = "";
     m_help       = null;
     m_menuParent = null;
 }
Exemple #15
0
        private void AjouterHelp(CHelpData hlp)
        {
            ListViewItem itm = new ListViewItem(hlp.Titre);

            itm.SubItems.Add(hlp.NomCourt);
            itm.SubItems.Add(hlp.TypeLiaison.ToString());
            itm.Tag = hlp;
            lv_hlps.Items.Add(itm);
        }
Exemple #16
0
        public static void FaireClignoterControl(CHelpData.CtrlPartiel ctrl)
        {
            Control c = CHelpData.GetControl(ctrl);

            if (c != null)
            {
                FaireClignoterControl(c);
            }
        }
Exemple #17
0
        private void Afficher(CHelpData help)
        {
            m_helpData = help;

            visualiseur.Initialiser(help);

            //Titre
            SetTitre(help);


            if (help == null)
            {
                if (Visible)
                {
                    Visible = false;
                }
                return;
            }

            int nState = GetKeyState(0x11);

            if (nState < 0 && CHelpExtender.AutoriseModeEdition)
            {
                EditeHelp(help);
                return;
            }

            //if (!m_bAutoriseEdition || help.VisualisationAide == EVisualisationAide.Popup)
            //{
            //    while ((!help.HasData || help.VisualisationAide == EVisualisationAide.Popup) && help.Controle != null && help.Controle.Parent != null)
            //    {
            //        help = CHelpData.SourceAide.GetHelp(help.Controle.Parent, help.Contexte);
            //        if (help == null)
            //            return;
            //    }
            //}
            if (!help.HasData && !CHelpExtender.ModeEdition)
            {
                Visible = false;
                return;
            }


            //Menu Voir aussi
            ctrl_voirAussi.Initialiser(help, CHelpExtender.ModeEdition);
            m_lblTitre.Text = help.Titre;

            //Disponibilité du bouton d'edition
            m_btnEditer.Visible      = CHelpExtender.AutoriseModeEdition;
            m_chkModeEdition.Visible = CHelpExtender.AutoriseModeEdition;
            pan_separateur2.Visible  = CHelpExtender.AutoriseModeEdition;

            Visible = true;
            Focus();
            BringToFront();
        }
Exemple #18
0
        //----------------------------------------------------------------------
        private void m_btnSelectHelp_Click(object sender, EventArgs e)
        {
            CHelpData help = CFormSelectHelpPage.SelectHelp();

            if (help != null)
            {
                SetHelpAssociee(help);
                ValideModifs();
            }
        }
Exemple #19
0
        public static CHelpData GetHelp(string strCle)
        {
            if (m_sourceAide == null)
            {
                throw new Exception("Source d'aide non initialisée");
            }
            CHelpData help = m_sourceAide.GetHelp(strCle);

            return(help);
        }
Exemple #20
0
        public CHelpData GetHelp(string strCle, string strContexte)
        {
            CHelpData help = GetHelp(CHelpData.GetCle(strContexte));

            if (help != null)
            {
                help.Contexte = strContexte;
            }
            return(help);
        }
Exemple #21
0
        public CHelpData GetHelp(Type tp, string strContexte)
        {
            CHelpData help = GetHelp(CHelpData.GetCle(tp, strContexte));

            if (help != null)
            {
                help.TypeLie  = tp;
                help.Contexte = strContexte;
            }
            return(help);
        }
Exemple #22
0
        public CHelpData GetHelp(Control ctrl, string strContexte)
        {
            CHelpData help = GetHelp(CHelpData.GetCle(ctrl, strContexte));

            //if (help != null)
            //{
            //    help.Controle =  ctrl;
            //    help.Contexte = strContexte;
            //}
            return(help);
        }
Exemple #23
0
        //---------------------------------------------------------
        public CResultAErreur DeleteHelp(CHelpData help)
        {
            CResultAErreur result = CResultAErreur.True;

            Directory.Delete(RepertoireDeBase + GetDirectoryOf(help));
            File.Delete(RepertoireDeBase + GetFileTitle(help));

            m_tableAides.Remove(help.HelpKey);

            return(result);
        }
Exemple #24
0
        public string GetDirectoryOf(CHelpData hlp)
        {
            string strFichier       = GetFileTitle(hlp);
            string strPathDirectory = RepertoireDeBase + strFichier.Substring(0, strFichier.LastIndexOf('.'));

            if (!Directory.Exists(strPathDirectory))
            {
                Directory.CreateDirectory(strPathDirectory);
            }

            return(strPathDirectory);
        }
Exemple #25
0
        public static CHelpData SelectHelp(ETypeSelection typeSelection)
        {
            CFormSelectHelpPage form = new CFormSelectHelpPage();

            form.Initialiser(typeSelection);
            CHelpData help = null;

            if (form.ShowDialog() == DialogResult.OK)
            {
                help = form.HelpSelectionne;
            }
            form.Dispose();
            return(help);
        }
Exemple #26
0
        private void lv_annexes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lv_annexes.SelectedItems.Count == 1)
            {
                CHelpData hlp = (CHelpData)lv_annexes.SelectedItems[0].Tag;

                if (NavigationVersHelp != null)
                {
                    NavigationVersHelp(sender, new ArgumentsEvenementNavigationVersAide(hlp));
                }

                Initialiser(hlp);
            }
        }
Exemple #27
0
        public static bool EditeLink(ref string strTexte, ref CHelpData helpData)
        {
            CFormEditLink form = new CFormEditLink();

            form.m_helpData         = helpData;
            form.m_txtLinkText.Text = strTexte;
            if (form.ShowDialog() == DialogResult.OK)
            {
                helpData = form.m_helpData;
                strTexte = form.m_txtLinkText.Text;
                return(true);
            }
            return(false);
        }
Exemple #28
0
        public static CHelpData GetHelp(Control ctrl, string strContexte)
        {
            if (m_sourceAide == null)
            {
                throw new Exception("Source d'aide non initialisée");
            }
            CHelpData help = m_sourceAide.GetHelp(ctrl, strContexte);

            if (help == null)
            {
                help = new CHelpData(ctrl, strContexte);
            }
            return(help);
        }
Exemple #29
0
 private void lv_hlps_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lv_hlps.SelectedItems.Count == 1)
     {
         CHelpData hlp = (CHelpData)lv_hlps.SelectedItems[0].Tag;
         if (hlp.TypeLiaison == ETypeLiaisonAide.Control)
         {
             CHelpExtender.FaireClignoterControl(hlp.Controle);
         }
         else
         {
             CHelpExtender.ArreterClignotementControl();
         }
     }
 }
Exemple #30
0
 private void btn_changerctrl_Click(object sender, EventArgs e)
 {
     if (m_help.Controle != null)
     {
         Control ctrl = CFormSelectControl.GetControl(m_help.Controle);
         if (ctrl != null)
         {
             if (AssureSave())
             {
                 m_help = CHelpData.GetHelp(ctrl, m_help.Contexte);
                 Initialiser(m_help);
             }
         }
     }
 }