public frmPorts(long ID, JBC_API_Remote jbcRef) { // Required by the designer InitializeComponent(); // Setting vars myID = ID; jbc = jbcRef; // Getting the number of ports nPorts = jbc.GetPortCount(myID); // Setting the configuration this.ClientSize = new Size((Configuration.PortsToolDataWidth + Configuration.PortsToolImgWidth) + Configuration.PortsHorzMargin * 2, nPorts * Math.Max(Configuration.PortsToolImgHeight, Configuration.PortsToolDataHeight) + Configuration.PortsVertMargin * (nPorts + 1)); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MinimizeBox = false; this.MaximizeBox = false; this.ShowIcon = false; //Me.BackgroundImage = PortsBackGndImg //Me.BackgroundImageLayout = ImageLayout.Center this.BackColor = Configuration.stnColorBackground; this.Location = new Point(System.Convert.ToInt32(PointToScreen(MousePosition).X - this.Width / 2), System.Convert.ToInt32(PointToScreen(MousePosition).Y - this.Height / 2)); this.Text = jbc.GetStationModel(myID) + " - " + jbc.GetStationName(myID) + " - " + Localization.getResStr(Configuration.PortsPortTitleId); // Creating the controls only if the port is present in the station if (nPorts >= 1) { createPortInstance(0, ref pcbTool1, ref lblData1); } if (nPorts >= 2) { createPortInstance(1, ref pcbTool2, ref lblData2); } if (nPorts >= 3) { createPortInstance(2, ref pcbTool3, ref lblData3); } if (nPorts >= 4) { createPortInstance(3, ref pcbTool4, ref lblData4); } // Launching the update timer tmr = new Timer(); tmr.Tick += tmr_Tick; tmr.Interval = 500; tmr.Start(); }
public async void startStationContinuousMode(SpeedContinuousMode speed = default(SpeedContinuousMode)) { // start new continuous mode queue for all of its ports int count = jbc.GetPortCount((long)ID); int a = (int)Port.NO_PORT; int b = (int)Port.NO_PORT; int c = (int)Port.NO_PORT; int d = (int)Port.NO_PORT; if (count >= 1) { a = (int)Port.NUM_1; } if (count >= 2) { b = (int)Port.NUM_2; } if (count >= 3) { c = (int)Port.NUM_3; } if (count >= 4) { d = (int)Port.NUM_4; } try { await jbc.SetContinuousModeAsync((long)ID, speed, (Port)a, (Port)b, (Port)c, (Port)d); uiContModeQueueID = System.Convert.ToUInt32(await jbc.StartContinuousModeAsync((long)ID)); //Debug.Print("startStationContinuousMode") } catch (Exception ex) { Console.WriteLine("Cstation::startStationContinuousMode . error:" + ex.Message); } }