public void LoadDbModels()
        {
            db.tabItems.Load();
            var someList = db.tabItems.Local.ToBindingList();

            TabItems.Clear();
            foreach (TabItem item in someList)
            {
                TabItems.Add(item);
            }
            InitialTabItems = TabItems;
        }
Beispiel #2
0
        public void Initialize()
        {
            TabItems.Clear();

            TabItems.Add(new CommunityTopViewModel(this));
            Community = new NicoNicoCommunity(CommunityUrl);

            IsActive = true;
            Status   = "コミュニティ情報を取得中";

            Task.Run(() => {
                Content  = Community.GetCommunity();
                IsActive = false;
                Status   = "";

                Name = Content.CommunityTitle;
            });
        }
        private void ToggleCheckBoxes(bool isChecked)
        {
            ObservableCollection <TabItem> tmpTabItems = new ObservableCollection <TabItem>();

            foreach (TabItem item in TabItems)
            {
                tmpTabItems.Add(item);
            }

            for (int i = 0; i < TabItems.Count; i++)
            {
                tmpTabItems.ElementAt(i).IsCheckedBoolean = isChecked;
            }

            TabItems.Clear();
            foreach (var item in tmpTabItems)
            {
                TabItems.Add(item);
            }
        }
Beispiel #4
0
        private void _Execute(string com)
        {
            //lol
            dataset.Tables.Clear();
            TabItems.Clear();

            adapter.SelectCommand.CommandText = com;
            adapter.Fill(dataset);

            for (int i = 0; i < dataset.Tables.Count; ++i)
            {
                TabItem item = new TabItem();
                item.Header = i.ToString();

                DataGrid view = new DataGrid();
                view.ItemsSource = dataset.Tables[i].DefaultView;

                item.Content = view;

                TabItems.Add(item);
            }
        }
Beispiel #5
0
 /// <summary>
 /// Removes all UI elements and validation errors from the layer.
 /// </summary>
 public override void Clear()
 {
     TabItems.Clear();
     base.Clear();
 }
Beispiel #6
0
 public void RemoveAllTabs()
 {
     TabItems.Clear();
 }
 public void CreateSession(string fileName)
 {
     TabItems.Clear();
     SaveSession(fileName);
     LoadSession(fileName);
 }
Beispiel #8
0
 /// <summary>
 /// The logic for ChangeTab.
 /// </summary>
 /// <param name="buttonid">The id for the dictionary.</param>
 private void ChangeTabCommand(int buttonid)
 {
     TabItems.Clear();
     TabDictionary[buttonid].ForEach(n => TabItems.Add(n));
     BackGroundColour = TabHead.First(th => th.Id == buttonid).Colour;
 }
Beispiel #9
0
 private void OnCloseAllTab()
 {
     TabItems.Clear();
 }
        /// <summary>
        /// Method to handle fetching of User Interests from NewsAPI
        /// </summary>
        public async Task GetUserData()
        {
            if (TabItems.Any())
            {
                TabItems.Clear();
            }

            var userInterestsList = DatabaseHelper.GetSavedInterestsList();

            if (userInterestsList != null && userInterestsList.Any())
            {
                foreach (var interest in userInterestsList)
                {
                    TabItems.Add(new Tab
                    {
                        Title       = interest.Title,
                        ArticlePage = 1
                    });
                }

                CurrentTab = TabItems[0];

                foreach (var tab in TabItems)
                {
                    await LoadTabData(tab).ConfigureAwait(false);
                }
            }
            else
            {
                // Save locally and load user interests if null

                List <Interest> interests = new List <Interest>
                {
                    new Interest {
                        Title = "Headlines"
                    },
                    new Interest {
                        Title = "Business"
                    },
                    new Interest {
                        Title = "Technology"
                    },
                    new Interest {
                        Title = "Entertainment"
                    },
                    new Interest {
                        Title = "Sports"
                    },
                    new Interest {
                        Title = "Science"
                    },
                    new Interest {
                        Title = "Health"
                    },
                };

                var interestsJson = JsonConvert.SerializeObject(interests);
                Settings.AddSetting(Settings.AppPrefrences.Interests, interestsJson);

                await GetUserData();
            }
        }
Beispiel #11
0
 public void Clear()
 {
     TabItems.Clear();
 }