Esempio n. 1
0
        protected override NotifyResult OnApply()
        {
            try
            {
                using (var propertySet = new FilePropertySet(TargetFiles[0]))
                {
                    propertySet.SetRtfDescription(GetDescription());
                    var comment = editor.DocumentText;
                    if (!string.IsNullOrEmpty(comment))
                    {
                        propertySet.SetComment(comment);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(NotifyResult.Invalid);
            }

            return(base.OnApply());
        }
Esempio n. 2
0
 protected override bool OnActivate()
 {
     try
     {
         using (var propertySet = new FilePropertySet(TargetFiles[0]))
         {
             var descr = propertySet.GetRtfDescription();
             if (descr != null && descr.Length > 0)
             {
                 SetDescription(descr);
             }
             else
             {
                 editor.DocumentText = propertySet.GetComment();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     return(base.OnActivate());
 }