コード例 #1
0
        private Boolean searchPaginate()
        {
            if (isCitation == false)
            {
                flag = 2;
                Searcher.CancelAsync();
                if (Searcher.IsBusy == false)
                {
                    this.cancel.Visibility = System.Windows.Visibility.Visible;
                    progressBar.Visibility = System.Windows.Visibility.Visible;
                    this.searchBox.Opacity = 0.50;
                    d.pageId = currentPageSelected;
                    updateStatusBar("Fetching More Results...");
                    test = new Controller(this);
                    Searcher.RunWorkerAsync(d);
                    return true;
                }
            }
            else if (isCitation)
            {
                this.cancel.Visibility = System.Windows.Visibility.Visible;
                progressBar.Visibility = System.Windows.Visibility.Visible;
                this.searchBox.Opacity = 0.50;
                s.sOrder = this.getSortOrder();
                updateStatusBar("Fetching Citations...");
                displayCitations(s.sOrder, s.i);
                return true;
            }
            return false;

        }
コード例 #2
0
        public void displayCitations(SortOrder so, int id)
        {
            test = new Controller(this);
            TabItem selectedTab = mw.tabDynamic.SelectedItem as TabItem;
            selectedTab.Header = "Citations List";
            //test.getGSCitations(url);
            this.isCitation = true;


            s.sOrder = this.getSortOrder();
            s.i = id;
            s.start = currentPageSelected * 10;
            s.c = viewCitation;
            if (viewCitation.IsBusy)
            {
                viewCitation.CancelAsync();
            }
            viewCitation.RunWorkerAsync(s);
        }
コード例 #3
0
        private void search(object sender = null, RoutedEventArgs e = null)
        {

            this.ResultsPane.Items.Clear();
            Pagination.Visibility = Visibility.Hidden;
            Pagination.IsEnabled = false;
            updateStatusBar(" ");

            this.searchBox.Opacity = 0.50;
            this.cancel.Visibility = System.Windows.Visibility.Visible;
            progressBar.Visibility = System.Windows.Visibility.Visible;
            this.Author.Children.Clear();
            this.Paper.Children.Clear();
            this.Journal.Children.Clear();
            newResultFlag = 1;
           
            btnAddFav.Background = new SolidColorBrush(Colors.White);
            btnAddFav.Foreground = new SolidColorBrush(Colors.Black);
            btnAddFav.Content = "+ Add to Favorites";
            currentPageSelected = 1;
            if (firstSearchFlag != 0)
            {
                try
                {
                    changePagination(currentPageSelected);
                }
                catch (Exception)
                {
                }
            }
            if (this.flag == 0)
            {
                flag = 1;
                updateStatusBar("Looking up for " + this.getSearchBoxText()+"...");
                TabItem selectedTab = mw.tabDynamic.SelectedItem as TabItem;
                if (getSearchBoxText() != "")
                    selectedTab.Header = getSearchBoxText();


                d.qs = this.getSearchBoxText(); Console.WriteLine(d.qs);
                d.yl = this.getYlo(); Console.WriteLine(d.yl);
                d.yh = this.getYhi(); Console.WriteLine(d.yh);
                d.ic = this.getIncludePatents(); Console.WriteLine(d.ic);
                d.so = this.getSortOrder(); Console.WriteLine(d.so);
                d.rt = this.getResultType(); Console.WriteLine(d.rt);
                d.b = Searcher;
                d.pageId = currentPageSelected;

                test = new Controller(this);

                Searcher.RunWorkerAsync(d);

            }
            else
            {
                flag = 2;
                Searcher.CancelAsync();
            }
            /*  try
          {
              test.initiateSearch();
          }
          catch (Exception)
          {
              MessageBox.Show(error);
          }
                  * */
        }
