示例#1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="container">Dependency injection container</param>
        public VMExplorePage(IContainer container, Page page)
        {
            Container  = container;
            Page       = page;
            Me         = Container.Resolve <ICharacterService>().GetCharacter();
            VMLocation = new VMLocation(Container, Me.Id);
            VMLocation.OnItemSelected += SelectItem;
            Inventory = new VMInventory(Container);
            Container.Resolve <IImageService>()
            .ReadAsync(new List <Guid>()
            {
                new Guid("a15e4ade-5fbe-4eb1-9d62-f1c1e67a207b")
            })
            .ContinueWith((task) =>
            {
                var image       = task.Result?.FirstOrDefault();
                BackgroundImage = image;
            });
            if (Me.ChildrenIds.Count() > 0)
            {
                Container.Resolve <IMessageService>().SendRequestAsync <CoreReadItemCrudResponse>(new CoreReadItemCrudRequest()
                {
                    ItemIds = Me.ChildrenIds
                }).ContinueWith(messageTask =>
                {
                    Inventory.Add(messageTask.Result.CoreReadItemCrudEvent.Items);
                });
            }
            MessageService = Container.Resolve <IMessageService>();
            IsAdmin        = Me.GetData <AccountData>().Admin;
            VMEmotes       = new VMEmotes(Container);
            var GameService = container.Resolve <IGameService>();

            GameService.OnMessage      += OnMessage;
            GameService.OnMessage      += VMLocation.OnMessage;
            LocationItemTable_OnClicked = new Xamarin.Forms.Command((object itemTableControl) =>
            {
                var control = (ItemTableControl)itemTableControl;
                SelectItem(control?.SelectedItem);
//                control.SetHighlight(SelectedItem);
            });
            ItemDescriptions_ItemOnCommand = new Xamarin.Forms.Command((object itemCommand) =>
            {
                OnItemCommand((ItemCommand)itemCommand);
            });
            ItemDescriptions_ItemOnSelect = new Xamarin.Forms.Command((object itemDescriptionsControl) =>
            {
                var control = (BotItemDescriptionsControl)itemDescriptionsControl;
                SelectItem((control.ItemSelectedLastStatus) ? control.ItemSelectedLast : null);
            });
            VMAdminPicker = new VMAdminPicker(Container, page, VMLocation);
            MessageService.SendRequestAsync <WorldReadLocationSummaryResponse>(new WorldReadLocationSummaryRequest()
            {
            });
        }
 /// <summary>
 /// Constructor
 /// </summary>
 public VMAdminPicker(IContainer container, Page page, VMLocation vmLocation)
 {
     Container      = container;
     MessageService = container.Resolve <IMessageService>();
     Page           = page;
     VMLocation     = vmLocation;
     Source         = new List <string>()
     {
         "Edit Location",
         "Create Location",
         "Create Item"
     };
 }