Beispiel #1
0
 public void SetTabItem(int bookNumber, int chapterNumber, int paragraphNumber, bool newTab)
 {
     if (WelcomeBubble.Visibility == Visibility.Visible)
     {
         WelcomeBubble.Visibility = Visibility.Collapsed;
         AddTabButton.Visibility  = Visibility.Visible;
     }
     _tickEvent.Triger(() =>
     {
         Chapter chapter = new Chapter(bookNumber, chapterNumber, paragraphNumber);
         CustomTabViewItem customTabViewItem = new CustomTabViewItem(chapter);
         if (newTab || AppData.ChapterCount() == 0)
         {
             AppData.AddChapter(customTabViewItem);
             AppData.SetSelectedItem(customTabViewItem.TabItem);
             MyTabView.Items.Add(customTabViewItem.TabItem);
             _tickEvent.Triger(() =>
             {
                 MyTabView.SelectedIndex = MyTabView.Items.Count - 1;
             }, 3, "Set index 1");
         }
         else
         {
             AppData.CustomTabViewItems[AppData.SelectedIndex] = customTabViewItem;
             MyTabView.Items[MyTabView.SelectedIndex]          = customTabViewItem.TabItem;
             _tickEvent.Triger(() =>
             {
                 MyTabView.SelectedIndex = AppData.SelectedIndex;
             }, 3, "Set index 2");
         }
     }, 3, "SetTabItem");
 }
Beispiel #2
0
    public string AddChapter(string chapterName, string chapterDescription, int courseID, int userID)
    {
        string result = "";

        DataTable CheckChapterExist = AppData.ChecChapterExist(chapterName, courseID);

        if (CheckChapterExist.Rows.Count > 0)
        {
            result = "Exist";
        }
        else
        {
            result = AppData.AddChapter(chapterName, chapterDescription, courseID, userID);
        }

        return(result);
    }