Esempio n. 1
0
        static public void gridviewLayoutSaveToXml(DevExpress.XtraGrid.Views.Grid.GridView _grid_view, String _xml_file_name)
        {
            if (null != _grid_view)
            {
                string layout_directory = System.Windows.Forms.Application.StartupPath + "\\" + LAYOUT_DIRECTORY_NM;

                // check directory
                DirectoryInfo _dinfo = new DirectoryInfo(layout_directory);
                if (!_dinfo.Exists)
                {
                    try
                    {
                        _dinfo.Create();
                    }
                    catch (Exception) { return; }
                }

                // save layout
                String layout_file_path = layout_directory + "\\" + _xml_file_name.Replace("./", "");
                try
                {
                    _grid_view.SaveLayoutToXml(layout_file_path);
                }
                catch (Exception) { }
            }
        }
Esempio n. 2
0
        internal void CargarOGuardarDisenios(DevExpress.XtraGrid.Views.Grid.GridView control, bool guardar, string usuario, string nombreVista)
        {
            string direccion;

            if (guardar)
            {
                direccion = $@"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\{control.Name}{nombreVista}{usuario}.xml";
                control.SaveLayoutToXml(direccion);
            }
            else
            {
                direccion = $@"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}\{control.Name}{nombreVista}{usuario}.xml";
                if (File.Exists(direccion))
                {
                    control.RestoreLayoutFromXml(direccion);
                }
            }
        }