Esempio n. 1
0
    public virtual IView Create(ViewTypes type)
    {
        IView view = null;
        switch (type) {
            case ViewTypes.GAME:
                view = new GameView(services.Updateables, services.GameService);
            break;
            case ViewTypes.INIT:
                view = new InitView();
            break;
            case ViewTypes.LOAD:
                view = new LoadView();
            break;
            case ViewTypes.MAIN:
                view = new MainView(services);
                break;
            case ViewTypes.RESULTS:
                view = new ResultsView(services);
                break;
            case ViewTypes.LEVEL_UP:
                view = new LevelUpView(services);
                break;
        }
        initView(view);

        return view;
    }
        private void RefreshUI()
        {
            postsProgressBinding?.Detach();
            gifsProgressBinding?.Detach();

            ResultsView.ClearOnScrollListeners();
            QueryEditText.ClearFocus();
            if (Vm.IsReddit)
            {
                ResultsView.SetLayoutManager(new LinearLayoutManager(Context));
                var adapter = Vm.Subreddits.GetRecyclerAdapter(BindRedditView, Resource.Layout.Tmpl_SubredditResult, SubredditItemClick);
                ResultsView.SetAdapter(adapter);
                ResultsView.AddOnScrollListener(new ScrollListener(Vm.Subreddits));
            }
            else if (Vm.IsPosts)
            {
                ResultsView.SetLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.Vertical));
                var adapter = Vm.Posts.GetRecyclerAdapter(BindPostView, Resource.Layout.Tmpl_GalleryThumbnail, PostItemClick);
                ResultsView.SetAdapter(adapter);
                ResultsView.AddOnScrollListener(new ScrollListener(Vm.Posts));

                postsProgressBinding = this.SetBinding(() => Vm.Posts.IsBusy, () => RedditsProgress.Visibility, BindingMode.OneWay).ConvertSourceToTarget(BoolToViewState);
            }
            else if (Vm.IsGifs)
            {
                ResultsView.SetLayoutManager(new GridLayoutManager(Context, 2));
                var adapter = Vm.Gifs.GetRecyclerAdapter(BindGifView, Resource.Layout.Tmpl_SubredditThumbnail, GifItemClick);
                ResultsView.SetAdapter(adapter);
                ResultsView.AddOnScrollListener(new ScrollListener(Vm.Gifs));

                gifsProgressBinding = this.SetBinding(() => Vm.Gifs.IsBusy, () => RedditsProgress.Visibility, BindingMode.OneWay).ConvertSourceToTarget(BoolToViewState);
            }
        }
Esempio n. 3
0
        private void Grid_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            ResultsView.SelectionMode = SelectionMode.Single;

            if (e.Key == Key.Up)
            {
                if (ResultsView.SelectedIndex > -1)
                {
                    ResultsView.SelectedIndex--;
                }

                e.Handled = true;
            }
            else if (e.Key == Key.Down)
            {
                if (ResultsView.SelectedIndex < ResultsView.Items.Count - 1)
                {
                    ResultsView.SelectedIndex++;
                }

                e.Handled = true;
            }

            try
            {
                ResultsView.ScrollIntoView(ResultsView.SelectedItem);
            }
            catch (Exception ex)
            {
                Debug.Print("Error scrolling selected with down arrow into view" + ex.Message);
            }
        }
Esempio n. 4
0
 public ResultsPane(DesignerContext designerContext, IErrorTaskCollection errors)
 {
     this.designerContext = designerContext;
     this.view            = ResultsView.Console;
     this.messageLogger   = new ResultsPane.ResultsMessageLogger();
     this.errorManager    = new ResultsPane.ResultsErrorManager(this, errors);
 }
Esempio n. 5
0
 public OptionsView(Session session)
 {
     this._session = session;
     _settingsView = new SettingsView(_session);
     _aboutView    = new AboutView();
     _resultsView  = new ResultsView(_session);
     InitializeComponent();
 }
Esempio n. 6
0
 private void FilterTextBox_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Down && ResultsView.Items?.Count > 0)
     {
         ResultsView.SelectedIndex = 0;
         ResultsView.Focus();
     }
 }
Esempio n. 7
0
        public ResultsViewModel(ResultsView view, ObservableCollection <ExamRegistration> examRegs)
        {
            this.view     = view;
            this.examRegs = examRegs;

            resultModels = new List <ExamResult>();
            ProvideItemsSource(view, examRegs);
            view.OnCellEditEnding = dgExamResults_CellEditEnding;
        }
