//private Task threadListenToServerByTCP = null; public MainWindow() { InitializeComponent(); //SetFullScreen();//设置本程序全屏显示 LoadVectorMap(); //加载矢量地图 LoadImageMap(); //加载影像地图-------考虑异步加载,节省程序加载时间 PublicParams.pubMainMap = mainMap; PublicParams.pubLayoutRoot = LayoutRoot; PublicParams.pubInfoWin = mainInfoWindow; //PublicParams.pubCanvasChild1 = canvasChild1; Task listenToClient = new Task(ListenToClientByTCP, TaskCreationOptions.LongRunning); //长时间监听 listenToClient.Start(); //建立监听,等待客户端连接大屏 Thread threadRefreshMainMap = new Thread(MapMethods.RefreshMainMapThread) { IsBackground = true }; threadRefreshMainMap.Start(); if (PublicParams.IsInitLayers != "0") //暂时没有图层服务器,不显示图层 { MapLayers.InitMapLayers(); //初始化地图所需的图层,静态方法 } //ShowOneCrimePoint();//添加一个案件点 PadHelper.InitPads(); PoliceCarGPS gps = new PoliceCarGPS(); //MQ相关,接收警车GPS信号 Traffic traffic = new Traffic(); //红绿灯和道路 ParamsHelper.ReloadModularsFromXML(); }
public InputHelper() { OldKeyState = NewKeyState = Keyboard.GetState(); for (int i = 0; i < 4; i++) { Pads[i] = new PadHelper((PlayerIndex)i); } }
public MainWindow() { InitializeComponent(); LogHelper.WriteLog("<-------加载开始了!"); LoadVectorMap(); //加载矢量地图 LoadImageMap(); //加载影像地图-------考虑异步加载,节省程序加载时间 PublicParams.pubMainMap = mainMap; PublicParams.pubLayoutRoot = LayoutRoot; PublicParams.pubInfoWin = mainInfoWindow; PublicParams.pubCanvasChild1 = canvasChild1; if (PublicParams.IsInitLayers != "0") { MapLayers.InitMapLayers();//初始化地图所需的图层,静态方法 } //ShowOneCrimePoint();//添加一个模拟的案件点 //Task taskConnectDVCSServer = new Task(ConnectDVCSServerInTask);//DVCS服务器连接相关 //taskConnectDVCSServer.Start(); PublicParams.dvcsServerMain = new DVCSServer() { dvcsServerIP = PublicParams.DVCSIP, dvcsServerPort = PublicParams.DVCSPort, dvcsName = PublicParams.dvcsServerMainName }; ConnectDVCSServerInTask(PublicParams.dvcsServerMain); PublicParams.dvcsServer2 = new DVCSServer() { dvcsServerIP = PublicParams.DVCSIP2, dvcsServerPort = PublicParams.DVCSPort2, dvcsName = PublicParams.dvcsServer2Name }; ConnectDVCSServerInTask(PublicParams.dvcsServer2); PadHelper.InitPads(); //初始化信息窗 WallVideosHelper.InitOpenedVideos(); //初始化已打开视频列表 PoliceCarGPS gpsPoliceCar = new PoliceCarGPS(); //MQ相关,接收警车GPS信号 Cases cases = new Cases(); //MQ相关,接收案件信息 Traffic traffic = new Traffic(); drawBuffer = new Draw(mainMap) { LineSymbol = App.Current.Resources["DrawLineSymbol"] as LineSymbol, FillSymbol = App.Current.Resources["DrawFillSymbol"] as FillSymbol }; drawBuffer.DrawComplete += drawBuffer_DrawComplete; drawLenOrArea = new Draw(PublicParams.pubMainMap) { LineSymbol = App.Current.Resources["DrawLineSymbol"] as LineSymbol, FillSymbol = App.Current.Resources["DrawFillSymbol"] as FillSymbol }; drawLenOrArea.DrawComplete += drawLenOrArea_DrawComplete; LogHelper.WriteLog("<-------加载完成了!"); }
public void ReleasePad(PadHelper pad) { for (int i = 0; i < 4; i++) { if (Pads[i].Index == pad.Index) { PadAssigned[i] = false; return; } } }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); // When setting up the SharpMik Player you need to pass a driver to it // in this instance we are using the XNA driver from the lib. // additional data can also be passed to the driver if the driver needs / supports it. m_Player.Init <XNADriver>(); // Hook up the event so we know when the player changes m_Player.PlayerStateChangeEvent += new ModPlayer.PlayerStateChangedEvent(m_Player_PlayerStateChangeEvent); // Setup some basic stuff for the sample m_Font = Content.Load <SpriteFont>("fonts/SpriteFont1"); m_Pad = new PadHelper(InputPlayer.One); m_Mouse = new MouseHelper(); // Load all the textures. m_Background = Content.Load <Texture2D>("Art/background"); m_ProgressBar = Content.Load <Texture2D>("Art/Progess"); m_ProgressBarCover = Content.Load <Texture2D>("Art/ProgressCover"); m_Buttons = new Texture2D[4]; m_Buttons[0] = Content.Load <Texture2D>("Art/Back"); m_Buttons[1] = Content.Load <Texture2D>("Art/Play"); m_Buttons[2] = Content.Load <Texture2D>("Art/Stop"); m_Buttons[3] = Content.Load <Texture2D>("Art/Next"); m_ButtonLocations = new Vector2[4]; m_ButtonLocations[0] = new Vector2(50, 300); m_ButtonLocations[1] = new Vector2(250, 300); m_ButtonLocations[2] = new Vector2(450, 300); m_ButtonLocations[3] = new Vector2(650, 300); m_PadIcons = new Texture2D[4]; m_PadIcons[0] = Content.Load <Texture2D>("Art/xboxControllerLeftShoulder"); m_PadIcons[1] = Content.Load <Texture2D>("Art/xboxControllerButtonA"); m_PadIcons[2] = Content.Load <Texture2D>("Art/xboxControllerButtonB"); m_PadIcons[3] = Content.Load <Texture2D>("Art/xboxControllerRightShoulder"); m_PadLocations = new Rectangle[4]; m_PadLocations[0] = new Rectangle(150, 300, 64, 32); m_PadLocations[1] = new Rectangle(350, 300, 32, 32); m_PadLocations[2] = new Rectangle(450, 300, 32, 32); m_PadLocations[3] = new Rectangle(625, 300, 64, 32); IsMouseVisible = true; }