Exemplo n.º 1
0
        private void UpdateDisplayWorker(object sender, DoWorkEventArgs e)
        {
            var request = e.Argument as DisplayRequest;

            if (request == null)
            {
                throw new InvalidCastException("Unable to cast argument to DisplayRequest.");
            }

            var response = new DisplayResponse();

            switch (request.DisplayState.CurrentState)
            {
            case CurrentStates.RootGenres:
                request.DisplayState.ClearRootGenre();
                response.HeaderText   = "Select a Genre";
                response.DisplayItems = QuikPixCore.Current.GetRootGenres();
                break;

            case CurrentStates.SubGenres:
                var dataItemA = request.CurrentDisplayItem as GenreDisplayItem;
                if (request.DisplayAction == DisplayActions.Select && dataItemA != null)
                {
                    request.DisplayState.RootGenreId    = dataItemA.GenreId;
                    request.DisplayState.RootGenreTitle = dataItemA.Title;
                }
                request.DisplayState.ClearSubGenre();

                response.HeaderText   = string.Format("{0}: Select a Sub-Genre", request.DisplayState.RootGenreTitle);
                response.DisplayItems = QuikPixCore.Current.GetSubGenres(request.DisplayState.RootGenreId);
                break;

            case CurrentStates.Titles:
                var dataItemB = ItemScroller.CurrentDataItem as GenreDisplayItem;
                if (request.DisplayAction == DisplayActions.Select && dataItemB != null)
                {
                    request.DisplayState.SubGenreId    = dataItemB.GenreId;
                    request.DisplayState.SubGenreTitle = dataItemB.Title;
                }
                request.DisplayState.ClearTitle();

                response.HeaderText   = string.Format("{0}: {1}: Select a Title", request.DisplayState.RootGenreTitle, request.DisplayState.SubGenreTitle);
                response.DisplayItems = QuikPixCore.Current.GetTitles(request.DisplayState.SubGenreId);
                break;

            default:
                Beep();
                break;
            }

            e.Result = response;
        }
Exemplo n.º 2
0
        private void UpdateDisplayWorker(object sender, DoWorkEventArgs e)
        {
            var request = e.Argument as DisplayRequest;
            if (request == null)
                throw new InvalidCastException("Unable to cast argument to DisplayRequest.");

            var response = new DisplayResponse();

            switch (request.DisplayState.CurrentState)
            {
                case CurrentStates.RootGenres:
                    request.DisplayState.ClearRootGenre();
                    response.HeaderText = "Select a Genre";
                    response.DisplayItems = QuikPixCore.Current.GetRootGenres();
                    break;
                case CurrentStates.SubGenres:
                    var dataItemA = request.CurrentDisplayItem as GenreDisplayItem;
                    if (request.DisplayAction == DisplayActions.Select && dataItemA != null)
                    {
                        request.DisplayState.RootGenreId = dataItemA.GenreId;
                        request.DisplayState.RootGenreTitle = dataItemA.Title;
                    }
                    request.DisplayState.ClearSubGenre();

                    response.HeaderText = string.Format("{0}: Select a Sub-Genre", request.DisplayState.RootGenreTitle);
                    response.DisplayItems = QuikPixCore.Current.GetSubGenres(request.DisplayState.RootGenreId);
                    break;
                case CurrentStates.Titles:
                    var dataItemB = ItemScroller.CurrentDataItem as GenreDisplayItem;
                    if (request.DisplayAction == DisplayActions.Select && dataItemB != null)
                    {
                        request.DisplayState.SubGenreId = dataItemB.GenreId;
                        request.DisplayState.SubGenreTitle = dataItemB.Title;
                    }
                    request.DisplayState.ClearTitle();

                    response.HeaderText = string.Format("{0}: {1}: Select a Title", request.DisplayState.RootGenreTitle, request.DisplayState.SubGenreTitle);
                    response.DisplayItems = QuikPixCore.Current.GetTitles(request.DisplayState.SubGenreId);
                    break;
                default:
                    Beep();
                    break;
            }

            e.Result = response;
        }