Пример #1
0
 protected virtual void OnMruMenuItemFileMissing(MruMenuItemFileMissingEventArgs e)
 {
     if (MruMenuItemFileMissing != null)
     {
         MruMenuItemFileMissing(this, e);
     }
 }
Пример #2
0
        private void MruMenuItem_Click(object sender, System.EventArgs e)
        {
            // Get clicked MruToolStripMenuItem
            MruToolStripMenuItem mruMenuItem = (MruToolStripMenuItem)sender;
            string filename = mruMenuItem.Filename;

            // Check if file is missing and, if so, ask if it needs to
            // be deleted. If nobody's registered with the MruMenuItemFileMissing
            // event, the file won't be deleted, MruMenuItemClick will be
            // called and an exception will be raised if the file is missing.
            MruMenuItemFileMissingEventArgs args = new MruMenuItemFileMissingEventArgs(filename, false);

            if (!File.Exists(filename))
            {
                OnMruMenuItemFileMissing(args);
                if (args.RemoveFromMru)
                {
                    this.mruMenuListItems.Remove(filename);
                    return;
                }
            }

            OnMruMenuItemClick(new MruMenuItemClickEventArgs(filename));
        }