public ControlContainer(MMI.EBuLa.Tools.XMLLoader XMLConf, int side)
        {
            InitializeComponent();

            m_XMLConf = XMLConf;

            try
            {
                //m_parent = gotParent;
                m_widget = new ICE3Control(XMLConf, this);
                P_Display.Controls.Add(m_widget);
                if (m_XMLConf.Inverse)
                {
                    m_widget.Inverse = true;
                }
                else
                {
                    m_widget.Inverse = false;
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Fehler beim Erstellen des Widgets! ("+e.Message+")");
            }

            try
            {
                pB_EBuLa.Image = new Bitmap(BACKGROUND_IMAGE);
            }
            catch(Exception)
            {
                MessageBox.Show("Fehler! Das Hintergrundbild \""+BACKGROUND_IMAGE+"\" konnte nicht geladen werden!");
            }

            if (side == 1)
                net = new Network(ref m_widget, "(links)");
            else if (side == 2)
                net = new Network(ref m_widget, "(rechts)");
            else
                return;

            if (t == null)
            {
                t = new Thread(new ThreadStart(net.Connect));
                t.IsBackground = true;
                t.Priority = m_XMLConf.thread_prio;
                t.Start();
                Thread.Sleep(1);
            }

            /*
            MMI.EBuLa.Network ebula_net = null;
            m_widget_ebula = new MMI.EBuLa.EbulaControl(m_XMLConf, ref ebula_net);
            m_widget_ebula.Visible = false;
            P_Display.Controls.Add(m_widget_ebula);
            /*if (m_XMLConf.Inverse)
            {
                m_widget_ebula.Inverse();
            }*/
        }
示例#2
0
 public ET42XState(ref MMI.EBuLa.Tools.XMLLoader conf, ref SoundInterface sound)
 {
     HBL_Druck = 5f;
     HL_Druck = 5f;
     //störungmgr.Add(new Störung(ENUMStörung.S02_Trennschütz));
     störungmgr.Add(new Störung(ENUMStörung.S01_ZUSIKomm));
     localconf = conf;
     fis = new FIS(ref conf, ref sound);
 }
        public EBuLaTools(ref XMLLoader Conf)
        {
            InitializeComponent();

            m_conf = Conf;
            backup_conf = m_conf;

            LoadConfiguration();
        }
        public DavidControl(MMI.EBuLa.Tools.XMLLoader conf, ControlContainer cc)
        {
            if (!conf.DoubleBuffer)
            {
                //This turns off internal double buffering of all custom GDI+ drawing
                this.SetStyle(ControlStyles.DoubleBuffer, true);
                this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                this.SetStyle(ControlStyles.UserPaint, true);
                USE_DOUBLE_BUFFER = false;
            }
            else
            {
                USE_DOUBLE_BUFFER = true;
            }

            InitializeComponent();

            m_conf = conf;
            this.cc = cc;

            localstate = new DavidState();

            localstate.ICEtype = ICETYPE.ICE1;
            localstate.Type = TYPE.David2;
            localstate.DISPLAY = CURRENT_DISPLAY.D2_B;
            olddisplay = CURRENT_DISPLAY.D1_I;

            //SetButtons();
            vtime = DateTime.Now;

            InitC_druck();

            int interval = Convert.ToInt32(Math.Round((1d/(double)FramesPerSecond)*1000d));
            timer1.Interval = interval;
            timer1.Enabled = true;

            switch (m_conf.Sound)
            {
                case 1:
                    sound = new APISound();
                    break;
                case 2:
                    sound = new DxSound();
                    break;
                default:
                    sound = new NullSound();
                    break;
            }
            Button_SW_Pressed(this, new EventArgs());
        }
        public ICE3Control(MMI.EBuLa.Tools.XMLLoader conf, ControlContainer cc)
        {
            if (!conf.DoubleBuffer)
            {
                //This turns off internal double buffering of all custom GDI+ drawing
                this.SetStyle(ControlStyles.DoubleBuffer, true);
                this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                this.SetStyle(ControlStyles.UserPaint, true);
                USE_DOUBLE_BUFFER = false;
            }
            else
                USE_DOUBLE_BUFFER = true;

            InitializeComponent();

            schw.Initialize();
            tür.Initialize();

            m_conf = conf;
            this.cc = cc;
            localstate = new ICE3State();

            localstate.ICEtype1 = ICE3TYPE.ICE403;
            localstate.ICEtype2 = ICE3TYPE.NONE;
            //localstate.Type = TYPE.David2;
            if (localstate.Type == TYPE.David1)
            {
                localstate.DISPLAY = CURRENT_DISPLAY.D1_Grundb;
            }
            else
            {
                localstate.DISPLAY = CURRENT_DISPLAY.D2_Zustand;
            }
            //olddisplay = CURRENT_DISPLAY.D1_Grundb;

            switch (m_conf.Sound)
            {
                case 1:
                    sound = new APISound();
                    break;
                case 2:
                    sound = new DxSound();
                    break;
                default:
                    sound = new NullSound();
                    break;
            }

            //SetButtons();
            vtime = DateTime.Now;

            InitC_druck();

            threadDelegate_Türen = new ThreadStart(SetUpTüren);

            int interval = Convert.ToInt32(Math.Round((1d/(double)FramesPerSecond)*1000d));
            timer1.Interval = interval;
            timer1.Enabled = true;

            Button_SW_Pressed(this, new EventArgs());
        }
        public DIAGNOSEControl(MMI.EBuLa.Tools.XMLLoader conf, ref MMI.MMIBR185.BR185Control mmi)
        {
            if (!conf.DoubleBuffer)
            {
                //This turns off internal double buffering of all custom GDI+ drawing
                this.SetStyle(ControlStyles.DoubleBuffer, true);
                this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                this.SetStyle(ControlStyles.UserPaint, true);
                USE_DOUBLE_BUFFER = false;
            }
            else
                USE_DOUBLE_BUFFER = true;

            InitializeComponent();

            center = new Point(468+80, 30+80);

            uhrAußenList = (new ISphere(468+80, 30+80, 74)).PointList();
            uhrInnenklList = (new ISphere(468+80, 30+80, 69)).PointList();
            uhrInnengrList = (new ISphere(468+80, 30+80, 62)).PointList();
            uhrminList = (new ISphere(468+80, 30+80, 60)).PointList();
            uhrstdList = (new ISphere(468+80, 30+80, 47)).PointList();
            uhrsecList = (new ISphere(468+80, 30+80, 60)).PointList();
            uhrrestList = (new ISphere(468+80, 30+80, 10)).PointList();

            m_conf = conf;

            mmi_widget = mmi;

            localstate = new MMI.DIAGNOSE.DIAGNOSEState();

            localstate.Energie = conf.Energie;

            something_changed = true;

            // NOTBREMSE und E-BREMSE fehlen

            vtime = DateTime.Now;

            zugkraft_thread = new Thread(new ThreadStart(MoveZugkraft));

            int interval = Convert.ToInt32(Math.Round((1d/(double)conf.FramesPerSecondLow)*1000d));
            timer1.Interval = interval;
            timer1.Enabled = true;

            switch (m_conf.Sound)
            {
                case 1:
                    Sound = new APISound();
                    break;
                case 2:
                    Sound = new DxSound();
                    break;
                default:
                    Sound = new NullSound();
                    break;
            }
            Button_SW_Pressed(this, new EventArgs());

            mmi_widget.PREVENT_DRAW = true;
            /*
            try
            {
                // Now  setup our D3D stuff
                Microsoft.DirectX.Direct3D.PresentParameters presentParams = new Microsoft.DirectX.Direct3D.PresentParameters();
                presentParams.Windowed=true;
                presentParams.SwapEffect = Microsoft.DirectX.Direct3D.SwapEffect.Discard;
                device = new Microsoft.DirectX.Direct3D.Device(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, this,
                    Microsoft.DirectX.Direct3D.CreateFlags.HardwareVertexProcessing, presentParams);
            }
            catch (Exception) {}
            */
        }
        public EbulaControl(MMI.EBuLa.Tools.XMLLoader XMLConf, bool isDAVID)
        {
            //This turns off internal double buffering of all custom GDI+ drawing
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);

            // Dieser Aufruf ist für den Windows Form-Designer erforderlich.
            InitializeComponent();

            try
            {
                InitSpeedBar();

                // Setze Virtuelle Zeit auf Reale Zeit
                vtime = new DateTime(System.DateTime.Now.Ticks);

                // Zeitmesser (basiert auf RealZeit)
                vdifftime = new DateTime(System.DateTime.Now.Ticks);

                vtimer = new System.Timers.Timer();
                vtimer.Enabled = true;
                vtimer.Interval = 950;
                vtimer.SynchronizingObject = this;
                vtimer.Elapsed += new System.Timers.ElapsedEventHandler(this.vtimer_Elapsed);

                g = this.CreateGraphics();

                verspaetung = 0;
                B_GNT.Enabled = false;

                control = new Control(verspaetung, XMLConf);
                control.use_DB = XMLConf.UseDB;

                //control.LoadTrainDEBUG();
                control.Route = new Route("", "");
                control.Route.Position = -1;

                control.vtime = vtime;

                m_conf = XMLConf;

                if (XMLConf.Sound == 0)
                {
                    Sound = new NullSound();
                    control.sound = false;
                }
                else
                {
                    switch (XMLConf.Sound)
                    {
                        case 1:
                            Sound = new APISound();
                            break;
                        case 2:
                            Sound = new DxSound();
                            break;
                    }
                    control.sound = true;
                }

                net = new Network(isDAVID);
                if (net != null)
                {
                    net.setControl(ref control);

                    if (t == null)
                    {
                        t = new Thread(new ThreadStart(net.Connect));
                        t.IsBackground = true;
                        t.Start();
                        Thread.Sleep(0);
                    }
                }

                L_TOP.Location = new Point(260, L_TOP.Location.Y);
                L_DOWN.Location = new Point(260, L_DOWN.Location.Y);

                fsdwason = true;
                SetButtons(false);

                if (control.sound) Sound.PlaySound();

                UpdateControl();

                this.Focus();
            }
            catch (Exception e)
            {
               MessageBox.Show("Fehler beim Erstellen der EBuLa Anzeige! ("+e.Message.ToString()+")");
            }
        }
        public ET42XControl(MMI.EBuLa.Tools.XMLLoader conf, ref Network net)
        {
            if (!conf.DoubleBuffer)
            {
                //This turns off internal double buffering of all custom GDI+ drawing
                this.SetStyle(ControlStyles.DoubleBuffer, true);
                this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                this.SetStyle(ControlStyles.UserPaint, true);
                USE_DOUBLE_BUFFER = false;
            }
            else
                USE_DOUBLE_BUFFER = true;

            InitializeComponent();

            m_net = net;

            uhrAußen = new ISphere(508+60, 41+60, 57);
            uhrInnengr = new ISphere(508+60, 41+60, 45);
            uhrInnenkl = new ISphere(508+60, 41+60, 52);
            uhrsec = new ISphere(508+60, 41+60, 43);
            uhrmin = new ISphere(508+60, 41+60, 43);
            uhrstd = new ISphere(508+60, 41+60, 28);
            uhrrest = new ISphere(508+60, 41+60, 7);
            center = new Point(508+60, 41+60);

            m_conf = conf;

            // NOTBREMSE und E-BREMSE fehlen

            switch (m_conf.Sound)
            {
                case 1:
                    Sound = new APISound();
                    break;
                case 2:
                    Sound = new DxSound();
                    break;
                default:
                    Sound = new NullSound();
                    break;
            }

            localstate = new MMI.ET42X.ET42XState(ref conf, ref Sound);

            SetButtons();

            localstate.Energie = conf.Energie;

            vtime = DateTime.Now;

            zugkraft_thread = new Thread(new ThreadStart(MoveZugkraft));

            int interval = Convert.ToInt32(Math.Round((1d/(double)conf.FramesPerSecondLow)*1000d));
            timer1.Interval = interval;
            timer1.Enabled = true;

            Button_SW_Pressed(this, new EventArgs());

            /*if (localstate.ET42Xtype1 == ET42XTYPE.ET423)
                localstate.FISType = FIS_TYPE.FIS;*/

            timer2.Enabled = true;

            if (vtime.DayOfYear > 100 && vtime.DayOfYear < 300)
                localstate.Kuehlung = true;
            else
                localstate.Kuehlung = false;
        }
        public VT612Control(MMI.EBuLa.Tools.XMLLoader conf)
        {
            if (!conf.DoubleBuffer)
            {
                //This turns off internal double buffering of all custom GDI+ drawing
                this.SetStyle(ControlStyles.DoubleBuffer, true);
                this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                this.SetStyle(ControlStyles.UserPaint, true);
                USE_DOUBLE_BUFFER = false;
            }
            else
                USE_DOUBLE_BUFFER = true;

            InitializeComponent();

            uhrAußen = new ISphere(468+80, 41+80, 74);
            uhrInnengr = new ISphere(468+80, 41+80, 62);
            uhrInnenkl = new ISphere(468+80, 41+80, 69);
            uhrsec = new ISphere(468+80, 41+80, 60);
            uhrmin = new ISphere(468+80, 41+80, 60);
            uhrstd = new ISphere(468+80, 41+80, 47);
            uhrrest = new ISphere(468+80, 41+80, 10);
            center = new Point(468+80, 41+80);

            m_conf = conf;

            localstate = new MMI.VT612.VT612State();

            // NOTBREMSE und E-BREMSE fehlen

            SetButtons();

            vtime = DateTime.Now;

            zugkraft_thread = new Thread(new ThreadStart(MoveZugkraft));

            int interval = Convert.ToInt32(Math.Round((1d/(double)conf.FramesPerSecondLow)*1000d));
            timer1.Interval = interval;
            timer1.Enabled = true;
        }