コード例 #1
0
        public async void Open(int id)
        {
            int?param = id;

            if (id == -1)
            {
                param = null;
            }
            if (_tourns != null)
            {
                var tourn = _tourns.FirstOrDefault(el => el.Id == id);
                if (tourn != null && !tourn.HasChildTourns)
                {
                    Messenger.Default.Send <NavigateToPageMessage>(new NavigateToPageMessage()
                    {
                        PageName = "TournPage",
                        Param    = new int[] { id }
                    });
                    return;
                }
            }

            if (_currentTourn != param)
            {
                _path.Push(_currentTourn);
                _currentTourn = param;
            }

            Tourns = (await _agent.GetTournsAsync(param)).Select(Mapper.Map <LogicLayer.Model.Tourn, TournRow>).ToList();
        }
コード例 #2
0
        public async void Open(int id)
        {
            //App.SetProgressIndicator(true);
            SetBusy(true);
            int?param = id;

            if (id == -1)
            {
                param = null;
            }


            try
            {
                Tourns =
                    (await _agent.GetTournsAsync(param)).Select(Mapper.Map <LogicLayer.Model.Tourn, TournRow>).ToList();

                if (_currentTourn != param)
                {
                    _path.Push(_currentTourn);
                    _currentTourn = param;
                }

                IsNetworkError = false;
            }
            catch (HttpRequestException)
            {
                _currentTourn  = param;
                IsNetworkError = true;
            }
            catch (WebException)
            {
                _currentTourn  = param;
                IsNetworkError = true;
            }
            catch (NotTournListException)
            {
                Messenger.Default.Send <NavigateToPageMessage>(new NavigateToPageMessage()
                {
                    PageName = "TournPage", Param = new int[] { id }
                });
            }

            SetBusy(false);

            //App.SetProgressIndicator(false);
        }