/// <summary> /// Gets the StatusInfo async. /// </summary> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{LiveTvServiceStatusInfo}</returns> public async Task <LiveTvServiceStatusInfo> GetStatusInfoAsync(CancellationToken cancellationToken) { _logger.Info("[ArgusTV] Start GetStatusInfoAsync"); await EnsureConnectionAsync(cancellationToken); NewVersionInfo newVersionAvailable = null; string serverVersion = string.Empty; try { newVersionAvailable = Proxies.CoreService.IsNewerVersionAvailable().Result; serverVersion = await Proxies.CoreService.GetServerVersion(); _logger.Info(string.Format("[ArgusTV] New Version Available: {0} & serverVersion: {1}", newVersionAvailable, serverVersion)); } catch (Exception ex) { _logger.ErrorException("[ArgusTV] Get Status Information failed", ex); } //TODO: Get more information return(new LiveTvServiceStatusInfo { HasUpdateAvailable = (newVersionAvailable != null), Version = serverVersion }); }
private void MainForm_Load(object sender, EventArgs e) { try { if (Properties.Settings.Default.ConsoleWindowPosition != Point.Empty || Properties.Settings.Default.ConsoleWindowSize != Size.Empty) { Point consolePosition = Properties.Settings.Default.ConsoleWindowPosition; Size consoleWindowSize = Properties.Settings.Default.ConsoleWindowSize; // Leave defaults, when screenresolution was changed to a lower resolution if (consolePosition.X < Screen.PrimaryScreen.Bounds.Width - 50 && consolePosition.Y < Screen.PrimaryScreen.Bounds.Height - 50 && consoleWindowSize.Height < Screen.PrimaryScreen.Bounds.Size.Height && consoleWindowSize.Width < Screen.PrimaryScreen.Bounds.Size.Width) { this.Location = consolePosition; this.Size = consoleWindowSize; } } SetMenuMode(MainMenuMode.Normal); // Add some default plugin services. // Could put these in a config file later on perhaps...? _pluginServiceSettings.Add(new PluginServiceSetting("ARGUS", "ARGUS TV Recorder", 49953)); _pluginServiceSettings.Add(new PluginServiceSetting("TVE", "MediaPortal TV Server", 49842)); #if DEBUG _pluginServiceSettings.Add(new PluginServiceSetting("Test", "Test", 49840)); #endif _pluginServiceSettings.Add(new PluginServiceSetting("Other", "Other", 0)); _baseFormTitle = this.Text + " " + Constants.ProductVersion; _formTitle = _baseFormTitle; this.Text = _baseFormTitle; _connectionProfile = null; if (!ConnectToArgusTVService(this.CommandLineArgs.Count == 1 ? this.CommandLineArgs[0] : null, false)) { this.Close(); } else { if (DateTime.Now >= Properties.Settings.Default.NextVersionCheck) { NewVersionInfo versionInfo = Proxies.CoreService.IsNewerVersionAvailable().Result; if (versionInfo != null) { Program.App.HideSplash(); if (!this.IsDisposed) { if (MessageBox.Show(this, versionInfo.Name + " is available for download." + Environment.NewLine + Environment.NewLine + "Would you like to see what's new?", "New version", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { System.Diagnostics.Process.Start(new ProcessStartInfo(versionInfo.Url)); } Properties.Settings.Default.NextVersionCheck = DateTime.Now.AddDays(7); Properties.Settings.Default.Save(); } } } } _tvGuideLinkLabel_LinkClicked(this, null); } catch (Exception ex) { Program.App.HideSplash(); MessageBox.Show(null, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } finally { Program.App.HideSplash(); } }
public override void OnEnteredState() { this.zipTempName = Path.GetTempFileName() + ".zip"; try { bool getFull; if (SystemLayer.OS.IsDotNetVersionInstalled( NewVersionInfo.NetFxMajorVersion, NewVersionInfo.NetFxMinorVersion, NewVersionInfo.NetFxServicePack, true)) { getFull = false; } else { getFull = true; } OnProgress(0.0); FileStream zipFileWrite = new FileStream(zipTempName, FileMode.Create, FileAccess.Write, FileShare.Read); try { // we need to wrap the zipFileWrite in a SiphonStream so that we can // Abort() it externally SiphonStream monitorStream = new SiphonStream(zipFileWrite); this.abortMeStream = monitorStream; ProgressEventHandler progressCallback = delegate(object sender, ProgressEventArgs e) { OnProgress(e.Percent); }; string url; url = NewVersionInfo.ChooseDownloadUrl(getFull); SystemLayer.Tracing.Ping("Chosen mirror url: " + url); Utility.DownloadFile(new Uri(url), monitorStream, progressCallback); monitorStream.Flush(); this.abortMeStream = null; monitorStream = null; } finally { if (zipFileWrite != null) { zipFileWrite.Close(); zipFileWrite = null; } } StateMachine.QueueInput(PrivateInput.GoToExtracting); } catch (Exception ex) { this.exception = ex; if (this.AbortRequested) { StateMachine.QueueInput(PrivateInput.GoToAborted); } else { this.exception = ex; StateMachine.QueueInput(PrivateInput.GoToError); } } }