Example #1
0
        private void OnMidiTick(Object o, int position)
        {
            if (position < TrackProgress.Maximum)
            {
                TrackProgress.Invoke(t => t.Value = position);

                CurrentProgressInfo.Invoke(t => t.Text = player.CurrentTime);
            }
        }
        public MiniHud()
        {
            InitializeComponent();
            TrackProgress.IsEnabled       = false;
            TrackProgress.PreviewMouseUp += (x, y) =>
            {
                if (MainWindow.currentlyPlayingAudioFile == null)
                {
                    return;
                }
                var d = new DoubleAnimation()
                {
                    To       = MainWindow.currentlyPlayingAudioFile.TotalTime.TotalSeconds,
                    From     = TrackProgress.Value,
                    Duration = new Duration(TimeSpan.FromSeconds(MainWindow.currentlyPlayingAudioFile.TotalTime.TotalSeconds - TrackProgress.Value))
                };
                TrackProgress.BeginAnimation(ProgressBar.ValueProperty, d);
                MainWindow.PlayPauseDialx.VisualStatePlay();
                MainWindow.MiniHud.TrackStatus.Text = "Status: Playing";
                MainWindow.trackAnim = d;
                try
                {
                    MainWindow.outputDevice.Play();
                } catch (Exception) { }
            };

            TrackProgress.PreviewMouseMove += (sender, args) =>
            {
                if (MainWindow.currentlyPlayingAudioFile == null)
                {
                    return;
                }
                if (args.LeftButton == MouseButtonState.Pressed)
                {
                    TrackProgress.RaiseEvent(new MouseButtonEventArgs(args.MouseDevice, args.Timestamp, MouseButton.Left)
                    {
                        RoutedEvent = UIElement.PreviewMouseLeftButtonDownEvent,
                        Source      = args.Source
                    });
                    TrackProgress.BeginAnimation(ProgressBar.ValueProperty, null);
                    var ts = TimeSpan.FromSeconds(TrackProgress.Value);
                    MainWindow.currentlyPlayingAudioFile.CurrentTime = ts;
                    MainWindow.MiniHud.TrackCurrentPos.Text          = string.Format("{0:00}:{1:00}:{2:00}",
                                                                                     (int)(ts.TotalHours),
                                                                                     ts.Minutes,
                                                                                     ts.Seconds);
                    try
                    {
                        MainWindow.outputDevice.Play();
                    } catch (Exception) { }
                }
            };
        }
Example #3
0
        public void UpdatePlayer()
        {
            TrackProgress.Invoke(t => t.Maximum = player.MaxTick);
            TrackProgress.Invoke(t => t.Value   = 0);
            if (player.CurrentTick < player.MaxTick)
            {
                TrackProgress.Invoke(t => t.Value = player.CurrentTick);
            }

            Bitmap playPauseBmp = (player.IsPlaying ? Properties.Resources.Pause : Properties.Resources.Play);

            TrackPlay.Invoke(t => t.Image = playPauseBmp);
        }
Example #4
0
        public IActionResult Update(string id, TrackProgress itemIn)
        {
            var book = TrackDataProxy.Get(id);

            if (book == null)
            {
                return(NotFound());
            }

            TrackDataProxy.Update(id, itemIn);

            return(NoContent());
        }
Example #5
0
        private void TrackProgressExecute(object obj)
        {
            var progressModel = new ProgressModel {
                GoalId = SelectedGoal.GoalId, Date = DateTime.Now
            };
            var newProgessViewModel = new AddProgressViewModel(progressModel, _client);

            var dialog = new TrackProgress();

            dialog.DataContext = newProgessViewModel;
            var result = dialog.ShowDialog();

            if (result.GetValueOrDefault())
            {
                Progress.Add(new ProgressViewModel(SelectedGoal, newProgessViewModel.Progress));
            }
        }
Example #6
0
 private void TrackProgress_MouseUp(object sender, MouseEventArgs e)
 {
     if (!player.Loaded)
     {
         return;
     }
     if (e.Button == MouseButtons.Left && !player.IsPlaying)
     {
         if (trackHoldPlaying)
         {
             player.Play();
         }
         UpdatePlayer();
         if (player.CurrentTick > player.MaxTick)
         {
             return;
         }
         TrackProgress.Invoke(t => t.Value = (int)player.CurrentTick);
     }
 }
Example #7
0
 private void Start()
 {
     trackProgress = FindObjectOfType <TrackProgress>();
     light         = GetComponentInChildren <Light>();
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ItSeez3D.AsyncWebRequest`1"/> class.
 /// </summary>
 /// <param name="initialState">Initial value to be returned by State property. Usually a name of the
 /// operation, e.g. "Downloading file".</param>
 /// <param name="progressTracking">Set to UPLOAD if you're uploading file to server, DOWNLOAD otherwise.</param>
 public AsyncWebRequest(string initialState = "", TrackProgress progressTracking = TrackProgress.DOWNLOAD)
     : base(initialState)
 {
     this.progressTracking = progressTracking;
 }
Example #9
0
 public ActionResult <TrackProgress> Create(TrackProgress item)
 {
     TrackDataProxy.Create(item);
     return(CreatedAtRoute("GetTrack", new { id = item.Id.ToString() }, item));
 }