public async Task OnGetAsync(Guid?id) { if (!id.HasValue) { this.EngineView = new EngineView(); return; } try { var response = await this.client.ProcessRequestApiAsync <YEngine>($"api/Engines/{id}", null).ConfigureAwait(false); this.EngineView = new EngineView(response.Value); if (!string.IsNullOrEmpty(this.EngineView.EngineName)) { this.AddBreadCrumb(new BreadCrumb { Url = this.HttpContext.Request.GetEncodedUrl(), Title = this.EngineView.EngineName, Order = 2 }); } } catch (Exception ex) { Debug.WriteLine(ex.Message); throw; } }
public EngineViewmodel(Server.Engine engine) { _engine = engine; _engine.EngineTick += this.OnEngineTick; _engine.EngineOperation += this._engineOperation; _engine.ServerPropertyChanged += OnServerPropertyChanged; _engine.PropertyChanged += this.OnEnginePropertyChanged; _engine.VisibleEventsOperation += OnEnginePlayingEventsDictionaryOperation; _engine.LoadedNextEventsOperation += OnEngineLoadedEventsDictionaryOperation; _engine.RunningEventsOperation += OnEngineRunningEventsOperation; Debug.WriteLine(this, "Creating root EventViewmodel"); _rootEventViewModel = new EventViewmodel(_engine, this); Debug.WriteLine(this, "Creating EventEditViewmodel"); _eventEditViewmodel = new EventEditViewmodel(this); Debug.WriteLine(this, "Creating EventClipboard"); Debug.WriteLine(this, "Creating PlayingEventViewmodel"); _playingEventViewmodel = new PlayingEventViewmodel(_engine); _createCommands(); Debug.WriteLine(this, "Creating EngineView"); _engineView = new EngineView(); _engineView.DataContext = this; _selectedEvents = new ObservableCollection<EventViewmodel>(); _selectedEvents.CollectionChanged += _selectedEvents_CollectionChanged; EventClipboard.ClipboardChanged += EngineViewmodel_ClipboardChanged; }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (!id.HasValue) { return(new NotFoundResult()); } var enginesAction = await this.enginesController.GetEngineAsync(id); if (enginesAction.HasError) { return(new NotFoundResult()); } this.EngineView = new EngineView(enginesAction.Value); if (!string.IsNullOrEmpty(this.EngineView.EngineName)) { this.AddBreadCrumb(new BreadCrumb { Url = this.HttpContext.Request.GetEncodedUrl(), Title = this.EngineView.EngineName, Order = 2 }); } return(Page()); }
// Use this for initialization void Start() { rb = GetComponentInParent <Rigidbody> (); engine = new Engine(); engView = GetComponent <EngineView>(); engView.UpdatePower(engine.GetPower()); //engView.UpdateEngineState(engine.GetIsOn()); }
/// <summary> /// Pauses the video /// </summary> public void Pause() { EngineView.Pause(); PlayheadTimer.Stop(); IsPlaying = false; //Invoke VideoPaused Event OnVideoPaused(EventArgs.Empty); }
void Start() { shipModules = transform.parent.gameObject.GetComponent<ShipController>().modules; engineView = gameObject.GetComponent<EngineView>(); engine = gameObject.GetComponent<Engine>(); engineView.enabled = false; engine.thrustDuration = 0.0f; engine.isRunning = false; }
/// <summary> /// Handles the loading of the new project for the different controlls on the form. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event Args</param> private void NewProjectForm_ProjectCreated(object sender, ProjectCreatedEventArgs e) { //Set ProjectInfo and core data references to the new project's data. ProjectInfo = e.ProjectInfo; //Save project by calling the SaveProject menu item click handler. saveProjectToolStripMenuItem.PerformClick(); EngineView.LoadMovie(0,Path.Combine(ProjectInfo.DirectoryPath,ProjectInfo.EditorEngineFileName)); }
private void openProjectToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult result = OpenProjectDialog.ShowDialog(); //Only read in file of OK button was pressed if (result == DialogResult.OK) ProjectInfo = XMLReader.ParseProject(OpenProjectDialog.FileName); //Load the video EngineView.LoadMovie(0, Path.Combine(ProjectInfo.DirectoryPath, ProjectInfo.EditorEngineFileName)); }
/// <summary> /// This function reloads the video with updated state so that the video reflects changes /// made in the editor. /// </summary> private void ReloadVideo() { /* What is happening here is that the video is paused, then all of the captions are * saved to file. The EngineView is then loaded with a new .swf file, called * "blank.swf". This is so that all of the captions dissapear and are reset on reload. * It seems that just calling the loadmovie function once does not seem to work when * loading the same swf file successively, so here is a hackish workaround. */ Pause(); saveProjectToolStripMenuItem_Click(this, EventArgs.Empty); EngineView.ReloadMovie(ProjectInfo.EditorEngineFile.AbsolutePath); }
public SupplierController( ApplicationService service, EngineView engineView, TyreView tyreView, FuelView fuelView, IMapperService mapper) { _service = service ?? throw new ArgumentNullException(nameof(service)); _engineView = engineView ?? throw new ArgumentNullException(nameof(engineView)); _tyreView = tyreView ?? throw new ArgumentNullException(nameof(tyreView)); _fuelView = fuelView ?? throw new ArgumentNullException(nameof(fuelView)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); }
/// <summary> /// Handles the event fired when FlashVideoPlayer is done loading /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event Args</param> private void EngineView_VideoLoaded(object sender, EventArgs e) { double vidLength = EngineView.VideoLength(); TrackBar_Timeline.Maximum = (int)vidLength * 10; //Set Label PlayheadLabel.VideoLength = vidLength; Timeline.VideoLength = vidLength; Timeline.Redraw(); Timeline.SetScrollBarValues(); }
/// <summary> /// Plays the video /// </summary> public void Play() { if (videoReloadRequested) { ReloadVideo(); videoReloadRequested = false; } EngineView.Play(); PlayheadTimer.Start(); IsPlaying = true; //Invoke VideoPlayed Event OnVideoPlayed(EventArgs.Empty); }
public async Task <ActionResult> Edit(int id, EngineView editEngine) { if (ModelState.IsValid) { var newBLEngine = _mapper.Map <EngineDTO>(editEngine); await _engineService.UpdateAsync(newBLEngine); return(RedirectToAction("Index")); } else { ViewBag.Message = "Not Valid"; return(View(editEngine)); } }
/// <summary> /// Handles the PlayheadChanged Event. Updates the playhead in various controls. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event Args</param> private void Timeline_PlayheadChanged(object sender, TimelinePlayheadChangedEventArgs e) { Console.WriteLine("Playhead Changed!"); bool wasPlaying = EngineView.IsPlaying(); //Pause video, change time, and then play to prevent confusing the player Pause(); EngineView.SetPlayHeadTime(e.PlayheadTime); //Update label PlayheadLabel.PlayheadTime = e.PlayheadTime; //Only play if Engine was playing previously if (wasPlaying) { Play(); } }
/// <summary> /// Handles the Tick event. Updates ui controls with relevant information when the video /// is playing. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event Args</param> private void PlayheadTimer_Tick(object sender, EventArgs e) { double playheadTime = EngineView.GetPlayheadTime(); int vidPos = (int)playheadTime * 10; if (TrackBar_Timeline.Minimum <= vidPos && vidPos <= TrackBar_Timeline.Maximum) { TrackBar_Timeline.Value = vidPos; } //Set playhead time for label PlayheadLabel.PlayheadTime = playheadTime; Timeline.UpdatePlayheadPosition(playheadTime); //Redraw Timeline Timeline.Redraw(); TrackBar_Timeline.Update(); }
/// <summary> /// Initializes the VideoPlayer. Everything related to VideoPlayer initialization should /// go in this method. /// </summary> private void InitVideoPlayer() { //This method can not be called in the EngineView constructor, so we will call it here. EngineView.LoadMovie(0, Paths.BlankSwf); }