Exemplo n.º 1
0
 public FavoritesResult(MainWindow mw, Favourites f, FavouritesPage favPage)
 {
     InitializeComponent();
     this.mw      = mw;
     this.f       = f;
     this.favPage = favPage;
 }
Exemplo n.º 2
0
        public FavouritesPage(MainWindow mw, Favourites fav)
        {
            this.f = fav;
            InitializeComponent();
            this.mw = mw;
            FavoritesResult page;
            ListBoxItem     item;
            int             flag = 0;

            foreach (Query q in f.getFavourites())
            {
                flag = 1;
                page = new FavoritesResult(mw, f, this);
                item = new ListBoxItem();
                page.setQueryString(q.getqueryString());
                String s = "";
                if (q.sortOrder == SortOrder.CITATIONS)
                {
                    s = s + "Sorted by Citations, ";
                }
                else
                {
                    s = s + "Sorted by Year, ";
                }
                if (q.issetylo() == true)
                {
                    s = s + "From " + q.getylo();
                }
                if (q.issetyhi() == true)
                {
                    s = s + " To " + q.getyhi();
                }
                page.setQueryParams(s);
                page.setSearch(q);
                if (q.resultType == ResultType.AUTHOR)
                {
                    page.setSearchType("Search by Author");
                }
                else
                {
                    page.setSearchType("Search by Journal");
                }
                item         = page.listItem;
                page.Content = null;
                this.favoritesPane.Items.Add(item);
            }
            if (flag == 0)
            {
                page = new FavoritesResult(mw, f, this);
                item = new ListBoxItem();
                page.setQueryString("            YOUR FAVORITES LIST IS EMPTY!");
                page.btnViewSearch.IsEnabled  = false;
                page.btnViewSearch.Visibility = Visibility.Hidden;
                page.btnDelete.IsEnabled      = false;
                page.btnDelete.Visibility     = Visibility.Hidden;
                item         = page.listItem;
                page.Content = null;
                this.favoritesPane.Items.Add(item);
            }
        }
 public FavoritesResult(MainWindow mw, Favourites f, FavouritesPage favPage)
 {
     InitializeComponent();
     this.mw = mw;
     this.f = f;
     this.favPage = favPage;
 }
Exemplo n.º 4
0
 public Page2(MainWindow mw, TabPage page, Paper paper, Favourites fav)
 {
     InitializeComponent();
     this.fav = fav;
     this.mw = mw;
     this.page = page;
     this.paper = paper;
 }
Exemplo n.º 5
0
 public Page2(MainWindow mw, TabPage page, Paper paper, Favourites fav)
 {
     InitializeComponent();
     this.fav   = fav;
     this.mw    = mw;
     this.page  = page;
     this.paper = paper;
 }
Exemplo n.º 6
0
 public FavouritesPage(MainWindow mw, Favourites fav)
 {
     this.f = fav;
     InitializeComponent();
     this.mw = mw;
     FavoritesResult page;
     ListBoxItem item;
     int flag = 0;
     foreach (Query q in f.getFavourites())
     {
         flag = 1;
         page = new FavoritesResult(mw, f, this);
         item = new ListBoxItem();
         page.setQueryString(q.getqueryString());
         String s = "";
         if (q.sortOrder == SortOrder.CITATIONS)
             s = s + "Sorted by Citations, ";
         else
             s = s + "Sorted by Year, ";
         if (q.issetylo() == true)
             s = s + "From " + q.getylo();
         if (q.issetyhi() == true)
             s = s + " To " + q.getyhi();
         page.setQueryParams(s);
         page.setSearch(q);
         if (q.resultType == ResultType.AUTHOR)
             page.setSearchType("Search by Author");
         else
             page.setSearchType("Search by Journal");
         item = page.listItem;
         page.Content = null;
         this.favoritesPane.Items.Add(item);
     }
     if (flag == 0)
     {
         page = new FavoritesResult(mw, f, this);
         item = new ListBoxItem();
         page.setQueryString("            YOUR FAVORITES LIST IS EMPTY!");
         page.btnViewSearch.IsEnabled = false;
         page.btnViewSearch.Visibility = Visibility.Hidden;
         page.btnDelete.IsEnabled = false;
         page.btnDelete.Visibility = Visibility.Hidden;
         item = page.listItem;
         page.Content = null;
         this.favoritesPane.Items.Add(item);
     }
 }
