// GET: PlaceType
        public ActionResult Index()
        {
            var model = new PlaceType();
            var vm    = model.GetAllPlaceTypes();

            return(View("PlaceTypes", vm));
        }
        public ResultJSON <string> ApplyBeMyClient(string carNo, int id, PlaceType placeType)
        {
            try
            {
                string accessToken;
                if (placeType == PlaceType.水上)
                {
                    accessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.水上计划Secret);
                }
                else
                {
                    accessToken = AccessTokenContainer.TryGetToken(this.option.CorpId, this.option.陆上计划Secret);
                }
                string agentId = placeType == PlaceType.水上 ? option.水上计划AgentId : option.陆上计划AgentId;

                //推送到“水上或陆上计划”
                MassApi.SendTextCard(accessToken, agentId, $"{UserName}申请{carNo}成为他的客户"
                                     , $"<div class=\"gray\">客户:{carNo}</div>"
                                     , $"https://vue.car0774.com/#/sales/myclient/{id.ToString()}/{UserName}", toUser: "******");

                return(new ResultJSON <string> {
                    Code = 0, Msg = "提交申请成功"
                });
            }
            catch
            {
                return(new ResultJSON <string> {
                    Code = 503, Msg = "推送失败请重试"
                });
            }
        }
Beispiel #3
0
        public static string From(PlaceType type)
        {
            List <char> letters = new List <char>();
            var         name    = type.ToString();

            for (int i = 0; i < name.Length; i++)
            {
                char letter = name[i];

                if (char.IsUpper(letter))
                {
                    if (i != 0)
                    {
                        letters.Add('_');
                    }
                    letters.Add(Char.ToLower(letter));
                }
                else
                {
                    letters.Add(letter);
                }
            }

            return(new string(letters.ToArray()));
        }
Beispiel #4
0
        /// <summary>
        /// Valida que un objeto PlaceType cumpla con los filtros actuales
        /// </summary>
        /// <param name="placeType">Objeto a validar</param>
        /// <returns>Truw. SI cumple | False. No cumple</returns>
        /// <history>
        /// [emoguel] created 11/04/2016
        /// </history>
        private bool ValidateFilter(PlaceType placeType)
        {
            if (_nStatus != -1)//Filtro por estatus
            {
                if (placeType.pyA != Convert.ToBoolean(_nStatus))
                {
                    return(false);
                }
            }

            if (!string.IsNullOrWhiteSpace(_placeTypeFIlter.pyID))//Filtro por ID
            {
                if (_placeTypeFIlter.pyID != placeType.pyID)
                {
                    return(false);
                }
            }

            if (!string.IsNullOrWhiteSpace(_placeTypeFIlter.pyN))//filtro por estatus
            {
                if (!placeType.pyN.Contains(_placeTypeFIlter.pyN, StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
            }
            return(true);
        }
 public Place(string name, int capacity, PlaceType type)
 {
     this.Name = name;
     this.Capacity = capacity;
     this.Type = type;
     this.units = new List<IBattleUnit>(capacity);
 }
Beispiel #6
0
        /// <summary>
        /// Muestra la ventana detalle
        /// </summary>
        /// <history>
        /// [emoguel] 11/04/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            PlaceType          placeType          = (PlaceType)dgrPlaceTypes.SelectedItem;
            frmPlaceTypeDetail frmPlaceTypeDetail = new frmPlaceTypeDetail();

            frmPlaceTypeDetail.Owner        = this;
            frmPlaceTypeDetail.enumMode     = EnumMode.Edit;
            frmPlaceTypeDetail.oldPlaceType = placeType;
            if (frmPlaceTypeDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <PlaceType> lstPlaceTypes = (List <PlaceType>)dgrPlaceTypes.ItemsSource;
                if (ValidateFilter(frmPlaceTypeDetail.placeType))                         //Verificar si cumple con los filtros
                {
                    ObjectHelper.CopyProperties(placeType, frmPlaceTypeDetail.placeType); //Actualizamos los datos del registro
                    lstPlaceTypes.Sort((x, y) => string.Compare(x.pyN, y.pyN));           //ornedamos los registros
                    nIndex = lstPlaceTypes.IndexOf(placeType);                            //Buscamos la posicion del registro
                }
                else
                {
                    lstPlaceTypes.Remove(frmPlaceTypeDetail.placeType);
                }
                dgrPlaceTypes.Items.Refresh();               //Actualizamos la vista
                GridHelper.SelectRow(dgrPlaceTypes, nIndex); //Seleccionamos el registros
                StatusBarReg.Content = lstPlaceTypes.Count + " Place Types.";
            }
        }
Beispiel #7
0
        public IActionResult NewNonNetworkItem(string placeId, PlaceType placeType,
                                               string name, string type, int count)
        {
            NonNetworkItem item;

            if (placeType == PlaceType.Room)
            {
                item = new NonNetworkRoomItem {
                    Type = Enum.Parse <NonNetworkRoomItem.NonNetworkRoomItemType>(type)
                }
            }
            ;
            else if (placeType == PlaceType.Rack)
            {
                item = new NonNetworkRackItem {
                    Type = Enum.Parse <NonNetworkRackItem.NonNetworkRackItemType>(type)
                }
            }
            ;
            else
            {
                throw new NotImplementedException();
            }

            item.Place = placeId;
            item.Name  = name;
            item.Count = count;

            db.Save(item);
            return(RedirectToAction(nameof(Item), new { type = placeType.ToString(), id = placeId.ToString() }));
        }
        // One option for configuring - but can also pass to constructor!
        //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        //{
        //    optionsBuilder.UseSqlServer("connectionString");

        //    base.OnConfiguring(optionsBuilder);
        //}

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            var city = new PlaceType {
                Id = 1, Name = "City"
            };
            var town = new PlaceType {
                Id = 2, Name = "Town"
            };
            var village = new PlaceType {
                Id = 3, Name = "Village"
            };

            modelBuilder.Entity <PlaceType>().HasData(city, town, village);

            modelBuilder.Entity <Place>().HasData(
                new Place {
                Id = 1, Name = "London", TypeId = city.Id
            },
                new Place {
                Id = 2, Name = "Aberdeen", TypeId = city.Id
            },
                new Place {
                Id = 3, Name = "Barnsley", TypeId = town.Id
            },
                new Place {
                Id = 4, Name = "Barking", TypeId = town.Id
            },
                new Place {
                Id = 5, Name = "Carlisle", TypeId = city.Id
            }
                );
        }
