Ejemplo n.º 1
0
        private void btnLink_Click(object sender, EventArgs e)
        {
            if (ppiCurrent == null)
            {
                return;
            }

            AssignToCategory f = new AssignToCategory(ppiCurrent.PhotoInfo.ImageId, false);

            if (f.ShowDialog() == DialogResult.OK)
            {
                // Check if the current image got removed from the current category
                System.Collections.Hashtable h = PhotoInfo.GetCatListById(ppiCurrent.PhotoInfo.ImageId);
                if (!(bool)h[photoPreviewContainer1.CurrentCategory])
                {
                    photoPreviewContainer1.Controls.Remove(ppiCurrent);
                }

                // Check if category list needs to be refreshed
                if (f.needCategoryRefresh)
                {
                    supressCatChanged = true;
                    object selectedItem = _categories.SelectedItem;
                    InternalLoadCategories();
                    _categories.SelectedItem = selectedItem;
                    supressCatChanged        = false;
                }
            }
        }
Ejemplo n.º 2
0
        private void btnAddImage_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog f = new OpenFileDialog();

            Program.Presenter.BeginExKeyOwner();
            f.Title       = Loc.Get("Select image to add");
            f.Filter      = Loc.Get("Supported formats") + " | *.jpeg;*.jpg;*.png;*.bmp;*.gif | JPG | *.jpg | JPEG | *.jpeg | GIF | *.gif | PNG | *.png | BMP | *.bmp";
            f.Multiselect = false;
            if (f.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    int id = PhotoInfo.AddImage(Image.FromFile(f.FileName));
                    AssignToCategory a2c = new AssignToCategory(id, true);
                    if (a2c.ShowDialog() == DialogResult.OK)
                    {
                        LoadCategories();
                        photoPreviewContainer1.Controls.Clear();
                    }
                }
                catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.ToString()); }
            }
            Program.Presenter.EndExKeyOwner();
        }