コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: abnaki/windows
        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);
            }
        }
コード例 #3
0
ファイル: Preference.cs プロジェクト: abnaki/windows
        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);
        }