public static void Show(ErrorMessage message, MessageBoxButton buttons,  Action okClickedCallback)
 {
     new ZuneMessageBox(message.Message, message.ErrorMode, okClickedCallback).Show();
 }
 public static MessageBoxResult Show(ErrorMessage message, MessageBoxButton buttons)
 {
     var msgBox = new ZuneMessageBox(message.Message, message.ErrorMode, buttons);
     msgBox.ShowDialog();
     return msgBox.result;
 }
        public void LoadFromZuneWebsite()
        {
            var warningMsg = new ErrorMessage(ErrorMode.Warning, "This process could take a very long time, are you sure?");
            ZuneMessageBox.Show(warningMsg, () =>
            {
                this.CanShowScanAllButton = false;
                int counter = 0;

                //we have to get the list from the CollectionView because of how its sorted
                var toScan = (from object album in _cvs.View select album as AlbumDetailsViewModel)
                    .ToList().Where(x=> x.LinkStatus != LinkStatus.Unlinked);

                foreach (AlbumDetailsViewModel album in toScan)
                {
                    album.LinkStatus = LinkStatus.Unknown; // reset the linkstatus so we can scan all multiple times
                    album.Right = null;

                    AlbumDetailsViewModel closedAlbum = album;
                    //TODO: don't like having to call back into the zune db just to get the albumMediaId
                    var url = String.Concat(Urls.Album, album.AlbumMediaId);
                    AlbumDetailsDownloader.DownloadAsync(url, dledAlbum =>
                    {
                        if (dledAlbum != null)
                        {
                            closedAlbum.LinkStatus = LinkStatus.Linked;
                            closedAlbum.Right = new AlbumThumbDetails
                            {
                                Artist = dledAlbum.Artist,
                                ArtworkUrl = dledAlbum.ArtworkUrl,
                                Title = dledAlbum.Title
                            };
                        }
                        else
                        {
                            closedAlbum.LinkStatus = LinkStatus.Unlinked;
                        }

                        counter++;
                        Trace.WriteLine(counter);
                        ReportProgress(counter, toScan.Count());
                    });
                }
            });
        }
        private void DisplayMessage(ErrorMessage message)
        {
            this.Visibility = Visibility.Visible;
            SetMessageText(message.Message);

            var imageResourcePath = GetErrorImageFor(message.ErrorMode);
            this.imgError.Source = new BitmapImage(new Uri(imageResourcePath, UriKind.RelativeOrAbsolute));

            this._timer.Interval = 20000;
            this._timer.Start();
        }
        private void QueueMessage(ErrorMessage message)
        {
            _messages.Enqueue(message);

            if (Visibility == Visibility.Collapsed)
                DisplayMessage(_messages.Dequeue());
        }
        public void LoadFromZuneWebsite()
        {
            if (_isScanning)
            {
                _isScanning = false;
                AlbumDetailsDownloader.AbortAllCurrentRequests();
                ResetLoadingProgress();
                ScanButtonText = "SCAN ALL";
                return;
            }

            var warningMsg = new ErrorMessage(ErrorMode.Warning, "This process could take a very long time, are you sure?");
            var result = ZuneMessageBox.Show(warningMsg, System.Windows.MessageBoxButton.OKCancel);

            if (result == System.Windows.MessageBoxResult.OK)
            {
                this._isScanning = true;
                this.ScanButtonText = "STOP";

                AlbumDetailsDownloader.Aborted = false;

                var toScan = (from object album in _cvs.View select album as AlbumDetailsViewModel)
                    .ToList().Where(x => x.AlbumMediaId != Guid.Empty);

                var splitted = toScan.Split(10);
                //we are scanning the albums in chunks because it is easier for the abortion mechanism
                ScanChunk(splitted, 0, toScan.Count());
            }
            else
            {
                ResetLoadingProgress();
            }
        }