public static string IduceVrijeme(IFirePlaySong song) { string default_end = "Z"; int min = 0, sec = 0, millis = 0; //int index = -1; if (song.Trajanje.Contains(".")) { int index = song.Trajanje.IndexOf("."); if (!(int.TryParse(new String(song.Trajanje.ToCharArray(), 0, index), out sec))) { throw new IndexingErrorExeption("Index for dot missaligned"); } if (!(int.TryParse(new String(song.Trajanje.ToCharArray(), index + 1, song.Trajanje.Length), out millis))) { throw new IndexingErrorExeption("Index for dot missaligned"); } if (sec > 59) { min = (int)(sec / 60); sec -= (min * 60); while (millis > 1000) { millis /= 10; } return(FPTime.Sum(new FPTime(song.Vrijeme), new FPTime(0, 0, 0, 0, min, sec, millis, default_end)).GetTimeString()); } } else { if (!(int.TryParse(new String(song.Trajanje.ToCharArray(), 0, song.Trajanje.Length), out sec))) { throw new IndexingErrorExeption("Index for dot missaligned"); } if (sec > 59) { min = (int)(sec / 60); sec -= (min * 60); while (millis > 1000) { millis /= 10; } return(FPTime.Sum(new FPTime(song.Vrijeme), new FPTime(0, 0, 0, 0, min, sec, millis, default_end)).GetTimeString()); } } return(string.Empty); }
public InfoForm(IFirePlaySong song) { Song = song; InitializeComponent(); this.GridView(); this.SetUpAnchors(); InitializeList(); Show(); this.KeyPreview = true; this.KeyDown += (a, b) => { if (b.KeyCode == Keys.C && ModifierKeys.HasFlag(Keys.Control)) { foreach (ListViewItem lvi in infoListView.Items) { if (lvi.Selected) { System.Windows.Forms.Clipboard.SetText(lvi.SubItems[1].Text); } } } }; }
public static async Task <SongView> CreateSongViewAsync(IFirePlaySong song) { return(await Task.Run(() => new SongView(song))); }
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////// CONSTRUCTOR /////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////// public SongView(IFirePlaySong song) { InitializeComponent(); checkbox_selected.Visible = false; _allSongViews.Add(this); if (!_allVisibel) { this.Hide(); } else if (_allVisibel) { this.Show(); } TimeInfo = "0:0:00.000 @00:00:00.000"; Song = song; SetPlayAudio(); Song.SongChanged += UpdateThis; /* * this.MouseEnter += (a, b) => * { * if (SongView.MouseDownBool) this.Select(); * }; * * this.MouseLeave += (a, b) => * { * if (SongView.MouseDownBool) this.Unselect(); * }; */ UpdateThis(this, new EventArgs()); if (song.Sweeper) { this.Back_Color(SongViewColor.Sweeper); } else { this.Back_Color(SongViewColor.Song); } //this.MouseDown += (z, p) => MouseDownBool = true; //this.MouseUp += (z, p) => MouseDownBool = false; //this.MouseMove += (a, b) => this.Select(); //this.MouseEnter += (a, b) => Select(); this.DefaultColor = this.Back_Color(); this.MouseClick += Selector; this.song_info.MouseClick += Selector; this.song_time_info.MouseClick += Selector; KeyPress += OnKeyPressed; KeyDown += OnKeyDown; this.UserControl = (System.Windows.Forms.UserControl) this; linkLabel1.Visible = false; /*PanelOptions.EditedIndex += (a, b) => * { * if (this.Parent.Equals(a)) * { * if (this.Index < b.FirstIndex) this.UserControl.Hide(); * else * { * this.UserControl.Show(); * this.UserControl.Top = (SongView.Margin - 1) * (this.Index - b.FirstIndex); * } * } * };*/ //DrawRectangleForSelect(); this.MouseWheel += (s, e) => { if (play != null) { if (play.IsPlaying) { if (e.Delta > 0 && ModifierKeys.HasFlag(Keys.Shift)) { long l = play.AudioReader.Position - 96000 * 4 * 2; play.AudioReader.Position = l < 0 ? 0 : l; } else if (e.Delta < 0 && ModifierKeys.HasFlag(Keys.Shift)) { long l = play.AudioReader.Position + 96000 * 4 * 2; play.AudioReader.Position = (double)l > (play.AudioReader.TotalTime.TotalSeconds * 4 * 96000) ? (int)(play.AudioReader.TotalTime.TotalSeconds * 4 * 96000) : l; } } } }; }