예제 #1
0
 private void HandleAfterItemEdit(object sender, JetItemEditEventArgs e)
 {
     if (e.Text != null)
     {
         IResource res = (IResource)e.Item;
         if (AfterItemEdit != null)
         {
             ResourceItemEditEventArgs args = new ResourceItemEditEventArgs(e.Text, res, e.Column);
             AfterItemEdit(this, args);
         }
         else if (BeforeItemEdit == null)
         {
             IResourceRenameHandler renameHandler = Core.PluginLoader.GetResourceRenameHandler(res);
             if (renameHandler != null)
             {
                 renameHandler.ResourceRenamed(res, e.Text);
             }
             else
             {
                 IResourceUIHandler uiHandler = Core.PluginLoader.GetResourceUIHandler(res);
                 if (uiHandler != null)
                 {
                     uiHandler.ResourceRenamed(res, e.Text);
                 }
             }
         }
     }
 }
예제 #2
0
 private void HandleBeforeItemEdit(object sender, JetItemEditEventArgs e)
 {
     if (BeforeItemEdit != null)
     {
         ResourceItemEditEventArgs args = new ResourceItemEditEventArgs(e.Text, (IResource)e.Item, e.Column);
         BeforeItemEdit(this, args);
         e.Text       = args.Text;
         e.CancelEdit = args.CancelEdit;
     }
     else if (AfterItemEdit == null)
     {
         string text = e.Text;
         if (CanEditResourceLabel((IResource)e.Item, ref text))
         {
             e.Text = text;
         }
         else
         {
             e.CancelEdit = true;
         }
     }
 }