Esempio n. 1
0
 public static async Task MoveGroundObject(IHubProxy HubProxy, DeployedFormation deployFormation)
 {
     try
     {
         await HubProxy.Invoke <DeployedFormation>("MoveGroundObject", deployFormation);
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 2
0
        public static async Task <AtomData> DeployFormationFromTree(IHubProxy HubProxy, DeployedFormation formation)
        {
            try
            {
                AtomData atom = await HubProxy.Invoke <AtomData>("DeployFormationFromTree", formation);

                return(atom);
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
Esempio n. 3
0
        protected  async override void OnDrop( System.Windows.DragEventArgs e)
        {
            double currMapX = 0;
            double currMapY = 0;           

            System.Windows.DataObject d = (System.Windows.DataObject)e.Data;

            string[] dataFormats = d.GetFormats();
            string dataText = d.GetText();

            Point position = e.GetPosition(this);
            GMap.NET.PointLatLng curPosition = FromLocalToLatLng((int)position.X, (int)position.Y);
            currMapX = curPosition.Lng;
            currMapY = curPosition.Lat;

            for (int i = 0; i < dataFormats.Length; i++)
            {
                string dragFormat = dataFormats[i];

                if (dragFormat.Contains("FormationTree") && dataText == "Actor")
                {                 
                   
                    object dragObject = d.GetData(dragFormat);

                    FormationTree formation = dragObject as FormationTree;
                    if (formation == null) continue;

                    enOSMhighwayFilter highwayFilter = enOSMhighwayFilter.Undefined;
                    SetHighwayFilter(highwayFilter);
                    shPointId PointId = await clsRoadRoutingWebApi.GetNearestPointIdOnRoad("0", highwayFilter, currMapX, currMapY);
                    if (PointId!=null)
                    {
                       shPoint pnt = PointId.point;
                       DeployedFormation deployFormation = new DeployedFormation();
                       deployFormation.x = pnt.x;
                       deployFormation.y = pnt.y;
                       deployFormation.formation = formation;

                        AtomData atom=   await TDSClient.SAGInterface.SAGSignalR.DeployFormationFromTree(VMMainViewModel.Instance.SimulationHubProxy, deployFormation);
                        if(atom!=null)
                        {
                            AtomDeployedEventArgs args = new AtomDeployedEventArgs();
                            args.atom = atom;
                            if(AtomDeployedEvent!=null)
                            {
                                AtomDeployedEvent(this, args);                                
                            }
                        }
                    }

                    return;
                }
            }

      


        }
Esempio n. 4
0
        internal  async void NotifyMouseLeftClickOnMapEvent(MapMouseEventArgsWPF args)
        {

            double currMapX = args.MapXLongLatWGS84;
            double currMapY = args.MapYLongLatWGS84;


            switch(CurrMapTool)
            {
                case enMapTool.MoveObjectTool:
                    CurrMapTool = enMapTool.DefautMapTool;

                    enOSMhighwayFilter highwayFilter = enOSMhighwayFilter.Undefined;
                    highwayFilter = highwayFilter | enOSMhighwayFilter.CarMostImportant;
                    highwayFilter = highwayFilter | enOSMhighwayFilter.CarMediumImportant;
                    highwayFilter = highwayFilter | enOSMhighwayFilter.CarLowImportant;
                    highwayFilter = highwayFilter | enOSMhighwayFilter.Construction;

                    shPointId PointId = await clsRoadRoutingWebApi.GetNearestPointIdOnRoad("0", highwayFilter, currMapX, currMapY);

                    if (PointId != null)
                    {
                        shPoint pnt = PointId.point;
                        DeployedFormation deployFormation = new DeployedFormation();
                        deployFormation.x = pnt.x;
                        deployFormation.y = pnt.y;

                        deployFormation.formation = new FormationTree();
                        deployFormation.formation.Identification = MoveObjectCommonProperty.AtomName;
                        deployFormation.formation.GUID = MoveObjectCommonProperty.GUID;


                       // deployFormation.formation = formation;

                        await TDSClient.SAGInterface.SAGSignalR.MoveGroundObject(VMMainViewModel.Instance.SimulationHubProxy, deployFormation);
                       
                    }


                    break;
            }

          




            if (dlgMouseLeftClickOnMapEvent == null) return;

            System.Delegate[] invklist = dlgMouseLeftClickOnMapEvent.GetInvocationList();
            IEnumerator ie = invklist.GetEnumerator();
            while (ie.MoveNext())
            {
                MouseLeftClickOnMapEventWPF handler = (MouseLeftClickOnMapEventWPF)ie.Current;
                try
                {
                    
                    {
                        // IAsyncResult ar = handler.BeginInvoke(this,args, null, null);
                        // handler.EndInvoke(ar);

                        handler.Invoke(this, args);
                    }

                }
                catch (System.Exception e)
                //catch
                {
                    dlgMouseLeftClickOnMapEvent -= handler;
                }
            }


        }
Esempio n. 5
0
        public static async Task<AtomData> DeployFormationFromTree(IHubProxy HubProxy, DeployedFormation formation)
        {
            try
            {
                AtomData atom = await HubProxy.Invoke<AtomData>("DeployFormationFromTree", formation);

                return atom;
            }
            catch (Exception ex)
            {
            }
            return null;
        }
Esempio n. 6
0
        public static async Task MoveGroundObject(IHubProxy HubProxy, DeployedFormation deployFormation)
        {
            try
            {
                await HubProxy.Invoke<DeployedFormation>("MoveGroundObject", deployFormation);
            }
            catch (Exception ex)
            {
            }

        }