Beispiel #9
0
        /// <summary>
        /// Obtiene registros del catalogo PlaceTypes
        /// </summary>
        /// <param name="nStatus">-1. Todos | 0. Inactivos | 1. Activos</param>
        /// <param name="placeType">objeto con filtros adicionales</param>
        /// <returns>Lista de tipo Playce Type</returns>
        /// <history>
        /// [emoguel] created 11/04/2016
        /// </history>
        public async static Task <List <PlaceType> > GetPlaceTypes(int nStatus = -1, PlaceType placeType = null)
        {
            return(await Task.Run(() =>
            {
                using (var dbContext = new IMEntities(ConnectionHelper.ConnectionString()))
                {
                    var query = from py in dbContext.PlaceTypes
                                select py;

                    if (nStatus != -1)//Filtro por estatus
                    {
                        bool blnStatus = Convert.ToBoolean(nStatus);
                        query = query.Where(py => py.pyA == blnStatus);
                    }

                    if (placeType != null)                              //verificamos si se tiene un objeto
                    {
                        if (!string.IsNullOrWhiteSpace(placeType.pyID)) //filtro por ID
                        {
                            query = query.Where(py => py.pyID == placeType.pyID);
                        }

                        if (!string.IsNullOrWhiteSpace(placeType.pyN))//Filtro por descripción
                        {
                            query = query.Where(py => py.pyN.Contains(placeType.pyN));
                        }
                    }

                    return query.OrderBy(py => py.pyN).ToList();
                }
            }));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PlaceTypeID,Name")] PlaceType placeType)
        {
            if (id != placeType.PlaceTypeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(placeType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlaceTypeExists(placeType.PlaceTypeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(placeType));
        }
        public void SetPlaceType(PlaceType placeType)
        {
            switch (placeType)
            {
            case PlaceType.All:
                CustomPlaceType = "";
                break;

            case PlaceType.Geocode:
                CustomPlaceType = "geocode";
                break;

            case PlaceType.Address:
                CustomPlaceType = "address";
                break;

            case PlaceType.Establishment:
                CustomPlaceType = "establishment";
                break;

            case PlaceType.Regions:
                CustomPlaceType = "(regions)";
                break;

            case PlaceType.Cities:
                CustomPlaceType = "(cities)";
                break;
            }
        }
Beispiel #12
0
 public void SetPlaceInfo(int wmId, PlaceType type, bool isRandomPlace, string placeName)
 {
     this.WmId          = wmId;
     this.Type          = type;
     this.IsRandomPlace = isRandomPlace;
     this.PlaceName     = placeName;
 }
Beispiel #13
0
            private bool BeyondOccupationLimit
            (
                ref SetPlaceOwnerEvent c0,
                PlaceType placeType,
                int limit)
            {
                var occupations    = MyOwnPlaces[c0.OwnerEntity];
                var samePlaceCount = 0;

                foreach (var occupation in occupations)
                {
                    if (occupation.Type == placeType)
                    {
                        samePlaceCount++;
                    }
                }

                if (samePlaceCount < limit)
                {
                    return(false);
                }
                // Send Warning Event later?
                Debug.Log($"Beyond the {placeType} occupation limit! Limit is {limit}");
                return(true);
            }
Beispiel #14
0
        private void GeneratePlaces(PlaceType baseType)
        {
            uint      numberOfPlaceToGenerate = GetNumberOfPlace(baseType);
            uint      minDist   = GetMinDistToLimit(baseType);
            uint      minGap    = GetMinGap(baseType);
            BiomeType biomeType = GetBiomeTypeAccordingTo(baseType);

            List <Chunk> foundedChunks = biomeManager.GetChunkFromMinDistance(biomeType, (int)minDist);

            while (numberOfPlaceToGenerate > 0 && foundedChunks.Count > 0)
            {
                // find the chunk
                int   randomIndex = randomGenerator.Next(foundedChunks.Count - 1);
                Chunk chunk       = foundedChunks[randomIndex];

                // create the base
                Place newPlace = InstantiatePlace(baseType);
                newPlace.Construct(chunk.GetCoords());
                newPlace.transform.position = chunk.transform.position;
                _basesPerType[baseType].Add(newPlace);

                // remove the tile and the other at the min dist
                foundedChunks.RemoveAt(randomIndex);
                RemoveChunks(ref foundedChunks, chunk, (int)minGap);
                numberOfPlaceToGenerate--;
            }
        }
Beispiel #15
0
        /// <summary>
        /// Returns a string representation of the specified place type.
        /// </summary>
        /// <returns>The type value.</returns>
        /// <param name="type">Type.</param>
        string PlaceTypeValue(PlaceType type)
        {
            switch (type)
            {
            case PlaceType.All:
                return("");

            case PlaceType.Geocode:
                return("geocode");

            case PlaceType.Address:
                return("address");

            case PlaceType.Establishment:
                return("establishment");

            case PlaceType.Regions:
                return("(regions)");

            case PlaceType.Cities:
                return("(cities)");

            default:
                return("");
            }
        }
        /// <summary>
        /// Converts a location type name into something more readable.
        /// </summary>
        public static void ConvertPlaceType(this HtmlHelper htmlHelper, PlaceType placeType)
        {
            switch (placeType)
            {
            case PlaceType.Country:
                htmlHelper.ViewContext.Writer.Write("Country");
                break;

            case PlaceType.AdministrativeAreaLevel1:
                htmlHelper.ViewContext.Writer.Write("State");
                break;

            case PlaceType.AdministrativeAreaLevel2:
                htmlHelper.ViewContext.Writer.Write("City / County");
                break;

            case PlaceType.Route:
                htmlHelper.ViewContext.Writer.Write("Road");
                break;

            default:
                htmlHelper.ViewContext.Writer.Write(placeType.ToString());
                break;
            }
        }
 public PlaceSettings()
 {
     Type         = PlaceType.Unknown;
     Color        = Color.white;
     FontSize     = 16;
     OutlineColor = Color.black;
 }
Beispiel #18
0
        //determine the random placetype based on available options
        public PlaceType determineOrbitalPlaceType(Random rando, GridTile.GridTerrain gridTerrain)
        {
            List <PlaceType> possiblePlaceTypes = new List <PlaceType>();

            possiblePlaceTypes.AddRange(new PlaceType[] { PlaceType.Graveyard, PlaceType.Cave, PlaceType.Encampment, PlaceType.Ruins, PlaceType.Farm });

            //check for terrain specific possibilities
            if (gridTerrain == GridTile.GridTerrain.Beach)
            {
            }
            else if (gridTerrain == GridTile.GridTerrain.Forest)
            {
            }
            else if (gridTerrain == GridTile.GridTerrain.Hills)
            {
            }
            else if (gridTerrain == GridTile.GridTerrain.Grass)
            {
            }


            PlaceType thisType = possiblePlaceTypes[rando.Next(0, possiblePlaceTypes.Count)];

            return(thisType);
        }
Beispiel #19
0
        private int CountStabilizedOccupiedSeats(Func <PlaceType[, ], int, int, int, int, IEnumerable <PlaceType> > seatsSelector, int minOccupiedSeatsNumberToMakeEmpty)
        {
            var(grid, width, height) = InputData.GetInputGrid <PlaceType>();

            while (true)
            {
                var newGrid = new PlaceType[width, height];

                for (var x = 0; x < width; x++)
                {
                    for (var y = 0; y < height; y++)
                    {
                        newGrid[x, y] = grid[x, y] switch
                        {
                            PlaceType.EmptySeat => seatsSelector(grid, width, height, x, y).All(p => p != PlaceType.OccupiedSeat)
                                ? PlaceType.OccupiedSeat
                                : PlaceType.EmptySeat,
                            PlaceType.OccupiedSeat => seatsSelector(grid, width, height, x, y).CountValue(PlaceType.OccupiedSeat) >= minOccupiedSeatsNumberToMakeEmpty
                                ? PlaceType.EmptySeat
                                : PlaceType.OccupiedSeat,
                            _ => PlaceType.Floor
                        };
                    }
                }

                if (newGrid.OfType <PlaceType>().SequenceEqual(grid.OfType <PlaceType>()))
                {
                    return(grid.OfType <PlaceType>().CountValue(PlaceType.OccupiedSeat));
                }

                grid = newGrid;
            }
        }
        public ActionResult DeleteConfirmed(long id)
        {
            PlaceType placeType = db.PlaceTypes.Find(id);

            db.PlaceTypes.Remove(placeType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #21
0
 // Constructor.
 internal Place(string name,
                string state,
                TerraServerReference.PlaceType placeType)
 {
     Name      = name;
     State     = state;
     PlaceType = (PlaceType)placeType;
 }
        public void DownloadAsync(string keyword, PlaceType type, object userArgs)
        {
            PlacesDownloadSettings settings = (PlacesDownloadSettings)this.Settings.Clone();

            settings.Collection = "places";
            settings.Query      = this.KeywordQuery(keyword, type);
            base.DownloadAsync(settings, userArgs);
        }
Beispiel #23
0
        public UserSettings UpdateUserSettingsDefaultSearchPlaceType(Guid userID, PlaceType placeType)
        {
            UserSettingsDA da       = new UserSettingsDA();
            UserSettings   settings = da.GetByID(userID);

            settings.PartnerSearchPlaceType = placeType;
            return(da.Update(settings));
        }
Beispiel #24
0
 // Constructor.
 internal Place(string name,
                 string state,
                 TerraServerReference.PlaceType placeType)
 {
     Name = name;
     State = state;
     PlaceType = (PlaceType)placeType;
 }
        public void DownloadChildrenAsync(long woeid, PlaceType type, object userArgs)
        {
            PlacesDownloadSettings settings = (PlacesDownloadSettings)this.Settings.Clone();

            settings.Collection = "place/";
            settings.Query      = woeid.ToString() + "/children.type(" + Convert.ToInt32(type).ToString() + ")";
            base.DownloadAsync(settings, userArgs);
        }
Beispiel #26
0
 // Constructor.
 internal Place(string name,
                string state,
                PlaceType placeType)
 {
     Name      = name;
     State     = state;
     PlaceType = placeType;
 }
Beispiel #27
0
 public Place(DirectoryInfo rootDirectory, long availableFreeSpace, PlaceType placeType, string volumeLabel, int percentFilled)
 {
     this.AvailableFreeSpace = availableFreeSpace;
     this.PlaceType          = placeType;
     this.VolumeLabel        = volumeLabel;
     this.Path          = rootDirectory.FullName;
     this.PercentFilled = percentFilled;
 }
 // Constructor.
 internal Place(string name,
                string state,
                PlaceType placeType)  //XXX: supposed to be from a imported type
 {
     Name      = name;
     State     = state;
     PlaceType = (PlaceType)placeType;
 }
        /// <summary>
        /// Return a list of the top 100 unique places clustered by a given placetype for set of tags or machine tags.
        /// </summary>
        /// <param name="placeType">The ID for a specific place type to cluster photos by. </param>
        /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters. </param>
        /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. </param>
        /// <param name="threshold">The minimum number of photos that a place type must have to be included.
        /// If the number of photos is lowered then the parent place type for that place will be used.</param>
        /// <param name="tags">A list of tags. Photos with one or more of the tags listed will be returned.</param>
        /// <param name="tagMode">Either 'any' for an OR combination of tags, or 'all' for an AND combination.
        /// Defaults to 'any' if not specified.</param>
        /// <param name="machineTags"></param>
        /// <param name="machineTagMode"></param>
        /// <param name="minUploadDate">Minimum upload date.</param>
        /// <param name="maxUploadDate">Maximum upload date.</param>
        /// <param name="minTakenDate">Minimum taken date.</param>
        /// <param name="maxTakenDate">Maximum taken date.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PlacesPlacesForTagsAsync(PlaceType placeType, string woeId, string placeId, int threshold,
                                             string[] tags, TagMode tagMode, string[] machineTags,
                                             MachineTagMode machineTagMode, DateTime minUploadDate,
                                             DateTime maxUploadDate, DateTime minTakenDate, DateTime maxTakenDate,
                                             Action <FlickrResult <PlaceCollection> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.places.placesForTags");

            parameters.Add("place_type_id", placeType.ToString("D"));
            if (!String.IsNullOrEmpty(woeId))
            {
                parameters.Add("woe_id", woeId);
            }
            if (!String.IsNullOrEmpty(placeId))
            {
                parameters.Add("place_id", placeId);
            }
            if (threshold > 0)
            {
                parameters.Add("threshold", threshold.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (tags != null && tags.Length > 0)
            {
                parameters.Add("tags", String.Join(",", tags));
            }
            if (tagMode != TagMode.None)
            {
                parameters.Add("tag_mode", UtilityMethods.TagModeToString(tagMode));
            }
            if (machineTags != null && machineTags.Length > 0)
            {
                parameters.Add("machine_tags", String.Join(",", machineTags));
            }
            if (machineTagMode != MachineTagMode.None)
            {
                parameters.Add("machine_tag_mode", UtilityMethods.MachineTagModeToString(machineTagMode));
            }
            if (minTakenDate != DateTime.MinValue)
            {
                parameters.Add("min_taken_date", UtilityMethods.DateToMySql(minTakenDate));
            }
            if (maxTakenDate != DateTime.MinValue)
            {
                parameters.Add("max_taken_date", UtilityMethods.DateToMySql(maxTakenDate));
            }
            if (minUploadDate != DateTime.MinValue)
            {
                parameters.Add("min_upload_date", UtilityMethods.DateToUnixTimestamp(minUploadDate));
            }
            if (maxUploadDate != DateTime.MinValue)
            {
                parameters.Add("max_upload_date", UtilityMethods.DateToUnixTimestamp(maxUploadDate));
            }

            GetResponseAsync <PlaceCollection>(parameters, callback);
        }
Beispiel #30
0
        /// <summary>
        /// Gets filename associated with PlaceType value.
        /// </summary>
        /// <param name="value">Type of place.</param>
        /// <returns>Filename associated with PlaceType value.</returns>
        public static string GetFilename(this PlaceType value)
        {
            if (!(GetPlaceDescriptionAttribute(value) is PlaceTypeDescriptionAttribute placeAttribute))
            {
                return(null);
            }

            return(placeAttribute.Filename);
        }
Beispiel #31
0
        private Place InstantiatePlace(PlaceType baseType)
        {
            Place baseResult = Instantiate <Place>(basePrefab);

            baseResult.transform.parent = gameObject.transform;
            baseResult.name             = baseType.ToString();

            return(baseResult);
        }
Beispiel #32
0
 // Constructor.
 internal Place(string name,
     string state,
     //LinqToTerraServerProvider.TerraServerReference.PlaceType placeType)
     PlaceType placeType)
 {
     Name = name;
     State = state;
     PlaceType = (PlaceType)placeType;
 }
Beispiel #33
0
        /// <summary>
        /// Gets category id associated with PlaceType value.
        /// </summary>
        /// <param name="value">Type of place.</param>
        /// <returns>Category id associated with PlaceType value.</returns>
        public static string GetPlaceCategoryId(this PlaceType value)
        {
            if (!(GetPlaceDescriptionAttribute(value) is PlaceTypeDescriptionAttribute placeAttribute))
            {
                return(null);
            }

            return(placeAttribute.PlaceCategoryId);
        }
        public void TestCrud()
        {
            Country country = new Country();
            country.Name = GetNewString();

            City city = new City();
            city.Name = GetNewString();
            city.Country = country;

            Account acct = new Account();
            acct.Created = acct.LastLogin = acct.Modified = DateTime.UtcNow;
            acct.Name = "Test User";
            acct.Password = "******";
            acct.Birthday = new DateTime(1976, 9, 7);

            PlaceType placetype = new PlaceType();
            placetype.Name = GetNewString();

            Place place = new Place();
            place.Account = acct;
            place.Name = GetNewString();
            place.Created = place.Modified = DateTime.UtcNow;
            place.City = city;
            place.Type = placetype;

            AccountPlaceFavorite fav = new AccountPlaceFavorite();
            fav.Account = acct;
            fav.Place = place;
            fav.Created = DateTime.UtcNow;

            Session.Save(placetype);
            Session.Save(country);
            Session.Save(city);
            Session.Save(acct);
            Session.Save(place);
            Session.Save(fav);
            Session.Flush();

            Assert.IsTrue(acct.Id > 0);
            Assert.IsTrue(place.Id > 0);
            Assert.IsTrue(fav.Id > 0);

            Session.Delete(acct);
            Session.Delete(placetype);
            Session.Delete(city);
            Session.Delete(country);
            Session.Flush();
        }
Beispiel #35
0
            public async Task Place(IUserMessage imsg, PlaceType placeType, uint width = 0, uint height = 0)
            {
                var channel = (ITextChannel)imsg.Channel;

                string url = "";
                switch (placeType)
                {
                    case PlaceType.Cage:
                        url = "http://www.placecage.com";
                        break;
                    case PlaceType.Steven:
                        url = "http://www.stevensegallery.com";
                        break;
                    case PlaceType.Beard:
                        url = "http://placebeard.it";
                        break;
                    case PlaceType.Fill:
                        url = "http://www.fillmurray.com";
                        break;
                    case PlaceType.Bear:
                        url = "https://www.placebear.com";
                        break;
                    case PlaceType.Kitten:
                        url = "http://placekitten.com";
                        break;
                    case PlaceType.Bacon:
                        url = "http://baconmockup.com";
                        break;
                    case PlaceType.Xoart:
                        url = "http://xoart.link";
                        break;
                }
                var rng = new NadekoRandom();
                if (width <= 0 || width > 1000)
                    width = (uint)rng.Next(250, 850);

                if (height <= 0 || height > 1000)
                    height = (uint)rng.Next(250, 850);

                url += $"/{width}/{height}";

                await channel.SendMessageAsync(url).ConfigureAwait(false);
            }
 public PlaceCollection PlacesPlacesForUser(PlaceType placeTypeId, string placeType, string woeId, string placeId, int? threshold, DateTime? minUploadDate, DateTime? maxUploadDate, DateTime? minTakenDate, DateTime? maxTakenDate)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.places.placesForUser");
     if (placeTypeId != PlaceType.None) dictionary.Add("place_type_id", placeTypeId.ToString().ToLower());
     if (placeType != null) dictionary.Add("place_type", placeType);
     if (woeId != null) dictionary.Add("woe_id", woeId);
     if (placeId != null) dictionary.Add("place_id", placeId);
     if (threshold != null) dictionary.Add("threshold", threshold.ToString().ToLower());
     if (minUploadDate != null) dictionary.Add("min_upload_date", minUploadDate.Value.ToUnixTimestamp());
     if (maxUploadDate != null) dictionary.Add("max_upload_date", maxUploadDate.Value.ToUnixTimestamp());
     if (minTakenDate != null) dictionary.Add("min_taken_date", minTakenDate.Value.ToUnixTimestamp());
     if (maxTakenDate != null) dictionary.Add("max_taken_date", maxTakenDate.Value.ToUnixTimestamp());
     return GetResponse<PlaceCollection>(dictionary);
 }
 public PlaceCollection PlacesPlacesForTags(PlaceType placeTypeId, string woeId, string placeId, int? threshold, IEnumerable<string> tags, TagMode tagMode, IEnumerable<string> machineTags, MachineTagMode machineTagMode, DateTime? minUploadDate, DateTime? maxUploadDate, DateTime? minTakenDate, DateTime? maxTakenDate)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.places.placesForTags");
     if (placeTypeId != PlaceType.None) dictionary.Add("place_type_id", placeTypeId.ToString().ToLower());
     if (woeId != null) dictionary.Add("woe_id", woeId);
     if (placeId != null) dictionary.Add("place_id", placeId);
     if (threshold != null) dictionary.Add("threshold", threshold.ToString().ToLower());
     if (tags != null) dictionary.Add("tags", tags == null ? String.Empty : String.Join(",", tags.ToArray()));
     if (tagMode != TagMode.None) dictionary.Add("tag_mode", tagMode.ToString().ToLower());
     if (machineTags != null) dictionary.Add("machine_tags", machineTags == null ? String.Empty : String.Join(",", machineTags.ToArray()));
     if (machineTagMode != MachineTagMode.None) dictionary.Add("machine_tag_mode", machineTagMode.ToString().ToLower());
     if (minUploadDate != null) dictionary.Add("min_upload_date", minUploadDate.Value.ToUnixTimestamp());
     if (maxUploadDate != null) dictionary.Add("max_upload_date", maxUploadDate.Value.ToUnixTimestamp());
     if (minTakenDate != null) dictionary.Add("min_taken_date", minTakenDate.Value.ToUnixTimestamp());
     if (maxTakenDate != null) dictionary.Add("max_taken_date", maxTakenDate.Value.ToUnixTimestamp());
     return GetResponse<PlaceCollection>(dictionary);
 }
 public PlaceCollection PlacesPlacesForBoundingBox(BoundaryBox bbox, PlaceType placeType)
 {
     return PlacesPlacesForBoundingBox(bbox, placeType, null, null);
 }
Beispiel #39
0
        /// <summary>
        /// Metoda przeciązająca akcje po wciśnięciu na dany UIelement
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Sender object</param>
        private new void ManipulationStarted(object sender, ManipulationStartedEventArgs e)
        {
            Image image = (Image)sender;
            this._startPoint = new Point(Canvas.GetLeft(image), Canvas.GetTop(image));

            SettingCanvasOrigin(image, new Point((double)((int)(Canvas.GetLeft(image) - 0.15 * image.Width)),
                                                (double)((int)(Canvas.GetTop(image) - 0.15 * image.Width))));

            //Canvas.SetLeft(image, (double)((int)(Canvas.GetLeft(image) - 0.15 * image.Width)));
            //Canvas.SetTop(image, (double)((int)(Canvas.GetTop(image) - 0.15 * image.Width)));

            //testowy fragment kodu
            PlaceType place = this._controlPanel.RecognizePlace(new Point(Canvas.GetLeft(image) +
                (this._controlPanel.CardSize * 1.3) / 2, Canvas.GetTop(image) + (this._controlPanel.CardSize * 1.3) / 2));
            this._startCoords = this._controlPanel.GetCoordsFromActualPoint(new Point(Canvas.GetLeft(image) +
                (this._controlPanel.CardSize * 1.3) / 2, Canvas.GetTop(image) + (this._controlPanel.CardSize * 1.3) / 2), place);
            this._startPlaceType = place;

            _isItJoker = _game.GetJokerOnCoords(place, (int)(_startCoords.X - 1), (int)(_startCoords.Y - 1));

            Canvas.SetZIndex((UIElement)sender, 1);        // ustawienie z-indeksu trzymanego obrazka na wierzch

            image.Opacity = this._controlPanel.OpacityCoefficient;                    // ustawienie półprzezroczystości
            image.Height = image.Width = this._controlPanel.CardSize * this._controlPanel.ResizeCoefficient;       // zwiększenie rozmiaru
        }
Beispiel #40
0
 /// <summary>
 /// Return the top 100 most geotagged places for a day.
 /// </summary>
 /// <param name="placeType">The type for a specific place type to cluster photos by. </param>
 /// <param name="placeId">Limit your query to only those top places belonging to a specific Flickr Places identifier.</param>
 /// <param name="woeId">Limit your query to only those top places belonging to a specific Where on Earth (WOE) identifier.</param>
 /// <returns></returns>
 public PlaceCollection PlacesGetTopPlacesList(PlaceType placeType, string placeId, string woeId)
 {
     return PlacesGetTopPlacesList(placeType, DateTime.MinValue, placeId, woeId);
 }
Beispiel #41
0
        /// <summary>
        /// Return the top 100 most geotagged places for a day.
        /// </summary>
        /// <param name="placeType">The type for a specific place type to cluster photos by. </param>
        /// <param name="date">A valid date. The default is yesterday.</param>
        /// <param name="placeId">Limit your query to only those top places belonging to a specific Flickr Places identifier.</param>
        /// <param name="woeId">Limit your query to only those top places belonging to a specific Where on Earth (WOE) identifier.</param>
        /// <returns></returns>
        public PlaceCollection PlacesGetTopPlacesList(PlaceType placeType, DateTime date, string placeId, string woeId)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.places.getTopPlacesList");

            parameters.Add("place_type_id", placeType.ToString("D"));
            if (date != DateTime.MinValue) parameters.Add("date", date.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo));
            if (!String.IsNullOrEmpty(placeId)) parameters.Add("place_id", placeId);
            if (!String.IsNullOrEmpty(woeId)) parameters.Add("woe_id", woeId);

            return GetResponseCache<PlaceCollection>(parameters);
        }
Beispiel #42
0
 public Point GetCoordsFromActualPoint(Point point, PlaceType place)
 {
     if (place == PlaceType.Grid)
     {
         return GetRowAndColumnFromViewportPoint(point, this.GetTopGrid().Y);
     }
     else if (place == PlaceType.Rand)
     {
         return GetRowAndColumnFromViewportPoint(point, this.GetTopRand().Y);
     }
     else
     {
         return GetRowAndColumnFromViewportPoint(point, this.GetTopJoker().Y);
     }
 }
        /// <summary>
        /// Return a list of the top 100 unique places clustered by a given placetype for set of tags or machine tags.
        /// </summary>
        /// <param name="placeType">The ID for a specific place type to cluster photos by. </param>
        /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters. </param>
        /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. </param>
        /// <param name="boundaryBox">The boundary box to search for places in.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PlacesPlacesForBoundingBoxAsync(PlaceType placeType, string woeId, string placeId,
            BoundaryBox boundaryBox,
            Action<FlickrResult<PlaceCollection>> callback)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.places.placesForBoundingBox");

            parameters.Add("place_type_id", placeType.ToString("D"));
            if (!String.IsNullOrEmpty(woeId)) parameters.Add("woe_id", woeId);
            if (!String.IsNullOrEmpty(placeId)) parameters.Add("place_id", placeId);
            parameters.Add("bbox", boundaryBox.ToString());

            GetResponseAsync<PlaceCollection>(parameters, callback);
        }
 /// <summary>
 /// Gets the places of a particular type that the authenticated user has geotagged photos.
 /// </summary>
 /// <param name="placeType">The type of places to return.</param>
 /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters.</param>
 /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. </param>
 /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
 public void PlacesPlacesForUserAsync(PlaceType placeType, string woeId, string placeId,
     Action<FlickrResult<PlaceCollection>> callback)
 {
     PlacesPlacesForUserAsync(placeType, woeId, placeId, 0, DateTime.MinValue, DateTime.MinValue,
                              DateTime.MinValue, DateTime.MinValue, callback);
 }
        /// <summary>
        /// Return a list of the top 100 unique places clustered by a given placetype for set of tags or machine tags.
        /// </summary>
        /// <param name="placeType">The ID for a specific place type to cluster photos by. </param>
        /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters. </param>
        /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. </param>
        /// <param name="threshold">The minimum number of photos that a place type must have to be included. 
        /// If the number of photos is lowered then the parent place type for that place will be used.</param>
        /// <param name="contactType">The type of contacts to return places for. Either all, or friends and family only.</param>
        /// <param name="minUploadDate">Minimum upload date.</param>
        /// <param name="maxUploadDate">Maximum upload date.</param>
        /// <param name="minTakenDate">Minimum taken date.</param>
        /// <param name="maxTakenDate">Maximum taken date.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PlacesPlacesForContactsAsync(PlaceType placeType, string woeId, string placeId, int threshold,
            ContactSearch contactType, DateTime minUploadDate,
            DateTime maxUploadDate, DateTime minTakenDate, DateTime maxTakenDate,
            Action<FlickrResult<PlaceCollection>> callback)
        {
            CheckRequiresAuthentication();

            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.places.placesForContacts");

            parameters.Add("place_type_id", placeType.ToString("D"));
            if (!String.IsNullOrEmpty(woeId)) parameters.Add("woe_id", woeId);
            if (!String.IsNullOrEmpty(placeId)) parameters.Add("place_id", placeId);
            if (threshold > 0)
                parameters.Add("threshold", threshold.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (contactType != ContactSearch.None)
                parameters.Add("contacts", (contactType == ContactSearch.AllContacts ? "all" : "ff"));
            if (minUploadDate != DateTime.MinValue)
                parameters.Add("min_upload_date", UtilityMethods.DateToUnixTimestamp(minUploadDate));
            if (maxUploadDate != DateTime.MinValue)
                parameters.Add("max_upload_date", UtilityMethods.DateToUnixTimestamp(maxUploadDate));
            if (minTakenDate != DateTime.MinValue)
                parameters.Add("min_taken_date", UtilityMethods.DateToMySql(minTakenDate));
            if (maxTakenDate != DateTime.MinValue)
                parameters.Add("max_taken_date", UtilityMethods.DateToMySql(maxTakenDate));

            GetResponseAsync<PlaceCollection>(parameters, callback);
        }
 public RestOperationCanceler SearchAsync(double latitude, double longitude, PlaceType? granularity, string accuracy, string query, Action<RestOperationCompletedEventArgs<IList<Place>>> operationCompleted)
 {
     NameValueCollection parameters = this.BuildGeoParameters(latitude, longitude, granularity, accuracy, query);
     return this.restTemplate.GetForObjectAsync<IList<Place>>(this.BuildUrl("geo/search.json", parameters), operationCompleted);
 }
Beispiel #47
0
        /// <summary>
        /// Return a list of the top 100 unique places clustered by a given placetype for set of tags or machine tags.
        /// </summary>
        /// <param name="placeType">The ID for a specific place type to cluster photos by. </param>
        /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters. </param>
        /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. </param>
        /// <param name="boundaryBox">The boundary box to search for places in.</param>
        /// <returns></returns>
        public PlaceCollection PlacesPlacesForBoundingBox(PlaceType placeType, string woeId, string placeId, BoundaryBox boundaryBox)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.places.placesForBoundingBox");

            parameters.Add("place_type_id", placeType.ToString("D"));
            if (!String.IsNullOrEmpty(woeId)) parameters.Add("woe_id", woeId);
            if (!String.IsNullOrEmpty(placeId)) parameters.Add("place_id", placeId);
            parameters.Add("bbox", boundaryBox.ToString());

            return GetResponseCache<PlaceCollection>(parameters);
        }
        public Task<IList<Place>> ReverseGeoCodeAsync(double latitude, double longitude, PlaceType? granularity, string accuracy) 
        {
		    NameValueCollection parameters = this.BuildGeoParameters(latitude, longitude, granularity, accuracy, null);
            return this.restTemplate.GetForObjectAsync<IList<Place>>(this.BuildUrl("geo/reverse_geocode.json", parameters));
	    }