Exemplo n.º 7
0
        public MainWindow()
        {
            try
            {
                InitializeComponent();

                favourites = new Favourites();

                /*
                 * Initially two tabs are created:
                 * One for the search
                 * Other for adding a new tab
                 */

                // initialize tabItem array
                _tabItems = new List <TabItem>();

                // add a tabItem with + in header
                _tabAdd             = new TabItem();
                _tabAdd.Header      = "+";
                _tabAdd.Background  = Brushes.LightGray;
                _tabAdd.BorderBrush = Brushes.DarkGray;

                _tabItems.Add(_tabAdd);

                // add first tab
                this.AddTabItem();

                // bind tab control
                tabDynamic.DataContext = _tabItems;

                tabDynamic.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 8
0
        public TabPage(MainWindow mw, Favourites f)
        {
            this.mw = mw;
            error   = "";
            fav     = f;
            InitializeComponent();
            Page5 welcome = new Page5(mw);
            Grid  g1      = new Grid();

            g1 = welcome.welcome;
            welcome.Content = null;
            this.ResultsPane.Items.Add(g1);
            this.Searcher = new System.ComponentModel.BackgroundWorker();
            this.Searcher.WorkerReportsProgress      = true;
            this.Searcher.WorkerSupportsCancellation = true;


            this.Searcher.DoWork             += new System.ComponentModel.DoWorkEventHandler(this.Searcher_DoWork);
            this.Searcher.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(this.Searcher_ProgressChanged);
            this.Searcher.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.Searcher_RunWorkerCompleted);


            this.viewCitation = new System.ComponentModel.BackgroundWorker();
            this.viewCitation.WorkerReportsProgress      = true;
            this.viewCitation.WorkerSupportsCancellation = true;
            this.viewCitation.DoWork             += new System.ComponentModel.DoWorkEventHandler(this.Citation_DoWork);
            this.viewCitation.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(this.Citation_ProgressChanged);
            this.viewCitation.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.Citation_RunWorkerCompleted);
            controllerList = new List <Controller>();

            progressBar.Visibility = System.Windows.Visibility.Hidden;
            this.searchBox.Opacity = 1;


            this.UpdateStatusBar += updateStatusBar;  // related to statusbar

            updateStatusBar("Ready To Search...");


            /*
             * Initially two tabs are created:
             * One for the search
             * Other for adding a new tab
             */

            //Dummy to test

            /*pageList = new List<Button>();
             * Button b;
             * for (int i = 0; i < 12; i++)
             * {
             *  b = new Button();
             *  b.HorizontalAlignment = HorizontalAlignment.Stretch;
             *  b.Background = new SolidColorBrush(Colors.White);
             *  b.Foreground = new SolidColorBrush(Colors.Blue);
             *  b.BorderBrush = Brushes.White;
             *  b.BorderThickness = new Thickness(0);
             *  b.Cursor = Cursors.Hand;
             *  b.Uid = i + "";
             *  if (i == 0)
             *      b.Content = b.Uid = "previous";
             *  else if (i == 11)
             *      b.Content = b.Uid = "next";
             *  else
             *      b.Content = (i) + "";
             *  if (i == 1)
             *  {
             *      b.Foreground = new SolidColorBrush(Colors.Black);
             *      b.Background = Brushes.LightGray;
             *  }
             *  else
             *  {
             *      b.Background = Brushes.White;
             *      b.Foreground = new SolidColorBrush(Colors.Blue);
             *  }
             *  b.Click += b_Click;
             *  pageList.Add(b);
             *  Pagination.Children.Add(pageList[i]);
             * }*/
            //Dummy to test
        }
