Пример #1
0
 private void loadSeriesStations(List <ulong> listSeriesStations)
 {
     ManRegGlobal.cListStation stn = default(ManRegGlobal.cListStation);
     bLoadingStations = true;
     stationList.Clear();
     foreach (ulong ID in listSeriesStations)
     {
         // search id in connected stations
         bool bConnected = false;
         foreach (ManRegGlobal.cConnectedStation connStn in ManRegGlobal.connectedStations)
         {
             if (ulong.Parse(connStn.ID) == ID)
             {
                 bConnected = true;
                 break;
             }
         }
         if (bConnected)
         {
             stn = new ManRegGlobal.cListStation(Convert.ToString(ID), jbc.GetStationName((long)ID), jbc.GetStationModel((long)ID));
             stationList.Add(stn);
         }
     }
     cbxStation.DataSource    = null; // para que actualice el combo box
     cbxStation.DataSource    = stationList;
     cbxStation.DisplayMember = "Text";
     cbxStation.ValueMember   = "ID";
     bLoadingStations         = false;
 }
Пример #2
0
        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();
        }
Пример #3
0
        private void updateConnectedStations()
        {
            bUpdatingStations = true;
            bool   bSelectStationIDFound = false;
            bool   bSelectValueIDFound   = false;
            string selectedValue         = System.Convert.ToString(cbxStation.SelectedValue);

            // Loading the connected stations
            //For Each stn As cListStation In stationList
            //    stn = Nothing
            //Next
            stationList.Clear();
            foreach (ManRegGlobal.cConnectedStation connStn in ManRegGlobal.connectedStations)
            {
                ManRegGlobal.cListStation stn = new ManRegGlobal.cListStation(connStn.ID, jbc.GetStationName(long.Parse(connStn.ID)), jbc.GetStationModel(long.Parse(connStn.ID)));
                stationList.Add(stn);
                if (connStn.ID == sSelectStationID)
                {
                    bSelectStationIDFound = true;
                }
                if (connStn.ID == selectedValue)
                {
                    bSelectValueIDFound = true;
                }
            }
            if (!bSelectStationIDFound)
            {
                sSelectStationID = "";
            }

            cbxStation.DataSource    = null;
            cbxStation.DataSource    = stationList;
            cbxStation.DisplayMember = "Text";
            cbxStation.ValueMember   = "ID";

            // Restoring the selected item
            try
            {
                if (!string.IsNullOrEmpty(sSelectStationID))
                {
                    cbxStation.SelectedValue = sSelectStationID;
                }
                else if (bSelectValueIDFound)
                {
                    cbxStation.SelectedValue = selectedValue;
                }
                else
                {
                    cbxStation.SelectedIndex = -1;
                }
            }
            catch (Exception)
            {
                cbxStation.SelectedIndex = -1;
            }

            bUpdatingStations = false;
        }
Пример #4
0
        //Private Sub loadAvailableStations()
        //    ' Loading the connected stations
        //    stationLst.Clear()
        //    For Each ID As ULong In connectedStations
        //        stationLst.Add(ID.ToString & " - " & jbc.GetStationName(ID))
        //    Next

        //End Sub

        private void updateConnectedStations()
        {
            bUpdatingStations = true;
            string selectedValue = System.Convert.ToString(cbxStationTrigger.SelectedValue);

            // Loading the connected stations
            //foreach (ManRegGlobal.cListStation stn in stationList)
            //{
            //    stn = null;
            //}
            stationList.Clear();
            foreach (ManRegGlobal.cConnectedStation connStn in ManRegGlobal.connectedStations)
            {
                ManRegGlobal.cListStation stn = new ManRegGlobal.cListStation(connStn.ID, jbc.GetStationName(long.Parse(connStn.ID)), jbc.GetStationModel(long.Parse(connStn.ID)));
                stationList.Add(stn);
            }
            cbxStationTrigger.DataSource    = stationList;
            cbxStationTrigger.DisplayMember = "Text";
            cbxStationTrigger.ValueMember   = "ID";

            // Restoring the selected item
            try
            {
                cbxStationTrigger.SelectedValue = selectedValue;
            }
            catch (Exception)
            {
                cbxStationTrigger.SelectedIndex = -1;
            }

            bUpdatingStations = false;
        }