예제 #1
0
        public async void frmRouteList_EndDrawPolygonEvent(object sender, DrawPolygonEventArgs args)
        {
            if (txtRoute.Text != args.PolygonName)
            {
                txtReferenceX.Tag     = null;
                txtReferenceX.Content = string.Empty;
                txtReferenceY.Content = string.Empty;
                referencePoint.X      = 0;
                referencePoint.Y      = 0;
            }


            txtRoute.Text = args.PolygonName;
            Route route = await SAGSignalR.GetRouteByName(VMMainViewModel.Instance.SimulationHubProxy, txtRoute.Text);

            ActivityRoute = route;

            VMMainViewModel.Instance.InvalidateVisual();
        }
예제 #2
0
        private void btnSelect_Click(object sender, RoutedEventArgs e)
        {
            int i = dtGridRoute.SelectedIndex;

            if (i < 0)
            {
                return;
            }


            if (EndDrawPolygonEvent != null)
            {
                RouteData currRouteData = (RouteData)dtGridRoute.Items[i];

                DrawPolygonEventArgs arg = new DrawPolygonEventArgs();
                arg.isCancel    = false;
                arg.PolygonName = currRouteData.RouteName;
                EndDrawPolygonEvent(this, arg);
            }
            this.Close();
        }
        private async void cmdExit_Click(object sender, RoutedEventArgs e)
        {
            bool isCheckOk = await CheckOk();

            if (isCheckOk == false)
            {
                return;
            }

            DrawPolygonEventArgs arg = new DrawPolygonEventArgs();

            arg.isCancel = false;
            arg.isNew    = true;

            arg.PolygonName = txtRouteName.Text.Trim();

            arg.PolygonPnts = m_PolygonPnts.ToArray <DPoint>();
            //  isOK = true;
            if (EndDrawPolygonEvent != null)
            {
                EndDrawPolygonEvent(this, arg);
            }
            this.Close();
        }
예제 #4
0
        private async void cmdExit_Click(object sender, RoutedEventArgs e)
        {
            bool isCheckOk = await CheckOk();

            if (isCheckOk == false)
            {
                return;
            }

            DrawPolygonEventArgs arg = new DrawPolygonEventArgs();

            arg.isCancel = false;
            arg.isNew    = true;

            arg.PolygonName = txtRouteName.Text.Trim();

            arg.PolygonPnts = m_PolygonPnts.ToArray <DPoint>();
            //  isOK = true;
            if (EndDrawPolygonEvent != null)
            {
                EndDrawPolygonEvent(this, arg);
            }


            GeneralActivityDTO ActivityDTO = new GeneralActivityDTO();

            ActivityDTO.ActivityType = enumActivity.MovementActivity;

            AtomData atomdata = new AtomData();

            atomdata.UnitName = txPlatformName.Text;
            atomdata.Location = m_PolygonPnts[0];

            ActivityDTO.StartActivityOffset = (TimeSpan)startActivity.Value;
            ActivityDTO.DurationActivity    = (TimeSpan)durationActivity.Value;
            ActivityDTO.Speed = (int)speedUpDown.Value;

            Route route = new Route();

            route.RouteName           = txtRouteName.Text;
            route.Points              = m_PolygonPnts;
            ActivityDTO.RouteActivity = route;

            if (refActivityDTO != null)
            {
                atomdata.UnitGuid      = refActivityDTO.Atom.UnitGuid;
                ActivityDTO.ActivityId = refActivityDTO.ActivityId;
                if (ActivityDTO.RouteActivity != null)
                {
                    ActivityDTO.RouteActivity.RouteGuid = refActivityDTO.RouteActivity.RouteGuid;
                }
            }



            ActivityDTO.Atom = atomdata;



            await SAGSignalR.SaveActivity(VMMainViewModel.Instance.SimulationHubProxy, ActivityDTO);


            this.Close();
        }
예제 #5
0
        public async void frmRouteList_EndDrawPolygonEvent(object sender, DrawPolygonEventArgs args)
        {
            if (txtRoute.Text != args.PolygonName)
            {
                txtReferenceX.Tag = null;
                txtReferenceX.Content = string.Empty;
                txtReferenceY.Content = string.Empty;
                referencePoint.X = 0;
                referencePoint.Y = 0;

            }


            txtRoute.Text = args.PolygonName;
            Route route = await SAGSignalR.GetRouteByName(VMMainViewModel.Instance.SimulationHubProxy, txtRoute.Text);
            ActivityRoute = route;

            VMMainViewModel.Instance.InvalidateVisual();

        }
예제 #6
0
        private async void cmdExit_Click(object sender, RoutedEventArgs e)
        {

            bool isCheckOk = await CheckOk();

            if (isCheckOk == false) return;

            DrawPolygonEventArgs arg = new DrawPolygonEventArgs();
            arg.isCancel = false;
            arg.isNew = true;

            arg.PolygonName = txtRouteName.Text.Trim();

            arg.PolygonPnts = m_PolygonPnts.ToArray<DPoint>();
            //  isOK = true;
            if (EndDrawPolygonEvent != null)
            {
                EndDrawPolygonEvent(this, arg);
            }


            GeneralActivityDTO ActivityDTO = new GeneralActivityDTO();
            ActivityDTO.ActivityType = enumActivity.MovementActivity;

            AtomData atomdata = new AtomData();
            atomdata.UnitName = txPlatformName.Text;
            atomdata.Location = m_PolygonPnts[0];

            ActivityDTO.StartActivityOffset = (TimeSpan)startActivity.Value;
            ActivityDTO.DurationActivity = (TimeSpan)durationActivity.Value;
            ActivityDTO.Speed = (int)speedUpDown.Value;

            Route route = new Route();
            route.RouteName = txtRouteName.Text;
            route.Points = m_PolygonPnts;
            ActivityDTO.RouteActivity = route;

            if (refActivityDTO!=null)
            {
                atomdata.UnitGuid = refActivityDTO.Atom.UnitGuid;
                ActivityDTO.ActivityId = refActivityDTO.ActivityId;
                if (ActivityDTO.RouteActivity!=null)
                {
                    ActivityDTO.RouteActivity.RouteGuid = refActivityDTO.RouteActivity.RouteGuid;
                }
             

                

            }



            ActivityDTO.Atom = atomdata;

           


            
           


            await SAGSignalR.SaveActivity(VMMainViewModel.Instance.SimulationHubProxy, ActivityDTO);


            this.Close();
        }
