//protected void SaveGridLayout(string formName, BaseView view) //{ // string stateLayoutPath = UiUtility.StateConfigPath; // string formFileName = string.Empty; // string filename = string.Format("{0}\\{1}_{2}.xml", stateLayoutPath, formName, view.Name); // //Check Exist Directory // if (!Directory.Exists("GridLayout")) // { // Directory.CreateDirectory("GridLayout"); // } // using (FileStream stream = new FileStream(filename, FileMode.Create)) // { // view.SaveLayoutToStream(stream, DevExpress.Utils.OptionsLayoutBase.FullLayout); // stream.Close(); // } //} //protected void LoadGridLayout(string formName, BaseView view) //{ // string stateLayoutPath = UiUtility.StateConfigPath; // string filename = string.Format("{0}\\{1}_{2}.xml", stateLayoutPath, formName, view.Name); // if (File.Exists(filename)) // { // view.RestoreLayoutFromXml(filename, DevExpress.Utils.OptionsLayoutBase.FullLayout); // } //} //test protected void LoadFormLayout() { string stateLayoutPath = string.Format("{0}\\{1}", Application.StartupPath, UiUtility.StateConfigPath); string formFileName = string.Format("{0}\\{1}.xml", stateLayoutPath, this.Name); FormConfigState formState = null; if (File.Exists(formFileName)) { try { formState = UiUtility.DeserializeObject <FormConfigState>(formFileName); } catch (Exception ex) { formState = null; } if (formState != null) { if (!formState.FormSize.IsEmpty) { this.Size = formState.FormSize; } if (!formState.FormLocation.IsEmpty) { this.Location = formState.FormLocation; } } } }
protected void LoadGridLayout(GridControl grd) { string stateLayoutPath = string.Format("{0}\\{1}", Application.StartupPath, UiUtility.StateConfigPath); string formFileName = string.Format("{0}\\{1}.xml", stateLayoutPath, this.Name); if (File.Exists(formFileName)) { FormConfigState formState = UiUtility.DeserializeObject <FormConfigState>(formFileName); if (formState != null) { string[] grdArr = Regex.Split(formState.GridControl, @","); int index = Array.IndexOf(grdArr, grd.Name); if (index >= 0) { string[] lastViewArr = Regex.Split(formState.LastDefaultView, @","); this.LoadGridLayoutMultipleView(this.Name, grd, lastViewArr[index]); } } } //this.LoadGridLayoutMultipleView(this.Name, grd); //all to list; if (this.lstGridControl == null) { this.lstGridControl = new List <GridControl>(); } this.lstGridControl.Add(grd); }