public TaskContainer(Control MainControl, IUSB_Controller usb, TaskDialog RunningTaskDialog) { asyncWorker.RunWorkerCompleted += asyncWorkerComplete; asyncWorker.ProgressChanged += asyncWorkerProgressChange; asyncWorker.WorkerReportsProgress = true; asyncWorker.WorkerSupportsCancellation = true; USB = usb; HostControl = MainControl; taskDialog = RunningTaskDialog; }
private void Form1_Load(object sender, EventArgs e) { ExtLog.Logger = logger1; if (ApplicationDeployment.IsNetworkDeployed) { Text += ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(4); } else { Text += Assembly.GetExecutingAssembly().GetName().Version.ToString(); } #region View initialization cursorCrossHair = new CrossHair(0, 0, Color.Blue); drillCrossHair = new CrossHair(0, 0, Color.Red); CNCTableBox = new Box(0, 0, 6, 6, Color.LightGray); drawingPageBox = new Box(0, 0, 8.5f, 11, Color.GhostWhite); moveTarget = new Cross(0, 0, Color.Yellow); nodeViewer = new Viewer(OutputLabel, new PointF(11.0f, 11.0f)); nodeViewer.OnSelect += OnSelect; lastSelectedStatus = DrillNode.DrillNodeStatus.Idle; lastSelectedIndex = -1; RebuildListBoxAndViewerFromNodes(); #endregion #region UI Initialization AxisOffsetComboBox.SelectedIndex = 0; AxisOffsetCount = 1; XScaleTextBox.Text = GlobalProperties.X_Scale.ToString("D"); YScaleTextBox.Text = GlobalProperties.Y_Scale.ToString("D"); XBacklastTextbox.Text = GlobalProperties.X_Backlash.ToString("D"); YBacklastTextbox.Text = GlobalProperties.Y_Backlash.ToString("D"); #endregion #region USB interface initialization USBdevicesComboBox.Items.Clear(); var USBDevices = USB.GetDevicesList(); if (USBDevices.Count > 0) { foreach (var uDev in USBDevices) { USBdevicesComboBox.Items.Add(uDev); } USBdevicesComboBox.SelectedIndex = 0; } else { USBdevicesComboBox.Items.Add("[None]"); USB = new USB_Control_Emulator(); } USB.OnProgress = OnProgress; USB.OnMove = onMove; USB.OnMoveCompleted = OnMoveCompleted; USB.X_StepMotor_Driver_Enable = checkBoxX.Checked; USB.Y_StepMotor_Driver_Enable = checkBoxY.Checked; USB.TQA_Driver_Enable = checkBoxT.Checked; USB.Cycle_Drill = checkBoxD.Checked; USB.Inhibit_Backlash_Compensation = IgnoreBacklashBox.Checked; TaskRunner = new TaskContainer(this, USB, taskDialog) { UpdateNodes = OnUpdateNode }; #endregion }