コード例 #1
0
 public void HandleSyncErrors(ISyncPartnership partnership, ICollection <SyncResult> errors)
 {
     if ((partnership != null) && ((bool)GlobalSetting.GetApplicationSetting("ShowSyncErrors")))
     {
         this.ShowSyncErrorsPanel(errors);
     }
 }
コード例 #2
0
        public void Commit()
        {
            string applicationSetting = (string)GlobalSetting.GetApplicationSetting("MusicSyncSource");

            if (applicationSetting != this.MusicSyncSource)
            {
                GlobalSetting.SetApplicationSetting("MusicSyncSource", this.MusicSyncSource);
                this.controller.ResetMusicSyncSourceType();
            }
            GlobalSetting.SetApplicationSetting("PlaySoundOnSyncComplete", this.PlaySoundOnSyncComplete);
            GlobalSetting.SetApplicationSetting("ShowSyncErrors", this.ShowSyncErrors);
            GlobalSetting.SetApplicationSetting("SendSqmInfo", this.SendSqmInfo);
        }
コード例 #3
0
        public void Init()
        {
            bool?applicationSetting = (bool?)GlobalSetting.GetApplicationSetting("PlaySoundOnSyncComplete");

            this.PlaySoundOnSyncComplete = applicationSetting.HasValue ? applicationSetting.GetValueOrDefault() : false;
            bool?nullable2 = (bool?)GlobalSetting.GetApplicationSetting("ShowSyncErrors");

            this.ShowSyncErrors  = nullable2.HasValue ? nullable2.GetValueOrDefault() : false;
            this.MusicSyncSource = (string)GlobalSetting.GetApplicationSetting("MusicSyncSource");
            bool?nullable3 = (bool?)GlobalSetting.GetApplicationSetting("SendSqmInfo");

            this.SendSqmInfo = nullable3.HasValue ? nullable3.GetValueOrDefault() : false;
            this.SyncSourceITunesIsEnabled = ITunesMusicSyncSource.IsITunesInstalled();
        }
コード例 #4
0
 private void OnSyncStopped(SyncStoppedReason reason)
 {
     using (new OperationLogger())
     {
         if (this.Device != null)
         {
             this.Device.RefreshProperties();
         }
         if ((((bool)GlobalSetting.GetApplicationSetting("PlaySoundOnSyncComplete")) && (reason != SyncStoppedReason.Cancelled)) && (reason != SyncStoppedReason.Paused))
         {
             SystemSounds.Asterisk.Play();
         }
         this.FireSyncErrors();
     }
 }
コード例 #5
0
        public static IMusicSyncSource CreateMusicSyncSource()
        {
            string applicationSetting = (string)GlobalSetting.GetApplicationSetting("MusicSyncSource");

            switch (applicationSetting)
            {
            case "ITunes":
                return(DependencyContainer.ResolveITunesMusicSyncSource());

            case "WindowsLibraries":
                return(DependencyContainer.ResolveWindowsLibraryMusicSyncSource());
            }
            Logger.TraceError("Managed:SyncEngine", "Factory: Bad music sync source type", applicationSetting);
            return(DependencyContainer.ResolveWindowsLibraryMusicSyncSource());
        }
コード例 #6
0
        private void InitSources()
        {
            if (DeviceSettings.GetDeviceDirectories().Count <string>() > 0)
            {
                switch ((GlobalSetting.GetApplicationSetting("MusicSyncSource") as string))
                {
                case "ITunes":
                    this.musicSyncSource = DependencyContainer.ResolveITunesMusicSyncSource();
                    break;

                case "WindowsLibraries":
                    this.musicSyncSource = DependencyContainer.ResolveWindowsLibraryMusicSyncSource();
                    break;
                }
            }
            this.photoSyncSource = DependencyContainer.ResolvePhotosSyncSource();
        }
