Пример #1
0
 public static void ViewInPhotoGallery(string path)
 {
     if (!IsPhotoGalleryAvailable)
     {
         return;
     }
     try
     {
         string str = string.Empty;
         if (!string.IsNullOrEmpty(path))
         {
             str = !File.Exists(path) ? string.Format(Shell.LoadString(StringId.IDS_PHOTOS_PHOTO_GALLERY_OPEN_FOLDER), path, path) : string.Format(Shell.LoadString(StringId.IDS_PHOTOS_PHOTO_GALLERY_OPEN_FILE), Path.GetDirectoryName(path), path);
         }
         if (string.IsNullOrEmpty(PhotoGalleryExecutablePath))
         {
             return;
         }
         new Process()
         {
             StartInfo =
             {
                 FileName         = PhotoGalleryExecutablePath,
                 WorkingDirectory = Path.GetDirectoryName(PhotoGalleryExecutablePath),
                 Arguments        = str
             }
         }.Start();
         SQMLog.Log(SQMDataId.LaunchWLPG, 1);
     }
     catch (FileNotFoundException ex)
     {
     }
     catch (Win32Exception ex)
     {
     }
 }
Пример #2
0
 public PlaylistResult CreateAutoPlaylist(
     string title,
     CreatePlaylistOption options)
 {
     SQMLog.Log(SQMDataId.AutoPlaylistCreations, 1);
     return(this.CreatePlaylist(title, CreatePlaylistOption.AutoPlaylist | options));
 }
Пример #3
0
        public static void LaunchMovieMaker(IList mediaFiles)
        {
            if (!IsMovieMakerAvailable)
            {
                return;
            }
            string str    = WriteMovieMakerMedia(mediaFiles);
            string format = Shell.LoadString(StringId.IDS_PHOTOS_MOVIE_MAKER_ARGS);

            try
            {
                if (string.IsNullOrEmpty(MovieMakerExecutablePath))
                {
                    return;
                }
                new Process()
                {
                    StartInfo =
                    {
                        FileName         = MovieMakerExecutablePath,
                        WorkingDirectory = Path.GetDirectoryName(MovieMakerExecutablePath),
                        Arguments        = string.Format(format, str)
                    }
                }.Start();
                SQMLog.Log(SQMDataId.LaunchMovieMaker, 1);
            }
            catch (FileNotFoundException ex)
            {
            }
            catch (Win32Exception ex)
            {
            }
        }
Пример #4
0
        public static bool ManageProfileImage(
            ProfileImage image,
            MessagingCallback callback,
            object state)
        {
            bool   flag = !string.IsNullOrEmpty(image.TypeName);
            string strProfileImageUrl = null;

            if (flag)
            {
                strProfileImageUrl = CreateOperationUri(image.TypeName);
                flag = strProfileImageUrl != null;
            }
            if (flag)
            {
                flag = image.Image == null ? image.ResourceId != null && MessagingService.Instance.ManageProfileImage(strProfileImageUrl, image.ResourceId, callback, state) : MessagingService.Instance.ManageProfileImage(strProfileImageUrl, image.Image, callback, state);
            }
            if (flag)
            {
                if (image.Type == ProfileImageType.Background)
                {
                    SQMLog.Log(SQMDataId.SocialEditBackground, 1);
                }
                else if (image.Type == ProfileImageType.Tile)
                {
                    SQMLog.Log(SQMDataId.SocialEditTile, 1);
                }
            }
            return(flag);
        }
Пример #5
0
 protected override void EndOperation(WirelessStateResults result)
 {
     if (result != WirelessStateResults.Finished)
     {
         if (this._fProfileSaved)
         {
             this.RestoreProfile();
         }
         if (result == WirelessStateResults.Canceled)
         {
             this._error         = Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_CANCELED);
             this._detailedError = null;
             this._hr            = HRESULT._S_OK;
         }
         else if (this._attemptingProfile != null)
         {
             this._error = string.Format(Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_FAILED), _attemptingProfile.SSID);
         }
         else
         {
             this._error = Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_FAILED_GENERIC);
         }
     }
     else if (!string.IsNullOrEmpty(this._wlanTestResult))
     {
         this._error         = string.Format(Shell.LoadString(StringId.IDS_WIRELESS_SYNC_TEST_FAILED), _attemptingProfile.SSID);
         this._detailedError = this._wlanTestResult;
         this._hr            = this._wlanTestResultCode;
     }
     else
     {
         SQMLog.Log(SQMDataId.DeviceWirelessSetup, 1);
     }
 }
