private void createFolder(object sender, EventArgs e) { MyPhotosClient client = new MyPhotosClient(); DialogBox dlg = new DialogBox(); if (dlg.ShowDialog() == DialogResult.Yes) { string workingDirectory = Environment.CurrentDirectory; string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.FullName; string folderPath = Path.Combine(projectDirectory, dlg.FolderName); if (!Directory.Exists(folderPath)) { System.IO.Directory.CreateDirectory(folderPath); dt = Directory.GetCreationTime(folderPath); //using client API client.AddFolder(dlg.FolderName, folderPath, dt.ToString()); string message = "Folder created succesfully!"; string caption = "Success"; MessageBoxButtons buttons = MessageBoxButtons.OK; // MessageBox result; MessageBox.Show(message, caption, buttons); treeView1.Refresh(); } else { //show a message to user MessageBox.Show("Your folder already exists. Please provide other name!", "Error", MessageBoxButtons.OK); } } }
public AddPropertyToFileForm(AddNewFileForm Parent, File file, MyPhotosClient Client) { InitializeComponent(); parent = Parent; client = Client; InitializeData(file); }
public AddNewFileForm(File file, MainWindowForm parent, MyPhotosClient Client) { InitializeComponent(); parentReference = parent; client = Client; ImportDataFromFile(file); }
private void SavePerson_Click(object sender, EventArgs e) { person = new Person(FirstNameValue.Text, LastNameValue.Text, AgeValue.Value.ToString()); MyPhotosClient myPhotoClient = new MyPhotosClient(); myPhotoClient.AddPerson(person); Clear(); }
private void SaveButton_Click(object sender, EventArgs e) { location = new Location(LocationNameValue.Text, LocationDescriptionValue.Text, LocationTypeValue.Text); MyPhotosClient myPhotoClient = new MyPhotosClient(); myPhotoClient.AddLocation(location); Clear(); }
private void SaveButton_Click(object sender, EventArgs e) { landscape = new LandScape(LandScapeNameValue.Text, LandScapeDescriptionValue.Text); MyPhotosClient myPhotoClient = new MyPhotosClient(); myPhotoClient.AddLandScape(landscape); Clear(); }
private void SaveButton_Click(object sender, EventArgs e) { myEvent = new MyPhotosV2.Event(EventNameValue.Text, EventDescriptionValue.Text); // eventAPI.AddEvent(myEvent); MyPhotosClient myPhotoClient = new MyPhotosClient(); myPhotoClient.AddEvent(myEvent); Clear(); }
private void UpdateButton_Click(object sender, EventArgs e) { MyPhotosClient myPhotoClient = new MyPhotosClient(); if (selectedPhoto != null) { string LocationName = LocationUpdateComb.Text; string LandScapeName = LandScapeUpdateComb.Text; string PersonName = PersonUpdateComb.Text; string EventName = EventUpdateComb.Text; int LocationId; int LandScapeId; int PersonId; int EventId; if (LocationName != "") { LocationId = myPhotoClient.GetIdByName(LocationName); } else { LocationId = selectedPhoto.LocationId; } if (LandScapeName != "") { LandScapeId = myPhotoClient.GetIdByName(LandScapeName); } else { LandScapeId = selectedPhoto.LandScapeId; } if (PersonName != "") { PersonId = myPhotoClient.GetIdByName(PersonName.Substring(0, PersonName.IndexOf(" "))); } else { PersonId = selectedPhoto.PersonId; } if (EventName != "") { EventId = myPhotoClient.GetIdByName(EventName); } else { EventId = selectedPhoto.EventId; } // myPhotoClient.UpdatePhoto(selectedPhoto, EventId, LandScapeId, PersonId, LocationId); } else { MessageBox.Show("No image selected"); } }
private void FindButton_Click(object sender, EventArgs e) { List <Photo> photos; MyPhotosClient myPhotoClient = new MyPhotosClient(); string LocationName = LocationComb.Text; string LandScapeName = LandScapeComb.Text; string PersonName = PersonComb.Text; string EventName = EventComb.Text; int LocationId = myPhotoClient.GetIdByName(LocationName); int LandScapeId = myPhotoClient.GetIdByName(LandScapeName); int PersonId = myPhotoClient.GetIdByName(PersonName.Substring(0, PersonName.IndexOf(" "))); int EventId = myPhotoClient.GetIdByName(EventName); photos = myPhotoClient.GetPhoto(LocationId, LandScapeId, PersonId, EventId); if (photos.Count > 0) { foreach (Photo photo in photos) { if (File.Exists(photo.FullPath)) { PictureList.Items.Add(photo.FullPath); selectedPhoto = photo; } else { myPhotoClient.UpdateIsRemoved(photo); } } } else { PictureList.Items.Clear(); pictureBox1.Image = null; } }
static void testControlls() { MyPhotosClient client = new MyPhotosClient(); Application.Run(new MainWindowForm(client)); }
private void MyPhotosForm_Load(object sender, EventArgs e) { myPhotos = new MyPhotosClient(); }
public MainWindowForm(MyPhotosClient Client) { client = Client; InitializeComponent(); UpdateData(); }
public CreatePropertyForm(AddPropertyToFileForm parentForm, MyPhotosClient Client) { InitializeComponent(); ParentForm = parentForm; client = Client; }