Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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());
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Pauses the video
 /// </summary>
 public void Pause()
 {
     EngineView.Pause();
     PlayheadTimer.Stop();
     IsPlaying = false;
     //Invoke VideoPaused Event
     OnVideoPaused(EventArgs.Empty);
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
        /// <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));
        }
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
 /// <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);
 }
Ejemplo n.º 10
0
 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));
 }
Ejemplo n.º 11
0
        /// <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();
        }
Ejemplo n.º 12
0
        /// <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);
        }
Ejemplo n.º 13
0
        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));
            }
        }
Ejemplo n.º 14
0
        /// <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();
            }
        }
Ejemplo n.º 15
0
        /// <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();
        }
Ejemplo n.º 16
0
 /// <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);
 }