/// <summary> /// Async - check for new versions /// </summary> /// <param name="WebHook"></param> public static void Check(CaptainHook WebHook) { if (WebHook == null) return; var Delegate = new Delegate_CheckNewVersion(CheckForNewVersions); Delegate.BeginInvoke(WebHook, null, null); }
public static void AsyncCoverLoad(string ArtistName, CaptainHook WebHook, DrunkenXMLSailor XMLSailor, PictureBox PBOX_Cover) { /*LASTFM API*/ string GETReq = @"http://ws.audioscrobbler.com/2.0/?method=artist.getInfo&artist=$artist&api_key=d1146fc51bcc3bec1d3fb356398d7362"; GETReq = GETReq.Replace("$artist", WebUtility.UrlEncode(ArtistName)); WebHook.HookRequest(GETReq, "GET"); XMLSailor = new DrunkenXMLSailor(WebHook.HookResponse()); /*Load cover image*/ try { if (XMLSailor.CanNavigate()) { string imgUrl = XMLSailor.SailorNavigate_GetArtistImageBig(); if (!String.IsNullOrEmpty(imgUrl) && imgUrl != String.Empty) { try { PBOX_Cover.BackgroundImage = null; PBOX_Cover.InitialImage = null; PBOX_Cover.Image = null; PBOX_Cover.Load(imgUrl); } catch (ExternalException e) { return; } } else { PBOX_Cover.Image = Image.FromFile("assets/pelvisLogo110.png"); } } } catch (ExternalException e) { return; } }
public static void CheckForNewVersions(CaptainHook WebHook) { string Response = String.Empty; WebHook.HookRequest(@"http://projects.edoardocasella.it/pelvisrecorder/pelvisservice.php?scanVersion=1&connectedPart=application"); if((Response = WebHook.HookResponse()) != String.Empty) { dynamic JSONResponse = JsonConvert.DeserializeObject(Response); if (JSONResponse != null) { string AppVersion = Convert.ToString(JSONResponse.Version).Trim(); string AppDescription = Convert.ToString(JSONResponse.Description).Trim().Replace("rar", "").Replace("zip", ""); if(VersionChecker.CompareVersions(Form1.Version, AppVersion) == -1) { /* 1)Major release number 2)Minor release number 3)Maintenance release number (bugfixes only) 4)If used at all: build number (or source control revision number) */ DialogResult dr = MessageBox.Show("New version available -> " + AppVersion + "\n------------------------------------------------------------------------\nWhat changes:\n" + AppDescription + "\n\n\nYou want to download it now?", "PelvisRecorder - New version available", MessageBoxButtons.YesNo); switch (dr) { case DialogResult.No: break; case DialogResult.Yes: System.Diagnostics.Process.Start("http://projects.edoardocasella.it/pelvisrecorder"); break; } } } } }
private void Setup() { string DocPath = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string Destination = String.Concat(DocPath, @"\", this.DestinationFolder); if(!Directory.Exists(Destination)) { Directory.CreateDirectory(Destination); } this.DestinationFolder = Destination; /*Application Exit event*/ Application.ApplicationExit += new EventHandler(this.OnApplicationExit); /*SpotifyRecorder instance*/ SpotifyRecorder = new SpotifyRecorder(this.DestinationFolder, this.TXT_Display, null, this.PBOX_Cover); /*Get recording device*/ WaveInCapabilities recDevice = SpotifyRecorder.GetRecordingDevice(); label_recdevice.Text = recDevice.ProductName; /*WebHook*/ WebHook = new CaptainHook(); /*Specialization*/ this.Specialization = Specialization.NOTHING; }
/// <summary> /// LoadArtistPicture /// </summary> /// <param name="ArtistData"></param> /// <param name="WebHook"></param> /// <param name="XMLSailor"></param> /// <param name="PBOX_Cover"></param> public void LoadArtistPicture(string ArtistName, CaptainHook WebHook, DrunkenXMLSailor XMLSailor, PictureBox PBOX_Cover) { var myAsinc = new LASTFMService.Delegate_CoverLoad(AsyncCoverLoad); myAsinc.BeginInvoke(ArtistName.Trim(), WebHook, XMLSailor, PBOX_Cover, null, null); }
/// <summary> /// SetupApplication /// </summary> private void __Setup() { this._wNameOutput = String.Empty; this.XMLSailor = null; this.WebHook = new CaptainHook(); this.LastFMService = new LASTFMService(); this.MixerControl = new MixerController(); this.Spotify_LastTitleRecorded = String.Empty; }