Exemplo n.º 1
0
 public ZSDisplayData(ZoneSpider ZS)
 {
     this.ZS = ZS;
 }
Exemplo n.º 2
0
 public ZSViewSource(string Name, ZoneSpider ZS)
     : base(Name)
 {
     DataSourceType = typeof(ZSDisplayData);
     this.ZS        = ZS;
 }
Exemplo n.º 3
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)
                {
                    ControlFrame.Instance.NavigateTo(
                        PageId.MASTER_EXPLORER, () => new MasterExplorer()
                        //  Open ZoneSpider Manager
                        , P => (( MasterExplorer )P).NavigateToDataSource(
                            typeof(ZSMDisplayData)
                            , async(ZSVS) =>
                    {
                        // Using the manager, import this script
                        ZSMDisplayData DisplayData = (( ZSManagerVS )ZSVS).ZSMData;
                        if (await DisplayData.OpenFile(HSI.ScriptFile))
                        {
                            // Open the imported script
                            ZoneSpider ZSpider = DisplayData.ZSTable.Items.Select(x => ( ZoneSpider )x.Source).FirstOrDefault(x => x.ZoneId == HSI.Id);
                            (( MasterExplorer )P).NavigateToZone(ZSpider);
                        }
                    }
                            ));
                    break;
                }

                // This will save the book
                SpiderBook SBook = await SpiderBook.ImportFile(await HSI.ScriptFile.ReadString(), true);

                if (SBook.CanProcess)
                {
                    ConfirmScriptParse(SBook);
                }
                else
                {
                    ConfirmErrorReport(HSI.Id, StatusType.HS_INVALID);
                }
                break;

            case AppKeys.HS_DECRYPT_FAIL:
                StringResources stx = StringResources.Load("Message", "ContextMenu");

                bool Place = false;

                await Popups.ShowDialog(UIAliases.CreateDialog(
                                            stx.Str("Desc_DecryptionFailed"), stx.Str("DecryptionFailed")
                                            , () => Place = true
                                            , stx.Text("PlaceRequest", "ContextMenu"), stx.Str("OK")
                                            ));

                if (Place)
                {
                    HSI = ( HubScriptItem )Mesg.Payload;
                    TransferRequest(SHTarget.KEY, HSI);
                }

                break;

            case AppKeys.HS_OPEN_COMMENT:
                InboxMessage BoxMessage = ( InboxMessage )Mesg.Payload;
                ControlFrame.Instance.NavigateTo(PageId.SCRIPT_DETAILS
                                                 , () => new ScriptDetails(BoxMessage.HubScript)
                                                 , P => (( ScriptDetails )P).OpenCommentStack(BoxMessage.CommId)
                                                 );
                break;

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

            case AppKeys.EX_DEATHBLOW:
                stx = StringResources.Load("Message", "ContextMenu");

                bool UseDeathblow = false;

                await Popups.ShowDialog(UIAliases.CreateDialog(
                                            stx.Str("ConfirmDeathblow")
                                            , () => UseDeathblow = true
                                            , stx.Str("Yes"), stx.Str("No")
                                            ));

                if (UseDeathblow)
                {
                    IDeathblow Deathblow = ( IDeathblow )Mesg.Payload;
                    ControlFrame.Instance.NavigateTo(PageId.W_DEATHBLOW, () => new WDeathblow(Deathblow), P => (( WDeathblow )P).Blow());
                }

                break;

            case AppKeys.PM_CHECK_TILES:
                CheckTiles();
                break;

            case AppKeys.OPEN_VIEWSOURCE:
                ControlFrame.Instance.NavigateTo(PageId.MASTER_EXPLORER, () => new MasterExplorer(), P => (( MasterExplorer )P).NavigateToViewSource(( GRViewSource )Mesg.Payload));
                break;

            case AppKeys.OPEN_ZONE:
                ControlFrame.Instance.NavigateTo(PageId.MASTER_EXPLORER, () => new MasterExplorer(), P => (( MasterExplorer )P).NavigateToZone(( ZoneSpider )Mesg.Payload));
                break;

            case AppKeys.PROMPT_LOGIN:
                (IMember Member, Action DialogClosed) = (Tuple <IMember, Action>)Mesg.Payload;
                if (!Member.IsLoggedIn)
                {
                    Login LoginDialog = new Login(Member);
                    await Popups.ShowDialog(LoginDialog);
                }
                DialogClosed();
                break;
            }
        }