Esempio n. 1
0
 private void changeMetadataToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (SelectedItems.Count() == 1)
     {
         var pc = SelectedItems.First();
         var rf = new ColorChangeTextForm(
             string.Format("Metadata for \"{0}\" ({1})", pc.Name, pc.Color.ToRgb().ToHtml()),
             pc.Metadata, pc);
         if (rf.ShowDialog(this) == DialogResult.OK)
         {
             appPal.ChangeMetadata(pc, rf.NewValue);
         }
     }
     else if (SelectedItems.Count() > 1)
     {
         var pc = SelectedItems.First();
         var rf = new ColorChangeTextMultipleForm("Metadata", false);
         if (rf.ShowDialog(this) == DialogResult.OK)
         {
             var names = Enumerable.Repeat(rf.NewText, SelectedItems.Count()).ToArray();
             if (rf.Numbered)
             {
                 for (int i = 0; names.Count() > i; i++)
                 {
                     names[i] = string.Format("{0} ({1})", names[i], i + 1);
                 }
             }
             appPal.ChangeMetadata(SelectedItems
                                   .Zip(names, (x, y) => new { Key = x, Value = y })
                                   .ToDictionary(x => x.Key, x => x.Value));
         }
     }
 }
Esempio n. 2
0
    public void ChangeMetadataSelection()
    {
        var pc = SelectedItems.First();
        var rd = new RenameColorDialog(pc.Color, pc.Metadata, "Change Metadata");

        if (rd.Run() == (int)ResponseType.Ok)
        {
            appPal.ChangeMetadata(pc, rd.NewText);
        }
        rd.Destroy();
    }