Exemple #1
0
        public void Add(Form form)
        {
            #region argument checking

            if (form == null)
            {
                throw new ArgumentNullException("form");
            }

            if (!form.IsValid())
            {
                throw new InvalidOperationException("form is invalid");
            }

            #endregion

            try
            {
                // add the form
                PluginStore.Instance.Save(this, form);
            }
            catch (MessageException me)
            {
                if (me.ErrorNumber == PluginErrorCodes.IdAlreadyInUse)
                {
                    // throw with a new message
                    throw new MessageException(me.ErrorNumber, ResourceManager.GetMessage(FormMessages.NameAlreadyInUse));
                }

                throw;
            }
        }