Beispiel #1
0
        private void MessageBus_OnDelivery( Message Mesg )
        {
            ProcConvoy Convoy = Mesg.Payload as ProcConvoy;
            if ( Mesg.Content == "RUN_RESULT"
                && Convoy != null
                && Convoy.Dispatcher == EditTarget )
            {
                BookInstruction TInst = Convoy.Payload as BookInstruction;

                ProcConvoy ProcCon = ProcManager.TracePackage( Convoy, ( P, C ) => P is ProcParameter );
                if ( ProcCon != null )
                {
                    ProcParameter PPClone = new ProcParameter();
                    PPClone.ReadParam( ProcCon.Dispatcher.ToXParam() );
                    ProcCon = new ProcConvoy( PPClone, null );
                }

                TInst.PackVolumes( ProcCon );

                Preview.Navigate(
                    typeof( TableOfContents )
                    , new Tuple<Volume[], SelectionChangedEventHandler>( TInst.GetVolumes(), PreviewContent )
                );
                Preview.BackStack.Clear();
                TestRunning.IsActive = false;
            }
        }
Beispiel #2
0
        private void MessageBus_OnDelivery( Message Mesg )
        {
            ProcConvoy Convoy = Mesg.Payload as ProcConvoy;
            if ( Mesg.Content == "RUN_RESULT"
                && Convoy != null
                && Convoy.Dispatcher == EditTarget )
            {
                TestRunning.IsActive = false;

                BookInstruction BookInst = Convoy.Payload as BookInstruction;
                if( BookInst != null )
                {
                    var j = ViewTestResult( BookInst );
                }
            }
        }
Beispiel #3
0
 public static void Send( Message Mesg )
 {
     Task.Run( () => { DoDelivery?.Invoke( Mesg ); } );
 }
Beispiel #4
0
 public static void SendUI( Message Mesg )
 {
     Helpers.Worker.UIInvoke( () => { DoDelivery?.Invoke( Mesg ); } );
 }
        private async void MessageBus_OnDelivery( Message Mesg )
        {
            if ( Mesg.TargetType != GetType() ) return;

            // Procedure Run
            if( Mesg.Content == "RUN" )
            {
                if ( Running ) return;
                PM.ActiveRange( 0, PM.ProcList.IndexOf( Mesg.Payload as Procedure ) + 1 );
                ProcRun( true );
            }

            // Goto SubProcedures Edit
            else if ( Mesg.Payload is ISubProcedure )
            {
                Procedure P = Mesg.Payload as Procedure;
                if ( PM.ProcList.Contains( P ) )
                {
                    await Dispatcher.RunIdleAsync( x => SubEdit( P ) );
                }
            }

            // Append Logs
            else if ( Mesg.Payload is PanelLog )
            {
                PanelLog PLog = ( PanelLog ) Mesg.Payload;
                PanelLogItem( PLog.ID, Mesg.Content, PLog.LogType );
            }
        }
        private void MessageBus_OnDelivery( Message Mesg )
        {
            ProcConvoy Convoy = Mesg.Payload as ProcConvoy;
            if ( Mesg.Content == "RUN_RESULT"
                && Convoy != null
                && Convoy.Dispatcher == EditTarget )
            {
                TestRunning.IsActive = false;

                Convoy = ProcManager.TracePackage( Convoy, ( P, C ) => Convoy.Payload is IEnumerable<BookInstruction> );

                if ( Convoy == null )
                {
                    throw new Exception( "Unable to find the generated book convoy" );
                }
                else
                {
                    var j = ViewTestResult( ( IEnumerable<BookInstruction> ) Convoy.Payload );
                }
            }
        }
        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;
            }
        }