public void ShowPhoto() { //Modifier la façon de savoir si l'image et en mode show ou hide. if (!IsInfoOpen) { IsInfoOpen = true; DLG = new InfoPhoto(this); DLG.Photo = PhotoBrowser.SelectedPhoto; DLG.User = DBPhotosWebServices.GetUser(PhotoBrowser.SelectedPhoto.OwnerId).ToString(); DLG.Show(); FB_Image_Show.BackgroundImage = Properties.Resources.Hide_Neutral; FB_Image_Show.ClickedImage = Properties.Resources.Hide_Clicked; FB_Image_Show.DisabledImage = Properties.Resources.Hide_Disabled; FB_Image_Show.NeutralImage = Properties.Resources.Hide_Neutral; FB_Image_Show.OverImage = Properties.Resources.Hide_Over; } else { if (!DLG.IsClosing) { DLG.Close(); } FB_Image_Show.BackgroundImage = Properties.Resources.Show_Neutral; FB_Image_Show.ClickedImage = Properties.Resources.Show_Clicked; FB_Image_Show.DisabledImage = Properties.Resources.Show_Disabled; FB_Image_Show.NeutralImage = Properties.Resources.Show_Neutral; FB_Image_Show.OverImage = Properties.Resources.Show_Over; FB_Image_Show.Refresh(); IsInfoOpen = false; } }
private void BTN_Change_Click(object sender, EventArgs e) { User.Name = TBX_Username.Text; User.Password = TBX_Password.Text; User.SetAvatarImage(IBX_Avatar.BackgroundImage); DBPhotosWebServices.UpdateUser(User); }
private void UpdateBlacklistFB() { bool AlreadyInBlacklist = false; if (PhotoBrowser.SelectedPhoto != null) { User CurrentUser = DBPhotosWebServices.GetUser(PhotoBrowser.SelectedPhoto.OwnerId); foreach (User User in CBX_BlackList.Items) { if (CurrentUser == User) { AlreadyInBlacklist = true; } } } if (!AlreadyInBlacklist) { AddToBlacklistMode = true; FB_Blacklist_Add.ClickedImage = Properties.Resources.Add_Clicked; FB_Blacklist_Add.DisabledImage = Properties.Resources.Add_Disabled; FB_Blacklist_Add.NeutralImage = Properties.Resources.Add_Neutral; FB_Blacklist_Add.OverImage = Properties.Resources.Add_Over; } }
private void Slideshow_Shown(object sender, EventArgs e) { WaitSplash.Show(this, "Loading photos from server..."); photos = DBPhotosWebServices.GetAllPhotos(); //photos = DBPhotosWebServices.GetAllPhotos().Where(p=>bl.IndexOf(p.OwnerId)==-1).ToList(); WaitSplash.Hide(); }
private void MI_Delete_Click(object sender, EventArgs e) { if (PhotoBrowser.SelectedPhoto != null && PhotoBrowser.SelectedPhoto.OwnerId == Logged_User.Id) { DBPhotosWebServices.DeletePhoto(PhotoBrowser.SelectedPhoto); PhotoBrowser.DeleteSelectedPhoto(); } }
private void AddToBlacklist() { if (PhotoBrowser.SelectedPhoto != null) { User CurrentUser = DBPhotosWebServices.GetUser(PhotoBrowser.SelectedPhoto.OwnerId); CBX_BlackList.Items.Add(CurrentUser); Blacklist.Add(CurrentUser.Id); } }
private void CBX_BlackList_Load() { CBX_BlackList.Items.Clear(); foreach (int ID in Blacklist) { CBX_BlackList.Items.Add(DBPhotosWebServices.GetUser(ID)); } }
private void MainForm_Shown(object sender, EventArgs e) { // Get server attention... WaitSplash.Show(this, "Connecting to Photo Manager..."); string bidon = DBPhotosWebServices.GetServerImagesURLBase(); WaitSplash.Hide(); Update_UI(); }
private void DeletePhoto_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Are you sure to delete this item ??", "Confirm Delete!!", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { DBPhotosWebServices.DeletePhoto(PhotoBrowser.SelectedPhoto); PhotoBrowser.DeleteSelectedPhoto(); } }
private void BTN_DeleteAccount_Click(object sender, EventArgs e) { if (MessageBox.Show("Êtes-vous sûr de vouloir effacer votre compte et toutes vos photos?", "Attention!", MessageBoxButtons.YesNo) == DialogResult.Yes) { DBPhotosWebServices.DeleteUser(User.Id); User = null; DialogResult = DialogResult.OK; Close(); } }
private void User_To_DLG() { photo = DBPhotosWebServices.GetPhoto(ID); TB_title.Text = photo.Title; TB_keyword.Text = photo.Keywords; RTBX_description.Text = photo.Description; DTP_Date.Value = photo.CreationDate; IBX_photo.BackgroundImage = photo.GetOriginalImage(); CB_Shared.Checked = photo.Shared; }
private void EditPhoto() { AddEditPhoto DLG = new AddEditPhoto(true); DLG.Photo = PhotoBrowser.SelectedPhoto; if (DLG.ShowDialog() == DialogResult.OK) { DBPhotosWebServices.UpdatePhoto(DLG.Photo); LoadPhoto(); } }
// Stocker une nouvelle image // Retourne le GUID de l'image créée public string Add(Image image) { Photo photo = new Photo { Title = "DB_Image", Shared = true, OwnerId = User.Id }; photo.SetImage(image); photo = DBPhotosWebServices.CreatePhoto(photo); DB_Photos.Add(photo); return(photo.ImageGUID); }
private void AddPhoto() { AddEditPhoto DLG = new AddEditPhoto(false); if (DLG.ShowDialog() == DialogResult.OK) { DLG.Photo.OwnerId = Logged_User.Id; DBPhotosWebServices.CreatePhoto(DLG.Photo); LoadPhoto(); } }
private void Submit_Task() { WaitSplash.Show(this, "Login..."); Logged_User = DBPhotosWebServices.Login(TBX_UserName.Text, TBX_Password.Text); if (CB_REMBEMBER.Checked) { Properties.Settings.Default.Password = TBX_Password.Text; Properties.Settings.Default.UserName = TBX_UserName.Text; Properties.Settings.Default.Save(); } WaitSplash.Hide(); }
private bool Validate_TBX_Username_OnSubmit(ref string message) { message = "Nom d'usager déjà utilisé"; if (User != null) { return(!DBPhotosWebServices.UserNameAlreadyUsed(User.Id, TBX_Username.Text)); } else { return(!DBPhotosWebServices.UserNameExist(TBX_Username.Text)); } }
// Efface l'image correspondant au GUID public void Delete(string GUID) { foreach (Photo photo in DB_Photos) { if (photo.ImageGUID == GUID) { DB_Photos.Remove(photo); DBPhotosWebServices.DeletePhoto(photo); break; } } }
private void InfoPhoto_Load(object sender, EventArgs e) { LoadSettings(); PictureBox.Image = Photo.GetOriginalImage(); TBX_Author.Text = User; TBX_Title.Text = Photo.Title; TBX_CreationDate.Text = Photo.CreationDate.ToString(); RTB_Description.Text = Photo.Description; TBX_Keywords.Text = Photo.Keywords; TBX_Size.Text = Photo.GetOriginalImage().Width + "x" + Photo.GetOriginalImage().Height + " pixels"; PBX_Avatar.BackgroundImage = DBPhotosWebServices.GetUser(Photo.OwnerId).GetAvatarOriginalImage(); }
private void SubmitTask() { if (User == null) { User = new User(); DLG_To_User(); User = DBPhotosWebServices.CreateUser(User); } else { DLG_To_User(); DBPhotosWebServices.UpdateUser(User); } }
private void OpenSlideShow() { Carousel DLG = new Carousel(); if (Slideshow.Count != 0) { DLG.PhotoList = Slideshow; } else { DLG.PhotoList = DBPhotosWebServices.GetFilteredPhotos(PhotoFilter); } DLG.Show(); }
private void LoadSettings() { if (!Properties.Settings.Default.FirstUse_MainForm) { // Position du fureteur // Puisqu'il que Properties n'offre pas l'option de choisir des enums, il est stocké en string switch (Properties.Settings.Default.PositionFureteur.ToLower()) { case "bottom": PhotoBrowser.Placement = PhotoBrowserPlacement.Bottom; break; case "top": PhotoBrowser.Placement = PhotoBrowserPlacement.Top; break; case "left": PhotoBrowser.Placement = PhotoBrowserPlacement.Left; break; case "right": PhotoBrowser.Placement = PhotoBrowserPlacement.Right; break; } // Liste des photos du carousel foreach (string ID in Properties.Settings.Default.PhotoCarousel) { Photo Photo = DBPhotosWebServices.GetPhoto(int.Parse(ID)); if (Photo != null) { Slideshow.Add(Photo); } } // Liste des usagers dans la blacklist foreach (string ID in Properties.Settings.Default.Blacklist) { Blacklist.Add(int.Parse(ID)); } CBX_BlackList_Load(); // Position du MainForm Location = Properties.Settings.Default.PositionMainForm; //Taille du MainForm Size = Properties.Settings.Default.TailleMainForm; } }
private void SubmitTask() { if (photo == null) { Photo photo = new Photo(); photo.SetImage(IBX_photo.BackgroundImage); photo.CreationDate = dateTimePicker1.Value; photo.Description = RTBX_description.Text; photo.Keywords = TB_keyword.Text; photo.Shared = CB_Shared.Checked; photo.Title = TB_title.Text; photo.OwnerId = User.Id; photo = DBPhotosWebServices.CreatePhoto(photo); } }
private void RemoveFromBlacklist() { if (CBX_BlackList.SelectedIndex >= 0) { foreach (int Id in Blacklist) { if (DBPhotosWebServices.GetUser(Id).Name == CBX_BlackList.SelectedItem.ToString()) { CBX_BlackList.Items.Remove(CBX_BlackList.SelectedItem); Blacklist.Remove(Id); CBX_BlackList.ResetText(); break; } } } }
private void MI_Account_Profile_Click(object sender, EventArgs e) { Profile DLG = new Profile(); DLG.User = Logged_User; DialogResult DGR = DLG.ShowDialog(); if (DGR == DialogResult.OK) { Logged_User = DLG.User; DBPhotosWebServices.UpdateUser(Logged_User); } else if (DGR == DialogResult.Yes) { DBPhotosWebServices.DeleteUser(Logged_User.Id); Logged_User = null; } Setup_Logged_User(); }
private void User_To_DLG() { User = DBPhotosWebServices.GetUser(UID); photo = DBPhotosWebServices.GetPhoto(ID); TB_Title.Text = photo.Title; TB_keywords.Text = photo.Keywords; RTBX_Description.Text = photo.Description; dateTimePicker1.Value = photo.CreationDate; IBX_photo.BackgroundImage = photo.GetOriginalImage(); TB_Left.Text = photo.GetOriginalImage().Width.ToString(); TB_right.Text = photo.GetOriginalImage().Height.ToString(); User u = DBPhotosWebServices.GetUser(photo.OwnerId); LB_Nom.Text = u.Name; if (photo.Shared) { LB_Shared.Text = "Shared"; } else { LB_Shared.Text = "Private"; } }
private void Diaporama_Shown(object sender, EventArgs e) { WaitSplash.Show(this, "Loading slide show photos..."); Slides = new List <Photo>(); // PhotoPool = new List<Photo>(); foreach (int photoId in SlideShowList) { // Obtenir la photo du service Photo photo = DBPhotosWebServices.GetPhoto(photoId); if (photo != null) { if (bl.IndexOf(photo.OwnerId) == -1) { Slides.Add(photo); } } } WaitSplash.Hide(); // Définir l'ordre des photos SetPhotosOrder(); // Démarrer l'horloge SlideshowTimer.Start(); }
private User Log_DB_Admin() { // return DBPhotosWebServices.Login("DB_Admin", "420-KA5"); return(DBPhotosWebServices.Login(UserName, Password)); }
private bool Validate_Password_OnSubmit(ref string message) { message = "Wrong password"; return(DBPhotosWebServices.PasswordMatch(TBX_UserName.Text, TBX_Password.Text)); }
private void Submit_Task() { WaitSplash.Show(this, "Login..."); Logged_User = DBPhotosWebServices.Login(TBX_UserName.Text, TBX_Password.Text); WaitSplash.Hide(); }
private bool Validate_UserName_OnSubmit(ref string message) { message = "User name does not exist"; return(DBPhotosWebServices.UserNameExist(TBX_UserName.Text)); }