Exemplo n.º 9
0
        public TabPage(MainWindow mw, Favourites f, Query q)
        {
            this.mw = mw;
            this.f  = f;
            this.q  = q;
            InitializeComponent();

            this.Searcher = new System.ComponentModel.BackgroundWorker();
            this.Searcher.WorkerReportsProgress      = true;
            this.Searcher.WorkerSupportsCancellation = true;


            this.Searcher.DoWork             += new System.ComponentModel.DoWorkEventHandler(this.Searcher_DoWork);
            this.Searcher.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(this.Searcher_ProgressChanged);
            this.Searcher.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.Searcher_RunWorkerCompleted);


            this.viewCitation = new System.ComponentModel.BackgroundWorker();
            this.viewCitation.WorkerReportsProgress      = true;
            this.viewCitation.WorkerSupportsCancellation = true;
            this.viewCitation.DoWork             += new System.ComponentModel.DoWorkEventHandler(this.Citation_DoWork);
            this.viewCitation.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(this.Citation_ProgressChanged);
            this.viewCitation.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.Citation_RunWorkerCompleted);
            controllerList = new List <Controller>();

            progressBar.Visibility = System.Windows.Visibility.Hidden;
            this.searchBox.Opacity = 1;


            this.UpdateStatusBar += updateStatusBar;  // related to statusbar

            updateStatusBar("Ready To Search !!!");

            this.searchBox.Text = q.getqueryString();
            if (q.resultType == ResultType.AUTHOR)
            {
                this.radioAuthor.IsChecked  = true;
                this.radioJournal.IsChecked = false;
            }
            else
            {
                this.radioJournal.IsChecked = true;
                this.radioAuthor.IsChecked  = false;
            }
            if (q.sortOrder == SortOrder.CITATIONS)
            {
                this.radioCitations.IsChecked = true;
                this.radioDate.IsChecked      = false;
            }
            else
            {
                this.radioDate.IsChecked      = true;
                this.radioCitations.IsChecked = false;
            }
            int flag = 0;

            if (q.issetyhi())
            {
                flag = 1;
                this.checkBoxCustomRange.IsChecked = true;
                this.checkBoxCustomRange.IsEnabled = true;
                this.yearEnd.IsEnabled             = true;
                this.yearStart.IsEnabled           = true;
                this.yearEnd.Text = q.getyhi() + "";
            }
            if (q.issetylo())
            {
                flag = 1;
                this.checkBoxCustomRange.IsChecked = true;
                this.checkBoxCustomRange.IsEnabled = true;
                this.yearEnd.IsEnabled             = true;
                this.yearStart.IsEnabled           = true;
                this.yearStart.Text = q.getylo() + "";
            }
            if (flag == 0)
            {
                this.checkBoxCustomRange.IsChecked = false;
            }
            currentPageSelected = q.getpageid();
            searchFav();
        }
Exemplo n.º 10
0
        public TabPage(MainWindow mw, Favourites f)
        {
            this.mw = mw;
            error = "";
            fav = f;
            InitializeComponent();
            Page5 welcome = new Page5(mw);
            Grid g1 = new Grid();
            g1 = welcome.welcome;
            welcome.Content = null;
            this.ResultsPane.Items.Add(g1);
            this.Searcher = new System.ComponentModel.BackgroundWorker();
            this.Searcher.WorkerReportsProgress = true;
            this.Searcher.WorkerSupportsCancellation = true;


            this.Searcher.DoWork += new System.ComponentModel.DoWorkEventHandler(this.Searcher_DoWork);
            this.Searcher.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.Searcher_ProgressChanged);
            this.Searcher.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.Searcher_RunWorkerCompleted);


            this.viewCitation = new System.ComponentModel.BackgroundWorker();
            this.viewCitation.WorkerReportsProgress = true;
            this.viewCitation.WorkerSupportsCancellation = true;
            this.viewCitation.DoWork += new System.ComponentModel.DoWorkEventHandler(this.Citation_DoWork);
            this.viewCitation.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.Citation_ProgressChanged);
            this.viewCitation.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.Citation_RunWorkerCompleted);
            controllerList = new List<Controller>();

            progressBar.Visibility = System.Windows.Visibility.Hidden;
            this.searchBox.Opacity = 1;


            this.UpdateStatusBar += updateStatusBar;  // related to statusbar

            updateStatusBar("Ready To Search...");

            
            /*
             * Initially two tabs are created:
             * One for the search
             * Other for adding a new tab
           */

            //Dummy to test
            /*pageList = new List<Button>();
            Button b;
            for (int i = 0; i < 12; i++)
            {
                b = new Button();
                b.HorizontalAlignment = HorizontalAlignment.Stretch;
                b.Background = new SolidColorBrush(Colors.White);
                b.Foreground = new SolidColorBrush(Colors.Blue);
                b.BorderBrush = Brushes.White;
                b.BorderThickness = new Thickness(0);
                b.Cursor = Cursors.Hand;
                b.Uid = i + "";
                if (i == 0)
                    b.Content = b.Uid = "previous";
                else if (i == 11)
                    b.Content = b.Uid = "next";
                else
                    b.Content = (i) + "";
                if (i == 1)
                {
                    b.Foreground = new SolidColorBrush(Colors.Black);
                    b.Background = Brushes.LightGray;
                }
                else
                {
                    b.Background = Brushes.White;
                    b.Foreground = new SolidColorBrush(Colors.Blue);
                }
                b.Click += b_Click;
                pageList.Add(b);
                Pagination.Children.Add(pageList[i]);
            }*/
            //Dummy to test
        }