Пример #6
0
 public void LogCategoryView()
 {
     if (this._sqmCountID == SQMDataId.Invalid)
     {
         return;
     }
     SQMLog.Log(this._sqmCountID, 1);
 }
Пример #7
0
 public void Stop()
 {
     if (!(this._start != DateTime.MinValue))
     {
         return;
     }
     SQMLog.Log(this._logId, (int)DateTime.Now.Subtract(this._start).TotalSeconds);
     this._start = DateTime.MinValue;
 }
Пример #8
0
        public static void NavigateToLand(bool showMix, bool exitOnPlaybackStopped)
        {
            if (ZuneShell.DefaultInstance.CurrentPage is NowPlayingLand)
            {
                return;
            }
            NowPlayingLand nowPlayingLand = new NowPlayingLand();

            nowPlayingLand.ShowMixOnEntry        = showMix;
            nowPlayingLand.ExitOnPlaybackStopped = exitOnPlaybackStopped;
            ZuneShell.DefaultInstance.NavigateToPage(nowPlayingLand);
            SQMLog.Log(SQMDataId.NowPlayingClicks, 1);
        }
Пример #9
0
        private static void Phase2InitializationWorker(object arg)
        {
            Win32Window.Close(_hWndSplashScreen);
            bool flag = _zuneLibrary.Phase2Initialization(out int hr);

            Application.DeferredInvoke(new DeferredInvokeHandler(Phase2InitializationUIStage), new object[2]
            {
                hr, flag
            });
            ZuneLibrary.CleanupTransientMedia();
            _transientTableCleanupComplete.Set();
            SQMLog.Log(SQMDataId.GdiMode, Application.RenderingType == RenderingType.GDI ? 1 : 0);
        }
Пример #10
0
 public void Navigate(string command, IDictionary commandArguments)
 {
     if (string.IsNullOrEmpty(command))
     {
         return;
     }
     if (command.Contains("Marketplace\\"))
     {
         SQMLog.Log(SQMDataId.SearchMarketplaceResultsCount, 1);
     }
     else if (command.Contains("Collection\\"))
     {
         SQMLog.Log(SQMDataId.SearchCollectionResultsCount, 1);
     }
     ZuneShell.DefaultInstance.Execute(command, commandArguments);
 }
Пример #11
0
 protected override bool OnCommitChanges()
 {
     if (this.CurrentPage is FirstLaunchWelcomePage)
     {
         ZuneShell.DefaultInstance.Management.MediaInfoChoice.Value = true;
         ZuneShell.DefaultInstance.Management.SqmChoice.Value       = true;
         SQMLog.Log(SQMDataId.UserConfiguredSettingsFUE, 0);
     }
     else
     {
         SQMLog.Log(SQMDataId.UserConfiguredSettingsFUE, 1);
     }
     ZuneShell.DefaultInstance.Management.CommitListSave();
     Fue.Instance.MigrateLegacyConfiguration();
     Fue.Instance.CompleteFUE();
     return(base.OnCommitChanges());
 }
Пример #12
0
        public override PlaylistResult CreatePlaylist(
            string title,
            CreatePlaylistOption option)
        {
            SQMLog.Log(SQMDataId.QuickMixPlaylistCreates, 1);
            int     playlistId = -1;
            HRESULT hr         = HRESULT._E_PENDING;

            if (this.Ready)
            {
                hr = this._hrCreation;
                if (hr.IsSuccess)
                {
                    hr = this._quickMixSession.SaveAsPlaylist(title, option, out playlistId);
                }
            }
            return(new PlaylistResult(playlistId, hr));
        }
