Example #1
0
 public static IDeviceEnumerationListener ResolveIDeviceEnumerationListener()
 {
     if (listener == null)
     {
         listener = new DeviceEnumerationListener();
     }
     return(listener);
 }
 public static IDeviceEnumerationListener ResolveIDeviceEnumerationListener()
 {
     if (listener == null)
     {
         listener = new DeviceEnumerationListener();
     }
     return listener;
 }
Example #3
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));
        }
Example #4
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));
        }