Beispiel #49
0
 /// <summary>
 /// Return the top 100 most geotagged places for a day.
 /// </summary>
 /// <param name="placeType">The type for a specific place type to cluster photos by. </param>
 /// <param name="date">A valid date. The default is yesterday.</param>
 /// <returns></returns>
 public PlaceCollection PlacesGetTopPlacesList(PlaceType placeType, DateTime date)
 {
     return PlacesGetTopPlacesList(placeType, date, null, null);
 }
 public PlaceCollection PlacesGetTopPlacesList(PlaceType placeTypeId, DateTime? date, string placeId, string woeId)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.places.getTopPlacesList");
     dictionary.Add("place_type_id", placeTypeId.ToString().ToLower());
     if (date != null) dictionary.Add("date", date.Value.ToUnixTimestamp());
     if (placeId != null) dictionary.Add("place_id", placeId);
     if (woeId != null) dictionary.Add("woe_id", woeId);
     return GetResponse<PlaceCollection>(dictionary);
 }
 public PlaceCollection PlacesPlacesForBoundingBox(BoundaryBox bbox, PlaceType placeType, int? placeTypeId, bool? recursive)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.places.placesForBoundingBox");
     dictionary.Add("bbox", bbox.ToString().ToLower());
     if (placeType != PlaceType.None) dictionary.Add("place_type", placeType.ToString().ToLower());
     if (placeTypeId != null) dictionary.Add("place_type_id", placeTypeId.ToString().ToLower());
     if (recursive != null) dictionary.Add("recursive", recursive.Value ? "1" : "0");
     return GetResponse<PlaceCollection>(dictionary);
 }