コード例 #7
0
        public bool Validate()
        {
            string applicationSetting = (string)GlobalSetting.GetApplicationSetting("MusicSyncSource");

            if (applicationSetting != this.MusicSyncSource)
            {
                if (!this.controller.CanResetMusicSyncSourceType())
                {
                    MessageBox.Show(Resources.CantSwitchSyncSourceText, Resources.CantSwitchSyncSourceTitle, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return(false);
                }
                if ((DeviceSettings.GetDeviceDirectories().FirstOrDefault <string>() != null) && (MessageBox.Show(Resources.SwitchSyncSourceWarningText, Resources.SwitchSyncSourceWarningTitle, MessageBoxButton.YesNo, MessageBoxImage.Exclamation, MessageBoxResult.No) == MessageBoxResult.No))
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #8
0
        public static IDeviceManager ResolveIDeviceManager()
        {
            IDeviceManager manager = null;
            Thread         thread  = new Thread(delegate {
                Thread.CurrentThread.SetApartmentState(ApartmentState.MTA);
                try
                {
                    manager = new DeviceManager(GlobalSetting.GetApplicationSetting("MockDeviceCount") as long?);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString());
                    throw;
                }
            });

            thread.Start();
            thread.Join();
            return(manager);
        }
コード例 #9
0
ファイル: SqmHelper.cs プロジェクト: netonjm/WindowsPhone
 public void InitSqm()
 {
     this.isSqmEnabled = (bool)GlobalSetting.GetApplicationSetting("SendSqmInfo");
     this.sqmManager.InitSqm(this.isSqmEnabled, GlobalSetting.SqmFilesDirectoryForApplication(true));
 }
コード例 #10
0
        public MainController(IWindow view, IMainFactory factory)
        {
            if (view == null)
            {
                throw new ArgumentNullException(typeof(IWindow).ToString());
            }
            this.view       = view;
            this.Dispatcher = view.Window.Dispatcher;
            if (factory == null)
            {
                throw new ArgumentNullException(typeof(IMainFactory).ToString());
            }
            this.repository = factory.CreateISyncRepository();
            if (this.repository == null)
            {
                throw new ApplicationInitializationException(typeof(ISyncRepository).ToString());
            }
            this.MainViewModel = factory.CreateIMainViewModel(this);
            if (this.MainViewModel == null)
            {
                throw new ApplicationInitializationException(typeof(IMainViewModel).ToString());
            }
            this.deviceManager = factory.CreateIDeviceManager();
            if (this.deviceManager == null)
            {
                throw new ApplicationInitializationException(typeof(IDeviceManager).ToString());
            }
            this.deviceEnumerationListener = factory.CreateIDeviceEnumerationListener();
            if (this.deviceEnumerationListener == null)
            {
                throw new ApplicationInitializationException(typeof(IDeviceEnumerationListener).ToString());
            }
            this.errorLogger = factory.CreateIErrorLogger();
            if (this.errorLogger == null)
            {
                throw new ApplicationInitializationException(typeof(IErrorLogger).ToString());
            }
            this.sqmHelper = factory.CreateISqmHelper();
            if (this.sqmHelper == null)
            {
                throw new ApplicationInitializationException(typeof(ISqmHelper).ToString());
            }
            this.preloader = factory.CreateISyncSourcePreloader();
            if (this.preloader == null)
            {
                throw new ApplicationInitializationException(typeof(ISyncSourcePreloader).ToString());
            }
            bool flag  = ((string)GlobalSetting.GetApplicationSetting("MusicSyncSource")) == "ITunes";
            bool flag2 = ((string)GlobalSetting.GetApplicationSetting("MusicSyncSource")) == "WindowsLibraries";

            if (!flag && !flag2)
            {
                GlobalSetting.SetApplicationSetting("MusicSyncSource", "WindowsLibraries");
            }
            bool flag3 = ITunesMusicSyncSource.IsITunesInstalled();

            if (flag && !flag3)
            {
                if (!((bool)GlobalSetting.GetApplicationSetting("FirstRun")))
                {
                    MessageBox.Show(Resources.iTunesMissingWillSwitchMessage, Resources.iTunesMissingWillSwitchTitle, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                GlobalSetting.SetApplicationSetting("MusicSyncSource", "WindowsLibraries");
                this.MainViewModel.AppSettingsViewModel.Init();
            }
            this.deviceEnumerationListener.EventArrived += new EventArrivedEventHandler(this.OnConnectedDevicesChanged);
            GlobalSetting.SettingChange = (EventHandler <ApplicationSettingsChangeEventArgs>)Delegate.Combine(GlobalSetting.SettingChange, new EventHandler <ApplicationSettingsChangeEventArgs>(this.OnApplicationSettingChanged));
        }