Esempio n. 8
0
        public IActionResult Results()
        {
            IList <Survey> SurveyResults = surveyDAO.GetSurveyResults();
            ResultsView    surveyModel   = new ResultsView()
            {
                AllSurveys = surveyDAO.GetSurveyResults(),
                AllParks   = parkDAO.GetParks(),
            };

            return(View(surveyModel));
            //REMOVED "RESULTS" FROM THE RETURN VIEW STATEMENT
        }
Esempio n. 9
0
        private void ProvideItemsSource(ResultsView view, ObservableCollection <ExamRegistration> examRegs)
        {
            foreach (var exam in examRegs)
            {
                ExamResult examResult = new ExamResult()
                {
                    ExamRegistrationId    = exam.ExamRegistrationId,
                    StudentNameAndSurname = exam.StudentNameAndSurname
                };

                resultModels.Add(examResult);
            }

            view.dgExamResults.ItemsSource = resultModels;
        }
Esempio n. 10
0
        private void OnExecuteMainWindow()
        {
            est = new Estimation(dataContext.Inputs);

            if (dataContext.Inputs.IsOptimizing)
            {
                gaView             = new GAParameters();
                gaView.DataContext = dataContext;
                gaView.Show();
            }
            else
            {
                ResultsView resView = new ResultsView(est.Estimate());
                resView.Show();
            }
        }
        public void ViewResults_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            CurrentView = new ResultsView();

            if (ResultsList.Count > 0)
            {
                CurrentTitle = League.Name + " - " + "Match Round " + (Week - 7);
            }
            else
            {
                CurrentTitle = "No Results";
            }

            PropertyChanged(this, new PropertyChangedEventArgs("CurrentView"));
            PropertyChanged(this, new PropertyChangedEventArgs("CurrentTitle"));
            PropertyChanged(this, new PropertyChangedEventArgs("ResultsList"));
        }
Esempio n. 12
0
 void ShowOption(UserControl _viewControl)
 {
     _contentControl.Children.Clear();
     if (_viewControl.GetType() == typeof(OptionsView))
     {
         _contentControl.Children.Add(_optionsView);
     }
     if (_viewControl.GetType() == typeof(GameView))
     {
         _gameView             = (GameView)_viewControl;
         _gameView.showOption += ShowOption;
         _contentControl.Children.Add(_gameView);
     }
     if (_viewControl.GetType() == typeof(SettingsView))
     {
         _settingsView             = (SettingsView)_viewControl;
         _settingsView.showOption += ShowOption;
         _contentControl.Children.Add(_settingsView);
     }
     if (_viewControl.GetType() == typeof(AboutView))
     {
         _aboutView             = (AboutView)_viewControl;
         _aboutView.showOption += ShowOption;
         _contentControl.Children.Add(_aboutView);
     }
     if (_viewControl.GetType() == typeof(ResultsView))
     {
         _resultsView             = (ResultsView)_viewControl;
         _resultsView.showOption += ShowOption;
         _contentControl.Children.Add(_resultsView);
     }
     if (_viewControl.GetType() == typeof(GameFlagView))
     {
         _gameFlagsView             = (GameFlagView)_viewControl;
         _gameFlagsView.showOption += ShowOption;
         _contentControl.Children.Add(_gameFlagsView);
     }
     if (_viewControl.GetType() == typeof(GameCountryView))
     {
         _gameCountryView             = (GameCountryView)_viewControl;
         _gameCountryView.showOption += ShowOption;
         _contentControl.Children.Add(_gameCountryView);
     }
 }
        public ActionResult GetResults(string query)
        {
            //db internal
            UserQueries userqueries = new UserQueries();

            userqueries.Query     = query;
            userqueries.DateQuery = DateTime.Now;
            _context.UserQueries.Add(userqueries);
            _context.SaveChanges();

            //webclient request
            WebClient webClient = new WebClient();
            string    url       = String.Format("https://api.duckduckgo.com/?q={0}&format=json", query);
            string    text      = webClient.DownloadString(url);

            var root = (JContainer)JToken.Parse(text);
            var list = root.DescendantsAndSelf().OfType <JProperty>().Where(p => p.Name == "Result").Select(p => p.Value.Value <string>());

            List <ResultsView> listresults = new List <ResultsView>();

            foreach (var item in list)
            {
                ResultsView resultsview = new ResultsView();
                int         index1      = item.IndexOf("\">");
                int         index2      = item.IndexOf("</a>");
                resultsview.Title = item.Substring(index1 + 2, index2 - index1 - 2);
                resultsview.Link  = item.Substring(9, index1 - 9);
                listresults.Add(resultsview);

                Results results = new Results();
                results.Title       = resultsview.Title;
                results.Link        = resultsview.Link;
                results.UserQueries = userqueries;
                _context.Results.Add(results);
                _context.SaveChanges();
            }

            return(Ok(listresults));
        }
        public ResultsViewModel(ResultsView view)
        {
            _view        = view;
            _gameService = GameService.GetInstace();

            PrizeWon = _gameService.Results.FinalPrize;

            TotalEllapsedTime = _gameService.Results.ElapsedTime.ToString(@"mm\:ss");
            if (_gameService.Results.CorrectAnswers == 0)
            {
                MediumTimeEllapsedPerQuestion = TotalEllapsedTime;
            }
            else
            {
                MediumTimeEllapsedPerQuestion = TimeSpan.FromSeconds((_gameService.Results.ElapsedTime.Seconds / _gameService.Results.CorrectAnswers)).ToString(@"mm\:ss");
            }

            int prizeId = Game.PrizeList.IndexOf(PrizeWon);

            switch (prizeId)
            {
            case -1:
                _view.mainGrid.Style        = Application.Current.TryFindResource("DangerGrid") as Style;
                _view.mainUserControl.Style = Application.Current.TryFindResource("NoWin") as Style;
                break;

            case int n when(n >= 0 && n < 14):
                _view.mainGrid.Style = Application.Current.TryFindResource("SuccessGrid") as Style;

                _view.mainUserControl.Style = Application.Current.TryFindResource("Win") as Style;
                break;

            case 14:
                _view.mainGrid.Style        = Application.Current.TryFindResource("SuccessGrid") as Style;
                _view.mainUserControl.Style = Application.Current.TryFindResource("BigWin") as Style;
                break;
            }
        }