Beispiel #52
0
        /// <summary>
        /// Metoda wywoływana podczas przeciągania danego UIelementu.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">Sender object</param>
        private new void ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
        {
            Image image = (Image)sender;
            SettingCanvasOrigin(image, new Point(Canvas.GetLeft(image) + e.DeltaManipulation.Translation.X,
                                                Canvas.GetTop(image) + e.DeltaManipulation.Translation.Y));
            PlaceType place;
            try
            {
                place = this._controlPanel.RecognizePlace(new Point(Canvas.GetLeft(image) + (this._controlPanel.CardSize * 1.3) / 2, Canvas.GetTop(image) + (this._controlPanel.CardSize * 1.3) / 2));
                this._endCoords = this._controlPanel.GetCoordsFromActualPoint(new Point(Canvas.GetLeft(image) + (this._controlPanel.CardSize * 1.3) / 2, Canvas.GetTop(image) + (this._controlPanel.CardSize * 1.3) / 2), place);
                this._endPlaceType = place;
            }
            catch (OutOfBoardException)
            {
                canvas.Children.Remove(this._opacityRect);
                this._opacityRect = null;
                return;
            }

            try
            {
                canvas.Children.Remove(this._opacityRect);
                Point point = _controlPanel.GetViewportPointFromActualPoint(new Point(Canvas.GetLeft(image) + (_controlPanel.CardSize * 1.3) / 2, Canvas.GetTop(image) + (_controlPanel.CardSize * 1.3) / 2));
                if (_isItJoker == true && this._game.GetBoardField(this._endPlaceType, (int)(_endCoords.X - 1), (int)(_endCoords.Y - 1)) != null &&
                    this._game.GetBoardField(this._endPlaceType, (int)(_endCoords.X - 1), (int)(_endCoords.Y - 1)).IsJoker == true)
                {
                    this._opacityRect = null;
                    return;
                }
                else if (this._game.IsFieldFree((int)_endCoords.X, (int)_endCoords.Y, this._endPlaceType) == true || _isItJoker == true)            // wyłączenie podświetlenia kafelka gdy jest zajęty
                {
                    this._opacityRect = _controlPanel.GetMarkRectangle();
                    canvas.Children.Add(_opacityRect);
                    SettingCanvasOrigin(_opacityRect, point);
                }
                else if (_endPlaceType == PlaceType.Joker && _isItJoker == true)
                {
                    _opacityRect = _controlPanel.GetMarkRectangle();
                    canvas.Children.Add(_opacityRect);
                    Point jokerPoint = _controlPanel.GetJokerViewportPointFromCoords((int)(_endCoords.X - 1), (int)(_endCoords.Y));
                    SettingCanvasTranslate(_opacityRect, jokerPoint);
                }
            }
            catch (NullReferenceException)
            {
                this._opacityRect = null;
            }
        }
