private void UpdateMyMusicList(MyMusicListItem myMusicListItem) { FieldCollection fc = new FieldCollection(); int internalFieldsCount = 0; foreach (Field field in internalFields) { if (this.trackListFields.SingleOrDefault(x => x.Field == field) == null) { fc.Add(field); internalFieldsCount++; } } fc.AddRange(this.trackListFields.GetFields()); int soundFileIndex = fc.IndexOf(Field.TrackSoundFile); DataBaseView view = TrackView.CreateView(DataBase, fc, trackListSort, myMusicListItem.ID); object[] values = view.Read(); FillRowValues(myMusicListItem, values, soundFileIndex, internalFieldsCount); ListCollectionView lcv = this.dataGrid.ItemsSource as ListCollectionView; lcv.Refresh(); }
public TrackController( ApplicationService service, TrackView trackView, IMapperService mapper) { _service = service ?? throw new ArgumentNullException(nameof(service)); _trackView = trackView ?? throw new ArgumentNullException(nameof(trackView)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); }
public App() { var testPage = new TrackView(); testPage.BindingContext = new TrackViewModel(); ApplyTheme(); // The root page of your application MainPage = testPage; }
public void ResetSource() { if (source != null) { source.TracksAdded -= HandleTracksAdded; source.TracksDeleted -= HandleTracksDeleted; source = null; } TrackView.SetModel(null); FilterView.SetModel(null); }
private void WriteTrack(XmlTextWriter w) { long beginTimestamp = random.Next((int)durationTimestamps); Array viewValues = Enum.GetValues(typeof(TrackView)); TrackView view = (TrackView)viewValues.GetValue(random.Next(viewValues.Length)); Array extraDataValues = Enum.GetValues(typeof(TrackExtraData)); TrackExtraData extraData = (TrackExtraData)extraDataValues.GetValue(random.Next(extraDataValues.Length)); Array markerValues = Enum.GetValues(typeof(TrackMarker)); TrackMarker marker = (TrackMarker)markerValues.GetValue(random.Next(markerValues.Length)); bool displayBestFitCircle = random.NextBoolean(); string mainLabelText = random.NextString(20); w.WriteElementString("TimePosition", beginTimestamp.ToString()); w.WriteElementString("Mode", view.ToString()); w.WriteElementString("ExtraData", extraData.ToString()); w.WriteElementString("Marker", marker.ToString()); w.WriteElementString("DisplayBestFitCircle", displayBestFitCircle.ToString().ToLower()); WriteTrackerParameters(w); WriteTrackPoints(w, beginTimestamp); w.WriteStartElement("DrawingStyle"); WriteDrawingStyleColor(w, "color"); WriteDrawingStyleLineSize(w, "line size"); WriteDrawingStyleTrackShape(w, "track shape"); w.WriteEndElement(); w.WriteStartElement("MainLabel"); w.WriteAttributeString("Text", mainLabelText); PointF location = random.NextPointF(0, imageSize.Width, 0, imageSize.Height); w.WriteElementString("SpacePosition", XmlHelper.WritePointF(location)); w.WriteElementString("TimePosition", "0"); w.WriteEndElement(); /*if (keyframesLabels.Count > 0) * { * w.WriteStartElement("KeyframeLabelList"); * w.WriteAttributeString("Count", keyframesLabels.Count.ToString()); * * foreach (KeyframeLabel kfl in keyframesLabels) * { * w.WriteStartElement("KeyframeLabel"); * kfl.WriteXml(w); * w.WriteEndElement(); * } * * w.WriteEndElement(); * }*/ }
public X1Track(X1Project _proj, int num) { project = _proj; trackView = null; mixerStrip = null; //trackview + mixerstrip are created after the track and set these fields then name = "Track " + (num + 1); number = num; level = 1.0f; pan = 0.5f; mute = false; record = false; inputdevNum = -1; }
private void DrawTrack() { List <float> xCoor = null; List <float> yCoor = null; List <int> turnSections = null; int selectedlap; int selectedsection; if (SelectedLap == "All Laps") { selectedlap = -1; } else { selectedlap = int.Parse(SelectedLap); } if (SelectedSection == "All Sections") { selectedsection = -1; } else { selectedsection = int.Parse(SelectedSection); } xCoor = new List <float>(); yCoor = new List <float>(); turnSections = new List <int>(); for (int i = 0; i < rm.AccG[0].Count; i++) { if ((rm.CompletedLaps[i] == selectedlap - 1 || selectedlap == -1) && (rm.TurnSections[i] == selectedsection - 1 || selectedsection == -1)) { xCoor.Add(rm.CarCoordinates[0][i]); yCoor.Add(rm.CarCoordinates[2][i]); turnSections.Add(rm.TurnSections[i]); } } if (TrackView == null) { TrackView = new TrackView(); } TrackView.Track.DrawTrack(xCoor, yCoor, turnSections); TrackView.Topmost = true; TrackView.Show(); }
void bwTrackList_DoWork(object sender, DoWorkEventArgs e) { SafeObservableCollection <MyMusicListItem> items = new SafeObservableCollection <MyMusicListItem>(); int count = 0; FieldCollection fc = new FieldCollection(); int internalFieldsCount = 0; foreach (Field field in internalFields) { if (this.trackListFields.SingleOrDefault(x => x.Field == field) == null) { fc.Add(field); internalFieldsCount++; } } fc.AddRange(this.trackListFields.GetFields()); int soundFileIndex = fc.IndexOf(Field.TrackSoundFile); Big3.Hitbase.DataBaseEngine.Condition searchCondition = Big3.Hitbase.DataBaseEngine.Condition.Combine(Condition, ConditionFromTree); using (DataBaseView view = TrackView.CreateView(this.DataBase, fc, this.trackListSort, 0, searchCondition)) { object[] values; while ((values = view.Read()) != null) { MyMusicListItem newItem = new MyMusicListItem(); FillRowValues(newItem, values, soundFileIndex, internalFieldsCount); items.AddItemFromThread(newItem); count++; } } e.Result = items; }
public void WriteWordDoc(string fileName, TrackView trackView) { try { trackView.Lock(); Track track = trackView.GetTrack(); string templateName = Path.Combine(Path.GetDirectoryName(this.GetType().Assembly.Location), "docTemplate.dotx"); List<TrackPointExt> points = track.GetTrackPoints(); List<List<TrackPointExt>> pointsInFiles = new List<List<TrackPointExt>>(); for (int i = 0; i * pointsPerFile < points.Count; i++) { int count = (points.Count - (i + 1) * pointsPerFile >= 0) ? pointsPerFile : points.Count - i * pointsPerFile; pointsInFiles.Add(points.GetRange(i * pointsPerFile, count)); } int currentPercent = -1; for (int i = 0; i < pointsInFiles.Count; i++) { WordDocument document = new WordDocument(templateName, false); List<TrackPointExt> tempPoints = pointsInFiles[i]; for (int j = 0; j < tempPoints.Count; j++) { // событие изменения процентов int processPointsCount = 0; for (int k = 0; k < i; i++) { processPointsCount += pointsInFiles[i].Count; } processPointsCount = (j + processPointsCount) * 100 / points.Count; if (processPointsCount > currentPercent) { OnChanged(processPointsCount); currentPercent = processPointsCount; } // string[] row = new string[6]; row[0] = j.ToString(); row[1] = tempPoints[j].Point.Y.ToString(); row[2] = tempPoints[j].Point.X.ToString(); row[3] = tempPoints[j].H.ToString(); row[4] = track.GetSpeed(j + i * pointsPerFile).ToString(); row[5] = tempPoints[j].Time.ToString(); document.AddDataToTable(1, row); } document.Save(fileName + i + ".doc"); document.CloseDocument(); document.Close(); } trackView.Unlock(); } catch (Exception ex) { trackView.Unlock(); throw ex; } }
void AddNote(Note note, TrackView track) { track.notes.Add(note); UI.Points.maxPoints += note.length + 10; note = null; }
void bwAlbumView_DoWork(object sender, DoWorkEventArgs e) { FieldCollection fc = new FieldCollection(); fc.AddRange(new Field[] { Field.CDID, Field.Title, Field.ArchiveNumber, Field.CDCoverFront, Field.YearRecorded, Field.TrackNumber, Field.TrackTitle, Field.TrackLength, Field.TrackRating, Field.TrackSoundFile, Field.ArtistCDName, Field.ArtistCDSaveAs, Field.ArtistTrackName, Field.Category, Field.ComposerTrackName }); int count = 0; SortFieldCollection sfc = new SortFieldCollection(); sfc.Add(Field.ArtistCDSaveAs); sfc.Add(Field.Title); sfc.Add(Field.CDID); // Die Verzeichnisansicht immer sortiert nach Dateiname if (this.ShowItemType == ShowItemType.Directory) { sfc.Add(Field.TrackSoundFile); } else { sfc.Add(Field.TrackNumber); } SafeObservableCollection <AlbumViewItemBase> items = new SafeObservableCollection <AlbumViewItemBase>(); AlbumViewItem newItem = null; string lastArtist = ""; string lastArtistTitle = ""; string lastTitle = ""; int lastcdid = 0; Big3.Hitbase.DataBaseEngine.Condition searchCondition = Big3.Hitbase.DataBaseEngine.Condition.Combine(Condition, ConditionFromTree); using (DataBaseView view = TrackView.CreateView(DataBase, fc, sfc, 0, searchCondition)) { // Überall auf die Indizes 1 addieren, da die erste Spalte die TrackID ist. int colArtistName = fc.IndexOf(Field.ArtistCDName) + 1; int colArtistSaveAs = fc.IndexOf(Field.ArtistCDSaveAs) + 1; int colTitle = fc.IndexOf(Field.Title) + 1; int colCDID = fc.IndexOf(Field.CDID) + 1; int colFrontCover = fc.IndexOf(Field.CDCoverFront) + 1; int colCategory = fc.IndexOf(Field.Category) + 1; int colArchiveNumber = fc.IndexOf(Field.ArchiveNumber) + 1; int colYearRecorded = fc.IndexOf(Field.YearRecorded) + 1; int colTrackNumber = fc.IndexOf(Field.TrackNumber) + 1; int colTrackTitle = fc.IndexOf(Field.TrackTitle) + 1; int colTrackLength = fc.IndexOf(Field.TrackLength) + 1; int colTrackRating = fc.IndexOf(Field.TrackRating) + 1; int colTrackArtist = fc.IndexOf(Field.ArtistTrackName) + 1; int colTrackComposer = fc.IndexOf(Field.ComposerTrackName) + 1; int colTrackSoundFile = fc.IndexOf(Field.TrackSoundFile) + 1; int colTrackID = 0; object[] values; while ((values = view.Read()) != null) { string artistDisplay = values[colArtistName] is DBNull ? "" : (string)values[colArtistName]; string artist = values[colArtistSaveAs] is DBNull ? "" : (string)values[colArtistSaveAs]; string title = values[colTitle] is DBNull ? "" : (string)values[colTitle]; int cdid = (int)values[colCDID]; if (cdid != lastcdid) { if (newItem != null) { if (newItem.Artist != lastArtistTitle) { AlbumViewTitle albumTitle = new AlbumViewTitle(); albumTitle.Title = newItem.Artist; items.Add(albumTitle); lastArtistTitle = newItem.Artist; } items.Add(newItem); } newItem = new AlbumViewItem(); newItem.ID = cdid; newItem.Artist = artistDisplay; newItem.Title = title; newItem.ImageFilename = values[colFrontCover] is DBNull ? "" : (string)values[colFrontCover]; newItem.Genre = values[colCategory] is DBNull ? "" : (string)values[colCategory]; newItem.ArchiveNumber = values[colArchiveNumber] is DBNull ? "" : (string)values[colArchiveNumber]; int yearRecorded = values[colYearRecorded] is DBNull ? 0 : (int)values[colYearRecorded]; if (yearRecorded > 0) { newItem.Year = yearRecorded.ToString(); } newItem.Tracks = new SafeObservableCollection <Track>(); lastArtist = artist; lastTitle = title; } if (newItem != null) { Track track = new Track(); track.TrackNumber = (int)values[colTrackNumber]; track.Title = values[colTrackTitle] is DBNull ? "" : (string)values[colTrackTitle]; track.Length = (int)values[colTrackLength]; track.Rating = values[colTrackRating] is DBNull ? 0 : (int)values[colTrackRating]; track.Artist = values[colTrackArtist] is DBNull ? "" : (string)values[colTrackArtist]; track.Composer = values[colTrackComposer] is DBNull ? "" : (string)values[colTrackComposer]; track.Soundfile = values[colTrackSoundFile] is DBNull ? "" : (string)values[colTrackSoundFile]; track.CDID = cdid; track.ID = (int)values[colTrackID]; newItem.Tracks.Add(track); } //toolStripStatusProgressBar.Value = (int)(100.0 / TrackView.Rows.Count * count); count++; lastcdid = cdid; } } if (newItem != null) { if (newItem.Artist != lastArtistTitle) { AlbumViewTitle albumTitle = new AlbumViewTitle(); albumTitle.Title = newItem.Artist; items.Add(albumTitle); } items.Add(newItem); } e.Result = items; }