wenku10.Pages.Sharers.ScriptDetails.OpenCommentStack C# (CSharp) Method

OpenCommentStack() public method

public OpenCommentStack ( string CommId ) : void
CommId string
return void
        public async void OpenCommentStack( string CommId )
        {
            CommInit = true;

            DisplayControls( CommentControls );

            SimpleStory.DoubleAnimation(
                CommentStory, CommentSection
                , "(UIElement.RenderTransform).(TranslateTransform.Y)"
                , 0.25 * LayoutSettings.ScreenHeight, 0
            );

            SimpleStory.DoubleAnimation( CommentStory, CommentSection, "Opacity", 0, 1 );

            CommentSection.Visibility = Visibility.Visible;

            bool LoadFirst = true;
            Func<SHTarget, int, uint, string[], PostData> StackRequest = ( a, b, c, Ids ) =>
            {
                if ( LoadFirst )
                {
                    LoadFirst = false;
                    return Shared.ShRequest.GetCommentStack( Ids[ 0 ] );
                }

                return Shared.ShRequest.GetComments( a, b, c, Ids );
            };

            HSLoader<HSComment> CLoader = new HSLoader<HSComment>( CommId, SHTarget.COMMENT, StackRequest )
            {
                ConvertResult = ( x ) => x.Flattern( y => y.Replies )
            };

            IEnumerable<HSComment> FirstPage = await CLoader.NextPage();

            CommentsSource = new Observables<HSComment, HSComment>( FirstPage.ToArray() );

            CommentsSource.LoadStart += ( x, y ) => MarkLoading();
            CommentsSource.LoadEnd += ( x, y ) => MarkNotLoading();

            CommentsSource.ConnectLoader( CLoader );
            CommentList.ItemsSource = CommentsSource;

            CommentStory.Begin();
        }

Usage Example

Exemplo n.º 1
0
        private async void MessageBus_OnDelivery( Message Mesg )
        {
            switch ( Mesg.Content )
            {
                case AppKeys.SH_SCRIPT_DATA:
                    HubScriptItem HSI = ( HubScriptItem ) Mesg.Payload;

                    if ( ( HSI.Scope & SpiderScope.ZONE ) != 0 )
                    {
                        MainHub.ScrollToSection( ZoneListView );
                        PopupFrame.Content = null;
                        await ZoneListContext.OpenFile( HSI.ScriptFile );
                        break;
                    }

                    if ( await FileListContext.OpenSpider( HSI.ScriptFile ) )
                    {
                        ConfirmScriptParse( HSI );
                    }
                    else
                    {
                        ConfirmErrorReport( HSI.Id, StatusType.HS_INVALID );
                    }
                    break;

                case AppKeys.HS_DECRYPT_FAIL:
                    StringResources stx = new StringResources( "Message", "ContextMenu" );
                    MessageDialog MsgBox = new MessageDialog( stx.Str( "Desc_DecryptionFailed" ), stx.Str( "DecryptionFailed" ) );

                    HSI = ( HubScriptItem ) Mesg.Payload;
                    bool Place = false;

                    MsgBox.Commands.Add( new UICommand( stx.Text( "PlaceRequest", "ContextMenu" ), ( x ) => { Place = true; } ) );
                    MsgBox.Commands.Add( new UICommand( stx.Str( "OK" ) ) );

                    await Popups.ShowDialog( MsgBox );

                    if ( Place ) TransferRequest( SHTarget.KEY, HSI );
                    break;

                case AppKeys.HS_DETAIL_VIEW:
                    PopupFrame.Content = new Sharers.ScriptDetails( ( HubScriptItem ) Mesg.Payload );
                    break;

                case AppKeys.HS_OPEN_COMMENT:
                    InboxMessage BoxMessage = ( InboxMessage ) Mesg.Payload;
                    Sharers.ScriptDetails SSDetails = new Sharers.ScriptDetails( BoxMessage.HubScript );
                    PopupFrame.Content = SSDetails;
                    SSDetails.OpenCommentStack( BoxMessage.CommId );
                    break;

                case AppKeys.SH_SHOW_GRANTS:
                    Sharers.ManageAuth ManageAuth = new Sharers.ManageAuth( SHHub, PopupFrame );
                    PopupFrame.Content = ManageAuth;

                    ManageAuth.GotoRequests();
                    break;

                case AppKeys.SH_SCRIPT_REMOVE:
                    Tuple<string, HubScriptItem> RemoveInst = ( Tuple<string, HubScriptItem> ) Mesg.Payload;
                    if ( await SHHub.Remove( RemoveInst.Item2, RemoveInst.Item1 ) )
                    {
                        PopupFrame.Content = null;
                    }
                    break;

                case AppKeys.HS_NO_VOLDATA:
                    ConfirmErrorReport( ( ( BookInstruction ) Mesg.Payload ).Id, StatusType.HS_NO_VOLDATA );
                    break;

                case AppKeys.HS_MOVED:
                    Tuple<string, SpiderBook> Payload = ( Tuple<string, SpiderBook> ) Mesg.Payload;

                    LocalBook OBook = FileListContext.GetById( Payload.Item1 );
                    OBook?.RemoveSource();

                    FileListContext.Add( Payload.Item2 );
                    FileListContext.CleanUp();
                    break;
            }
        }