예제 #7
0
        private void btnSelect_Click(object sender, RoutedEventArgs e)
        {

            int i = dtGridRoute.SelectedIndex;
            if (i < 0) return;


            if (EndDrawPolygonEvent != null)
            {
                RouteData currRouteData = (RouteData)dtGridRoute.Items[i];

                DrawPolygonEventArgs arg = new DrawPolygonEventArgs();
                arg.isCancel = false;
                arg.PolygonName = currRouteData.RouteName;
                EndDrawPolygonEvent(this, arg);
            }
            this.Close();
        }
예제 #8
0
        public async void RouteEdit_EndDrawPolygonEvent(object sender, DrawPolygonEventArgs args)
        {
            dtGridRoute.Focus();


            if (args.isCancel)
            {
                int i = dtGridRoute.SelectedIndex;
                if (i > 0)
                {

                    RouteData currRouteData = (RouteData)dtGridRoute.Items[i];
                    if (!RouteShowList.ContainsKey(currRouteData.RouteName))
                    {
                        RouteShowList.Add(currRouteData.RouteName, currRouteData.route);
                    }
                }
            }
            else
            {
                Route route = null;// 
                if (!args.isNew)
                {
                      

                    if (dtGridRoute.ItemsSource == null) return;

                    List<RouteData> listData = (List<RouteData>)(dtGridRoute.ItemsSource);

                    RouteData currRouteData = null;
                    for (int j = 0; j < listData.Count; j++)
                    {
                        if (listData[j].RouteName == args.PolygonName)
                        {
                            currRouteData = listData[j];
                            break;
                        }
                    }

                    if (currRouteData == null) return;

                 //Victor   currRouteData.route.arr_legs = LegSector;
                    route = currRouteData.route;
                    if (!RouteShowList.ContainsKey(currRouteData.RouteName))
                    {
                        RouteShowList.Add(currRouteData.RouteName, currRouteData.route);
                    }


                }
                else
                {
                    route = new Route();                   

                   // LegSector = CreateLegSector(args.PolygonPnts);
                    route.Points =new List<DPoint>(args.PolygonPnts);
                    route.RouteName = args.PolygonName;

                    RouteData Rdata = new RouteData();
                    Rdata.route = route;




                    ((List<RouteData>)(dtGridRoute.ItemsSource)).Add(Rdata);
                    dtGridRoute.Items.Refresh();
                    dtGridRoute.SelectedItem = Rdata;
                    dtGridRoute.CurrentItem = Rdata;
                    DataGridWPFUtility.DataGridGotoLast(dtGridRoute);
                }

                await SAGSignalR.SaveRoute(VMMainViewModel.Instance.SimulationHubProxy, route);
            }
        }
예제 #9
0
        public async void RouteEdit_EndDrawPolygonEvent(object sender, DrawPolygonEventArgs args)
        {
            dtGridRoute.Focus();


            if (args.isCancel)
            {
                int i = dtGridRoute.SelectedIndex;
                if (i > 0)
                {
                    RouteData currRouteData = (RouteData)dtGridRoute.Items[i];
                    if (!RouteShowList.ContainsKey(currRouteData.RouteName))
                    {
                        RouteShowList.Add(currRouteData.RouteName, currRouteData.route);
                    }
                }
            }
            else
            {
                Route route = null;//
                if (!args.isNew)
                {
                    if (dtGridRoute.ItemsSource == null)
                    {
                        return;
                    }

                    List <RouteData> listData = (List <RouteData>)(dtGridRoute.ItemsSource);

                    RouteData currRouteData = null;
                    for (int j = 0; j < listData.Count; j++)
                    {
                        if (listData[j].RouteName == args.PolygonName)
                        {
                            currRouteData = listData[j];
                            break;
                        }
                    }

                    if (currRouteData == null)
                    {
                        return;
                    }

                    //Victor   currRouteData.route.arr_legs = LegSector;
                    route = currRouteData.route;
                    if (!RouteShowList.ContainsKey(currRouteData.RouteName))
                    {
                        RouteShowList.Add(currRouteData.RouteName, currRouteData.route);
                    }
                }
                else
                {
                    route = new Route();

                    // LegSector = CreateLegSector(args.PolygonPnts);
                    route.Points    = new List <DPoint>(args.PolygonPnts);
                    route.RouteName = args.PolygonName;

                    RouteData Rdata = new RouteData();
                    Rdata.route = route;



                    ((List <RouteData>)(dtGridRoute.ItemsSource)).Add(Rdata);
                    dtGridRoute.Items.Refresh();
                    dtGridRoute.SelectedItem = Rdata;
                    dtGridRoute.CurrentItem  = Rdata;
                    DataGridWPFUtility.DataGridGotoLast(dtGridRoute);
                }

                await SAGSignalR.SaveRoute(VMMainViewModel.Instance.SimulationHubProxy, route);
            }
        }