Example #1
0
        private void Btn_ViewComment_Click(object sender, RoutedEventArgs e)
        {
            int selectedId;

            selectedId = Convert.ToInt32(ListBox_CommentDetails.SelectedValue);

            // Verify the user selected a record to view
            if (selectedId > 0)
            {
                if (searchResultIds.Count > 1)
                {
                    vetCommentWin = new CommentRecord(parentWin);
                    vetCommentWin.SetMultiRecord(searchResultIds);
                    vetCommentWin.BuildAndShowDialog(selectedId);
                }
                else
                {
                    vetCommentWin = new CommentRecord(parentWin);
                    vetCommentWin.SetSingleRecord();
                    vetCommentWin.BuildAndShowDialog(selectedId);
                }

                parentWin.DataContext       = null;
                parentWin.MainWindowContent = vetCommentWin;
                parentWin.DataContext       = parentWin;
            }
            else
            {
                MessageBox.Show(Tools.RecordSelectMessage, Tools.RecordSelectTitle);
            }
        }
        private void Btn_Next_Click(object sender, RoutedEventArgs e)
        {
            int currentIndex = recordIds.IndexOf(currentCnum);

            if (currentIndex < (recordIds.Count - 1))
            {
                MessageBoxResult result = MessageBoxResult.No;

                if (Tools.hasDataChanged)
                {
                    result = MessageBox.Show(Tools.unsavedMessage, Tools.unsavedTitle, MessageBoxButton.YesNo);
                }

                if (!Tools.hasDataChanged || result == MessageBoxResult.Yes)
                {
                    CommentRecord vetWin;
                    vetWin = new CommentRecord(mainWin);
                    vetWin.SetMultiRecord(recordIds);
                    vetWin.BuildAndShowDialog(recordIds[currentIndex + 1]);

                    mainWin.DataContext       = null;
                    mainWin.MainWindowContent = vetWin;
                    mainWin.DataContext       = mainWin;

                    // User has changed the page, discarding the changed data
                    Tools.hasDataChanged = false;
                }
            }
        }