private void MainPanelCargarClick(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show("Cargar");
            // Open document
            string filename = flowControls.LoadFileName;

            _exp1Class = null;
            _exp1Class = _fileSaver.DeSerializeExp1(filename);
            flowControls.DataContext    = _exp1Class;
            xpControlsPanel.DataContext = _exp1Class.GetProtocolo(0);
            RefreshTree();
            _exp1Class.ResetSignal = true;
        }
        public NewXP1()
        {
            InitializeComponent();
            _exp1Class.Started = false;
            for (int i = 0; i < _exp1Class.NumberOfProtocols; i++)
            {
                ProtocoloExp1 p = _exp1Class.GetProtocolo(i);
                p.IsActive             = false;
                p.Invertir             = (i % 2 == 0);
                p.ActivateSound        = false;
                p.SoundFrequency       = 1.0f;
                p.SoundSync            = false;
                p.ActivateAnimation    = true;
                p.ActiveFrequency      = 1.0f;
                p.PassiveFrequency     = 0.0f;
                p.PostPassiveFrequency = 0.0f;
                p.AnimationBlending    = 50;
                p.CyclesNextProtocol   = 10;
                p.TimeNextProtocol     = 10f;
                p.CiclosEntrePulso     = 0;
                p.PrioridadCiclos      = true;
                p.EnNegro = false;
            }


            _tvProtocolos = tvProtocolosControl.TreeViewProtocolos;

            _listaData = GetData();
            _tvProtocolos.ItemsSource = _listaData;



            flowControls.DataContext    = _exp1Class;
            xpControlsPanel.DataContext = _exp1Class.GetProtocolo(0);

            _dispatcherTimer.Tick    += DispatcherTimerTick;
            _dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            _dispatcherTimer.Start();

            _sm = SocketManager.Instance;

            _sm.CreateReceivingSocket(IPAddress.Any, 5001);
        }