Ejemplo n.º 1
0
        public SequenceForm(Inputs inputs)
        {
            InitializeComponent();
            dataGridViewInputs.AutoGenerateColumns = false;

            Inputs        = inputs;
            InputSequence = Inputs.Sequence == null ? new InputSequence() : (InputSequence)Inputs.Sequence.Clone();
        }
Ejemplo n.º 2
0
        public object Clone()
        {
            var output = new InputSequence();

            output.Name    = Name;
            output.Length  = Length;
            output.Repeats = Repeats;
            foreach (var inputs in Inputs)
            {
                output.Inputs.Add((Inputs)inputs.Clone());
            }
            return(output);
        }
Ejemplo n.º 3
0
 public static bool Load(string filename, out InputSequence inputSequence)
 {
     try
     {
         var serializer = new XmlSerializer(typeof(InputSequence));
         using (var stream = new FileStream(filename, FileMode.Open))
         {
             inputSequence = (InputSequence)serializer.Deserialize(stream);
             return(true);
         }
     }
     catch
     {
         inputSequence = null;
         return(false);
     }
 }
Ejemplo n.º 4
0
 private void buttonLoad_Click(object sender, EventArgs e)
 {
     using (var dialog = new OpenFileDialog())
     {
         dialog.Filter = "Input sequence|*.xml";
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             InputSequence inputSequence;
             if (InputSequence.Load(dialog.FileName, out inputSequence))
             {
                 InputSequence = inputSequence;
             }
             else
             {
                 MessageBox.Show("Failed to load input sequence.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }