Example #1
0
        private void ConvertMatchesToButtons(SortableObservableCollection <IMatchVw> matches, SortableObservableCollection <VFLMatchButton> vflMatchButtons)
        {
            SortableObservableCollection <VFLMatchButton> buttons = new SortableObservableCollection <VFLMatchButton>();
            int channel = 0;

            foreach (MatchVw match in matches.OrderBy(x => x.LineObject.BtrMatchId))
            {
                VFLMatchButton button = new VFLMatchButton(match.HomeCompetitorName, match.AwayCompetitorName, match.LineObject.BtrMatchId, match);
                button.Channel = channel++;
                buttons.Add(button);
            }

            if (vflMatchButtons.Count != 0)
            {
                if (buttons.Count == 0)
                {
                    vflMatchButtons.Clear();
                }

                if (vflMatchButtons[0].MatchVw.VirtualDay != buttons[0].MatchVw.VirtualDay)
                {
                    vflMatchButtons.Clear();
                }
            }
            if (vflMatchButtons.Count == 0)
            {
                foreach (var vflMatchButton in buttons)
                {
                    vflMatchButtons.Add(vflMatchButton);
                }
                vflMatchButtons.ElementAt(0).IsSelected = true;
                OnOpenVflPage(vflMatchButtons.ElementAt(0));
            }
        }
Example #2
0
        private void SelectedItemChanged(RoutedPropertyChangedEventArgs <object> obj)
        {
            object selected = obj.NewValue;

            if (selected == null)
            {
                return;
            }

            if (selected is SimpleTreeNodeViewModel)
            {
                SimpleTreeNodeViewModel tvm = (SimpleTreeNodeViewModel)selected;
                _selectedNode = tvm;
                if (tvm.Node is Model.Feed)
                {
                    Articles = new SortableObservableCollection <Model.Article>(((Model.Feed)tvm.Node).Articles);
                }
                else if (tvm.Node is Model.Host)
                {
                    List <Model.Article> intermediate = new List <Model.Article>();
                    foreach (Model.Feed feed in ((Model.Host)tvm.Node).Feeds)
                    {
                        foreach (Model.Article a in feed.Articles)
                        {
                            intermediate.Add(a);
                        }
                    }
                    Articles = new SortableObservableCollection <Model.Article>(intermediate);
                }
                else
                {
                    if (_articles == null)
                    {
                        _articles = new SortableObservableCollection <Article>();
                    }
                    _articles.Clear();
                    foreach (Model.Host h in _allData)
                    {
                        foreach (Model.Feed feed in h.Feeds)
                        {
                            foreach (Model.Article a in feed.Articles)
                            {
                                _articles.Add(a);
                            }
                        }
                    }
                }
                SortedArticles.SortDescriptions.Clear();                                                           // Clear all
                SortedArticles.SortDescriptions.Add(new SortDescription("SortKey", ListSortDirection.Descending)); // Sort descending by "PropertyName"
                //Articles.OrderByDescending(el => el.SortKey);
            }
            RaisePropertyChanged("SortedArticles");
        }
Example #3
0
        void fillProfile(int n, double r, double h, bool concave, bool isneg)
        {
            int    dp = (int)OTWB.BasicLib.GetSetting("DP");
            double R = (r * r + h * h) / (2 * h);
            double d = R - h;
            double theta = Math.Atan(d / r);
            double dtheta = (Math.PI / 2 - theta) / n;
            double rr = 0, rh = 0;

            _profile.Clear();
            for (int i = 0; i <= n; i++)
            {
                double a = theta + i * dtheta;
                rr = Math.Round(R * Math.Cos(a), dp);
                if (concave)
                {
                    rh = (float)Math.Round(R * Math.Sin(a) - d, dp);
                }
                else
                {
                    rh = (float)Math.Round(R * (1 - Math.Sin(a)), dp);
                }
                Point np = new Point(rr, (isneg) ? -rh : rh);
                _profile.Add(np);
            }

            int maxindx = _profile.Count - 1;

            for (int indx = maxindx; indx >= 0; indx--)
            {
                Point p = _profile[indx];
                if (Math.Abs(p.X) > 0)
                {
                    _profile.Add(new Point(-p.X, p.Y));
                }
            }
        }
        void LoadResults(long obj)
        {
            _footballResults.Clear();
            _tennisResults.Clear();
            _basketballResults.Clear();
            _icehockeyResults.Clear();
            _rugbyResults.Clear();
            _handballResults.Clear();
            _volleyballResults.Clear();

            var notFilteredResults = new SortableObservableCollection <MatchResultVw>();

            Repository.FindResults(notFilteredResults,
                                   matchResult =>
            {
                var start = DateTime.Now
                            .AddDays(-ChangeTracker.ResultsSelectedDay)
                            .Date;
                var end = DateTime.Now
                          .AddDays(-ChangeTracker.ResultsSelectedDay)
                          .Date
                          .AddHours(23)
                          .AddMinutes(59)
                          .AddSeconds(59);

                if (matchResult.StartDate.Value.LocalDateTime > end)
                {
                    return(false);
                }
                if (matchResult.StartDate.Value.LocalDateTime < start)
                {
                    return(false);
                }

                return(true);
            },
                                   Comparison);

            var tp = new TestDBTranslationProvider();

            _footballResults.AddRange(FilterFoundResults(
                                          notFilteredResults,
                                          tp.Translate(MultistringTags.SHOP_FORM_SOCCER)));

            _tennisResults.AddRange(FilterFoundResults(
                                        notFilteredResults,
                                        tp.Translate(MultistringTags.SHOP_FORM_TENNIS)));

            _basketballResults.AddRange(FilterFoundResults(
                                            notFilteredResults,
                                            tp.Translate(MultistringTags.SHOP_FORM_BASKETBALL)));

            _icehockeyResults.AddRange(FilterFoundResults(
                                           notFilteredResults,
                                           tp.Translate(MultistringTags.SHOP_FORM_ICEHOCKEY)));

            _rugbyResults.AddRange(FilterFoundResults(
                                       notFilteredResults,
                                       "Rugby"));

            _handballResults.AddRange(FilterFoundResults(
                                          notFilteredResults,
                                          "Handball"));

            _volleyballResults.AddRange(FilterFoundResults(
                                            notFilteredResults,
                                            "Volleyball"));
        }
Example #5
0
        /// <summary>
        /// Clears the current list of filters and resets everything
        /// that is file filter related to null.
        /// </summary>
        public void ClearFilter()
        {
            _CurrentItems.Clear();

            this.SelectedItem = null;
        }