Esempio n. 15
0
        void ReleaseDesignerOutlets()
        {
            if (AILogo != null)
            {
                AILogo.Dispose();
                AILogo = null;
            }

            if (BackButton != null)
            {
                BackButton.Dispose();
                BackButton = null;
            }

            if (BottomLeft_Button != null)
            {
                BottomLeft_Button.Dispose();
                BottomLeft_Button = null;
            }

            if (BottomRight_Button != null)
            {
                BottomRight_Button.Dispose();
                BottomRight_Button = null;
            }

            if (CenteringLabel != null)
            {
                CenteringLabel.Dispose();
                CenteringLabel = null;
            }

            if (HighLowLabel != null)
            {
                HighLowLabel.Dispose();
                HighLowLabel = null;
            }

            if (ImportanceLevelLabel != null)
            {
                ImportanceLevelLabel.Dispose();
                ImportanceLevelLabel = null;
            }

            if (ImportanceTextBox != null)
            {
                ImportanceTextBox.Dispose();
                ImportanceTextBox = null;
            }

            if (InfoButton != null)
            {
                InfoButton.Dispose();
                InfoButton = null;
            }

            if (OneToFiveLabel2 != null)
            {
                OneToFiveLabel2.Dispose();
                OneToFiveLabel2 = null;
            }

            if (PCTitle != null)
            {
                PCTitle.Dispose();
                PCTitle = null;
            }

            if (PlayCharLabel != null)
            {
                PlayCharLabel.Dispose();
                PlayCharLabel = null;
            }

            if (PlayErrorLabel != null)
            {
                PlayErrorLabel.Dispose();
                PlayErrorLabel = null;
            }

            if (PlayPrefLabel != null)
            {
                PlayPrefLabel.Dispose();
                PlayPrefLabel = null;
            }

            if (ProgressBar != null)
            {
                ProgressBar.Dispose();
                ProgressBar = null;
            }

            if (Putter_Fitter != null)
            {
                Putter_Fitter.Dispose();
                Putter_Fitter = null;
            }

            if (PutterSpecsLabel != null)
            {
                PutterSpecsLabel.Dispose();
                PutterSpecsLabel = null;
            }

            if (ResultsTitleLabel != null)
            {
                ResultsTitleLabel.Dispose();
                ResultsTitleLabel = null;
            }

            if (ResultsView != null)
            {
                ResultsView.Dispose();
                ResultsView = null;
            }

            if (ShowMoreButton != null)
            {
                ShowMoreButton.Dispose();
                ShowMoreButton = null;
            }

            if (ShowMoreLabel != null)
            {
                ShowMoreLabel.Dispose();
                ShowMoreLabel = null;
            }

            if (ShowMyDetailsButton != null)
            {
                ShowMyDetailsButton.Dispose();
                ShowMyDetailsButton = null;
            }

            if (StartOverButton != null)
            {
                StartOverButton.Dispose();
                StartOverButton = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (TopLeft_Button != null)
            {
                TopLeft_Button.Dispose();
                TopLeft_Button = null;
            }

            if (TopRight_Button != null)
            {
                TopRight_Button.Dispose();
                TopRight_Button = null;
            }
        }
Esempio n. 16
0
        private void ExecuteSetResults(object p)
        {
            ResultsView resultsView = new ResultsView(Students);

            resultsView.ShowDialog();
        }
Esempio n. 17
0
        /// <summary>
        /// Function called when the user clicked on the OK button of the window
        /// </summary>
        private void ShowResults()
        {
            if ((isLoad && NbRecording > 0) || IsAtLeastOneCheckBoxIsChecked(choiceResultView.stkPanel))
            {
                choiceResultView.Close();
                List <bool> lbool = new List <bool>();
                lbool.Add(choiceResultView.chkAgitationHips.IsChecked.HasValue && choiceResultView.chkAgitationHips.IsChecked.Value); // this is a way to convert a bool? to a bool
                lbool.Add(choiceResultView.chkAgitationLHand.IsChecked.HasValue && choiceResultView.chkAgitationLHand.IsChecked.Value);
                lbool.Add(choiceResultView.chkAgitationLKnee.IsChecked.HasValue && choiceResultView.chkAgitationLKnee.IsChecked.Value);
                lbool.Add(choiceResultView.chkAgitationLShoulder.IsChecked.HasValue && choiceResultView.chkAgitationLShoulder.IsChecked.Value);
                lbool.Add(choiceResultView.chkAgitationRHand.IsChecked.HasValue && choiceResultView.chkAgitationRHand.IsChecked.Value);
                lbool.Add(choiceResultView.chkAgitationRKnee.IsChecked.HasValue && choiceResultView.chkAgitationRKnee.IsChecked.Value);
                lbool.Add(choiceResultView.chkAgitationRShoulder.IsChecked.HasValue && choiceResultView.chkAgitationRShoulder.IsChecked.Value);
                lbool.Add(choiceResultView.chkHandsJoined.IsChecked.HasValue && choiceResultView.chkHandsJoined.IsChecked.Value);
                lbool.Add(choiceResultView.chkArmsCrossed.IsChecked.HasValue && choiceResultView.chkArmsCrossed.IsChecked.Value);
                lbool.Add(choiceResultView.chkEmotion.IsChecked.HasValue && choiceResultView.chkEmotion.IsChecked.Value);
                lbool.Add(choiceResultView.chkLookDirec.IsChecked.HasValue && choiceResultView.chkLookDirec.IsChecked.Value);
                lbool.Add(choiceResultView.chkNumberSyllables.IsChecked.HasValue && choiceResultView.chkNumberSyllables.IsChecked.Value);
                var results = new ResultsView(lbool);
                if (isLoad) //if the windowis called after a user click on the "Open charts analysis"
                {
                    List <string> listpathdate = new List <string>();

                    if (lastRecord) // to know if the "Last Record" choice is selected in the comboBox
                    {
                        listpathdate.Add(listpath.ElementAt(0));
                    }
                    else
                    {
                        foreach (string s in listpath)
                        {
                            DateTime date = Tools.getDateFromPath(s);
                            if (date.CompareTo(maxDate) <= 0 && date.CompareTo(minDate) >= 0) // we compare the minimum date and the maximum date
                            {
                                listpathdate.Add(s);
                            }
                        }
                    }
                    ((ResultsViewModel)results.DataContext).loadManyCharts(listpathdate); // we called the function to load files
                }
                else //if the window is called after the user clicked on the button "Display my results"
                {
                    ((ResultsViewModel)results.DataContext).getAgitationStatistics(Agitation.getAgitationStats());
                    List <IGraph> temp = new List <IGraph>();
                    temp.AddRange(HandsJoined.getHandStatistics());
                    temp.AddRange(ArmsCrossed.getArmsStatistics());
                    ((ResultsViewModel)results.DataContext).getArmsMotion(temp); //temp is a union between HandsJoined.getHandStatistics() and ArmsCrossed.getArmsStatistics()
                    if (TrackingSideToolViewModel.get().FaceTracking)
                    {
                        List <IGraph> listGraphFace = new List <IGraph>();
                        listGraphFace.AddRange(EmotionRecognition.getEmotionsStatistics());
                        listGraphFace.AddRange(lookingDirection.getLookingStatistics());

                        ((ResultsViewModel)results.DataContext).getFaceStatistics(listGraphFace);
                    }
                    if (TrackingSideToolViewModel.get().SpeedRate)
                    {
                        List <IGraph> listGraphVoice = new List <IGraph>();
                        listGraphVoice.AddRange(AudioProvider.getVoiceStatistics());
                        ((ResultsViewModel)results.DataContext).getVoiceStatistics(listGraphVoice);
                    }
                }
                ((ResultsViewModel)results.DataContext).addResultsPartToView();
                results.Show();
            }
        }
Esempio n. 18
0
        public void Scann(IProgress <int> progress, CancellationToken ct, bool portscan = true)
        {
            if (IPStart == null || IPEnd == null)
            {
                throw new ArgumentException("Start or End IP not specified");
            }
            if (Results == null)
            {
                throw new ArgumentException("No control set for results");
            }
            byte[] start = IPStart.GetAddressBytes();
            byte[] end   = IPEnd.GetAddressBytes();
            Results.Dispatcher.Invoke(new Action(delegate
            {
                Results.Children.Clear();
            }));
            int done = 1;

            for (int i = 0; i < start.Length; i++)
            {
                if (end[i] < start[i])
                {
                    throw new ArgumentException("End IP is smaller than Start IP");
                }
            }

            for (byte a = start[0]; a <= end[0]; a++)
            {
                for (byte b = start[1]; b <= end[1]; b++)
                {
                    for (byte c = start[2]; c <= end[2]; c++)
                    {
                        Parallel.For(start[3], end[3], (d, loopstate) =>
                                     //for (byte d = start[3]; d <= end[3]; d++)
                        {
                            try
                            {
                                ct.ThrowIfCancellationRequested();
                                IPAddress current = new IPAddress(new byte[] { a, b, c, (byte)d });
                                Ping ping         = new Ping();
                                if (ping.Send(current, PingTimeOut).Status == IPStatus.Success)
                                {
                                    string result = null;
                                    if (portscan)
                                    {
                                        result = ScanPorts(current);
                                    }
                                    Results.Dispatcher.Invoke(new Action(delegate
                                    {
                                        ResultsView rv = new ResultsView();
                                        string host    = "";
                                        try { host = Dns.GetHostEntry(current).HostName; }
                                        catch (Exception) { }
                                        rv.ComputerAdress = string.Format("{0} - {1}", current.ToString(), host);
                                        rv.PingResult     = result;
                                        Results.Children.Add(rv);
                                    }));
                                }
                            }
                            catch (OperationCanceledException)
                            {
                                loopstate.Break();
                                if (progress != null)
                                {
                                    progress.Report(0);
                                }
                                return;
                            }
                            if (progress != null)
                            {
                                progress.Report(done);
                            }
                            done++;
                        });
                    }
                }
            }
            Results.Dispatcher.Invoke(new Action(delegate
            {
                System.Windows.Forms.MessageBox.Show("Scann completed", "Information", System.Windows.Forms.MessageBoxButtons.OK);
            }));
        }
Esempio n. 19
0
 private void BTN_GoToResults_Click(object sender, RoutedEventArgs e)
 {
     if(CurrentGame.GameState != GameState.Finished)
     {
         MessageBox.Show("You must submit the results for this match before continuing", "Submit Results", MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
     else
     {
         ResultsView results = new ResultsView(TourneyView.Tourney, TourneyConfig.ReadFromFile());
         results.Owner = Application.Current.MainWindow;
         results.Show();
     }
 }