Пример #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
        private void loadTemplate(ref string file)
        {
            //loading the template
            frmMainReg.plot.loadTPT(file, template);

            //clearing the tree
            trvTemplate.Nodes.Clear();

            //setting the template tree
            System.Windows.Forms.TreeNode node = default(System.Windows.Forms.TreeNode);
            int station = 0;
            int port    = 0;

            foreach (Cplot.tTPTserie s in template.series)
            {
                //if the serie station don't exist creating it
                // 06/08/2013 #edu# station model added in template. Current format "ID - stnname - stnmodel"
                // do not match with node text
                string[] seriestn = s.station.Split("-".ToCharArray());
                Array.Resize(ref seriestn, 3);
                ManRegGlobal.cListStation stn = new ManRegGlobal.cListStation(seriestn[0].Trim(), seriestn[1].Trim(), seriestn[2].Trim());
                if (!lookForNode(trvTemplate.Nodes, stn.Text, ref station))
                {
                    node           = trvTemplate.Nodes.Add(stn.Text);
                    node.Tag       = stn;
                    node.ForeColor = Color.Black;
                    node           = node.Nodes.Add(System.Convert.ToString(s.port));
                    node.ForeColor = Color.Black;
                    node.Tag       = s.port;
                    node           = node.Nodes.Add(s.name);
                    node.ForeColor = s.clr;
                }
                else
                {
                    if (!lookForNode(trvTemplate.Nodes[station].Nodes, System.Convert.ToString(s.port), ref port))
                    {
                        node           = trvTemplate.Nodes[station].Nodes.Add(System.Convert.ToString(s.port));
                        node.ForeColor = Color.Black;
                        node           = node.Nodes.Add(s.name);
                        node.ForeColor = s.clr;
                    }
                    else
                    {
                        node           = trvTemplate.Nodes[station].Nodes[port].Nodes.Add(s.name);
                        node.ForeColor = s.clr;
                    }
                }
            }

            //updating the tree
            trvTemplate.ExpandAll();
            trvTemplate.Update();

            //indicating the trigger type
            Cplot.cTrigger triggerType = template.trigger;
            lblTriggerType.Text = ManRegGlobal.getTriggerText(triggerType);

            //enabling the apply button
            butApply.Enabled = true;
        }
Пример #3
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;
        }
Пример #4
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;
        }