Exemplo n.º 11
0
        public TabPage(MainWindow mw, Favourites f, Query q)
        {
            this.mw = mw;
            this.f = f;
            this.q = q;
            InitializeComponent();

            this.Searcher = new System.ComponentModel.BackgroundWorker();
            this.Searcher.WorkerReportsProgress = true;
            this.Searcher.WorkerSupportsCancellation = true;


            this.Searcher.DoWork += new System.ComponentModel.DoWorkEventHandler(this.Searcher_DoWork);
            this.Searcher.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.Searcher_ProgressChanged);
            this.Searcher.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.Searcher_RunWorkerCompleted);


            this.viewCitation = new System.ComponentModel.BackgroundWorker();
            this.viewCitation.WorkerReportsProgress = true;
            this.viewCitation.WorkerSupportsCancellation = true;
            this.viewCitation.DoWork += new System.ComponentModel.DoWorkEventHandler(this.Citation_DoWork);
            this.viewCitation.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.Citation_ProgressChanged);
            this.viewCitation.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.Citation_RunWorkerCompleted);
            controllerList = new List<Controller>();

            progressBar.Visibility = System.Windows.Visibility.Hidden;
            this.searchBox.Opacity = 1;


            this.UpdateStatusBar += updateStatusBar;  // related to statusbar

            updateStatusBar("Ready To Search !!!");

            this.searchBox.Text = q.getqueryString();
            if (q.resultType == ResultType.AUTHOR)
            {
                this.radioAuthor.IsChecked = true;
                this.radioJournal.IsChecked = false;
            }
            else
            {
                this.radioJournal.IsChecked = true;
                this.radioAuthor.IsChecked = false;
            }
            if (q.sortOrder == SortOrder.CITATIONS)
            {
                this.radioCitations.IsChecked = true;
                this.radioDate.IsChecked = false;
            }
            else
            {
                this.radioDate.IsChecked = true;
                this.radioCitations.IsChecked = false;
            }
            int flag = 0;
            if (q.issetyhi())
            {
                flag = 1;
                this.checkBoxCustomRange.IsChecked = true;
                this.checkBoxCustomRange.IsEnabled = true;
                this.yearEnd.IsEnabled = true;
                this.yearStart.IsEnabled = true;
                this.yearEnd.Text = q.getyhi() + "";
            }
            if (q.issetylo())
            {
                flag = 1;
                this.checkBoxCustomRange.IsChecked = true;
                this.checkBoxCustomRange.IsEnabled = true;
                this.yearEnd.IsEnabled = true;
                this.yearStart.IsEnabled = true;
                this.yearStart.Text = q.getylo() + "";
            }
            if (flag == 0)
                this.checkBoxCustomRange.IsChecked = false;
            currentPageSelected = q.getpageid();
            searchFav();

        }