Ejemplo n.º 1
0
        public void SetCollection(ObservableNumericValueCollection c)
        {
            Collection = new IObservableNumericValue[c.Count];

            for (int i = 0; i < c.Count; i++)
            {
                Collection[i] = c[i];
            }
        }
Ejemplo n.º 2
0
        public TestConfigTabControl()
        {
            InitializeComponent();

            activeTestConfiguration = new TestConfiguration();
            instructionEntries      = new List <InstructionUIEntry>();
            observedValues          = new ObservableNumericValueCollection();
            observedValueLabels     = new List <string>();

            if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
            {
                SetUpTestConfigurationPanel();
            }
        }
Ejemplo n.º 3
0
        public ObservableNumericValueCollection GetCollection()
        {
            ObservableNumericValueCollection c = new ObservableNumericValueCollection();

            if (Collection.Length > 0)
            {
                foreach (IObservableNumericValue n in Collection)
                {
                    c.Add(n);
                }
            }

            return(c);
        }
Ejemplo n.º 4
0
        private void ReceiveSensorList(object _sensor_list, string attribute, string label)
        {
            Debug.Log("Receive sensor list " + attribute);
            JObject sensor_list = (JObject)_sensor_list;

            ThreadHelper.UI_Invoke(this, null, UISensorCheckboxList, (data) =>
            {
                autoObservableValues = new ObservableNumericValueCollection();
                foreach (var elem in (JObject)data["sensor_list"])
                {
                    if (!sensor_information.ContainsKey(elem.Key))
                    {
                        //string sensor_name = label + ": " + elem.Key;
                        string sensor_name = elem.Key;

                        sensor_information.Add(sensor_name, elem.Value.ToString());

                        UISensorCheckboxList.Items.Add(sensor_name);

                        if (DataReceiver.Observe)
                        {
                            AddParameterControlRow(new ObservedDataRow
                            {
                                name  = elem.Key,
                                value = ""
                            }
                                                   );

                            IObservableNumericValue o = autoObservableValues.AddWithType(elem.Key, elem.Value.ToString());
                            o.OnUpdate(ObservedValueChanged);
                        }
                    }
                }
                if (autoObservableValues.Count > 0)
                {
                    autoParamControlTemplate.SetCollection(autoObservableValues);
                    DataReceiver.SetObservableNumericValues(autoObservableValues);
                }
            }, new Hashtable {
                { "form", this },
                { "panel", null },
                { "control", UISensorCheckboxList },
                { "sensor_list", sensor_list }
            });
        }
        private void UITemplateSaveButton_Click(object sender, EventArgs e)
        {
            string name = UIParameterTemplateNameInput.Text;

            if (name.Length > 0)
            {
                using (LiteDatabase db = new LiteDatabase(db_path))
                {
                    ObservableNumericValueCollection          observedValues = Program.app.DataReceiver.ObservedValues;
                    LiteCollection <ParameterControlTemplate> collection     = db.GetCollection <ParameterControlTemplate>(collection_name);

                    if (UIParameterControlTemplateList.SelectedIndex == -1)
                    {
                        ParameterControlTemplate template = new ParameterControlTemplate(observedValues);
                        template.Name        = UIParameterTemplateNameInput.Text;
                        template.Description = UIParameterControlTemplateDescriptionInput.Text;

                        collection.Insert(template);
                    }
                    else
                    {
                        ParameterControlTemplate template = templateList[UIParameterControlTemplateList.SelectedIndex];
                        template.Name        = UIParameterTemplateNameInput.Text;
                        template.Description = UIParameterControlTemplateDescriptionInput.Text;
                        template.SetCollection(observedValues);

                        if (!collection.Update(template.Id, template))
                        {
                            Debug.Log("Update failed");
                        }
                        else
                        {
                            Debug.Log("Update OK");
                        }
                    }
                }

                Close();
            }
            else
            {
                MessageBox.Show("Cannot save, no name given");
            }
        }
Ejemplo n.º 6
0
 public void SetObservableParameterList(ObservableNumericValueCollection observableNumericValues)
 {
     UITestConfigOutputParamChecklist.Items.Clear();
     UITestConfigOutputParamChecklist.Items.AddRange(observableNumericValues.ToArray());
 }
Ejemplo n.º 7
0
 public DataReceiver()
 {
     subscriptions  = new Dictionary <string, DataSubscription>();
     observedValues = new ObservableNumericValueCollection();
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Set the observed values collection
 /// </summary>
 /// <param name="col">Collection of observable numeric values</param>
 public void SetObservableNumericValues(ObservableNumericValueCollection col)
 {
     observedValues = col;
 }
Ejemplo n.º 9
0
 public ParameterControlTemplate(ObservableNumericValueCollection c)
 {
     SetCollection(c);
     Date = DateTime.Now;
 }