コード例 #1
0
ファイル: CompanyCreation.cs プロジェクト: becerda/JobDB
        /// <summary>
        /// Refreshes A ComboBox's Source
        /// </summary>
        /// <param name="cb">The ComboBox To Refresh</param>
        /// <param name="bs">The Source Of The ComboBox</param>
        private void RefereshComboBox(ComboBox cb, BaseSingleton bs)
        {
            cb.ItemsSource = bs.AllObjects();
            ICollectionView view = CollectionViewSource.GetDefaultView(cb.ItemsSource);

            view.Refresh();
        }
コード例 #2
0
ファイル: BaseList.cs プロジェクト: becerda/JobDB
        /// <summary>
        /// Refreshes The List View
        /// </summary>
        /// <param name="bs"></param>
        protected void RefreshListView(BaseSingleton bs)
        {
            BaseListWindow.listviewCurrent.ItemsSource = bs.AllObjects();
            ICollectionView view = CollectionViewSource.GetDefaultView(BaseListWindow.listviewCurrent.ItemsSource);

            view.Refresh();
        }
コード例 #3
0
ファイル: Files.cs プロジェクト: becerda/JobDB
        /// <summary>
        /// Loads A Singleton's Object Data
        /// </summary>
        /// <typeparam name="T">The Type Of Object Data</typeparam>
        /// <param name="bs">The Singleton To Save To</param>
        /// <param name="filename">The File To Load From</param>
        private void LoadSingletonObject <T>(BaseSingleton bs, string filename)
        {
            if (File.Exists(filename))
            {
                string content = new StreamReader(filename).ReadToEnd();

                string[] objs = content.Split('\n');
                foreach (string obj in objs)
                {
                    if (obj.Length > 0)
                    {
                        var b = JsonConvert.DeserializeObject <T>(obj);
                        bs.AddObject(b as BaseInfo);
                    }
                }
            }
            else
            {
                bs.InitObjectList();
                SaveSingletonObject(bs.AllObjects(), filename);
            }
        }