Esempio n. 1
0
        private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                this.projectBindingSource.EndEdit();

                if (this.MdiChildren.Any(x => x.GetType() == typeof(FormProperties)))
                {
                    Form frm = this.MdiChildren.Single(x => x.GetType() == typeof(FormProperties));
                    frm.WindowState = FormWindowState.Normal;
                    frm.BringToFront();
                }
                else
                {
                    FormProperties frm = new FormProperties();
                    frm.Service   = this.Service;
                    frm.MdiParent = this;
                    frm.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error while modifing preferences");
            }
        }
Esempio n. 2
0
        public static DialogResult ShowForm(object value)
        {
            var formProps = new FormProperties {
                propertyGrid1 = { SelectedObject = value }
            };

            return(Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(formProps));
        }
        internal RequestForm(IHasRequestForm container)
        {
            Container = container;

            Properties = new FormProperties(this);

            Controls = new FormControls(this);
        }
Esempio n. 4
0
        protected virtual void SetFormProperties()
        {
            var flags = BindingFlags.Public | BindingFlags.Instance |
                        (UseInheritedProperties ? BindingFlags.Default : BindingFlags.DeclaredOnly);

            FormProperties = typeof(TE).GetProperties(flags)
                             .Where(p => p.CustomAttributes.All(a => a.AttributeType != typeof(IsReadOnlyAttribute))).ToList();
            if (typeof(IOrderedEntity).IsAssignableFrom(typeof(TE)))
            {
                FormProperties.Remove(typeof(TE).GetProperty(nameof(IOrderedEntity.OrderIndex)));
            }
        }
Esempio n. 5
0
        public static void Write(this FormProperties formProperties, CSideWriter writer)
        {
            writer.BeginSection("PROPERTIES");

            var relevantProperties = formProperties.Where(p => p.HasValue);

            foreach (var property in relevantProperties)
            {
                var isLastProperty = (property == relevantProperties.Last());
                property.Write(isLastProperty, PropertiesStyle.Object, writer);
            }

            writer.EndSection();
        }
        /// <summary>
        /// Метод сохранения формы в конфиг
        /// </summary>
        /// <param name="FormName">Имя формы</param>
        /// <param name="StartPos">Позиция при создании формы</param>
        /// <param name="Location">Последнее местоположение</param>
        /// <param name="Size">Размер формы</param>
        /// <param name="WinState">Состояние окна(мин, макс, хайд)</param>
        public void SaveResizedForm(string FormName, System.Windows.Forms.FormStartPosition StartPos,
            System.Drawing.Point Location, System.Drawing.Size Size, System.Windows.Forms.FormWindowState WinState)
        {
            if ((_settings as IFormsSettingsForSettings) == null)
                return;

            if ((_settings as IFormsSettingsForSettings).Forms == null)
                (_settings as IFormsSettingsForSettings).Forms = new FormsSettings();

            FormProperties fSettings = (_settings as IFormsSettingsForSettings).Forms.FindFormByName(FormName);
            bool add = false;
            if (fSettings == null)
            {
                fSettings = new FormProperties();
                add = true;
            }
            fSettings.FormName = FormName;
            fSettings.StartPosition = StartPos;
            fSettings.FormLocation = Location;
            fSettings.FormSize = Size;
            fSettings.FormState = WinState;
            if (add)
                (_settings as IFormsSettingsForSettings).Forms.Add(fSettings);
            Save();
        }
        /// <summary>
        /// Метод сохранение состояния окна в конфиг
        /// </summary>
        /// <param name="FormName">Имя формы</param>
        /// <param name="State">Состояние окна(мин, макс, хайд)</param>
        public void SaveFormWindowState(string FormName, System.Windows.Forms.FormWindowState State)
        {
            if (!(_settings is IFormsSettingsForSettings))
                return;

            if ((_settings as IFormsSettingsForSettings).Forms == null)
                (_settings as IFormsSettingsForSettings).Forms = new FormsSettings();

            FormProperties fSettings = (_settings as IFormsSettingsForSettings).Forms.FindFormByName(FormName);
            bool add = false;
            if (fSettings == null)
            {
                fSettings = new FormProperties();
                fSettings.FormName = FormName;
                add = true;
            }

            fSettings.FormState = State;
            if (add)
                (_settings as IFormsSettingsForSettings).Forms.Add(fSettings);
            Save();
        }
 protected override void SetFormProperties()
 {
     FormProperties.AddRange(GetRelevantProperties());
 }