Beispiel #53
0
        private static PlaceType ToPlaceType(this JsonPlaceType jsonPlaceType)
        {
            if (jsonPlaceType == null) throw new ArgumentNullException("jsonPlaceType");

            var placeType = new PlaceType
            {
                Name = jsonPlaceType.Name,
                Language = jsonPlaceType.Language,
                Uri = jsonPlaceType.Uri,
                Description = jsonPlaceType.Description,
                Code = (jsonPlaceType.JsonAttributes != null) ? jsonPlaceType.JsonAttributes.Code : default(int),
            };

            return placeType;
        }
        /// <summary>
        /// Return the top 100 most geotagged places for a day.
        /// </summary>
        /// <param name="placeType">The type for a specific place type to cluster photos by. </param>
        /// <param name="date">A valid date. The default is yesterday.</param>
        /// <param name="placeId">Limit your query to only those top places belonging to a specific Flickr Places identifier.</param>
        /// <param name="woeId">Limit your query to only those top places belonging to a specific Where on Earth (WOE) identifier.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PlacesGetTopPlacesListAsync(PlaceType placeType, DateTime date, string placeId, string woeId,
            Action<FlickrResult<PlaceCollection>> callback)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.places.getTopPlacesList");

            parameters.Add("place_type_id", placeType.ToString("D"));
            if (date != DateTime.MinValue)
                parameters.Add("date",
                               date.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo));
            if (!String.IsNullOrEmpty(placeId)) parameters.Add("place_id", placeId);
            if (!String.IsNullOrEmpty(woeId)) parameters.Add("woe_id", woeId);

            GetResponseAsync<PlaceCollection>(parameters, callback);
        }
