protected virtual void OnInitialize() { _typeResolver = new iOSFrameworkTypeResolver(); _loggingProvider = new DefaultLoggingProvider(); _resourcesProvider = new iOSResourcesProvider(); _synchronizationProvider = new iOSSynchronizationProvider(this); _navigationProvider = new iOSNavigationProvider(NavigationController, _typeResolver, new PlatformProviders(GetNavigationProvider, _synchronizationProvider, _resourcesProvider)); }
protected virtual void OnInitialize() { _typeResolver = new AndroidFrameworkTypeResolver(this); _loggingProvider = new DefaultLoggingProvider(); _resourcesProvider = new AndroidResourcesProvider(this); _synchronizationProvider = new AndroidSynchronizationProvider(); _navigationProvider = new AndroidNavigationProvider(_typeResolver, _synchronizationProvider, _resourcesProvider); }
public PerWindowPlatformProviders(INavigationProvider navigation, ISynchronizationProvider synchronization, IResourcesProvider resources) { Guard.AgainstNull(navigation, "navigation"); _navigation = navigation; Guard.AgainstNull(synchronization, "synchronization"); _synchronization = synchronization; Guard.AgainstNull(resources, "resources"); _resources = resources; }
protected virtual void OnInitialize(IActivatedEventArgs args) { _loggingProvider = new DefaultLoggingProvider(); _synchronization = new SynchronizationProvider(); _resources = new WindowsRuntimeResourcesProvider(ResourceLoader.GetForViewIndependentUse(Constants.StoreAppsInfrastructureResourceMapId)); _typeResolver = new DefaultMvvmTypeResolver(); _lifecycleProvider = new UwpLifecycleProvider(_typeResolver, _synchronization, _resources); _navigationProvider = CreateNavigationManager(Window.Current, _typeResolver, _synchronization, _resources); }
public static unsafe int SynchronizeInvoke(ISynchronizationProvider synchronizationProvider, IntPtr native, string format, int *data) { int result = default; synchronizationProvider.Invoke(() => result = Interop.FastNativeInvoke(native, format, data)); return(result); }
protected override async void CheckSettingsExecute() { using (this.ExecuteBusyAction(ExchangeResources.Exchange_CheckingCredentials)) { // first try with ExchangeEws and Office 365 endpoint ISynchronizationProvider provider = this.SynchronizationManager.GetProvider(SynchronizationService.ExchangeEws); this.Settings.SetValue(ExchangeSettings.ExchangeServerUri, Constants.Office365Endpoint); this.Settings.SetValue(ExchangeSettings.ExchangeEmail, this.Email); this.Settings.SetValue(ExchangeSettings.ExchangeUsername, this.Email); this.Settings.SetValue(ExchangeSettings.ExchangeVersion, ExchangeServerVersion.ExchangeOffice365); this.Settings.SetValue(ExchangeSettings.ExchangeSyncFlaggedItems, false); this.Settings.SetValue(ExchangeSettings.ExchangePassword, this.Settings.GetValue <byte[]>(ExchangeSettings.ActiveSyncPassword)); bool result = await provider.CheckLoginAsync(); if (result) { this.SynchronizationManager.Metadata.Reset(); this.SynchronizationManager.ActiveService = SynchronizationService.ExchangeEws; await this.HandleGoodSettings(); return; } // if that doesn't work, fallback to ActiveSync if (!result) { this.Settings.SetValue <string>(ExchangeSettings.ExchangeServerUri, null); this.Settings.SetValue <string>(ExchangeSettings.ExchangeEmail, null); this.Settings.SetValue <string>(ExchangeSettings.ExchangeUsername, null); this.Settings.SetValue <bool>(ExchangeSettings.ExchangeSyncFlaggedItems, false); this.Settings.SetValue <byte[]>(ExchangeSettings.ExchangePassword, null); this.CheckAndUpdateServerUri(); provider = this.SynchronizationManager.GetProvider(SynchronizationService.OutlookActiveSync); provider.OperationFailed += this.OnProviderOperationFailed; result = await provider.CheckLoginAsync(); provider.OperationFailed -= this.OnProviderOperationFailed; if (result) { this.SynchronizationManager.Metadata.Reset(); this.SynchronizationManager.ActiveService = SynchronizationService.OutlookActiveSync; await this.HandleGoodSettings(); } } } }
public SyncProviderViewModel(ISynchronizationProvider activeProvider, ISynchronizationManager synchronizationManager, bool isRecommended, Action configure = null, Action remove = null) { if (activeProvider == null) { throw new ArgumentNullException("activeProvider"); } this.provider = activeProvider; this.isRecommended = isRecommended; this.synchronizationMetadata = synchronizationManager.Metadata; if (configure == null) { configure = () => { } } ; if (remove == null) { remove = () => { } } ; this.configureCommand = new RelayCommand(configure); this.removeCommand = new RelayCommand(remove); if (this.provider != null && !string.IsNullOrWhiteSpace(this.provider.LoginInfo)) { if (this.provider.LoginInfo.Contains("@")) { var split = this.provider.LoginInfo.Split('@'); this.loginInfoPrimary = split[0]; if (split.Length > 1) { this.loginInfoSecondary = "@" + split[1]; } } else { this.loginInfoPrimary = this.provider.LoginInfo; } } else { this.loginInfoPrimary = string.Empty; this.loginInfoSecondary = string.Empty; } } }
protected override async void CheckSettingsExecute() { using (this.ExecuteBusyAction(ToodleDoResources.ToodleDo_CheckingCredentials)) { ISynchronizationProvider provider = this.SynchronizationManager.GetProvider(SynchronizationService.ToodleDo); provider.OperationFailed += this.OnProviderOperationFailed; var result = await provider.CheckLoginAsync(); provider.OperationFailed -= this.OnProviderOperationFailed; if (result) { this.SynchronizationManager.Metadata.Reset(); this.SynchronizationManager.ActiveService = SynchronizationService.ToodleDo; await this.HandleGoodSettings(); } } }
public void AttachWorkbook(IWorkbook target) { if (target == null) { throw new ArgumentNullException("target"); } if (this.workbook != null) { throw new InvalidOperationException("Workbook is already attached"); } this.workbook = target; if (this.metadata != null) { this.ActiveService = this.metadata.ActiveProvider; } else { this.metadata = new SynchronizationMetadata(); } this.provider = this.GetProvider(this.metadata.ActiveProvider); if (this.provider != null) { // make sure we have valid information for syncing if (string.IsNullOrEmpty(this.provider.ServerInfo) || string.IsNullOrEmpty(this.provider.LoginInfo)) { this.ActiveService = SynchronizationService.None; } } // listen for changes in the workbook this.RegisterWorkbookEvents(); }
public JobExecutor(ISynchronizationProvider synchronizationProvider, IJobStateProvider jobStateProvider) { _synchronizationProvider = synchronizationProvider; _jobStateProvider = jobStateProvider; }
public ExchangeSyncProviderViewModel(ISynchronizationProvider activeProvider, ISynchronizationManager synchronizationManager, bool isRecommended, Action configure = null, Action remove = null) : base(activeProvider, synchronizationManager, isRecommended, configure, remove) { }
protected override async void CheckSettingsExecute() { this.Settings.SetValue(ExchangeSettings.ExchangeVersion, ExchangeServerVersionHelper.GetEnum(this.exchangeVersion)); this.Settings.SetValue(ExchangeSettings.ExchangeSyncFlaggedItems, this.syncFlaggedItems); if (string.IsNullOrEmpty(this.Domain) && !string.IsNullOrEmpty(this.Email)) { // try to use the email address to find out what the domain is string[] emailComponents = this.Email.Split('@'); if (emailComponents.Length > 1) { this.Domain = emailComponents[1]; } } if (!string.IsNullOrEmpty(this.ServerUri)) { this.ServerUri = this.ServerUri.GetUriCompatibleString(); if (!this.ServerUri.StartsWith(HttpPrefix) && !this.ServerUri.StartsWith(HttpsPrefix)) { // http prefix is missing add it if (this.UseSSL) { this.ServerUri = HttpsPrefix + this.ServerUri; } else { this.ServerUri = HttpPrefix + this.ServerUri; } } } if (string.IsNullOrEmpty(this.Username) && !string.IsNullOrEmpty(this.Email)) { // if the username is empty while the email is not // use the email as the username this.Username = this.Email; } using (this.ExecuteBusyAction(ExchangeResources.Exchange_CheckingCredentials)) { SynchronizationService synchronizationService = SynchronizationService.ExchangeEws; ISynchronizationProvider provider = this.SynchronizationManager.GetProvider(synchronizationService); bool result = false; if (provider != null) { provider.OperationFailed += this.ProviderOnOperationFailed; result = await provider.CheckLoginAsync(); provider.OperationFailed -= this.ProviderOnOperationFailed; } // notify potential changes to the server uri this.RaisePropertyChanged("ServerUri"); this.UpdateSSLUsage(); if (result) { this.SynchronizationManager.Metadata.Reset(); this.SynchronizationManager.ActiveService = synchronizationService; await this.HandleGoodSettings(); } } }