Пример #13
0
        private void UpdatePlayedStates(
            bool markPlayed,
            bool incrementPlayCount,
            bool incrementSkipCount)
        {
            int mediaId = this.MediaId;

            if (mediaId == -1)
            {
                return;
            }
            EListType           listType            = this.ListType;
            ContainerPlayMarker containerPlayMarker = this._containerPlayMarker;

            ThreadPool.QueueUserWorkItem(new WaitCallback(UpdatePlayedStatesWorker), new UpdatePlayedStatesTask(markPlayed, incrementPlayCount, incrementSkipCount, mediaId, listType, containerPlayMarker));
            bool flag = this._containerPlayMarker != null && this._containerPlayMarker.PlaylistType == PlaylistType.QuickMix;

            if (incrementPlayCount)
            {
                if (this._mediaType == MediaType.Track)
                {
                    ++Shell.MainFrame.Social.PlayCount;
                }
                if (flag)
                {
                    SQMLog.Log(SQMDataId.QuickMixTrackPlays, 1);
                }
            }
            if (!incrementSkipCount || !flag)
            {
                return;
            }
            if (this.IsInVisibleCollection)
            {
                SQMLog.Log(SQMDataId.QuickMixLocalSkips, 1);
            }
            else
            {
                SQMLog.Log(SQMDataId.QuickMixRemoteSkips, 1);
            }
        }
Пример #14
0
 public QuickplayPage()
 {
     this.PivotPreference = Shell.MainFrame.Quickplay.Default;
     this.IsRootPage      = true;
     this.UI           = "res://ZuneShellResources!Quickplay.uix#Quickplay";
     this.UIPath       = "Quickplay\\Default";
     this.BackgroundUI = LandBackgroundUI;
     this.ShowSearch   = false;
     if (_createdOnce)
     {
         return;
     }
     _createdOnce = true;
     _showFUE     = ClientConfiguration.Quickplay.ShowFUE;
     if (!(Shell.SessionStartupPath == Shell.MainFrame.Quickplay.DefaultUIPath))
     {
         return;
     }
     SQMLog.Log(SQMDataId.QuickPlayAsDefaultStarts, 1);
     this._startupPage = true;
 }
Пример #15
0
        public void DownloadContent(
            IList items,
            EDownloadFlags eDownloadFlags,
            string deviceEndpointId,
            EventHandler onAllPending)
        {
            ZuneApplication.Service.Download(items, eDownloadFlags, deviceEndpointId, this.ClientContextEvent, this.ClientContextEventValue, new DownloadEventHandler(this.OnDownloadEvent), new DownloadEventProgressHandler(this.OnDownloadProgressEvent), onAllPending);
            if ((eDownloadFlags & ~(EDownloadFlags.CanBeOffline | EDownloadFlags.Subscription)) != EDownloadFlags.None)
            {
                return;
            }
            bool flag = ZuneShell.DefaultInstance.CurrentPage is InboxPage;

            if ((eDownloadFlags & EDownloadFlags.Subscription) != EDownloadFlags.None)
            {
                SQMLog.Log(flag ? SQMDataId.InboxDownload : SQMDataId.MarketplaceDownload, 1);
            }
            else
            {
                SQMLog.Log(flag ? SQMDataId.InboxPurchase : SQMDataId.MarketplacePurchase, 1);
            }
        }
Пример #16
0
        internal static void Show(bool updateFound, bool fIsCritical, bool isUserInitiated)
        {
            if (updateFound)
            {
                EventHandler cancelCommand = null;
                string       message       = !fIsCritical?Shell.LoadString(StringId.IDS_UPDATE_AVAILABLE) : Shell.LoadString(StringId.IDS_CRITICAL_UPDATE_AVAILABLE);

                string  cancelText = Shell.LoadString(StringId.IDS_UPDATE_INSTALL_LATER);
                Command okCommand  = new Command(null, Shell.LoadString(StringId.IDS_UPDATE_INSTALL_NOW), null);
                okCommand.Invoked += delegate
                {
                    SoftwareUpdates.Instance.InstallUpdates();
                };
                if (!isUserInitiated)
                {
                    cancelCommand = (sender, e) => SQMLog.Log(SQMDataId.UserDeferredAutomaticUpdate, 1);
                }
                MessageBox.Show(null, message, okCommand, cancelText, cancelCommand, true);
            }
            else
            {
                MessageBox.Show(null, Shell.LoadString(StringId.IDS_UPDATE_NOT_REQUIRED), null);
            }
        }
