Example #1
0
        public virtual void Erase()
        {
            Transaction trans = _database.TransactionManager.TopTransaction;
            Entity      ent   = (Entity)trans.GetObject(this.BaseObject, OpenMode.ForWrite);

            ent.Erase();

            foreach (DrawingObject drawingObject in SubObjects.Values)
            {
                drawingObject.Erase();
            }
            SubObjects.Clear();
        }
Example #2
0
        public override void BeforeEdit()
        {
            SubObjects.Clear();
            try
            {
                if (Value != null && Value.Contains($"\"Type\":\"{nameof(MenuItem)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <MenuItem>(Value));
                }
                else if (Value != null && Value.Contains($"\"Type\":\"{nameof(ModelSetting)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <ModelSetting>(Value));
                }
                else if (Value != null && Value.Contains($"\"Type\":\"{nameof(DisplaySetting)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <DisplaySetting>(Value));
                }
                else if (Value != null && Value.Contains($"\"Type\":\"{nameof(DataGridSetting)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <DataGridSetting>(Value));
                }
                else if (Value != null && Value.Contains($"\"Type\":\"{nameof(DataGridHandlerSetting)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <DataGridHandlerSetting>(Value));
                }
                else if (Value != null && Value.Contains($"\"Type\":\"{nameof(DialogOptions)}\""))
                {
                    SubObjects.Add(JsonSerializer.Deserialize <DialogOptions>(Value));
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine($"Error in {System.Reflection.MethodBase.GetCurrentMethod().Name}: {ex.Message}");
            }

            base.BeforeEdit();
        }