コード例 #1
0
        //------------------------------------------------------
        private static void SetSetupForWindow(CSessionClient session, Form form, CSetupVisibiliteControles setup)
        {
            string strKey = c_racineCleRegistre + form.GetType().ToString();
            CDataBaseRegistrePourClient reg = new CDataBaseRegistrePourClient(session.IdSession);

            if (setup == null)
            {
                reg.SetValeurBlob(strKey, new byte[0]);
            }
            else
            {
                MemoryStream           stream = new MemoryStream();
                BinaryWriter           writer = new BinaryWriter(stream);
                CSerializerSaveBinaire ser    = new CSerializerSaveBinaire(writer);
                CResultAErreur         result = setup.Serialize(ser);
                stream.Flush();
                reg.SetValeurBlob(strKey, stream.GetBuffer());
                writer.Close();
                stream.Close();
                stream.Dispose();
            }
        }
コード例 #2
0
        //------------------------------------------------------
        private static CSetupVisibiliteControles GetSetupForWindow(CSessionClient session, Form frm)
        {
            CSetupVisibiliteControles setup = new CSetupVisibiliteControles();
            string strKey = c_racineCleRegistre + frm.GetType().ToString();
            //cherche le setup dans le registre
            CDataBaseRegistrePourClient reg = new CDataBaseRegistrePourClient(session.IdSession);

            byte[] bts = reg.GetValeurBlob(strKey);
            if (bts != null)
            {
                MemoryStream           stream = new MemoryStream(bts);
                BinaryReader           reader = new BinaryReader(stream);
                CSerializerReadBinaire ser    = new CSerializerReadBinaire(reader);
                CResultAErreur         result = setup.Serialize(ser);
                if (!result)
                {
                    setup = new CSetupVisibiliteControles();
                }
                reader.Close();
                stream.Close();
                stream.Dispose();
            }
            return(setup);
        }