Пример #17
0
 public override void LogSend() => SQMLog.Log(SQMDataId.InboxMessageSendAlbum, 1);
Пример #18
0
 public void SetAutoRefresh(int playlistId, bool enable)
 {
     SQMLog.Log(SQMDataId.PlaylistAutoRefresh, enable ? 1 : 0);
     SetFieldValue(playlistId, EListType.ePlaylistList, 25, enable);
 }
Пример #19
0
 public void SetLimitValue(int playlistId, int value, int type)
 {
     SQMLog.LogToStream((SQMDataId)(type == 0 ? 205 : 206), (uint)value);
     SetFieldValue(playlistId, EListType.ePlaylistList, 221, value);
 }
Пример #20
0
 public void SetLimitType(int playlistId, int type)
 {
     SQMLog.LogToStream(SQMDataId.PlaylistLimitType, (uint)type);
     SetFieldValue(playlistId, EListType.ePlaylistList, 220, type);
 }
Пример #21
0
 public void SetSubType(int playlistId, int subtype)
 {
     SQMLog.LogToStream(SQMDataId.PlaylistSubType, (uint)subtype);
     SetFieldValue(playlistId, EListType.ePlaylistList, 324, subtype);
 }
Пример #22
0
        internal override void OnBeginPlayback(PlayerInterop playbackWrapper)
        {
            base.OnBeginPlayback(playbackWrapper);
            this._hasMarkedPlayed         = false;
            this._markPlayedAt            = 0L;
            this._hasIncrementedPlayCount = false;
            this._hasIncrementedSkipCount = false;
            this._lastStoredBookmark      = 0L;
            this._duration = playbackWrapper.Duration;
            if (this._mediaType == ZuneUI.MediaType.PodcastEpisode || this._mediaType == ZuneUI.MediaType.Video)
            {
                PodcastVideoLengthGroup videoLengthGroup = PodcastVideoLengthGroup.Long;
                while (videoLengthGroup > PodcastVideoLengthGroup.Short && this._duration <= c_podcastVideoLengths[(int)videoLengthGroup])
                {
                    --videoLengthGroup;
                }
                this._markPlayedAt = this._duration - c_podcastVideoMarkPlayedAtEOFMinus[(int)videoLengthGroup];
                if (this._markPlayedAt < 1L)
                {
                    this._markPlayedAt = 1L;
                }
                this._lastStoredBookmark = this.Bookmark;
                if (this._lastStoredBookmark != 0L)
                {
                    playbackWrapper.SeekToAbsolutePosition(this._lastStoredBookmark);
                    if (this._lastStoredBookmark > 200000000L)
                    {
                        this._hasIncrementedPlayCount = true;
                    }
                }
                if (this._mediaType == ZuneUI.MediaType.PodcastEpisode)
                {
                    if (this.IsVideo)
                    {
                        SQMLog.Log(SQMDataId.PodcastVideoEpisodePlayed, 1);
                    }
                    else
                    {
                        SQMLog.Log(SQMDataId.PodcastAudioEpisodePlayed, 1);
                    }
                }
            }
            EMediaTypes MediaType;

            switch (this.MediaType)
            {
            case ZuneUI.MediaType.Track:
                MediaType = EMediaTypes.eMediaTypeAudio;
                break;

            case ZuneUI.MediaType.Video:
                MediaType = EMediaTypes.eMediaTypeVideo;
                break;

            case ZuneUI.MediaType.PodcastEpisode:
                MediaType = EMediaTypes.eMediaTypePodcastEpisode;
                break;

            default:
                MediaType = EMediaTypes.eMediaTypeInvalid;
                break;
            }
            Microsoft.Zune.Util.Notification.BroadcastNowPlaying(MediaType, this.Album, this.DisplayArtist, this.Title, this.TrackNumber, this.ZuneMediaId);
        }
