Exemplo n.º 1
0
        public void ApplyShortcuts()
        {
            logger.Trace("Applying shortcuts");

            keyboard_hook.UnregisterAll();
            Layouts.Where(l => !l.Shortcut.IsEmpty()).Apply(l => keyboard_hook.RegisterHotKey(l.Shortcut));
        }
Exemplo n.º 2
0
        public void SaveConfig()
        {
            _config.Default = Default.Name;
            _config.Layouts = new List <XamlLayout>(Layouts.Where(l => l.IsBuiltIn == false));

            Core.Configuration.SaveAsync(_config).RunAsync();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Provides access to the entities of all layouts. Each element provides access to the entities of one layout.
 /// The elements are in the order of the AutoCAD layout tabs.
 /// </summary>
 /// <returns>An IEnumerable&lt;EntityContainer&gt;. Each EntityContainer provides access to the entities of one layout.</returns>
 public IEnumerable <EntityContainer> PaperSpace()
 {
     foreach (var layout in Layouts.Where(l => !l.ModelType)
              .OrderBy(l => l.TabOrder))
     {
         yield return(new EntityContainer(Database, transaction, layout.BlockTableRecordId));
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Provides access to the entities of all layouts. Each element provides access to the entities of one layout.
        /// The elements are in the order of the AutoCAD layout tabs.
        /// </summary>
        /// <returns>An IEnumerable&lt;EntityContainer&gt;. Each EntityContainer provides access to the entities of one layout.</returns>
        public IEnumerable <EntityContainer> PaperSpace()
        {
            Require.NotDisposed(Database.IsDisposed, nameof(AcadDatabase));

            foreach (var layout in Layouts.Where(l => !l.ModelType)
                     .OrderBy(l => l.TabOrder))
            {
                yield return(new EntityContainer(Database, transaction, layout.BlockTableRecordId));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Provides access to the entities of the layout with the given tab index.
        /// </summary>
        /// <param name="index">The zero-based tab index of the layout.</param>
        /// <returns>An EntityContainer to access the layout's entities.</returns>
        public EntityContainer PaperSpace(int index)
        {
            Require.NotDisposed(Database.IsDisposed, nameof(AcadDatabase));

            var paperSpaceLayouts = Layouts.Where(l => !l.ModelType)
                                    .OrderBy(l => l.TabOrder)
                                    .ToArray();

            Require.ValidArrayIndex(index, paperSpaceLayouts.Length, nameof(index));

            return(new EntityContainer(Database, transaction, paperSpaceLayouts.ElementAt(index)
                                       .BlockTableRecordId));
        }
Exemplo n.º 6
0
 private void BeforePopupMenuLayout(object sender = null, EventArgs e = null)
 {
     foreach (var layout in Layouts.Where(l => l.LayoutType == 0 && l.UserId == DBUser.Working.Id))
     {
         AddStateItemToMenu(layout.Id, layout.LayoutName);
     }
     if (dxsmiRemove.Items.Count != 0)
     {
         dxsmiRemove.Items.Add(bbiDeleteStates);
     }
     dxsmiSaved.Enabled  = dxsmiSaved.Items.Count != 0;
     dxsmiRemove.Enabled = dxsmiRemove.Items.Count != 0;
 }
Exemplo n.º 7
0
 BaseLayoutElement GetSelectedLayout()
 {
     if (Layouts.Count(l => l.IsSelected == true) > 0)
     {
         BaseLayoutElement selectedLayout = Layouts.Where(l => l.IsSelected == true)
                                            .ToList().SingleOrDefault();
         return(selectedLayout);
     }
     else
     {
         Layouts[0].IsSelected = true;
         if (Get.i.Layouts.ContainsKey(Layouts[0].Id))
         {
             Get.i.Layouts.SaveLayout(Layouts[0]);
         }
         else
         {
             Get.i.Layouts.InsertLayout(Layouts[0]);
         }
     }
     return(Layouts[0]);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Provides access to the entities of the layout with the given tab index.
        /// </summary>
        /// <param name="index">The zero-based tab index of the layout.</param>
        /// <returns>An EntityContainer to access the layout's entities.</returns>
        public EntityContainer PaperSpace(int index)
        {
            var layouts = Layouts.ToArray();

            if (index < 0 || index >= layouts.Length)
            {
                throw Error.IndexOutOfRange("index", layouts.Length);
            }

            var blockId = Layouts.Where(l => !l.ModelType)
                          .OrderBy(l => l.TabOrder)
                          .ElementAt(index)
                          .BlockTableRecordId;

            try
            {
                return(new EntityContainer(Database, transaction, blockId));
            }
            catch (Exception e)
            {
                throw Error.AutoCadException(e);
            }
        }
Exemplo n.º 9
0
        public void SelectLayout(Guid key)
        {
            Layouts.Where(w => w.IsSelected == true)
            .ToList()
            .ForEach(f => f.IsSelected = false);

            Get.i.Layouts.UnselectAll();

            SelectedLayout            = Layouts.Where(w => w.Id == key).ToList().Single();
            SelectedLayout.IsSelected = true;

            if (Get.i.Layouts.ContainsKey(key))
            {
                Get.i.Layouts.SaveLayout(SelectedLayout);
            }
            else
            {
                Get.i.Layouts.InsertLayout(SelectedLayout);
            }

            SelectedLayout.SerializeToXml();

            Logger.Debug("Selected layout changed to: {0}", SelectedLayout.Name);
        }