示例#1
0
        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);
 }
示例#3
0
 public AddNewFileForm(File file, MainWindowForm parent, MyPhotosClient Client)
 {
     InitializeComponent();
     parentReference = parent;
     client          = Client;
     ImportDataFromFile(file);
 }
示例#4
0
        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();
        }
示例#5
0
        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();
        }
示例#6
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            landscape = new LandScape(LandScapeNameValue.Text, LandScapeDescriptionValue.Text);
            MyPhotosClient myPhotoClient = new MyPhotosClient();

            myPhotoClient.AddLandScape(landscape);
            Clear();
        }
示例#7
0
        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();
        }
示例#8
0
        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");
            }
        }
示例#9
0
        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;
            }
        }
示例#10
0
        static void testControlls()
        {
            MyPhotosClient client = new MyPhotosClient();

            Application.Run(new MainWindowForm(client));
        }
示例#11
0
 private void MyPhotosForm_Load(object sender, EventArgs e)
 {
     myPhotos = new MyPhotosClient();
 }
示例#12
0
 public MainWindowForm(MyPhotosClient Client)
 {
     client = Client;
     InitializeComponent();
     UpdateData();
 }
示例#13
0
 public CreatePropertyForm(AddPropertyToFileForm parentForm, MyPhotosClient Client)
 {
     InitializeComponent();
     ParentForm = parentForm;
     client     = Client;
 }