Пример #23
0
 protected override void OnNavigatedAwayWorker(IPage destination)
 {
     if (!this._hasNavigatedAway && this._startupPage)
     {
         if (!this.UserInteracted && !(destination is NowPlayingLand))
         {
             SQMLog.Log(SQMDataId.QuickPlayAsDefaultSkips, 1);
         }
         if (ClientConfiguration.Quickplay.CheckUseCount)
         {
             if (this.UserInteracted)
             {
                 ClientConfiguration.Quickplay.UnusedCount = 0;
             }
             else
             {
                 ZunePage zunePage = destination as ZunePage;
                 string   str1     = "";
                 if (zunePage != null && zunePage.PivotPreference != null)
                 {
                     string str2 = "";
                     if (zunePage.PivotPreference.Experience is MarketplaceExperience || zunePage.PivotPreference.Experience is SocialExperience || zunePage.PivotPreference.Experience is CollectionExperience && !(zunePage.PivotPreference.Experience is DeviceExperience))
                     {
                         str2 = zunePage.UIPath;
                     }
                     if (!string.IsNullOrEmpty(str2))
                     {
                         str1 = str2;
                         int startIndex = str2.IndexOf('\\');
                         if (startIndex != -1)
                         {
                             str1 = str2.Remove(startIndex);
                         }
                     }
                 }
                 if (!string.IsNullOrEmpty(str1))
                 {
                     if (ClientConfiguration.Quickplay.FavoredExperience == str1)
                     {
                         ++ClientConfiguration.Quickplay.UnusedCount;
                     }
                     else
                     {
                         ClientConfiguration.Quickplay.FavoredExperience = str1;
                         ClientConfiguration.Quickplay.UnusedCount       = 1;
                     }
                     if (ClientConfiguration.Quickplay.UnusedCount >= ClientConfiguration.Quickplay.MaxUnusedCount)
                     {
                         ClientConfiguration.Quickplay.CheckUseCount = false;
                         this.Prompt(zunePage.PivotPreference.Experience);
                     }
                 }
                 else
                 {
                     ClientConfiguration.Quickplay.UnusedCount = 0;
                 }
             }
         }
     }
     this._hasNavigatedAway = true;
     base.OnNavigatedAwayWorker(destination);
 }
Пример #24
0
 public override void LogSend() => SQMLog.Log(SQMDataId.InboxMessageSendPlaylist, 1);
Пример #25
0
 private void OnClickNavigateBack(object sender, EventArgs args)
 {
     SQMLog.Log(SQMDataId.BackClicks, 1);
     this.NavigateBack();
 }
Пример #26
0
 public override void LogSend() => SQMLog.Log(SQMDataId.InboxMessageSendProfileCard, 1);
Пример #27
0
 public void RecordContextMenuType(SearchResultContextMenuType type) => SQMLog.LogToStream(SQMDataId.SearchContextMenuAction, (uint)type);
