Exemplo n.º 1
0
        public void ChangeModel(string nameModel)
        {
            if (nameModel == "Ka52")
            {
                foreach (var process in Process.GetProcessesByName("HxModel"))
                {
                    process.Kill();
                }
                foreach (var process in Process.GetProcessesByName("model_32_console"))
                {
                    process.Kill();
                }
                if (File.Exists(@"D:\!Develop\Ka52Model\model_32_console.exe"))
                {
                    Process.Start(@"D:\!Develop\Ka52Model\model_32_console.exe");
                }
                _dynamicModel   = new ModelKa52();
                _controlElement = new ControlElementKa52();
                DynamicInfos.Clear();
            }

            if (nameModel == "Ka50")
            {
                _controlElement = new ControlElementKa50();
                _dynamicModel   = new ModelKa50();
                DynamicInfos.Clear();
                foreach (var process in Process.GetProcessesByName("HxModel"))
                {
                    process.Kill();
                }
                foreach (var process in Process.GetProcessesByName("model_32_console"))
                {
                    process.Kill();
                }
            }

            if (nameModel == "Hx")
            {
                foreach (var process in Process.GetProcessesByName("HxModel"))
                {
                    process.Kill();
                }
                foreach (var process in Process.GetProcessesByName("model_32_console"))
                {
                    process.Kill();
                }
                if (File.Exists(@"d:\!Develop\DataTransfer\HxModel\bin\Debug\HxModel.exe"))
                {
                    Process.Start(@"d:\!Develop\DataTransfer\HxModel\bin\Debug\HxModel.exe");
                }
                _controlElement = new ControlElementKa50();
                _dynamicModel   = new ModelHx();
                DynamicInfos.Clear();
            }
        }
Exemplo n.º 2
0
        private void InitObject()
        {
            _config               = Config.Instance();
            _udpHelper            = new UdpHelper();
            _deviceControlElement = DeviceControlElement.GetInstance();
            _deviceControlElement.AddJoystick(_config.Default.DefaultControlElement.Rus.Guid);
            _deviceControlElement.AddJoystick(_config.Default.DefaultControlElement.Rud.Guid);
            _dynamicModelToBmpi     = new DynamicModelToBmpi();
            _aircraftPosition       = new AircraftPosition();
            _dynamicModelToVaps     = new DynamicModelToVaps();
            _modelState             = new ModelState();
            _channelRadar           = new ChannelRadar();
            _channelThermalEffect   = new ChannelThermalEffect();
            _channelTvHeadEffect    = new ChannelTvHeadEffect();
            _ethernetControlElement = new EthernetControlElement();
            _cLSEControl            = new CLSEControl();
            _cLSEState           = new CLSEState();
            _parametersOfControl = new ParametersOfControl();
            _lptp       = new Lptp();
            _commandPue = new CommandPue();

            if (_typeModel == 0)
            {
                _controlElement = new ControlElementKa52();
                _dynamicModel   = new ModelKa52();
            }
            _startPosition = new StartPosition();
            _landing       = new Landing();
            _route         = new Route();

            uint   version       = 0;
            uint   release       = 0;
            uint   releaseDay    = 0;
            uint   releaseMonth  = 0;
            uint   releaseYear   = 0;
            IntPtr pversion      = GetIntPtr(version);
            IntPtr prelease      = GetIntPtr(release);
            IntPtr preleaseDay   = GetIntPtr(releaseDay);
            IntPtr preleaseMonth = GetIntPtr(releaseMonth);
            IntPtr preleaseYear  = GetIntPtr(releaseYear);

            GetDllVersion(pversion, prelease, preleaseDay, preleaseMonth, preleaseYear);
            version      = (uint)Marshal.ReadInt32(pversion);
            release      = (uint)Marshal.ReadInt32(prelease);
            releaseDay   = (uint)Marshal.ReadInt32(preleaseDay);
            releaseMonth = (uint)Marshal.ReadInt32(preleaseMonth);
            releaseYear  = (uint)Marshal.ReadInt32(preleaseYear);
            Init("ConfigBrunner.xml");
        }