コード例 #4
0
        private void searchFav()
        {
            updateStatusBar(" ");
            this.searchBox.Opacity = 0.50;
            this.cancel.Visibility = System.Windows.Visibility.Visible;
            progressBar.Visibility = System.Windows.Visibility.Visible;
            this.Author.Children.Clear();
            this.Paper.Children.Clear();
            this.Journal.Children.Clear();
            newResultFlag = 0;
            btnAddFav.Background = new SolidColorBrush(Colors.White);
            btnAddFav.Foreground = new SolidColorBrush(Colors.Black);
            btnAddFav.Content = "+ Add to Favorites";

            pageList = new List<Button>();
            Button b;
            //Console.WriteLine(resultList.getCount());
            //maxCount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(resultList.getCount() / 20)));

            //updateStatusBar(maxCount.ToString());


            //Console.WriteLine(maxCount);
            //status.Text = "" + maxCount;
            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.MaxWidth = 20;
                b.BorderThickness = new Thickness(0);
                b.Cursor = Cursors.Hand;
                b.Uid = i + "";
                if (i == 0)
                    b.Content = b.Uid = "<<";
                else if (i == 11)
                    b.Content = b.Uid = ">>";
                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;
                /*
                if (i > maxCount && i != 11)
                {

                    b.IsEnabled = false;
                    b.Visibility = Visibility.Hidden;
                }*/
                pageList.Add(b);
                if (currentPageSelected == 1)
                {
                    pageList[0].Visibility = Visibility.Hidden;
                    pageList[0].IsEnabled = false;
                }
                else
                {
                    pageList[0].IsEnabled = true;
                    pageList[0].Visibility = Visibility.Visible;
                }
                //Pagination.Children.Add(pageList[i]);
            }
            try
            {
                changePagination(currentPageSelected);
            }
            catch (Exception)
            { 
            }
            
            if (this.flag == 0)
            {
                flag = 1;
                updateStatusBar("Looking up for " + this.getSearchBoxText()+" ...");
                TabItem selectedTab = mw.tabDynamic.SelectedItem as TabItem;
                if (getSearchBoxText() != "")
                    selectedTab.Header = getSearchBoxText();


                d.qs = this.getSearchBoxText(); Console.WriteLine(d.qs);
                d.yl = this.getYlo(); Console.WriteLine(d.yl);
                d.yh = this.getYhi(); Console.WriteLine(d.yh);
                d.ic = this.getIncludePatents(); Console.WriteLine(d.ic);
                d.so = this.getSortOrder(); Console.WriteLine(d.so);
                d.rt = this.getResultType(); Console.WriteLine(d.rt);
                d.b = Searcher;
                d.pageId = currentPageSelected;

                test = new Controller(this);

                Searcher.RunWorkerAsync(d);

            }
            else
            {
                flag = 2;
                Searcher.CancelAsync();
            }
            /*  try
          {
              test.initiateSearch();
          }
          catch (Exception)
          {
              MessageBox.Show(error);
          }
                  * */
        }
コード例 #5
0
        private void Searcher_DoWork(object sender, DoWorkEventArgs e)
        {

            Console.WriteLine("Thread started");
            data di = (data)e.Argument;
            BackgroundWorker b = sender as BackgroundWorker;
            //updateStatusBar("Looking up for");
            test = new Controller(this);

            aTimer = new System.Timers.Timer();
            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            // Set the Interval to 1 minute.
            aTimer.Interval = 140000;
            aTimer.Enabled = true;
            //updateStatusBar(" ");

            resultList = test.initiateSearch(di);
            //updateStatusBar("fetched results for "+di.qs);
            if (d.b.CancellationPending) e.Cancel = true;
            Console.WriteLine("why dis kolaveri");
            //TabPage tab = new TabPage(mw);

        }
コード例 #6
0
        private void Searcher_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {

            aTimer.Enabled = false;
            aTimer.Stop();
            if (e.Cancelled)
            {

                if (flag == 2)
                {/*
                    Searcher.Dispose();
                    displayError("Loading Please Wait !!!");
                    Searcher = new System.ComponentModel.BackgroundWorker();
                    Searcher.WorkerReportsProgress = true;
                    Searcher.WorkerSupportsCancellation = true;
                   */
                    updateStatusBar(" ");
                    flag = 1;
                    this.Author.Children.Clear();
                    this.Paper.Children.Clear();
                    this.Journal.Children.Clear();

                    progressBar.Value = 0;

                    TabItem selectedTab = mw.tabDynamic.SelectedItem as TabItem;
                    if (getSearchBoxText() != "")
                        selectedTab.Header = getSearchBoxText();


                    d.qs = this.getSearchBoxText(); Console.WriteLine(d.qs);
                    d.yl = this.getYlo(); Console.WriteLine(d.yl);
                    d.yh = this.getYhi(); Console.WriteLine(d.yh);
                    d.ic = this.getIncludePatents(); Console.WriteLine(d.ic);
                    d.so = this.getSortOrder(); Console.WriteLine(d.so);
                    d.rt = this.getResultType(); Console.WriteLine(d.rt);
                    d.b = Searcher;
                    d.pageId = currentPageSelected;
                    test = new Controller(this);
                    updateStatusBar("Looking up for " + d.qs+"...");
                    Searcher.RunWorkerAsync(d);
                }
                else
                {
                    updateStatusBar(" ");
                    flag = 0; progressBar.Value = 0;
                    cancel.Visibility = Visibility.Hidden;
                }
            }
            else
            {
                updateStatusBar(" ");
                if (resultList != null)
                {
                    updateStatusBar("Fetched Results.");
                    Console.WriteLine(this.resultList.getCount());
                    this.setResult(resultList); // searchCompleted(e);
                }
                else
                {
                    //TabPage.displayError("No Results found !!");
                    updateStatusBar("No Results Found.Please check your Search Query.");
                    NoResults welcome = new NoResults();
                    Grid g1 = new Grid();
                    g1 = welcome.grid;
                    welcome.Content = null;
                    this.ResultsPane.Items.Add(g1);
                    Console.WriteLine("it's null so sad"); progressBar.Value = 0; cancel.Visibility = Visibility.Hidden;
                    progressBar.Visibility = Visibility.Hidden;
                    searchBox.Opacity = 1;
                }
                flag = 0;
            }
        }