Пример #28
0
        private void AddQuickMixItemsWorker(IList items)
        {
            QuickMix    instance   = QuickMix.Instance;
            HRESULT     hresult    = HRESULT._S_OK;
            EMediaTypes eMediaType = EMediaTypes.eMediaTypeInvalid;

            this._quickMixNoResultsStringId = StringId.IDS_QUICKMIX_ITEM_CREATION_UNAVAILABLE_TEXT;
            if (this._quickMixSession != null)
            {
                this._quickMixSession.Dispose();
                this._quickMixSession = null;
            }
            NotificationArea.Instance.RemoveAll(NotificationTask.QuickMix, NotificationState.OneShot);
            if (items[0] is Artist artist)
            {
                this._quickMixNoResultsStringId = StringId.IDS_QUICKMIX_ARTIST_CREATION_UNAVAILABLE_TEXT;
                hresult = instance.CreateSession(EQuickMixMode.eQuickMixModeNowPlaying, artist.Id, EMediaTypes.eMediaTypePersonArtist, artist.Title, out this._quickMixSession);
                if (hresult.IsSuccess)
                {
                    string text = string.Format(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_ONE_PARAM_TEXT), artist.Title);
                    this._quickMixCreatingNotification = new QuickMixNotification(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TITLE), text, NotificationState.OneShot, false, 15000);
                    SQMLog.Log(SQMDataId.QuickMixRadioPlays, 1);
                }
            }
            if (hresult.IsSuccess && items[0] is LibraryDataProviderItemBase providerItemBase)
            {
                if (providerItemBase.TypeName == "Artist")
                {
                    eMediaType = EMediaTypes.eMediaTypePersonArtist;
                    this._quickMixNoResultsStringId = StringId.IDS_QUICKMIX_ARTIST_CREATION_UNAVAILABLE_TEXT;
                    string property = (string)providerItemBase.GetProperty("Title");
                    string text     = string.Format(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_ONE_PARAM_TEXT), property);
                    this._quickMixCreatingNotification = new QuickMixNotification(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TITLE), text, NotificationState.OneShot, false, 15000);
                }
                else if (providerItemBase.TypeName == "Album")
                {
                    eMediaType = EMediaTypes.eMediaTypeAudioAlbum;
                    this._quickMixNoResultsStringId = StringId.IDS_QUICKMIX_ALBUM_CREATION_UNAVAILABLE_TEXT;
                    string property1 = (string)providerItemBase.GetProperty("ArtistName");
                    string property2 = (string)providerItemBase.GetProperty("Title");
                    string text      = string.Format(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TWO_PARAM_TEXT), property1, property2);
                    this._quickMixCreatingNotification = new QuickMixNotification(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TITLE), text, NotificationState.OneShot, false, 15000);
                }
                else if (providerItemBase.TypeName == "Track")
                {
                    eMediaType = EMediaTypes.eMediaTypeAudio;
                    this._quickMixNoResultsStringId = StringId.IDS_QUICKMIX_SONG_CREATION_UNAVAILABLE_TEXT;
                    string property1 = (string)providerItemBase.GetProperty("ArtistName");
                    string property2 = (string)providerItemBase.GetProperty("Title");
                    string text      = string.Format(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TWO_PARAM_TEXT), property1, property2);
                    this._quickMixCreatingNotification = new QuickMixNotification(Shell.LoadString(StringId.IDS_QUICKMIX_NOTIFICATION_CREATION_BUSY_TITLE), text, NotificationState.OneShot, false, 15000);
                }
                int[] seedMediaIds = new int[1]
                {
                    (int)providerItemBase.GetProperty("LibraryId")
                };
                hresult = instance.CreateSession(EQuickMixMode.eQuickMixModeNowPlaying, seedMediaIds, eMediaType, out this._quickMixSession);
                SQMLog.Log(SQMDataId.QuickMixLocalPlays, 1);
            }
            if (hresult.IsSuccess)
            {
                if (this._quickMixSession != null)
                {
                    hresult            = this._quickMixSession.GetSimilarMedia((uint)ClientConfiguration.QuickMix.DefaultPlaylistLength, TimeSpan.FromMilliseconds(15000.0), new SimilarMediaBatchHandler(this.SimilarBatchHandler), new BatchEndHandler(this.BatchEndHandler));
                    this._quickMixType = this._quickMixSession.GetQuickMixType();
                    this._quickMixSession.GetPlaylistTitle(out this._quickMixTitle);
                }
                else
                {
                    hresult = HRESULT._E_UNEXPECTED;
                }
            }
            if (hresult.IsSuccess)
            {
                NotificationArea.Instance.Add(_quickMixCreatingNotification);
            }
            else
            {
                if (this._quickMixSession != null)
                {
                    this._quickMixSession.Dispose();
                    this._quickMixSession = null;
                }
                if (hresult.Int == HRESULT._ZUNE_E_QUICKMIX_MEDIA_NOT_FOUND)
                {
                    MessageBox.Show(Shell.LoadString(StringId.IDS_QUICKMIX_CREATION_UNAVAILABLE_NO_RESULTS_TITLE), Shell.LoadString(this._quickMixNoResultsStringId), null);
                }
                else
                {
                    ErrorDialogInfo.Show(hresult.Int, Shell.LoadString(StringId.IDS_QUICKMIX_CREATION_UNAVAILABLE_NO_RESULTS_TITLE));
                }
            }
        }