示例#1
0
    public Source(INavigableData data, bool preview)
    {
        _data    = data;
        _preview = preview;

        IEnumerable <IPublishedContent> contentAtRoot = data.GetAtRoot(preview);

        _root = new RootContent(contentAtRoot.Select(x => x.Id));
    }
        ///<summary>
        ///Set campaign content
        ///</summary>
        internal async Task <dynamic> SetCampaignContentAsync(string campaign_id, ContentTemplate contentTemplate)
        {
            string endpoint = Authenticate.EndPoint(TargetTypes.campaigns, SubTargetType.content, SubTargetType.not_applicable, campaign_id);

            RootContent content = new RootContent()
            {
                template = contentTemplate,
            };

            return(await BaseOperation.PutAsync <RootContent>(endpoint, content));
        }
        //Handle the close button clicked event
        private async void CloseButton_Clicked(object sender, EventArgs e)
        {
            await RootContent.FadeTo(0, 125); //Makes the RootContent of the current page fade out in 125 ms

            await Finder.TranslateTo(0, 400, 200);

            Current.FV.Children[0] = new MainView(); //Changes the value of the grid FV to the new MainView page

            Current.UpdateCamera = true;
            Position LocationUser = new Position(Current.CU.Latitude, Current.CU.Longitude);
            await Current.CustomMap.AnimateCamera(CameraUpdateFactory.NewPositionZoom(LocationUser, 17.5), TimeSpan.FromSeconds(2.5));
        }
        private async void CloseButton_Clicked(object sender, EventArgs e)
        {
            await RootContent.FadeTo(0, 125); //Makes the RootContent of the current page fade out in 125 ms

            await Finder.TranslateTo(0, 400, 200);

            Current.FV.Children[0] = new RouteView();                                                                                  //Changes the value of the grid FV to the new RouteView page

            Current.UpdateCamera = false;                                                                                              //Prevents the camera from updating when the postion changes
            Position LocationUser = new Position(Current.SelectedItem.Latitude, Current.SelectedItem.Longitude);
            await Current.CustomMap.AnimateCamera(CameraUpdateFactory.NewPositionZoom(LocationUser, 17.5), TimeSpan.FromSeconds(2.5)); //Animate the camera of the map to the selected position with a zoom of 17.5 and in a timespan of 2.5 seconds
        }
        ///<summary>
        ///Set campaign content
        ///</summary>
        internal async Task <dynamic> SetCampaignContentAsync(string campaign_id, ContentSetting setting)
        {
            string endpoint = Authenticate.EndPoint(TargetTypes.campaigns, SubTargetType.content, SubTargetType.not_applicable, campaign_id);

            RootContent content = new RootContent()
            {
                plain_text = setting.plain_text,
                html       = setting.html,
                url        = setting.url
            };

            return(await BaseOperation.PutAsync <RootContent>(endpoint, content));
        }