public void setAnalogGroup(AnalogGroup analogGroup)
        {
            this.SuspendLayout();

            if (analogGroup == null)
            {
                analogGroup = new AnalogGroup("Placehold analog group. Do not use.");
                replacementGroupSelector.Enabled = false;
            }
            else
            {
                replacementGroupSelector.Enabled = true;
            }

            this.analogGroup = analogGroup;



            this.renameTextBox.Text = analogGroup.GroupName;
            fillSelectorCombobox();
            analogGroupBeingChanged = true;
            this.analogGroupSelector.SelectedItem = analogGroup;
            analogGroupBeingChanged = false;
            updateGroupChannelSelectors();
            layoutGraphCollection();
            waveformEditor1.setWaveform(null);

            timeResolutionEditor.setParameterData(analogGroup.TimeResolution);

            this.descBox.Text = analogGroup.GroupDescription;

            this.replacementGroupSelector.SelectedItem = null;

            this.ResumeLayout();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            AnalogGroup ag = new AnalogGroup("Analog Group " + (Storage.sequenceData.AnalogGroups.Count + 1));

            Storage.sequenceData.AnalogGroups.Add(ag);
            setAnalogGroup(ag);
        }
        public void setAnalogGroup(AnalogGroup analogGroup)
        {
            this.SuspendLayout();

            if (analogGroup == null)
            {
                analogGroup = new AnalogGroup("Placehold analog group. Do not use.");
                replacementGroupSelector.Enabled = false;
            }
            else
                replacementGroupSelector.Enabled = true;

            this.analogGroup = analogGroup;

            this.renameTextBox.Text = analogGroup.GroupName;
            fillSelectorCombobox();
            analogGroupBeingChanged = true;
            this.analogGroupSelector.SelectedItem = analogGroup;
            analogGroupBeingChanged = false;
            updateGroupChannelSelectors();
            layoutGraphCollection();
            waveformEditor1.setWaveform(null);

            timeResolutionEditor.setParameterData(analogGroup.TimeResolution);

            this.descBox.Text = analogGroup.GroupDescription;

            this.replacementGroupSelector.SelectedItem = null;

            this.ResumeLayout();
        }
        private void analogSelector_SelectedValueChanged(object sender, EventArgs e)
        {
            if (analogSelector.SelectedItem.ToString() == "Continue")
            {
                analogSelector.BackColor = Color.Green;
                toolTip1.SetToolTip(analogSelector, "Continue previous analog group.");
            }
            else
            {
                analogSelector.BackColor = Color.White;
            }

            if (stepData != null)
            {
                AnalogGroup ag = analogSelector.SelectedItem as AnalogGroup;
                stepData.AnalogGroup = ag;
                if (updateGUI != null)
                {
                    updateGUI(sender, e);
                }
                if (ag != null)
                {
                    toolTip1.SetToolTip(analogSelector, ag.GroupDescription);
                }
            }
            analogSelectorBackupItem = analogSelector.SelectedItem;
        }
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!analogGroupBeingChanged)
     {
         AnalogGroup ag = analogGroupSelector.SelectedItem as AnalogGroup;
         setAnalogGroup(ag);
     }
 }
        private void newGroupButton_Click(object sender, EventArgs e)
        {
            int         id = Storage.sequenceData.GenerateNewAnalogGroupID();
            AnalogGroup ag = new AnalogGroup(id, "Group" + id);

            Storage.sequenceData.AnalogGroups.Add(ag);
            setAnalogGroup(ag);
        }
        private void renameButton_Click(object sender, EventArgs e)
        {
            AnalogGroup temp = this.analogGroup;

            if (analogGroup != null)
            {
                analogGroup.GroupName = renameTextBox.Text;
                this.analogGroupSelector.SelectedItem = null;
                this.analogGroupSelector.SelectedItem = temp;
            }
        }
        public void updateRunOrderPanel()
        {
            if (runOrderLabels != null)
            {
                foreach (Label lab in runOrderLabels)
                {
                    runOrderPanel.Controls.Remove(lab);
                    lab.Dispose();
                }
                runOrderLabels.Clear();
                runOrderLabelGroups.Clear();
            }
            else
            {
                runOrderLabels      = new List <Label>();
                runOrderLabelGroups = new Dictionary <Label, AnalogGroup>();
            }

            int xPos = label1.Location.X + label1.Width;

            if (Storage.sequenceData != null)
            {
                if (Storage.sequenceData.TimeSteps != null)
                {
                    foreach (TimeStep step in Storage.sequenceData.enabledTimeSteps())
                    {
                        if (step.AnalogGroup != null)
                        {
                            AnalogGroup ag  = step.AnalogGroup;
                            Label       lab = new Label();
                            lab.Text         = ag.ToString();
                            lab.BorderStyle  = BorderStyle.FixedSingle;
                            lab.AutoSize     = false;
                            lab.Width        = 80;
                            lab.TextAlign    = ContentAlignment.MiddleCenter;
                            lab.AutoEllipsis = true;
                            lab.Location     = new Point(xPos, label1.Location.Y);
                            lab.Click       += new EventHandler(runOrderLabelClick);
                            runOrderLabelGroups.Add(lab, ag);
                            runOrderLabels.Add(lab);

                            this.toolTip1.SetToolTip(lab, "Timestep: " + step.StepName + ", Duration: " + step.StepDuration.ToString());

                            xPos += lab.Width + 10;
                        }
                    }
                }
            }

            runOrderPanel.Controls.AddRange(runOrderLabels.ToArray());
        }
        private void replaceGroupButton_Click(object sender, EventArgs e)
        {
            AnalogGroup replacementGroup = replacementGroupSelector.SelectedItem as AnalogGroup;

            if (replacementGroup != null)
            {
                if (replacementGroup != this.analogGroup)
                {
                    DialogResult result = MessageBox.Show("This will permanently replace all occurences of the currently edited group with the group selected near the Replace button. Are you sure you want to proceed?", "Replace analog group?", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        Storage.sequenceData.replaceAnalogGroup(analogGroup, replacementGroup);
                        WordGenerator.MainClientForm.instance.RefreshSequenceDataToUI();
                    }
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Replaces all occurences in sequence of analog group ReplaceMe with group Withme, then
        /// removes ReplaceMe from list of groups.
        /// </summary>
        /// <param name="replaceMe"></param>
        /// <param name="withMe"></param>
        public void replaceAnalogGroup(AnalogGroup replaceMe, AnalogGroup withMe)
        {
            foreach (TimeStep step in TimeSteps)
            {
                if (step.AnalogGroup == replaceMe)
                {
                    step.AnalogGroup = withMe;
                }
            }

            if (AnalogGroups.Contains(replaceMe))
                AnalogGroups.Remove(replaceMe);
        }
 private void button1_Click(object sender, EventArgs e)
 {
     AnalogGroup ag = new AnalogGroup("Analog Group " + (Storage.sequenceData.AnalogGroups.Count+1));
     Storage.sequenceData.AnalogGroups.Add(ag);
     setAnalogGroup(ag);
 }
Ejemplo n.º 12
0
 public void activateAnalogGroupEditor(AnalogGroup ag)
 {
     this.analogGroupEditor1.setAnalogGroup(ag);
     this.mainTab.SelectedIndex = 1;
 }