Beispiel #55
0
        /// <summary>
        /// Return a list of the top 100 unique places clustered by a given placetype for set of tags or machine tags.
        /// </summary>
        /// <param name="placeType">The ID for a specific place type to cluster photos by. </param>
        /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters. </param>
        /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. </param>
        /// <param name="threshold">The minimum number of photos that a place type must have to be included. If the number of photos is lowered then the parent place type for that place will be used.</param>
        /// <param name="tags">A list of tags. Photos with one or more of the tags listed will be returned.</param>
        /// <param name="tagMode">Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.</param>
        /// <param name="machineTags"></param>
        /// <param name="machineTagMode"></param>
        /// <param name="minUploadDate">Minimum upload date.</param>
        /// <param name="maxUploadDate">Maximum upload date.</param>
        /// <param name="minTakenDate">Minimum taken date.</param>
        /// <param name="maxTakenDate">Maximum taken date.</param>
        /// <returns></returns>
        public PlaceCollection PlacesPlacesForTags(PlaceType placeType, string woeId, string placeId, int threshold, string[] tags, TagMode tagMode, string[] machineTags, MachineTagMode machineTagMode, DateTime minUploadDate, DateTime maxUploadDate, DateTime minTakenDate, DateTime maxTakenDate)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.places.placesForTags");

            parameters.Add("place_type_id", placeType.ToString("D"));
            if (!String.IsNullOrEmpty(woeId)) parameters.Add("woe_id", woeId);
            if (!String.IsNullOrEmpty(placeId)) parameters.Add("place_id", placeId);
            if (threshold > 0) parameters.Add("threshold", threshold.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (tags != null && tags.Length > 0) parameters.Add("tags", String.Join(",", tags));
            if (tagMode != TagMode.None) parameters.Add("tag_mode", UtilityMethods.TagModeToString(tagMode));
            if (machineTags != null && machineTags.Length > 0) parameters.Add("machine_tags", String.Join(",", machineTags));
            if (machineTagMode != MachineTagMode.None) parameters.Add("machine_tag_mode", UtilityMethods.MachineTagModeToString(machineTagMode));
            if (minTakenDate != DateTime.MinValue) parameters.Add("min_taken_date", UtilityMethods.DateToMySql(minTakenDate));
            if (maxTakenDate != DateTime.MinValue) parameters.Add("max_taken_date", UtilityMethods.DateToMySql(maxTakenDate));
            if (minUploadDate != DateTime.MinValue) parameters.Add("min_upload_date", UtilityMethods.DateToUnixTimestamp(minUploadDate));
            if (maxUploadDate != DateTime.MinValue) parameters.Add("max_upload_date", UtilityMethods.DateToUnixTimestamp(maxUploadDate));

            return GetResponseCache<PlaceCollection>(parameters);
        }
 /// <summary>
 /// Return the top 100 most geotagged places for a day.
 /// </summary>
 /// <param name="placeType">The type for a specific place type to cluster photos by. </param>
 /// <param name="date">A valid date. The default is yesterday.</param>
 /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
 public void PlacesGetTopPlacesListAsync(PlaceType placeType, DateTime date, Action<FlickrResult<PlaceCollection>> callback)
 {
     PlacesGetTopPlacesListAsync(placeType, date, null, null, callback);
 }
 private NameValueCollection BuildGeoParameters(double latitude, double longitude, PlaceType? granularity, string accuracy, string query)
 {
     NameValueCollection nameValueCollection = new NameValueCollection();
     nameValueCollection.Add("lat", latitude.ToString((IFormatProvider) CultureInfo.InvariantCulture));
     nameValueCollection.Add("long", longitude.ToString((IFormatProvider) CultureInfo.InvariantCulture));
     if (granularity.HasValue)
     {
         nameValueCollection.Add("granularity", granularity.ToString().ToLower());
     }
     if (accuracy != null)
     {
         nameValueCollection.Add("accuracy", accuracy);
     }
     if (query != null)
     {
         nameValueCollection.Add("query", query);
     }
     return nameValueCollection;
 }
