示例#1
0
        private void LoadPlaylist(JRPlaylist list, ProgressUI progress = null)
        {
            if (progress == null)
            {
                progress = new ProgressUI($"Loading playlist '{list.Name}'", LoadPlaylist, false, list);
            }
            progress.ShowDialog(this);

            LoadDataTable();
        }
示例#2
0
        public static bool CheckUpgrade(bool checkOnly = false, bool noQuestions = false)
        {
            try
            {
                if (checkOnly)
                {
                    FindLatestRelease(null);
                    return(hasUpgrade);
                }

                ProgressUI bar = new ProgressUI("Checking for updates", FindLatestRelease, false);
                if (bar.ShowDialog() == DialogResult.OK && bar.progress.result == true)
                {
                    if (LatestVersion.version > Program.version)
                    {
                        if (noQuestions || DialogResult.Yes == MessageBox.Show($"Version {LatestVersion.version} is now available! Do you want to upgrade?",
                                                                               "New version available", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        {
                            if (UpgradeNow())
                            {
                                Application.Restart();
                            }
                            else
                            {
                                MessageBox.Show($"Upgrade failed! Please upgrade manually from the release page:\n{LatestVersion.url}",
                                                "Upgrade error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("You are currently running the latest version.",
                                        "No new version", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    return(hasUpgrade);
                }
            }
            catch { }

            MessageBox.Show("Version check failed. Please check directly on the GitHub repository.",
                            "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            return(hasUpgrade);
        }
示例#3
0
        private bool GetPlayLists(bool startup = false)
        {
            var progressUI = new ProgressUI("Connecting to MediaCenter...", ConnectJRiver, false);

            if (startup)
            {
                progressUI.StartPosition = FormStartPosition.CenterScreen;
            }

            progressUI.ShowDialog(this);

            if (!jrAPI.Connected)
            {
                progressUI.Close();
                MessageBox.Show("Cannot connect to MediaCenter, please make sure it's installed on this PC", "No MediaCenter!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            if (jrAPI.Playlists.Count == 0)
            {
                string filtered = !string.IsNullOrEmpty(settings.PlaylistFilter) ? "\nPlease check the Playlist Filter in settings." : "";
                MessageBox.Show($"Failed to load list of Playlists from MediaCenter!{filtered}", "No playlists", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            lblStatus.Text = $"Connected to MediaCenter v{jrAPI.Version} - {jrAPI.Library}";
            loading        = true;

            // update datagrid column/field list
            List <string> columns = new List <string>();

            foreach (var f in state.TableFields)
            {
                if (jrAPI.FieldDisplayNames.Contains(f, StringComparer.InvariantCultureIgnoreCase))
                {
                    columns.Add(f);
                }
            }
            state.TableFields = columns;

            // load current playlist files
            comboLists.DataSource = jrAPI.Playlists.OrderBy(p => p.Path).ThenBy(p => p.ToString()).ToList();
            JRPlaylist list = null;

            if (currentPlaylist != null)
            {
                list = jrAPI.Playlists.Where(p => p.Name == currentPlaylist.Name).FirstOrDefault();
            }
            if (startup && settings.ReloadPlaylist && state.Playlist != null)
            {
                list = jrAPI.Playlists.Where(p => p.Name == state.Playlist).FirstOrDefault();
            }
            if (list == null)
            {
                list = jrAPI.Playlists.Where(p => p.Name == "Recently Played").FirstOrDefault();
            }
            if (list == null)
            {
                list = jrAPI.Playlists.FirstOrDefault();
            }

            loading = false;
            comboLists.SelectedItem = list;

            return(true);
        }
示例#4
0
        public static bool UpgradeNow()
        {
            ProgressUI bar = new ProgressUI($"Upgrading Zelda to v{LatestVersion.version}", DoUpgrade, false);

            return(bar.ShowDialog() == DialogResult.OK && bar.progress.result == true);
        }