void onActivePrintItemChanged(object sender, EventArgs e) { // first we have to remove any link to an old part (the part currently in the view) if (activePrintPreviewImage.PrintItem != null) { activePrintPreviewImage.PrintItem.SlicingOutputMessage.UnregisterEvent(PrintItem_SlicingOutputMessage, ref unregisterEvents); } activePrintPreviewImage.PrintItem = PrinterConnectionAndCommunication.Instance.ActivePrintItem; // then hook up our new part if (activePrintPreviewImage.PrintItem != null) { activePrintPreviewImage.PrintItem.SlicingOutputMessage.RegisterEvent(PrintItem_SlicingOutputMessage, ref unregisterEvents); } activePrintPreviewImage.Invalidate(); }
private void onActivePrintItemChanged(object sender, EventArgs e) { // first we have to remove any link to an old part (the part currently in the view) if (activePrintPreviewImage.ItemWrapper != null) { activePrintPreviewImage.ItemWrapper.SlicingOutputMessage -= PrintItem_SlicingOutputMessage; } activePrintPreviewImage.ItemWrapper = PrinterConnectionAndCommunication.Instance.ActivePrintItem; // then hook up our new part if (activePrintPreviewImage.ItemWrapper != null) { activePrintPreviewImage.ItemWrapper.SlicingOutputMessage += PrintItem_SlicingOutputMessage; } activePrintPreviewImage.Invalidate(); }