Beispiel #1
0
        private void  ConfigurationLoad()
        {
            configFileName = OSservices.AddSlash(PicesSipperVariables.ConfigurationDirectory()) + "ImageViewer.cfg";
            System.IO.StreamReader i = null;
            dataFieldAssignments    = new int[4];
            dataFieldAssignments[0] = PicesInstrumentData.GetFieldNum("Depth");
            dataFieldAssignments[1] = PicesInstrumentData.GetFieldNum("Temperature");
            dataFieldAssignments[2] = PicesInstrumentData.GetFieldNum("Oxygen");
            dataFieldAssignments[3] = PicesInstrumentData.GetFieldNum("Salinity");

            try { i = new System.IO.StreamReader(configFileName); }  catch (Exception) { i = null; }
            if (i != null)
            {
                String nextLine = null;

                while (true)
                {
                    try  { nextLine = i.ReadLine(); }  catch (Exception) { break; }
                    if (nextLine == null)
                    {
                        break;
                    }

                    nextLine = nextLine.Trim();

                    if ((nextLine.Length < 3) || (nextLine.Substring(0, 2) == "//"))
                    {
                        continue;
                    }

                    String[] fields = nextLine.Split('\t');
                    if (fields.Length != 2)
                    {
                        continue;
                    }

                    String fieldName  = fields[0];
                    String fieldValue = fields[1];

                    switch (fieldName)
                    {
                    case  "DataLabel0":  dataFieldAssignments[0] = PicesInstrumentData.GetFieldNum(fieldValue);   break;

                    case  "DataLabel1":  dataFieldAssignments[1] = PicesInstrumentData.GetFieldNum(fieldValue);   break;

                    case  "DataLabel2":  dataFieldAssignments[2] = PicesInstrumentData.GetFieldNum(fieldValue);   break;

                    case  "DataLabel3":  dataFieldAssignments[3] = PicesInstrumentData.GetFieldNum(fieldValue);   break;
                    }
                }

                i.Close();
            }
        } /* ConfigurationLoad */
Beispiel #2
0
        private void  SelectDataField(int dataLabelNum)
        {
            String existingSelField      = DataLabels[dataLabelNum].Text;
            SelectAInstrumentDataField f = new SelectAInstrumentDataField(existingSelField);

            f.ShowDialog();

            string newSelectedDataFieldStr = f.SelectedDataField;
            int    fieldIdxNew             = PicesInstrumentData.GetFieldNum(newSelectedDataFieldStr);

            if (fieldIdxNew >= 0)
            {
                dataFieldAssignments[dataLabelNum] = fieldIdxNew;
                DataLabels[dataLabelNum].Text      = PicesInstrumentData.FieldName(fieldIdxNew);
                ConfigurationSave();
            }

            UpdateDataFields();
        } /* SelectDataField */