public ActionResult CreateLane(LaneViewModel model) { if (ModelState.IsValid) { //var store = new UserStore<ApplicationUser>(context); //var manager = new UserManager<ApplicationUser>(store); var manager = laneRP.CreateUserStore(); var swimmer = manager.FindByEmail(model.SwimmerEmail); TimeSpan t = new TimeSpan(23, 59, 59); Lane lane = new Lane { EventId = model.EventId, LaneNumber = model.LaneNumber, Heat = model.Heat, Swimmer = swimmer, SwimmerTime = t }; //context.Lanes.Add(lane); //context.SaveChanges(); laneRP.Add(lane); return(View("LaneDisplay", lane)); } return(View(model)); }
private NodeViewModel ChildElement(LaneViewModel lane, string shape, string content, double offsetx, double offsety) { NodeViewModel node = new NodeViewModel() { UnitWidth = 130, UnitHeight = 60, LaneOffsetX = offsetx, LaneOffsetY = offsety, Shape = resourceDictionary[shape], }; if (shape == "Decision") { node.UnitWidth = 160; node.UnitHeight = 90; } if (shape == "Flow") { node.Shape = " M100,20 C100,31.05,91.37,40,80.72,40 L19.28,40 C8.63,40,0,31.05,0,20 L0,20 C0,8.95,8.63,0,19.28,0 L80.72,0 C91.37,0,100,8.95,100,20 Z"; } node.Annotations = new AnnotationCollection() { new AnnotationEditorViewModel() { Content = content, } }; (lane.Children as LaneChildren).Add(node); (this.Nodes as ObservableCollection <NodeViewModel>).Add(node); return(node); }
public void Initialize(PlayerCharacter attachedCharacter, LaneViewModel laneVM, Note noteData, Lane lane, Vector2 spawn, Vector2 destruct) { _attachedCharacter = attachedCharacter; _laneViewModel = laneVM; _noteData = noteData; _lane = lane; transform.Rotate(0, 0, (int)_noteData.Direction * -90); _noteImage.sprite = AssetManager.Instance.GetNoteSprite(_attachedCharacter.CharacterName, lane); _tailImage.sprite = AssetManager.Instance.GetTailSprite(_attachedCharacter.CharacterName, lane); _spawnPosition = spawn; _destructPosition = destruct; transform.position = _spawnPosition; float trackHeight = _spawnPosition.y - _destructPosition.y; Vector2 tailSize = new Vector2( _tailImage.GetComponent <RectTransform>().sizeDelta.x, 0.0f * trackHeight / TrackManager.Instance.BeatsShownInAdvance); _tailImage.GetComponent <RectTransform>().sizeDelta = tailSize; _tailImage.GetComponent <BoxCollider2D>().size = tailSize; _tailImage.GetComponent <BoxCollider2D>().offset = new Vector2(0, tailSize.y / 2); _tailImage.transform.rotation = Quaternion.Euler(0, 0, 0); }
public LaneViewModel CreateLaneViewModel(bool ishorizontal, string content, double angle) { AnnotationEditorViewModel annotation = new AnnotationEditorViewModel() { RotateAngle = angle, Content = content, Offset = new Point(0.5, 0.5) }; annotation.Constraints |= AnnotationConstraints.Rotatable & ~AnnotationConstraints.InheritRotatable; LaneViewModel l1 = new LaneViewModel() { Header = new SwimlaneHeaderViewModel() { Annotation = annotation, }, }; if (ishorizontal) { (l1.Header as SwimlaneHeaderViewModel).UnitWidth = 50; } else { (l1.Header as SwimlaneHeaderViewModel).UnitHeight = 50; } return(l1); }
public LaneView(Lane lane) { InitializeComponent(); laneViewModel = new LaneViewModel(lane); UpdateTasks(); DataContext = laneViewModel; }
private void InitializeDiagram() { //Initialize SwimlaneCollection to SfDiagram this.Swimlanes = new SwimlaneCollection(); //Creating the SwimlaneViewModel SwimlaneViewModel swimlane = new SwimlaneViewModel() { UnitWidth = 450, UnitHeight = 120, OffsetX = 300, OffsetY = 150, Orientation = Orientation.Horizontal, }; //Creating Header for SwimlaneViewModel swimlane.Header = new SwimlaneHeader() { UnitHeight = 32, Annotation = new AnnotationEditorViewModel() { Content = "SALES PROCESS FLOW CHART" }, }; LaneViewModel lane1 = new LaneViewModel() { UnitHeight = 100, Header = new SwimlaneHeader() { UnitHeight = 30, Annotation = new AnnotationEditorViewModel() { Content = "Consumer" } } }; swimlane.Lanes = new LaneCollection() { lane1 }; NodeViewModel node = new NodeViewModel() { UnitHeight = 50, UnitWidth = 50, LaneOffsetX = 100, LaneOffsetY = 30 }; NodeViewModel node1 = new NodeViewModel() { UnitHeight = 50, UnitWidth = 50, LaneOffsetX = 250, LaneOffsetY = 30 }; (this.Nodes as NodeCollection).Add(node); (this.Nodes as NodeCollection).Add(node1); (lane1.Children as LaneChildren).Add(node); (lane1.Children as LaneChildren).Add(node1); //Add Swimlane to Swimlanes property of the Diagram (this.Swimlanes as SwimlaneCollection).Add(swimlane); }
public ViewResult CreateLane(int?EventId) { LaneViewModel lane = new LaneViewModel { EventId = EventId }; return(View()); }
private void OnNodeChangedCommand(object obj) { var args = obj as ChangeEventArgs <object, NodeChangedEventArgs>; CustomNodeVM node = args.Item as CustomNodeVM; if (node != null && node.ParentLane != null && args.NewValue.InteractionState == NodeChangedInteractionState.Dragging) { LaneViewModel parentlane = (args.Item as CustomNodeVM).ParentLane as LaneViewModel; args.BoundaryConstraints = (parentlane.Info as ILaneInfo).Bounds; } }
private void BorderOnMouseMove(object sender, MouseEventArgs e) { if (_isDragging) { Vector change = _startPoint - e.GetPosition(this); LaneViewModel viewModel = DataContext as LaneViewModel; if (viewModel != null) { double newHeight = viewModel.Height - change.Y; viewModel.Resize(newHeight); _startPoint = e.GetPosition(this); } } }
private void InitializeDiagram() { //Initialize SwimlaneCollection to SfDiagram this.Swimlanes = new SwimlaneCollection(); //Creating the SwimlaneViewModel SwimlaneViewModel swimlane = new SwimlaneViewModel() { UnitWidth = 450, UnitHeight = 420, OffsetX = 400, OffsetY = 450, Orientation = Orientation.Horizontal, }; LaneViewModel lane1 = new LaneViewModel() { UnitHeight = 100, }; swimlane.Lanes = new LaneCollection() { lane1 }; CustomNodeVM node = new CustomNodeVM() { UnitHeight = 50, UnitWidth = 50, LaneOffsetX = 100, LaneOffsetY = 30 }; CustomNodeVM node1 = new CustomNodeVM() { UnitHeight = 50, UnitWidth = 50, LaneOffsetX = 250, LaneOffsetY = 30 }; (this.Nodes as NodeCollection).Add(node); (this.Nodes as NodeCollection).Add(node1); (lane1.Children as LaneChildren).Add(node); (lane1.Children as LaneChildren).Add(node1); //Add Swimlane to Swimlanes property of the Diagram (this.Swimlanes as SwimlaneCollection).Add(swimlane); }
private void UpdateLaneInput(LaneViewModel lane, PlayerInputHandler.AnalogueStick analogueStick) { if (lane.NotesInCatcher != null && lane.HeldNotes != null) { var catcherNote = lane.NotesInCatcher.NullSafePeek(); var heldNote = lane.HeldNotes.NullSafePeek(); if (catcherNote != null) { bool correctHit = analogueStick.Direction == catcherNote.Direction; bool correctHold = heldNote != null ? analogueStick.Direction == heldNote.Direction : false; if (!catcherNote.HasBeenHit && (analogueStick.IsPressed || (analogueStick.IsHeld && correctHit && heldNote != null && !correctHold))) { Debug.Log(string.Format("Notes in catcher: {0}, Note Direction is : {1}, stick held in Direction: {2}", lane.NotesInCatcher.Count, catcherNote.Direction, analogueStick.Direction)); catcherNote.HitNote(correctHit); } else if (analogueStick.IsPressed && catcherNote.HasBeenHit) { Debug.Log("Catcher note has been hit."); } } else if (analogueStick.IsPressed && catcherNote == null) { Debug.Log("Catcher note is null."); } if (heldNote != null) { bool correctHold = analogueStick.Direction == heldNote.Direction; if (analogueStick.IsReleased || (!heldNote.InSafeZone && !correctHold)) { heldNote.ReleaseHeldNote(false); } } } }
public async Task <IEnumerable <LaneViewModel> > Getlanes() { IEnumerable <Lane> lanes = await _laneRepository.GetManyAsync(l => l.isDelete == false, QueryIncludes.LANEFULLINCLUDES); LaneViewModel view = null; IEnumerable <LaneViewModel> models = new List <LaneViewModel>(); //foreach (var lane in lanes) //{ // view = new LaneViewModel(); // view.name = lane.nameVi; // view.code = lane.code; // view.loadingBayCode = lane.loadingBayCode; // view.loadingBayName = lane.loadingBay.nameVi; // view.truckTypeDesciption = lane.truckType.desciption; // view.loadingTypeDescription = lane.loadingType.description; // view.maxCapactity = lane.maxCapactity; // view.minCapacity = lane.minCapacity; // models.Add(view); //} models = Mapper.Map <IEnumerable <Lane>, IEnumerable <LaneViewModel> >(lanes); return(models); }
public IHttpActionResult PostLane(LaneViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var manager = laneRP.CreateUserStore(); var swimmer = manager.FindByEmail(model.SwimmerEmail); Lane lane = new Lane { EventId = model.EventId, LaneNumber = model.LaneNumber, Heat = model.Heat, Swimmer = swimmer, SwimmerTime = model.Time }; laneRP.Add(lane); return(CreatedAtRoute("DefaultApi", new { id = lane.LaneId }, lane)); }
private void InitializeDiagram() { SwimlaneViewModel swimLane = new SwimlaneViewModel(); swimLane.Orientation = Orientation.Horizontal; swimLane.OffsetX = 400; swimLane.OffsetY = 300; swimLane.UnitWidth = 650; swimLane.UnitHeight = 500; swimLane.Header = new SwimlaneHeaderViewModel() { UnitHeight = 50, Annotation = new AnnotationEditorViewModel() { Content = "SALES PROCESS FLOW CHART" }, }; PhaseViewModel nn1 = CreatePhaseViewModel(true, "Phase1", 0); nn1.UnitWidth = 760; swimLane.Phases = new ObservableCollection <PhaseViewModel>() { nn1 }; LaneViewModel ll1 = CreateLaneViewModel(true, "Consumer", 270); NodeViewModel n1 = ChildElement(ll1, "Rectangle", "Consumer learns of product", 130, 55); NodeViewModel n2 = ChildElement(ll1, "Decision", "Does Consumer \n want the product", 320, 55); NodeViewModel n3 = ChildElement(ll1, "Flow", "No sales lead", 520, 55); NodeViewModel n4 = ChildElement(ll1, "Rectangle", "Sell to consumer", 680, 55); LaneViewModel ll2 = CreateLaneViewModel(true, "Marketing", 270); NodeViewModel n5 = ChildElement(ll2, "Rectangle", "Create marketing campaigns", 130, 55); NodeViewModel n6 = ChildElement(ll2, "Rectangle", "Marketing finds sales leads", 320, 55); LaneViewModel ll3 = CreateLaneViewModel(true, "Sales", 270); NodeViewModel n7 = ChildElement(ll3, "Rectangle", "Sales receives lead", 320, 60); LaneViewModel ll4 = CreateLaneViewModel(true, "Success", 270); NodeViewModel n8 = ChildElement(ll4, "Rectangle", "Success helps retain consumer as a customer", 680, 55); ll1.UnitHeight = 115; ll2.UnitHeight = 115; ll3.UnitHeight = 115; ll4.UnitHeight = 115; swimLane.Lanes = new ObservableCollection <LaneViewModel>() { ll1, ll2, ll3, ll4 }; (this.Swimlanes as ObservableCollection <SwimlaneViewModel>).Add(swimLane); CreateConnection(n1, n2); ConnectorViewModel noconnector = CreateConnection(n2, n3); noconnector.Annotations = new ObservableCollection <IAnnotation>() { new AnnotationEditorViewModel() { Content = "No" } }; CreateConnection(n4, n8); ConnectorViewModel yesconnector = CreateConnection(n2, n6); yesconnector.Annotations = new ObservableCollection <IAnnotation>() { new AnnotationEditorViewModel() { Content = "Yes", RotationReference = RotationReference.Page, Length = 0.4 } }; CreateConnection(n5, n1); CreateConnection(n6, n7); ConnectorViewModel con = CreateConnection(n4, n7); NodePortViewModel port = CreatePort(n4, 0, 0.5); NodePortViewModel port1 = CreatePort(n7, 1, 0.5); con.SourcePort = port; con.TargetPort = port1; }
public async Task <ResponseViewModel <LaneViewModel> > DeleteLane([FromBody] LaneViewModel laneView) { return(await _adminService.DeleteLane(laneView)); }
public async Task <ResponseViewModel <LaneViewModel> > CreateNewLane([FromBody] LaneViewModel laneView) { return(await _adminService.CreateNewLane(laneView)); }