public static async Task <GeneralActivityDTO> SaveActivity(IHubProxy HubProxy, GeneralActivityDTO ActivityDTO) { try { GeneralActivityDTO activity = await HubProxy.Invoke <GeneralActivityDTO>("SaveActivity", ActivityDTO); return(activity); } catch (Exception ex) { } return(null); }
public frmRouteActivityRouting(GeneralActivityDTO pActivityDTO) { InitializeComponent(); this.Background = new LinearGradientBrush(Colors.AliceBlue, Colors.LightGray, 90); refActivityDTO = pActivityDTO; SetGridRoutes(); dtGridRoute.ItemsSource = new List<OsmRouteData>(); }
public frmActivityEdit(structTransportCommonProperty CommonProperty, GeneralActivityDTO ActivityDTO) { InitializeComponent(); this.Background = new LinearGradientBrush(Colors.AliceBlue, Colors.LightGray, 90); txPlatformName.IsReadOnly = true; AtomCommonProperty = CommonProperty; refActivityDTO = ActivityDTO; if (AtomCommonProperty!=null) { txPlatformName.Text = AtomCommonProperty.AtomName; } }
public static async Task<GeneralActivityDTO> SaveActivity(IHubProxy HubProxy, GeneralActivityDTO ActivityDTO) { try { GeneralActivityDTO activity= await HubProxy.Invoke<GeneralActivityDTO>("SaveActivity", ActivityDTO); return activity; } catch (Exception ex) { } return null; }
private void btnOK_Click(object sender, RoutedEventArgs e) { // bool isCheckOk = await CheckOk(); bool isCheckOk = CheckOk(); if (isCheckOk == false) return; GeneralActivityDTO ActivityDTO = new GeneralActivityDTO(); ActivityDTO.Atom = new AtomData(); ActivityDTO.Atom.UnitName = AtomCommonProperty.AtomName; ActivityDTO.ActivityType = enumActivity.MovementActivity; ActivityDTO.StartActivityOffset = (TimeSpan)startActivity.Value; ActivityDTO.Speed = (int)speedUpDown.Value; double X = 0; double Y = 0; if (txtReferenceX.Tag != null) { double.TryParse(txtReferenceX.Tag.ToString(), out X); double.TryParse(txtReferenceY.Tag.ToString(), out Y); ActivityDTO.ReferencePoint = new DPoint(X,Y); } // Route route = new Route(); // route.RouteName = txtRoute.Text; ActivityDTO.RouteActivity = ActivityRoute;// route; ActivityDTOEditEventArgs args = new ActivityDTOEditEventArgs(); args.isNew = false; if (refActivityDTO == null) { args.isNew = true; } else { ActivityDTO.ActivityId = refActivityDTO.ActivityId; ActivityDTO.Activity_SeqNumber = refActivityDTO.Activity_SeqNumber; } args.ActivityDTO = ActivityDTO; if(ActivityDTOEditEvent!=null) { ActivityDTOEditEvent(this, args); } 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); } 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(); }