private void Setup_Logged_User() { if (Logged_User != null) { blacklistToolStripMenuItem.Enabled = true; AddNewPhoto.Enabled = true; AddNewPhoto.BackgroundImage = Properties.Resources.ICON_Add_Neutral; Text = "Photo Manager Client application -" + Logged_User.Name; PhotoFilter = new PhotoFilter(Logged_User.Id); Init_UsersList(); initializing = true; LoadPhoto(); Init_Keywords_List(); initializing = false; } else { blacklistToolStripMenuItem.Enabled = false; AddNewPhoto.Enabled = false; CBX_UsersList.Items.Clear(); CBX_Keywords.Items.Clear(); PhotoBrowser.Clear(); PhotoFilter = null; } Update_UI(); }
private string GetWhereClause(PhotoFilter filter) { if (filter == null) { return(""); } List <string> conditions = new List <string>(); if (filter.PhotoId.HasValue) { conditions.Add("P.[PhotoId] = " + filter.PhotoId.Value); } if (filter.StartTime.HasValue) { conditions.Add("P.[Timestamp] >= '" + filter.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"); } if (filter.EndTime.HasValue) { conditions.Add("P.[Timestamp] <= '" + filter.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") + "'"); } if (!conditions.Any()) { return(""); } return(" WHERE " + string.Join(" AND ", conditions)); }
public void OnFilterSelected(PhotoFilter photoFilter) { try { GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); var(key, filter) = ConvertTypeFilterEffect(photoFilter); if (string.IsNullOrEmpty(key)) { SeekBarRotate.Visibility = ViewStates.Invisible; SeekBarRotate.SetProgress(0); } else { SeekBarRotate.Visibility = ViewStates.Visible; SeekBarRotate.SetProgress(0); } MNiceArtEditor.SetFilterEffect(photoFilter); } catch (Exception e) { Console.WriteLine(e); } }
private void Setup_Logged_User() { if (Logged_User != null) { Text = "Photo Manager Client application -" + Logged_User.Name; PhotoFilter = new PhotoFilter(Logged_User.Id); Init_UsersList(); initializing = true; LoadPhoto(); Init_Keywords_List(); initializing = false; FB_Ajout.Enabled = true; FB_Masquer.Enabled = true; FB_Modifier.Enabled = true; FB_Supprimer.Enabled = true; } else { CBX_UsersList.Items.Clear(); CBX_Keywords.Items.Clear(); PhotoBrowser.Clear(); PhotoFilter = null; } Update_UI(); }
public ActionResult FilterPhoto(PhotoFilter filter = PhotoFilter.None) { var model = new PhotoListModel(); try { switch (filter) { case PhotoFilter.Random: model.Photos = _photoService.GetRandomPhotos().InitPhotoListModel(); break; case PhotoFilter.NoAlbum: model.Photos = _photoService.GetOrphans().InitPhotoListModel(); break; case PhotoFilter.Background: model.Photos = _photoService.GetBackgroundPhotos().InitPhotoListModel(); break; default: model.Photos = _photoService.GetRandomPhotos().Union(_photoService.GetOrphans()).Union(_photoService.GetBackgroundPhotos()).InitPhotoListModel(); break; } } catch (Exception exception) { Log.RegisterError(exception); } return(PartialView("~/Views/Management/_PhotoList.cshtml", model)); }
public void Process(string path) //这是执行“编辑照片”的方法 { var photo = Photo.load(path); //通过调用Photo类的load路径方法实例photo对象 var filters = new PhotoFilter(); //实例化滤镜 filters.ApplyBrightness(photo); //调用PhotoFilter类的改变亮度方法 filters.ApplyContrast(photo); //调用PhotoFilter类的改变对比度方法 filters.Resize(photo); //调用PhotoFilter类的调整大小方法 photo.save(); //储存 }
/// <summary> /// Set pre-define filter available /// </summary> /// <param name="filterType">type of filter want to apply { @link NiceArtEditor }</param> public void SetFilterEffect(PhotoFilter filterType) { try { ParentView.SetFilterEffect(filterType); } catch (Exception e) { Console.WriteLine(e); } }
public IEnumerable <Photo> Browse(PhotoFilter filter) { IEnumerable <Photo> photos = _photoRepository.Browse(filter); foreach (Photo photo in photos.Where(p => p.Image != null)) { byte[] imageData = _fileRepository.Get(photo.Image.FileName); photo.Image.Data = imageData; } return(photos); }
public RecipeQuery(RecipeQuery query) { this.Keywords = query.Keywords; this.Rating = query.Rating; if (query.Include != null) this.Include = (Guid[]) query.Include.Clone(); if (query.Exclude != null) this.Exclude = (Guid[]) query.Exclude.Clone(); this.Time = query.Time; this.Photos = query.Photos; this.Sort = query.Sort; this.Direction = query.Direction; }
/// <summary> /// Set pre-define filter available /// </summary> /// <param name="filterType">type of filter want to apply { @link NiceArtEditor }</param> public void SetFilterEffect(PhotoFilter filterType) { try { ParentView.SetFilterEffect(filterType); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public async Task <List <Photo> > List(PhotoFilter model) { this.SetHeaders(); var url = QueryStringBuilder.BuildUrl("photos", model); var response = await Client.GetAsync(url); HandleResponse(response); var result = await response.Content.ReadAsAsync <List <Photo> >(); return(result); }
public async Task GetAllPhotos() { var model = new PhotoFilter() { PerPage = 20, Page = 2, Status = Status.Active, }; var photos = await new PhotoService().List(model); Assert.IsTrue(photos.Count >= 1); }
public async void SetFilterEffect(PhotoFilter filterType) { try { MImageFilterView.Visibility = ViewStates.Visible; MImageFilterView.SetSourceBitmap(MImgSource.GetBitmap()); await MImageFilterView.SetFilterEffect(filterType); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public async void SetFilterEffect(PhotoFilter filterType) { try { MImageFilterView.Visibility = ViewStates.Visible; MImageFilterView.SetSourceBitmap(MImgSource.GetBitmap()); await MImageFilterView.SetFilterEffect(filterType); } catch (Exception e) { Console.WriteLine(e); } }
public void UsageDelegate() { var filters = new PhotoFilter(); //Se nao usar o action usaria: //PhotoFilterHandler filterHandler = filters.ApplyBrightness; Action <Photo> filterHandler = filters.ApplyBrightness; filterHandler += filters.ApplyContrast;//necessario usar p += e nao usa o () filterHandler += filters.Resize; filterHandler += AnotherFilter; Process("photox.jpg", filterHandler); }
public async Task SetFilterEffect(PhotoFilter effect) { try { MCurrentEffect = effect; MCustomEffect = null; RequestRender(); } catch (Exception e) { Console.WriteLine(e); } }
public async Task SetFilterEffect(PhotoFilter effect) { try { MCurrentEffect = effect; MCustomEffect = null !; RequestRender(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public RecipeQuery(RecipeQuery query) { this.Keywords = query.Keywords; this.Rating = query.Rating; if (query.Include != null) { this.Include = (Guid[])query.Include.Clone(); } if (query.Exclude != null) { this.Exclude = (Guid[])query.Exclude.Clone(); } this.Time = query.Time; this.Photos = query.Photos; this.Sort = query.Sort; this.Direction = query.Direction; }
public IEnumerable <Photo> Browse(PhotoFilter filter) { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); return(connection.Query <Photo, Image, Photo>($@" SELECT * FROM [Photos] P INNER JOIN [Images] I ON P.[ImageId] = I.[ImageId]" + GetWhereClause(filter), (photo, image) => { photo.Image = image; return photo; }, splitOn: "ImageId")); } }
private async void button2_Click(object sender, EventArgs e) { //Get popular and choose the first var photoFilter = new PhotoFilter(Feature.Popular, Categories.Nude); var response_pop = await MyService.GetPhotos(photoFilter, 1, 100); List <CCSWE.FiveHundredPx.Models.Photo> lista_fotos_500px = new List <CCSWE.FiveHundredPx.Models.Photo>(); foreach (var photo in response_pop.Photos) { // Store the photos for the current page in a List<Photo> or something lista_fotos_500px.Add(photo); } CCSWE.FiveHundredPx.Models.Photo chosen_one = (CCSWE.FiveHundredPx.Models.Photo)lista_fotos_500px[0]; var response1 = await MyService.LikePhoto(chosen_one.Id); if (response1.IsSuccessStatusCode) { MessageBox.Show("Liked photo!!"); } else { MessageBox.Show("Issue liking!!"); } var response2 = await MyService.FavoritePhoto(chosen_one.Id); if (response2.IsSuccessStatusCode) { MessageBox.Show("Favorited photo!!"); } else { MessageBox.Show("Issue Favoriting!!"); } }
private void Setup_Logged_User() { if (Logged_User != null) { Text = "Photo Manager Client - " + Logged_User.Name; PhotoFilter = new PhotoFilter(Logged_User.Id); Init_UsersList(); Initializing = true; LoadPhoto(); Init_Keywords_List(); Initializing = false; } else { Text = "Photo Manager Client - Not connected"; CBX_UsersList.Items.Clear(); CBX_Keywords.Items.Clear(); PhotoBrowser.Clear(); PhotoFilter = null; } Update_UI(); }
// Charger les photos de l'usager private List <Photo> GetUserPhoto() { PhotoFilter photoFilter = new PhotoFilter(User.Id); return(photoFilter.GetPhotos()); }
public RecipeQueryBuilder HasPhoto(PhotoFilter photoFilter) { this.query.Photos = photoFilter; return this; }
private (string, string) ConvertTypeFilterEffect(PhotoFilter filter) { try { string type = string.Empty; string key = string.Empty; switch (filter) { case PhotoFilter.None: break; case PhotoFilter.AutoFix: type = EffectFactory.EffectAutofix; key = "scale"; break; case PhotoFilter.BlackWhite: type = EffectFactory.EffectBlackwhite; key = "black"; break; case PhotoFilter.Brightness: type = EffectFactory.EffectBrightness; key = "brightness"; break; case PhotoFilter.Contrast: type = EffectFactory.EffectContrast; key = "contrast"; break; case PhotoFilter.CrossProcess: type = EffectFactory.EffectCrossprocess; break; case PhotoFilter.Documentary: type = EffectFactory.EffectDocumentary; break; case PhotoFilter.DueTone: type = EffectFactory.EffectDuotone; break; case PhotoFilter.FillLight: type = EffectFactory.EffectFilllight; key = "strength"; break; case PhotoFilter.FishEye: type = EffectFactory.EffectFisheye; key = "scale"; break; case PhotoFilter.FlipVertical: type = EffectFactory.EffectGrain; key = "vertical"; break; case PhotoFilter.FlipHorizontal: type = EffectFactory.EffectGrain; key = "horizontal"; break; case PhotoFilter.Grain: type = EffectFactory.EffectGrain; key = "strength"; break; case PhotoFilter.Lomoish: type = EffectFactory.EffectLomoish; break; case PhotoFilter.Negative: type = EffectFactory.EffectNegative; break; case PhotoFilter.Posterize: type = EffectFactory.EffectPosterize; break; case PhotoFilter.Rotate: type = EffectFactory.EffectRotate; key = "angle"; break; case PhotoFilter.Saturate: type = EffectFactory.EffectSaturate; key = "scale"; break; case PhotoFilter.Sepia: type = EffectFactory.EffectSepia; break; case PhotoFilter.Sharpen: type = EffectFactory.EffectSharpen; break; case PhotoFilter.Temperature: type = EffectFactory.EffectTemperature; key = "scale"; break; case PhotoFilter.Tint: type = EffectFactory.EffectTint; break; case PhotoFilter.Vignette: type = EffectFactory.EffectVignette; key = "scale"; break; } return(key, type); } catch (Exception e) { Console.WriteLine(e); return("", ""); } }
public RecipeQueryBuilder HasPhoto(PhotoFilter photoFilter) { this.query.Photos = photoFilter; return(this); }
/* /// <summary> /// 搜索相片 /// </summary> public override PhotoCollection GetPhotosByFilter(PhotoFilter filter, bool isGetPrivacyType, int pageNumber, int pageSize, ref int? count) { using (SqlQuery query = new SqlQuery()) { query.Pager.TableName = "bx_Photos"; query.Pager.SortField = "[PhotoID]"; query.Pager.PageNumber = pageNumber; query.Pager.PageSize = pageSize; query.Pager.SelectCount = true; query.Pager.TotalRecords = count; query.Pager.IsDesc = true; query.Pager.Condition = BuildConditionsByFilter(query, filter); using (XSqlDataReader reader = query.ExecuteReader()) { SqlDataReaderWrap readerWrap = new SqlDataReaderWrap(reader); PhotoCollection photos = new PhotoCollection(readerWrap); if (count == null && readerWrap.NextResult()) { if (readerWrap.Next) { count = readerWrap.Get<int>(0); } } return photos; } } } */ /// <summary> /// 根据Filter来获得Sql用的条件,并填充参数 /// </summary> /// <param name="query"></param> /// <param name="filter"></param> /// <returns></returns> private string BuildConditionsByFilter(PhotoFilter filter, SqlQuery query) { StringBuffer sqlConditions = new StringBuffer(); if (filter.BeginDate != null) { sqlConditions += " AND [CreateDate] >= @BeginDate"; query.CreateParameter<DateTime?>("@BeginDate", filter.BeginDate, SqlDbType.DateTime); } if (filter.EndDate != null) { sqlConditions += " AND [CreateDate] <= @EndDate"; query.CreateParameter<DateTime?>("@EndDate", filter.EndDate, SqlDbType.DateTime); } if (string.IsNullOrEmpty(filter.Usernames) == false) { sqlConditions += " AND [UserID] = (SELECT [UserID] FROM [bx_Users] WHERE [Username] = @Username)"; query.CreateParameter<string>("@Username", filter.Usernames, SqlDbType.NVarChar, 50); } if (string.IsNullOrEmpty(filter.SearchKey) == false) { sqlConditions += " AND ([Name] LIKE '%' + @Name + '%' OR [Description] LIKE '%' + @Name + '%')"; query.CreateParameter<string>("@Name", filter.SearchKey, SqlDbType.NVarChar, 50); } if (sqlConditions.Length > 0) sqlConditions.Remove(0, 5); return sqlConditions.ToString(); }
public IEnumerable <Photo> Get([FromQuery] PhotoFilter filter) { return(photoService.Browse(filter)); }