private Brush backgroundBrush2, buttonBrush, highlightButtonBrush; // for Skins support public PageCustomTab1() { InitializeComponent(); ttbVersion.Text = "PPNC_Router_Addin v0.50"; // Register for translation all TextBlocks whose names begin with "ttb" and all "btn" Buttons. g.theTranslator.RegisterAllUIElements <TextBlock>(this, "ttb"); g.theTranslator.RegisterAllUIElements <Button>(this, "btn"); // Controls and strings may also be registered individually. (See MCF Dev Guide.) g.theTranslator.RegisterText("You clicked the ENABLE button!"); g.theTranslator.RegisterText("You clicked the DISABLE button!"); backgroundBrush2 = (Brush)FindResource("BackgroundBrush2"); // for Skins support buttonBrush = (Brush)FindResource("ButtonBrush"); highlightButtonBrush = (Brush)FindResource("HighlightButtonBrush"); // Obtain references to objects, devices and members, and attach Changed handlers. (See MCF Dev Guide.) // Note: Members cannot be created here! Members must be created in FObject constructors where they will be // added to the Machine View hierarchy. All members must exist before the WPF Pages are created. AxesDisplay = FMember.GetRef("Axes.Display"); AxesDisplay.ChangedAsString += AxesDisplay_ChangedAsString; //FMember.AddHandler("Axes.Display", AxesDisplay_ChangedAsString); // equivalent if you don't need the member reference Tool = FDeviceInteger.GetRef("Tool.Tool", this); Tool.Changed += Tool_Changed; FDeviceInteger.AddHandler("Tool.Tool", Tool_Changed); Tool_Number_In_Spindle = FDeviceInteger.GetRef("CustomObject.Tool_Number_In_Spindle", this); Tool_Number_In_Spindle.Changed += Tool_Number_In_Spindle_Changed; FDeviceInteger.AddHandler("CustomObject.Tool_Number_In_Spindle", Tool_Number_In_Spindle_Changed); tbToolCurrent.Text = String.Format("Current Tool in Spindle: {0}", Tool.Value); tbToolNext.Text = String.Format("Next Tool (Active Tcode): {0}", Tool_Number_In_Spindle.Value); tbEditTool.KeyDown += tbEditTool_KeyDown; }
public CustomObject(FObject Owner) : base(Owner, "CustomObject") { //DisplayName = "Custom Object"; DisplayName = "CNC Router"; Description = "Use this Custom Object as a starting point for your development."; Image = new BitmapImage(new Uri("/PPNC_Router_Addin;component/Images/stingray.png", UriKind.Relative)); // 24x24 PNG // Obtain references to the main application's objects, devices and members, and attach Changed handlers. // (See MCF Dev Guide.) theController = FDevice.GetRef("Controller"); AxesDisplay = FMember.GetRef("Axes.Display"); AxesDisplay.ChangedAsString += AxesDisplay_ChangedAsString; // Device members created here will appear in Machine View in the main application. (See MCF Dev Guide.) // FDeviceBoolean, FDeviceInteger, FDeviceFloat, FDeviceDouble, FDeviceString, FDeviceList<T>, FDeviceFile. // The PMAC variables and update rates are specified in this project's "DeviceMembers.xml" file. var ToolNumberInSpindle = new FDeviceInteger(this, theController, "Tool Number In Spindle", "P821", 500, EMemberCategory.Setting) { Description = "Tool Number NOW in Spindle." }; var PowerPendantEnabled = new FDeviceBoolean(this, theController, "PowerPendantEnabled", "P820", 500, EMemberCategory.Setting) { Description = "This boolean highlights one of the two buttons on \"Custom Page\"." }; var XaxisParkPosition = new FDeviceDouble(this, theController, "XAxisParkPositionInch", "P822", 500, EMemberCategory.Setting) { Description = "X Axis Park Position in Absolute Machine Inches." }; var YaxisParkPosition = new FDeviceDouble(this, theController, "YAxisParkPositionInch", "P823", 500, EMemberCategory.Setting) { Description = "Y Axis Park Position in Absolute Machine Inches." }; var ZaxisParkPosition = new FDeviceDouble(this, theController, "ZAxisParkPositionInch", "P824", 500, EMemberCategory.Setting) { Description = "Z Axis Park Position in Absolute Machine Inches." }; var XaxisParkSpeed = new FDeviceDouble(this, theController, "XAxisParkSpeedIpm", "P825", 500, EMemberCategory.Setting) { Description = "X Axis Park Speed (In/Min)" }; var YaxisParkSpeed = new FDeviceDouble(this, theController, "YAxisParkSpeedIpm", "P826", 500, EMemberCategory.Setting) { Description = "Y Axis Park Speed (In/Min)" }; var ZaxisParkSpeed = new FDeviceDouble(this, theController, "ZAxisParkSpeedIpm", "P827", 500, EMemberCategory.Setting) { Description = "Z Axis Park Speed (In/Min)" }; var XAwayPos = new FDeviceDouble(this, theController, "XAwayPosInch", "P828", 500, EMemberCategory.Setting) { Description = "X Axis Away from Park Inches (Pins Go Down)" }; var SheetZeroOffset = new FDeviceDouble(this, theController, "SheetZeroOffsetInch", "P829", 500, EMemberCategory.Setting) { Description = "X Distance to Start of Sheet (Inches)" }; var SheetLength = new FDeviceDouble(this, theController, "SheetLengthInch", "P830", 500, EMemberCategory.Setting) { Description = "Sheet Length Default (Inches)" }; var Roller1MinPos = new FDeviceDouble(this, theController, "Roller1MinPosInch", "P831", 500, EMemberCategory.Setting) { Description = "Roller 1 Min Position Inches" }; var Roller1MaxPos = new FDeviceDouble(this, theController, "Roller1MaxPos", "P832", 500, EMemberCategory.Setting) { Description = "Roller 1 Max Position Inches" }; var Roller2MinPos = new FDeviceDouble(this, theController, "Roller2MinPos", "P833", 500, EMemberCategory.Setting) { Description = "Roller 2 Min Position Inches" }; var Roller2MaxPos = new FDeviceDouble(this, theController, "Roller2MaxPos", "P834", 500, EMemberCategory.Setting) { Description = "Roller 2 Max Position Inches" }; var Roller3MinPos = new FDeviceDouble(this, theController, "Roller3MinPos", "P835", 500, EMemberCategory.Setting) { Description = "Roller 3 Min Position Inches" }; var Roller3MaxPos = new FDeviceDouble(this, theController, "Roller3MaxPos", "P836", 500, EMemberCategory.Setting) { Description = "Roller 3 Max Position Inches" }; var Roller4MinPos = new FDeviceDouble(this, theController, "Roller4MinPos", "P837", 500, EMemberCategory.Setting) { Description = "Roller 4 Min Position Inches" }; var Roller4MaxPos = new FDeviceDouble(this, theController, "Roller4MaxPos", "P838", 500, EMemberCategory.Setting) { Description = "Roller 4 Max Position Inches" }; }