コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();
            showView(ViewKind.StartupView);

            recent = RecentMangas.Load();
            RecentItems.ItemsSource = recent.Recent;

            _resizeEnding.Tick += resizeEnding_Tick;
        }
コード例 #2
0
        public static RecentMangas Load()
        {
            var result = new RecentMangas();

            try
            {
                using (var stream = new FileStream(ConfigurationPath(), FileMode.Open, FileAccess.ReadWrite))
                {
                    XmlSerializer xser = new XmlSerializer(typeof(RecentMangas));
                    result = xser.Deserialize(stream) as RecentMangas;
                    stream.Close();

                    fixupDeserialized(result);
                }
            }
            catch (FileNotFoundException) { /* Do not load anything */ }
            catch (InvalidOperationException) { /* data corrupted -- too bad */ }
            return result;
        }
コード例 #3
0
        private static void fixupDeserialized(RecentMangas result)
        {
            result.PinnedCount = result.Recent.Where((x) => x.Pinned).Count();

            foreach (var item in result.Recent)
            {
                result.bindState(item);
            }
        }