void EnforceColumnPrefs() { try { if (GridPref != null) { foreach (var pair in GridPref.ColumnPrefs.OrderBy(p => p.Value.VisiblePosition)) { ColumnPref pref = pair.Value; ColumnBase cb = this.Grid.Columns[pair.Key]; if (cb == null) // no longer exists { continue; } if (pref.Width > 0) { cb.Width = pref.Width; } cb.VisiblePosition = pref.VisiblePosition; } GridPref.Completed = true; } } catch (Exception ex) { AbnakiLog.Exception(ex); } }
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { // but in OnClosed(), note that RestoreBounds is Empty base.OnClosing(e); try { SaveBounds(); MessageTube.Publish(new FarewellMessage()); FileInfo fi = LayoutFileInfo(); InvokeSavingPanelLayout(fi); } catch (Exception ex) { AbnakiLog.Exception(ex); } }
public static Tpref ReadClassPrefs <Tclass, Tpref>() where Tpref : class { FileInfo fi = ClassPrefsFile <Tclass>(); if (fi.Exists) { try { using (StreamReader sr = new StreamReader(fi.FullName, PrefEncoding)) { XmlSerializer xs = new XmlSerializer(typeof(Tpref)); return((Tpref)xs.Deserialize(sr)); } } catch (Exception ex) { AbnakiLog.Exception(ex); } } return(null); }