using System;
using System.Drawing;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Windows;
using Microsoft.VisualBasic.CompilerServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.ApplicationServices;
using System.Windows.Media.Imaging;
using BDuct_Global;
namespace BDuct
{
public class Commands : IExtensionApplication
{
[CommandMethod("BDUCT_INSERT_BLOCK")]
public void BDuct_Insert_Block()
{
string BlockName = GlobalVariables.Duct_Shape + "_";
switch (GlobalVariables.SelectedButton.Name)
{
case "Duct_Main":
BlockName = BlockName + "DUCT";
break;
default:
break;
}
AutoCADFunctions.InsertBlock(BlockName);
}
[CommandMethod("BDuct")]
public void BDuct()
{
if (GlobalVariables.ps == null)
{
GlobalVariables
.ps = new PaletteSet
("BDuct",
new Guid
("{ECBFEC73-9FE4-4aa2-8E4B-3068E94A2BFA}")); GlobalVariables.ps.Style = PaletteSetStyles.ShowPropertiesMenu | PaletteSetStyles.ShowAutoHideButton | PaletteSetStyles.ShowCloseButton;
// ps.Icon = GetEmbeddedIcon("Example1.gold_1_32.ico")
GlobalVariables
.ps.MinimumSize = new Size
(412,
629); var myPalette = GlobalVariables.MainWindow;
myPalette.TableLayoutPanel1.BackColor = Color.FromArgb(59, 68, 83);
myPalette.GroupBox1.BackColor = Color.FromArgb(59, 68, 83);
myPalette.BackColor = Color.FromArgb(59, 68, 83);
myPalette.Panel10.BackColor = Color.FromArgb(59, 68, 83);
GlobalVariables.ps.Add("BDuct", myPalette);
GlobalVariables.ps.KeepFocus = false;
GlobalVariables.ps.Visible = true;
}
else if (GlobalVariables.ps.Visible == false)
{
GlobalVariables.ps.Visible = true;
}
}
public void Initialize()
{
// Throw New NotImplementedException()
}
public void Terminate()
{
// Throw New NotImplementedException()
}
private static void ps_Load(object sender, PalettePersistEventArgs e)
{
// demo loading user data
double a = Conversions.ToDouble(e.ConfigurationSection.ReadProperty("BDuct", 22.3d));
}
private static void ps_Save(object sender, PalettePersistEventArgs e)
{
// demo saving user data
e.ConfigurationSection.WriteProperty("BDuct", 32.3d);
}
}
}