Пример #1
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();
        }
Пример #2
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));
        }