private async void LoadTrack(SoundCloudTrack currentTrack) { try { TrackDuration = currentTrack.duration != null ? (int)currentTrack.duration : 0; currentPosition = BackgroundMediaPlayer.Current.Position.TotalMilliseconds; OnPropertyChanged(nameof(CurrentPosition)); string albumartImage = ""; //Change album art if (currentTrack.artwork_url != null) { albumartImage = Convert.ToString(currentTrack.artwork_url); } if (string.IsNullOrWhiteSpace(albumartImage)) { albumartImage = @"ms-appx:///Assets/Albumart.jpeg"; } else { albumartImage = albumartImage.Replace("-large", "-t500x500"); } AlbumImage = new BitmapImage(new Uri(albumartImage)); //Change Title and User name TrackName = currentTrack.title; AlbumTitle = Convert.ToString(currentTrack.user.username); } catch (Exception ex) { Logger.LogError(this, ex.Message); ShowErrorMessage("There was an error during loading track."); } }
/// <summary> /// If a playlist is set, go back to the previous track. /// <paramref name="play"/> /// </summary> public void Previous(bool play) { if (playlist != null) { if (playlistTrackPosition > 0) { playlistTrackPosition--; player.Dispose(); track = playlist.tracks[playlistTrackPosition]; Init(track.stream_url + "?client_id=" + clientID); } else if (playlistTrackPosition <= 0) { playlistTrackPosition = playlist.track_count - 1; player.Dispose(); track = playlist.tracks[playlistTrackPosition]; Init(track.stream_url + "?client_id=" + clientID); } if (play) { player.Play(); } } }
private void Tracks_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { switch (e.Action) { case System.Collections.Specialized.NotifyCollectionChangedAction.Remove: // When track was really removed (not only being reordered) then don't store it's value. if (App.PlaylistManager.Tracks.Contains((SoundCloudTrack)e.OldItems[0])) { lastRemovedTrack = (SoundCloudTrack)e.OldItems[0]; lastRemovedTrackIndex = e.OldStartingIndex; } break; case System.Collections.Specialized.NotifyCollectionChangedAction.Add: if (lastRemovedTrack == null) { return; } var newIndex = e.NewStartingIndex; if (App.PlaylistManager.Playlist != null) { App.PlaylistManager.ReorderTracks(lastRemovedTrack, lastRemovedTrackIndex, newIndex); } lastRemovedTrack = null; lastRemovedTrackIndex = -1; break; } }
public SoundCloudPlayer(SoundCloudPlaylist playlist, string clientID) { this.clientID = clientID; this.playlist = playlist; track = playlist.tracks[0]; Init(track.stream_url + "?client_id=" + clientID); }
/// <summary> /// /// </summary> /// <param name="track"></param> /// <param name="clientID"></param> public SoundCloudPlayer(SoundCloudTrack track, string clientID) { this.clientID = clientID; this.track = track; Init(track.stream_url + "?client_id=" + clientID); player.PlaybackStopped += Playback_Stopped; }
/// <summary> /// If a playlist is set, move to the next track. /// <paramref name="play"/> /// </summary> public void Next(bool play) { if (playlist != null) { if (playlistTrackPosition < playlist.track_count) { playlistTrackPosition++; player.Dispose(); track = playlist.tracks[playlistTrackPosition]; Init(track.stream_url + "?client_id=" + clientID); } else if (playlistTrackPosition >= playlist.track_count) { playlistTrackPosition = 0; player.Dispose(); track = playlist.tracks[playlistTrackPosition]; Init(track.stream_url + "?client_id=" + clientID); } if (play) { player.Play(); } } }
/// <summary> /// Set a new track for the player. /// </summary> /// <param name="track"></param> public void SetTrack(SoundCloudTrack track) { if (playlist == null) { player.Dispose(); this.track = track; Init(track.stream_url + "?client_id=" + clientID); } }
/// <summary> /// Change the track in the playlist if specified. /// </summary> /// <param name="trackIndex"></param> public void SetTrackInPlaylist(int trackIndex) { if (playlist != null) { player.Dispose(); track = playlist.tracks[trackIndex]; Init(track.stream_url + "?client_id=" + clientID); } }
public static BitmapImage GetSoundCloudImage(SoundCloudTrack track, DirectoryInfo di, ImageQuality quality, bool checkQuality) { string name = string.Format("{0}_{1}.jpg", track.SoundCloudID, SoundCloudApi.GetQualityModifier(quality)); if (di.Exists) { return(di.GetFiles("*.jpg").Where(item => !checkQuality || item.Name.ToLower() == name).Select(item => new BitmapImage(new Uri(item.FullName))).FirstOrDefault()); } return(null); }
/// <summary> /// Set a new playlist for the player. /// </summary> /// <param name="playlist"></param> public void SetPlaylist(SoundCloudPlaylist playlist) { if (track == null) { player.Dispose(); this.playlist = playlist; track = playlist.tracks[0]; Init(track.stream_url + "?client_id=" + clientID); } }
public override PlayableBase ToPlayable() { var result = (ApiResult)Result; var newtrack = new SoundCloudTrack { Url = Url, TimeAdded = DateTime.Now, IsChecked = false }; newtrack.LoadInformation(result); return(newtrack); }
public override PlayableBase ToPlayable() { var result = (ApiResult) Result; var newtrack = new SoundCloudTrack { Url = Url, TimeAdded = DateTime.Now, IsChecked = false }; newtrack.LoadInformation(result); return newtrack; }
public static async Task<BitmapImage> LoadBitmapImage(SoundCloudTrack track, ImageQuality quality, DirectoryInfo albumDirectory) { var config = HurricaneSettings.Instance.Config; using (var client = new WebClient { Proxy = null }) { var image = await ImageHelper.DownloadImage(client, string.Format(track.ArtworkUrl, GetQualityModifier(quality))); if (config.SaveCoverLocal) { if (!albumDirectory.Exists) albumDirectory.Create(); await ImageHelper.SaveImage(image, string.Format("{0}_{1}", track.SoundCloudID, GetQualityModifier(quality)), albumDirectory.FullName); } return image; } }
private void DeleteTrackFromPlaylist(SoundCloudTrack track) { try { if (App.PlaylistManager.Playlist != null) { Debug.WriteLine($"ShellViewModel.DeleteTrackFromPlaylist: Deleting track {track.id} from playlist {App.PlaylistManager.Playlist.id}"); PlaylistTrackService.DeletePlaylistTrack(App.PlaylistManager.Playlist.id, (int)track.id); App.PlaylistManager.RemoveTrackFromCurrentPlaylist(track); } } catch (Exception ex) { ShowWarningMessage(ex.Message); } }
public async override Task <PlayableBase> ToPlayable() { var result = (ApiResult)Result; var newtrack = new SoundCloudTrack { Url = Url, TimeAdded = DateTime.Now }; if (_soundSourceInfo == null && !(await CheckIfAvailable())) { throw new Exception(); } newtrack.LoadInformation(result, _soundSourceInfo); return(newtrack); }
/// <summary> /// Removes track from current playlist /// </summary> /// <param name="track"></param> public void RemoveTrackFromCurrentPlaylist(SoundCloudTrack track) { if (track == null) { throw new Exception("Track to remove is null. Remove track from current playlist failed."); } if (Playlist == null) { throw new Exception("Playlist is null. Remove track from current playlist failed."); } if (!Tracks.Contains(track)) { throw new Exception($"There is no track with id {track.id} in current playlist. Remove track from current playlist failed."); } // Remove later when syncing with background task Tracks.Remove(track); MessageService.SendMessageToBackground(this, new DeleteTrackFromPlaybackList(track)); }
/// <summary> /// Cleans current playlist and plays single track /// </summary> /// <param name="track"></param> public void PlaySingleTrack(SoundCloudTrack track) { if (track == null) { throw new Exception("Track is empty. Play track failed."); } if (track.stream_url == null && track.uri != null) { track.stream_url = GetStreamUrlFromUri(track.uri); } if (track.stream_url != null) { MessageService.SendMessageToBackground(this, new UpdatePlaylistMessage(new List <SoundCloudTrack> { track })); } Tracks.Clear(); Tracks.Add(track); }
public async override Task <bool> CheckIfAvailable() { var newtrack = new SoundCloudTrack { SoundCloudID = ((ApiResult)Result).id }; try { using (var x = await newtrack.GetSoundSource()) { _soundSourceInfo = SoundSourceInfo.FromSoundSource(x); return(true); } } catch (Exception) { return(false); } }
public static async Task <BitmapImage> LoadBitmapImage(SoundCloudTrack track, ImageQuality quality, DirectoryInfo albumDirectory) { var config = HurricaneSettings.Instance.Config; using (var client = new WebClient { Proxy = null }) { var image = await Utilities.ImageHelper.DownloadImage(client, string.Format(track.ArtworkUrl, GetQualityModifier(quality))); if (config.SaveCoverLocal) { if (!albumDirectory.Exists) { albumDirectory.Create(); } await Utilities.ImageHelper.SaveImage(image, string.Format("{0}_{1}.jpg", track.SoundCloudID, GetQualityModifier(quality)), albumDirectory.FullName); } return(image); } }
/// <summary> /// Play single track from current playlist /// </summary> /// <param name="track"></param> public void PlayPlaylistTrack(SoundCloudTrack track) { if (track == null) { throw new Exception("Track is empty. Play track failed."); } if (track.stream_url == null && track.uri != null) { track.stream_url = GetStreamUrlFromUri(track.uri); } if (track.stream_url != null) { if (Tracks.Where(t => t.id == track.id).FirstOrDefault() != null) { MessageService.SendMessageToBackground(this, new TrackChangedMessage(new Uri(track.stream_url))); MessageService.SendMessageToBackground(this, new StartPlaybackMessage()); } else { throw new Exception("Playlist is empty. Play playlist track failed."); } } }
/// <summary> /// Handles track reordering /// </summary> public void ReorderTracks(SoundCloudTrack track, int indexFrom, int indexTo) { if (track == null) { throw new Exception("Track to remove is null. Reorder tracks from current playlist failed."); } if (Playlist == null) { throw new Exception("Playlist is null. Reorder tracks from current playlist failed."); } if (!Tracks.Contains(track)) { throw new Exception($"There is no track with id {track.id} in current playlist. Reorder tracks from current playlist failed."); } var movedPlaylistTrack = PlaylistTrackService.GetPlaylistTrack(Playlist.id, (int)track.id); movedPlaylistTrack.TrackOrder = indexTo; PlaylistTrackService.ModifyPlaylistTrack(movedPlaylistTrack); if (indexTo - indexFrom > 0) { for (int i = indexFrom; i < indexTo; ++i) { var movedTrack = PlaylistTrackService.GetPlaylistTrack(Playlist.id, (int)Tracks[i].id); movedTrack.TrackOrder = i; PlaylistTrackService.ModifyPlaylistTrack(movedTrack); } } else if (indexTo - indexFrom < 0) { for (int i = indexTo + 1; i <= indexFrom; ++i) { var movedTrack = PlaylistTrackService.GetPlaylistTrack(Playlist.id, (int)Tracks[i].id); movedTrack.TrackOrder = i; PlaylistTrackService.ModifyPlaylistTrack(movedTrack); } } }
public void __Application(IApplicationLoader app) { //app.LoadingAnimation.FadeOut(); var DefaultTitle = "jsc solutions"; Native.Document.title = DefaultTitle; StringActionAction GetTitleFromServer = new UltraWebService().GetTitleFromServer; GetTitleFromServer( n => Native.Document.title = n ); var MyPagesBackground = new IHTMLDiv { }; MyPagesBackground.style.overflow = IStyle.OverflowEnum.hidden; MyPagesBackground.style.position = IStyle.PositionEnum.absolute; MyPagesBackground.style.width = "100%"; MyPagesBackground.style.height = "100%"; MyPagesBackground.AttachToDocument(); var MyPages = new IHTMLDiv { }; MyPages.style.overflow = IStyle.OverflowEnum.auto; MyPages.style.position = IStyle.PositionEnum.absolute; MyPages.style.width = "100%"; MyPages.style.height = "100%"; MyPages.AttachToDocument(); var MyPagesInternal = new IHTMLDiv(); MyPagesInternal.style.margin = "4em"; MyPagesInternal.AttachTo(MyPages); // http://www.google.com/support/forum/p/Google+Analytics/thread?tid=486a963e463df665&hl=en var gapathname = Native.Document.location.pathname; var gasearch = Native.Document.location.search; var gahash = Native.Window.escape(Native.Document.location.hash); var gapageview = gapathname + gasearch + gahash; var hash = Native.Document.location.hash; Action<string> Analytics = delegate { }; #region logo { var IsStudio = Native.Document.location.hash.StartsWith("#/studio"); if (Native.Document.location.host.StartsWith("studio.")) { IsStudio = true; } if (IsStudio) { new StudioView(AddSaveButton).Content.AttachToDocument(); } else if (Native.Document.location.hash.StartsWith("#/docs")) { var view = new DocumentationCompilationViewer(); view.TouchTypeSelected += type => { Native.Document.location.hash = "#/docs/" + type.FullName; Analytics("#/docs/" + type.FullName); }; } else if (Native.Document.location.hash.StartsWith("#/warehouse")) { new UltraWebService().ThreeDWarehouse( y => { Func<string, IHTMLAnchor> Build = mid => { var a = new IHTMLAnchor { href = "http://sketchup.google.com/3dwarehouse/details?ct=hppm&mid=" + mid }.AttachTo(MyPagesInternal); var img = new IHTMLImage { src = "http://sketchup.google.com/3dwarehouse/download?rtyp=st&ctyp=other&mid=" + mid }.AttachTo(a); return a; }; var imgs = Enumerable.ToArray( from k in y.Elements() select Build(k.Value) ); } ); } else if (Native.Document.location.hash == "#/source") { var sln = new TreeNode(() => new VistaTreeNodePage()); sln.Text = "Solution"; sln.IsExpanded = true; Action<TreeNode> AddReferences = p => { var r = p.Add("References", new References()); r.Add("System", new Assembly()); r.Add("System.Core", new Assembly()); r.Add("ScriptCoreLib", new Assembly()); r.Add("ScriptCoreLib.Ultra", new Assembly()); r.Add("ScriptCoreLib.Ultra.Library", new Assembly()); r.Add("ScriptCoreLib.Ultra.Controls", new Assembly()); r.Add("ScriptCoreLibJava", new Assembly()); r.Add("jsc.meta", new Assembly()); }; Action<TreeNode> AddUltraSource = p => { var my = p.Add("My.UltraSource"); my.Add("Default.htm", new HTMLDocument()); my.Add("jsc.png", new ImageFile()); }; { var p = sln.Add("Visual C# Project", new VisualCSharpProject()); AddReferences(p); AddUltraSource(p); p.Add("Application.cs", new VisualCSharpCode()); p.Add("WebService.cs", new VisualCSharpCode()); p.Add("Program.cs", new VisualCSharpCode()); } { var p = sln.Add("Visual Basic Project", new VisualBasicProject()); AddReferences(p); AddUltraSource(p); p.Add("Application.vb", new VisualBasicCode()); p.Add("WebService.vb", new VisualBasicCode()); p.Add("Program.vb", new VisualBasicCode()); } { var p = sln.Add("Visual F# Project", new VisualFSharpProject()); AddReferences(p); AddUltraSource(p); p.Add("Application.fs", new VisualFSharpCode()); p.Add("WebService.fs", new VisualFSharpCode()); p.Add("Program.fs", new VisualFSharpCode()); } sln.Container.style.Float = IStyle.FloatEnum.right; sln.Container.AttachTo(MyPagesInternal); new SourceEditorHeader().Container.AttachTo(MyPagesInternal); //new IHTMLElement(IHTMLElement.HTMLElementEnum.h1, "Create your own Ultra Application project template").AttachTo(MyPagesInternal); var n = new TextEditor(MyPagesInternal); n.Width = 600; n.Height = 400; //n.InnerHTML = "<p>Create your own <b>Ultra Application</b> Project Template</p>"; new DefaultPage1().Container.AttachTo(n.Document.body); var m1 = new SimpleCodeView(); m1.Container.AttachTo(MyPagesInternal); //m1.SelectType.onchange += // delegate // { // m1.TypeName.innerText = m1.SelectType.value; // }; //m1.RunJavaScript.onclick += // delegate // { // m1.RunJavaScript.style.color = JSColor.Blue; // try // { // Native.Window.eval(m1.Code1.value); // 1000.AtDelay( // delegate // { // m1.RunJavaScript.style.color = JSColor.None; // } // ); // } // catch // { // m1.RunJavaScript.style.color = JSColor.Red; // 1000.AtDelay( // delegate // { // m1.RunJavaScript.style.color = JSColor.None; // } // ); // } // }; new Compilation().GetArchives().SelectMany(k => k.GetAssemblies()).First(k => k.Name == "ScriptCoreLib").WhenReady( ScriptCoreLib => { // we do not have reflection in place for native wrappers :/ m1.SelectEvent.Clear(); var Element = ScriptCoreLib.GetTypes().Single(k => k.FullName == "ScriptCoreLib.JavaScript.DOM.HTML.IHTMLElement"); //var Element = ScriptCoreLib.GetTypes().Single(k => k.HTMLElement == "ScriptCoreLib.JavaScript.DOM.HTML.IHTMLElement"); Action<CompilationEvent> Add = SourceEvent => { m1.SelectEvent.Add( new IHTMLOption { innerText = SourceEvent.Name } ); }; Element.GetEvents().ForEach(Add); } ); m1.SelectEvent.onchange += delegate { m1.EventName.innerText = m1.SelectEvent.value; }; } else if (Native.Document.location.hash == "#/UltraApplicationWithAssets") { new UltraApplicationWithAssets().Container.AttachToDocument(); } else if (Native.Document.location.hash == "#/audio") { Action AtTimer = delegate { }; (1000 / 15).AtInterval( tt => { AtTimer(); } ); new SoundCloudBackground().Container.AttachTo(MyPagesBackground); new SoundCloudHeader().Container.AttachTo(MyPagesInternal); var page = 1; var Tracks = new IHTMLDiv().AttachTo(MyPagesInternal); Tracks.style.margin = "1em"; var More = new SoundCloudMore(); var AudioLinks = default(AudioLink); var LoadCurrentPage = default(Action); LoadCurrentPage = delegate { var loading = new SoundCloudLoading(); loading.Container.AttachTo(Tracks); new UltraWebService().SoundCloudTracksDownload( System.Convert.ToString(page), ee => { if (loading != null) { loading.Container.Orphanize(); loading = null; } var t = new SoundCloudTrack(); t.Content.ApplyToggleConcept(t.HideContent, t.ShowContent).Hide(); t.Title.innerHTML = ee.trackName; t.Waveform.src = ee.waveformUrl; t.Audio.src = ee.streamUrl; t.Audio.autobuffer = true; AudioLinks = new AudioLink { Audio = t.Audio, Prev = AudioLinks }; var _AudioLinks = AudioLinks; if (AudioLinks.Prev != null) AudioLinks.Prev.Next = AudioLinks; else // we are the first :) t.Audio.play(); t.MoreButton.onclick += delegate { t.Audio.pause(); if (_AudioLinks.Next != null) { _AudioLinks.Next.Audio.currentTime = 0; _AudioLinks.Next.Audio.play(); if (_AudioLinks.Next.Next == null) { page++; LoadCurrentPage(); } } }; t.Audio.onended += delegate { if (_AudioLinks.Next != null) { _AudioLinks.Next.Audio.currentTime = 0; _AudioLinks.Next.Audio.play(); if (_AudioLinks.Next.Next == null) { page++; LoadCurrentPage(); } } }; t.Identity.innerText = ee.uid; t.Play.onclick += eee => { eee.PreventDefault(); t.Audio.play(); }; t.Pause.onclick += eee => { eee.PreventDefault(); t.Audio.pause(); }; t.Title.style.cursor = IStyle.CursorEnum.pointer; t.Title.onclick += eee => { eee.PreventDefault(); var playing = true; if (t.Audio.paused) playing = false; if (t.Audio.ended) playing = false; if (!playing) t.Audio.play(); else t.Audio.pause(); }; DoubleAction SetProgress1 = p => { t.Gradient3.style.width = System.Convert.ToInt32(800 * p) + "px"; t.Gradient4.style.width = System.Convert.ToInt32(800 * p) + "px"; }; t.Gradient5.style.Opacity = 0.4; t.Gradient6.style.Opacity = 0.4; DoubleAction SetProgress2 = p => { t.Gradient5.style.width = System.Convert.ToInt32(800 * p) + "px"; t.Gradient6.style.width = System.Convert.ToInt32(800 * p) + "px"; }; AtTimer += delegate { if (t.Audio.duration == 0) { t.Play.Hide(); t.Pause.Hide(); return; } else { var playing = true; if (t.Audio.paused) playing = false; if (t.Audio.ended) playing = false; if (!playing) t.Title.style.color = Color.None; else t.Title.style.color = Color.Blue; t.Play.Show(!playing); t.Pause.Show(playing); } var p = t.Audio.currentTime / t.Audio.duration; SetProgress1(p); }; t.Waveform.onmouseout += delegate { SetProgress2(0); }; t.Waveform.onmousemove += eee => { SetProgress2(eee.OffsetX / 800.0); }; t.Waveform.onclick += eee => { t.Audio.currentTime = t.Audio.duration * (eee.OffsetX / 800.0); t.Audio.play(); }; t.Waveform.style.cursor = IStyle.CursorEnum.pointer; SetProgress1(0); SetProgress2(0); t.Container.AttachTo(Tracks); } ); 10000.AtDelay( delegate { More.MoreButton.FadeIn(0, 1000, null); } ); }; More.MoreButton.Hide(); More.Container.AttachTo(MyPagesInternal); More.MoreButton.onclick += eee => { eee.PreventDefault(); More.MoreButton.FadeOut(1, 300, delegate { page++; LoadCurrentPage(); } ); }; LoadCurrentPage(); } else { //new PromotionWebApplication1.HTML.Audio.FromAssets.Track1 { controls = true }.AttachToDocument(); //new PromotionWebApplication1.HTML.Audio.FromWeb.Track1 { controls = true, autobuffer = true }.AttachToDocument(); var IsAvalonJavaScript = hash == "#/avalon.js"; var IsAvalonActionScript = hash == "#/avalon.as"; var IsAvalon = IsAvalonActionScript || IsAvalonJavaScript; //if (IsAvalon) //{ //{ // var ccc = new IHTMLDiv(); // ccc.style.position = IStyle.PositionEnum.absolute; // ccc.style.left = "15%"; // ccc.style.right = "15%"; // ccc.style.top = "15%"; // var Now = DateTime.Now; // var CountDown = new CountDownGadgetConcept(CountDownGadget.Create) // { // ShowOnlyDays = true, // Event = new DateTime(2010, 5, 24, 23, 59, 50), // }; // CountDown.Element.GadgetContainer.style.color = "#808080"; // CountDown.Element.GadgetContainer.style.textShadow = "#E0E0E0 1px 1px 1px"; // CountDown.Element.GadgetContainer.AttachTo(ccc); // CountDown.Element.GadgetContainer.FadeIn(3000, 2000, null); // ccc.AttachToDocument(); //} { var ccc = new IHTMLDiv(); ccc.style.position = IStyle.PositionEnum.absolute; ccc.style.left = "50%"; ccc.style.top = "50%"; ccc.style.marginLeft = (-JSCSolutionsNETCarouselCanvas.DefaultWidth / 2) + "px"; ccc.style.marginTop = (-JSCSolutionsNETCarouselCanvas.DefaultHeight / 2) + "px"; ccc.style.SetSize(JSCSolutionsNETCarouselCanvas.DefaultWidth, JSCSolutionsNETCarouselCanvas.DefaultHeight); ccc.AttachToDocument(); if (IsAvalonActionScript) { var alof = new UltraSprite(); alof.ToTransparentSprite(); alof.AttachSpriteTo(ccc); } else { var alo = new JSCSolutionsNETCarouselCanvas(); alo.Container.AttachToContainer(ccc); alo.AtLogoClick += delegate { //Native.Window.open("http://sourceforge.net/projects/jsc/", "_blank"); Native.Window.open("/download", "_blank"); }; } } //} //else //{ // var cc = new HTML.Pages.FromAssets.Controls.Named.CenteredLogo_Kamma(); // cc.Container.AttachToDocument(); // // see: http://en.wikipedia.org/wiki/Perl_control_structures // // "Unless" == "if not" ;) // IsMicrosoftInternetExplorer.YetIfNotThen(cc.TheLogoImage.BeginPulseAnimation).ButIfSoThen(cc.TheLogoImage.HideNowButShowAtDelay); //} var aa = new About(); aa.Service.innerText = gapageview; aa.Container.AttachToDocument(); } } #endregion Analytics = __hash => { var __gahash = Native.Window.escape(__hash); var __gapageview = gapathname + gasearch + __gahash; "UA-13087448-1".ToGoogleAnalyticsTracker( pageTracker => { pageTracker._setDomainName(".jsc-solutions.net"); pageTracker._trackPageview(__gapageview); } ); }; Analytics(Native.Document.location.hash); }
public void TrackRightTapped(SoundCloudTrack track) { rightTappedTrack = track; }
public void __Application(IApplicationLoader app) { //app.LoadingAnimation.FadeOut(); var DefaultTitle = "jsc solutions"; Native.Document.title = DefaultTitle; StringActionAction GetTitleFromServer = new UltraWebService().GetTitleFromServer; GetTitleFromServer( n => Native.Document.title = n ); var MyPagesBackground = new IHTMLDiv { }; MyPagesBackground.style.overflow = IStyle.OverflowEnum.hidden; MyPagesBackground.style.position = IStyle.PositionEnum.absolute; MyPagesBackground.style.width = "100%"; MyPagesBackground.style.height = "100%"; MyPagesBackground.AttachToDocument(); var MyPages = new IHTMLDiv { }; MyPages.style.overflow = IStyle.OverflowEnum.auto; MyPages.style.position = IStyle.PositionEnum.absolute; MyPages.style.width = "100%"; MyPages.style.height = "100%"; MyPages.AttachToDocument(); var MyPagesInternal = new IHTMLDiv(); MyPagesInternal.style.margin = "4em"; MyPagesInternal.AttachTo(MyPages); // http://www.google.com/support/forum/p/Google+Analytics/thread?tid=486a963e463df665&hl=en var gapathname = Native.Document.location.pathname; var gasearch = Native.Document.location.search; var gahash = Native.Window.escape(Native.Document.location.hash); var gapageview = gapathname + gasearch + gahash; var hash = Native.Document.location.hash; Action <string> Analytics = delegate { }; #region logo { var IsStudio = Native.Document.location.hash.StartsWith("#/studio"); if (Native.Document.location.host.StartsWith("studio.")) { IsStudio = true; } if (IsStudio) { new StudioView(AddSaveButton).Content.AttachToDocument(); } else if (Native.Document.location.hash.StartsWith("#/docs")) { var view = new DocumentationCompilationViewer(); view.TouchTypeSelected += type => { Native.Document.location.hash = "#/docs/" + type.FullName; Analytics("#/docs/" + type.FullName); }; } else if (Native.Document.location.hash.StartsWith("#/warehouse")) { new UltraWebService().ThreeDWarehouse( y => { Func <string, IHTMLAnchor> Build = mid => { var a = new IHTMLAnchor { href = "http://sketchup.google.com/3dwarehouse/details?ct=hppm&mid=" + mid }.AttachTo(MyPagesInternal); var img = new IHTMLImage { src = "http://sketchup.google.com/3dwarehouse/download?rtyp=st&ctyp=other&mid=" + mid }.AttachTo(a); return(a); }; var imgs = Enumerable.ToArray( from k in y.Elements() select Build(k.Value) ); } ); } else if (Native.Document.location.hash == "#/source") { var sln = new TreeNode(() => new VistaTreeNodePage()); sln.Text = "Solution"; sln.IsExpanded = true; Action <TreeNode> AddReferences = p => { var r = p.Add("References", new References()); r.Add("System", new Assembly()); r.Add("System.Core", new Assembly()); r.Add("ScriptCoreLib", new Assembly()); r.Add("ScriptCoreLib.Ultra", new Assembly()); r.Add("ScriptCoreLib.Ultra.Library", new Assembly()); r.Add("ScriptCoreLib.Ultra.Controls", new Assembly()); r.Add("ScriptCoreLibJava", new Assembly()); r.Add("jsc.meta", new Assembly()); }; Action <TreeNode> AddUltraSource = p => { var my = p.Add("My.UltraSource"); my.Add("Default.htm", new HTMLDocument()); my.Add("jsc.png", new ImageFile()); }; { var p = sln.Add("Visual C# Project", new VisualCSharpProject()); AddReferences(p); AddUltraSource(p); p.Add("Application.cs", new VisualCSharpCode()); p.Add("WebService.cs", new VisualCSharpCode()); p.Add("Program.cs", new VisualCSharpCode()); } { var p = sln.Add("Visual Basic Project", new VisualBasicProject()); AddReferences(p); AddUltraSource(p); p.Add("Application.vb", new VisualBasicCode()); p.Add("WebService.vb", new VisualBasicCode()); p.Add("Program.vb", new VisualBasicCode()); } { var p = sln.Add("Visual F# Project", new VisualFSharpProject()); AddReferences(p); AddUltraSource(p); p.Add("Application.fs", new VisualFSharpCode()); p.Add("WebService.fs", new VisualFSharpCode()); p.Add("Program.fs", new VisualFSharpCode()); } sln.Container.style.Float = IStyle.FloatEnum.right; sln.Container.AttachTo(MyPagesInternal); new SourceEditorHeader().Container.AttachTo(MyPagesInternal); //new IHTMLElement(IHTMLElement.HTMLElementEnum.h1, "Create your own Ultra Application project template").AttachTo(MyPagesInternal); var n = new TextEditor(MyPagesInternal); n.Width = 600; n.Height = 400; //n.InnerHTML = "<p>Create your own <b>Ultra Application</b> Project Template</p>"; new DefaultPage1().Container.AttachTo(n.Document.body); var m1 = new SimpleCodeView(); m1.Container.AttachTo(MyPagesInternal); //m1.SelectType.onchange += // delegate // { // m1.TypeName.innerText = m1.SelectType.value; // }; //m1.RunJavaScript.onclick += // delegate // { // m1.RunJavaScript.style.color = JSColor.Blue; // try // { // Native.Window.eval(m1.Code1.value); // 1000.AtDelay( // delegate // { // m1.RunJavaScript.style.color = JSColor.None; // } // ); // } // catch // { // m1.RunJavaScript.style.color = JSColor.Red; // 1000.AtDelay( // delegate // { // m1.RunJavaScript.style.color = JSColor.None; // } // ); // } // }; new Compilation().GetArchives().SelectMany(k => k.GetAssemblies()).First(k => k.Name == "ScriptCoreLib").WhenReady( ScriptCoreLib => { // we do not have reflection in place for native wrappers :/ m1.SelectEvent.Clear(); var Element = ScriptCoreLib.GetTypes().Single(k => k.FullName == "ScriptCoreLib.JavaScript.DOM.HTML.IHTMLElement"); //var Element = ScriptCoreLib.GetTypes().Single(k => k.HTMLElement == "ScriptCoreLib.JavaScript.DOM.HTML.IHTMLElement"); Action <CompilationEvent> Add = SourceEvent => { m1.SelectEvent.Add( new IHTMLOption { innerText = SourceEvent.Name } ); }; Element.GetEvents().ForEach(Add); } ); m1.SelectEvent.onchange += delegate { m1.EventName.innerText = m1.SelectEvent.value; }; } else if (Native.Document.location.hash == "#/UltraApplicationWithAssets") { new UltraApplicationWithAssets().Container.AttachToDocument(); } else if (Native.Document.location.hash == "#/audio") { Action AtTimer = delegate { }; (1000 / 15).AtInterval( tt => { AtTimer(); } ); new SoundCloudBackground().Container.AttachTo(MyPagesBackground); new SoundCloudHeader().Container.AttachTo(MyPagesInternal); var page = 1; var Tracks = new IHTMLDiv().AttachTo(MyPagesInternal); Tracks.style.margin = "1em"; var More = new SoundCloudMore(); var AudioLinks = default(AudioLink); var LoadCurrentPage = default(Action); LoadCurrentPage = delegate { var loading = new SoundCloudLoading(); loading.Container.AttachTo(Tracks); new UltraWebService().SoundCloudTracksDownload( System.Convert.ToString(page), ee => { if (loading != null) { loading.Container.Orphanize(); loading = null; } var t = new SoundCloudTrack(); t.Content.ApplyToggleConcept(t.HideContent, t.ShowContent).Hide(); t.Title.innerHTML = ee.trackName; t.Waveform.src = ee.waveformUrl; t.Audio.src = ee.streamUrl; t.Audio.autobuffer = true; AudioLinks = new AudioLink { Audio = t.Audio, Prev = AudioLinks }; var _AudioLinks = AudioLinks; if (AudioLinks.Prev != null) { AudioLinks.Prev.Next = AudioLinks; } else { // we are the first :) t.Audio.play(); } t.MoreButton.onclick += delegate { t.Audio.pause(); if (_AudioLinks.Next != null) { _AudioLinks.Next.Audio.currentTime = 0; _AudioLinks.Next.Audio.play(); if (_AudioLinks.Next.Next == null) { page++; LoadCurrentPage(); } } }; t.Audio.onended += delegate { if (_AudioLinks.Next != null) { _AudioLinks.Next.Audio.currentTime = 0; _AudioLinks.Next.Audio.play(); if (_AudioLinks.Next.Next == null) { page++; LoadCurrentPage(); } } }; t.Identity.innerText = ee.uid; t.Play.onclick += eee => { eee.PreventDefault(); t.Audio.play(); }; t.Pause.onclick += eee => { eee.PreventDefault(); t.Audio.pause(); }; t.Title.style.cursor = IStyle.CursorEnum.pointer; t.Title.onclick += eee => { eee.PreventDefault(); var playing = true; if (t.Audio.paused) { playing = false; } if (t.Audio.ended) { playing = false; } if (!playing) { t.Audio.play(); } else { t.Audio.pause(); } }; DoubleAction SetProgress1 = p => { t.Gradient3.style.width = System.Convert.ToInt32(800 * p) + "px"; t.Gradient4.style.width = System.Convert.ToInt32(800 * p) + "px"; }; t.Gradient5.style.Opacity = 0.4; t.Gradient6.style.Opacity = 0.4; DoubleAction SetProgress2 = p => { t.Gradient5.style.width = System.Convert.ToInt32(800 * p) + "px"; t.Gradient6.style.width = System.Convert.ToInt32(800 * p) + "px"; }; AtTimer += delegate { if (t.Audio.duration == 0) { t.Play.Hide(); t.Pause.Hide(); return; } else { var playing = true; if (t.Audio.paused) { playing = false; } if (t.Audio.ended) { playing = false; } if (!playing) { t.Title.style.color = Color.None; } else { t.Title.style.color = Color.Blue; } t.Play.Show(!playing); t.Pause.Show(playing); } var p = t.Audio.currentTime / t.Audio.duration; SetProgress1(p); }; t.Waveform.onmouseout += delegate { SetProgress2(0); }; t.Waveform.onmousemove += eee => { SetProgress2(eee.OffsetX / 800.0); }; t.Waveform.onclick += eee => { t.Audio.currentTime = t.Audio.duration * (eee.OffsetX / 800.0); t.Audio.play(); }; t.Waveform.style.cursor = IStyle.CursorEnum.pointer; SetProgress1(0); SetProgress2(0); t.Container.AttachTo(Tracks); } ); 10000.AtDelay( delegate { More.MoreButton.FadeIn(0, 1000, null); } ); }; More.MoreButton.Hide(); More.Container.AttachTo(MyPagesInternal); More.MoreButton.onclick += eee => { eee.PreventDefault(); More.MoreButton.FadeOut(1, 300, delegate { page++; LoadCurrentPage(); } ); }; LoadCurrentPage(); } else { //new PromotionWebApplication1.HTML.Audio.FromAssets.Track1 { controls = true }.AttachToDocument(); //new PromotionWebApplication1.HTML.Audio.FromWeb.Track1 { controls = true, autobuffer = true }.AttachToDocument(); var IsAvalonJavaScript = hash == "#/avalon.js"; var IsAvalonActionScript = hash == "#/avalon.as"; var IsAvalon = IsAvalonActionScript || IsAvalonJavaScript; //if (IsAvalon) //{ //{ // var ccc = new IHTMLDiv(); // ccc.style.position = IStyle.PositionEnum.absolute; // ccc.style.left = "15%"; // ccc.style.right = "15%"; // ccc.style.top = "15%"; // var Now = DateTime.Now; // var CountDown = new CountDownGadgetConcept(CountDownGadget.Create) // { // ShowOnlyDays = true, // Event = new DateTime(2010, 5, 24, 23, 59, 50), // }; // CountDown.Element.GadgetContainer.style.color = "#808080"; // CountDown.Element.GadgetContainer.style.textShadow = "#E0E0E0 1px 1px 1px"; // CountDown.Element.GadgetContainer.AttachTo(ccc); // CountDown.Element.GadgetContainer.FadeIn(3000, 2000, null); // ccc.AttachToDocument(); //} { var ccc = new IHTMLDiv(); ccc.style.position = IStyle.PositionEnum.absolute; ccc.style.left = "50%"; ccc.style.top = "50%"; ccc.style.marginLeft = (-JSCSolutionsNETCarouselCanvas.DefaultWidth / 2) + "px"; ccc.style.marginTop = (-JSCSolutionsNETCarouselCanvas.DefaultHeight / 2) + "px"; ccc.style.SetSize(JSCSolutionsNETCarouselCanvas.DefaultWidth, JSCSolutionsNETCarouselCanvas.DefaultHeight); ccc.AttachToDocument(); if (IsAvalonActionScript) { var alof = new UltraSprite(); alof.ToTransparentSprite(); alof.AttachSpriteTo(ccc); } else { var alo = new JSCSolutionsNETCarouselCanvas(); alo.Container.AttachToContainer(ccc); alo.AtLogoClick += delegate { //Native.Window.open("http://sourceforge.net/projects/jsc/", "_blank"); Native.Window.open("/download", "_blank"); }; } } //} //else //{ // var cc = new HTML.Pages.FromAssets.Controls.Named.CenteredLogo_Kamma(); // cc.Container.AttachToDocument(); // // see: http://en.wikipedia.org/wiki/Perl_control_structures // // "Unless" == "if not" ;) // IsMicrosoftInternetExplorer.YetIfNotThen(cc.TheLogoImage.BeginPulseAnimation).ButIfSoThen(cc.TheLogoImage.HideNowButShowAtDelay); //} var aa = new About(); aa.Service.innerText = gapageview; aa.Container.AttachToDocument(); } } #endregion Analytics = __hash => { var __gahash = Native.Window.escape(__hash); var __gapageview = gapathname + gasearch + __gahash; "UA-13087448-1".ToGoogleAnalyticsTracker( pageTracker => { pageTracker._setDomainName(".jsc-solutions.net"); pageTracker._trackPageview(__gapageview); } ); }; Analytics(Native.Document.location.hash); }
private async void LoadTrack(SoundCloudTrack currentTrack) { try { //Change album art string albumartImage = Convert.ToString(currentTrack.artwork_url); if (string.IsNullOrWhiteSpace(albumartImage)) { albumartImage = @"ms-appx:///Assets/Albumart.png"; } else { albumartImage = albumartImage.Replace("-large", "-t500x500"); } albumrtImage.ImageSource = new BitmapImage(new Uri(albumartImage)); //Change Title and User name txtSongTitle.Text = currentTrack.title; txtAlbumTitle.Text = Convert.ToString(currentTrack.user.username); } catch (Exception ex) { MessageDialog showMessgae = new MessageDialog("Something went wrong. Please try again. Error Details : " + ex.Message); await showMessgae.ShowAsync(); } }
public SoundCloudPlayer(SoundCloudTrack track, string clientID) { this.clientID = clientID; this.track = track; Init(track.stream_url + "?client_id=" + clientID); }
/// <summary> /// Downloads a track. /// </summary> /// <param name="track"></param> /// <param name="dir"></param> /// <param name="format"></param> public void DownloadTrack(SoundCloudTrack track, string dir, string format) { string trackUrl = track.stream_url + "?client_id=" + clientID; client.DownloadFileTaskAsync(trackUrl, dir + @"\" + RemoveIllegalCharacters(track.user.username + " - " + track.title) + "." + format); }
public DeleteTrackFromPlaybackList(SoundCloudTrack track) { this.Track = track; }
private void PlaySoundCloudTrack(SoundCloudTrack track) { App.PlaylistManager.PlaySingleTrack(track); }