Beispiel #58
0
 /// <summary>
 /// Gets the places of a particular type that the authenticated user has geotagged photos.
 /// </summary>
 /// <param name="placeType">The type of places to return.</param>
 /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters.</param>
 /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. </param>
 /// <returns>The list of places of that type.</returns>
 public PlaceCollection PlacesPlacesForUser(PlaceType placeType, string woeId, string placeId)
 {
     return PlacesPlacesForUser(placeType, woeId, placeId, 0, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue);
 }
        public Task<IList<Place>> SearchAsync(double latitude, double longitude, PlaceType? granularity, string accuracy, string query) 
        {
		    NameValueCollection parameters = this.BuildGeoParameters(latitude, longitude, granularity, accuracy, query);
            return this.restTemplate.GetForObjectAsync<IList<Place>>(this.BuildUrl("geo/search.json", parameters));
	    }
Beispiel #60
0
        /// <summary>
        /// Gets the places of a particular type that the authenticated user has geotagged photos.
        /// </summary>
        /// <param name="placeType">The type of places to return.</param>
        /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters.</param>
        /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. </param>
        /// <param name="threshold">The minimum number of photos that a place type must have to be included. If the number of photos is lowered then the parent place type for that place will be used.
        /// For example if you only have 3 photos taken in the locality of Montreal (WOE ID 3534) but your threshold is set to 5 then those photos will be "rolled up" and included instead with a place record for the region of Quebec (WOE ID 2344924).</param>
        /// <param name="minUploadDate">Minimum upload date. Photos with an upload date greater than or equal to this value will be returned.</param>
        /// <param name="maxUploadDate">Maximum upload date. Photos with an upload date less than or equal to this value will be returned. </param>
        /// <param name="minTakenDate">Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. </param>
        /// <param name="maxTakenDate">Maximum taken date. Photos with an taken date less than or equal to this value will be returned. </param>
        /// <returns>The list of places of that type.</returns>
        public PlaceCollection PlacesPlacesForUser(PlaceType placeType, string woeId, string placeId, int threshold, DateTime minUploadDate, DateTime maxUploadDate, DateTime minTakenDate, DateTime maxTakenDate)
        {
            CheckRequiresAuthentication();

            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.places.placesForUser");

            parameters.Add("place_type_id", placeType.ToString("D"));
            if (!String.IsNullOrEmpty(woeId)) parameters.Add("woe_id", woeId);
            if (!String.IsNullOrEmpty(placeId)) parameters.Add("place_id", placeId);
            if (threshold > 0) parameters.Add("threshold", threshold.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (minTakenDate != DateTime.MinValue) parameters.Add("min_taken_date", UtilityMethods.DateToMySql(minTakenDate));
            if (maxTakenDate != DateTime.MinValue) parameters.Add("max_taken_date", UtilityMethods.DateToMySql(maxTakenDate));
            if (minUploadDate != DateTime.MinValue) parameters.Add("min_upload_date", UtilityMethods.DateToUnixTimestamp(minUploadDate));
            if (maxUploadDate != DateTime.MinValue) parameters.Add("max_upload_date", UtilityMethods.DateToUnixTimestamp(maxUploadDate));

            return GetResponseCache<PlaceCollection>(parameters);
        }