コード例 #1
0
ファイル: Gh10803.xaml.cs プロジェクト: sung-su/maui
 public void Setup()
 {
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
     VisualDiagnostics.VisualTreeChanged += VTChanged;
     debuggerinitialstate = DebuggerHelper._mockDebuggerIsAttached;
     DebuggerHelper._mockDebuggerIsAttached = true;
 }
コード例 #2
0
ファイル: Gh10803.xaml.cs プロジェクト: sung-su/maui
 public void TearDown()
 {
     DebuggerHelper._mockDebuggerIsAttached = debuggerinitialstate;
     DispatcherProvider.SetCurrent(null);
     VisualDiagnostics.VisualTreeChanged -= VTChanged;
     failures = 0;
 }
コード例 #3
0
ファイル: Issue1545.cs プロジェクト: hevey/maui
 public void Setup()
 {
     Device.PlatformServices = new MockPlatformServices {
         RuntimePlatform = Device.iOS
     };
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
 }
コード例 #4
0
ファイル: BaseTestFixture.cs プロジェクト: hevey/maui
 public virtual void Setup()
 {
     _defaultCulture         = System.Threading.Thread.CurrentThread.CurrentCulture;
     _defaultUICulture       = System.Threading.Thread.CurrentThread.CurrentUICulture;
     Device.PlatformServices = new MockPlatformServices();
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
     DeviceDisplay.SetCurrent(null);
 }
コード例 #5
0
ファイル: BaseTestFixture.cs プロジェクト: hevey/maui
 public virtual void TearDown()
 {
     Device.PlatformServices = null;
     DeviceDisplay.SetCurrent(null);
     System.Threading.Thread.CurrentThread.CurrentCulture   = _defaultCulture;
     System.Threading.Thread.CurrentThread.CurrentUICulture = _defaultUICulture;
     DispatcherProvider.SetCurrent(null);
 }
コード例 #6
0
ファイル: PlatformBindingTests.cs プロジェクト: sung-su/maui
        public void SetUp()
        {
            DispatcherProvider.SetCurrent(new DispatcherProviderStub());

            //this should collect the ConditionalWeakTable
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
コード例 #7
0
 public virtual void TearDown()
 {
     MockPlatformSizeService.Current?.Reset();
     AppInfo.SetCurrent(null);
     DeviceDisplay.SetCurrent(null);
     DeviceInfo.SetCurrent(null);
     System.Threading.Thread.CurrentThread.CurrentCulture   = _defaultCulture;
     System.Threading.Thread.CurrentThread.CurrentUICulture = _defaultUICulture;
     DispatcherProvider.SetCurrent(null);
 }
コード例 #8
0
 public virtual void Setup()
 {
     Microsoft.Maui.Controls.Hosting.CompatibilityCheck.UseCompatibility();
     _defaultCulture   = System.Threading.Thread.CurrentThread.CurrentCulture;
     _defaultUICulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
     MockPlatformSizeService.Current?.Reset();
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
     DeviceDisplay.SetCurrent(null);
     DeviceInfo.SetCurrent(null);
     AppInfo.SetCurrent(null);
 }
コード例 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DispatcherJobScheduler" /> class.
        /// </summary>
        /// <param name="provider">The job provider.</param>
        /// <param name="prio">The priority for the dispatcher timer.</param>
        /// <param name="dispProvider">The function that provides the underlying dispatcher for the timer.</param>
        /// <param name="syncRoot">The unique object for sync operations.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="provider" />, <paramref name="dispProvider" /> and/or <paramref name="syncRoot" /> are <see langword="null" />.
        /// </exception>
        public DispatcherJobScheduler(JobProvider provider, DispatcherPriority prio, DispatcherProvider dispProvider, object syncRoot)
            : base(provider, syncRoot)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            this._PRIORITY      = prio;
            this._DISP_PROVIDER = dispProvider;
        }
コード例 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DispatcherObservableCollection{T}" /> class.
        /// </summary>
        /// <param name="provider">The value for the <see cref="DispatcherObservableCollection{T}.Provider" /> property.</param>
        /// <param name="prio">The value for the <see cref="DispatcherObservableCollection{T}.Priority" /> property.</param>
        /// <param name="isBackground">The value for the <see cref="DispatcherObservableCollection{T}.IsBackground" /> property.</param>
        /// <param name="syncRoot">The value for the <see cref="SynchronizedObservableCollection{T}._SYNC" /> field.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="provider" /> and/or <paramref name="syncRoot" /> are <see langword="null" />.
        /// </exception>
        public DispatcherObservableCollection(DispatcherProvider provider, DispatcherPriority prio, bool isBackground, object syncRoot)
            : base(syncRoot)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            this.Provider     = provider;
            this.Priority     = prio;
            this.IsBackground = isBackground;
        }
コード例 #11
0
ファイル: DialogActivity.cs プロジェクト: lmx01/eagleboost
 protected override void OnStartActivity()
 {
     DispatcherProvider.CheckedInvoke(() =>
     {
         try
         {
             ShowDialog();
         }
         catch (Exception e)
         {
             Completion.TrySetException(e);
         }
     });
 }
コード例 #12
0
        public static MauiAppBuilder ConfigureDispatching(this MauiAppBuilder builder)
        {
            builder.Services.TryAddSingleton <IDispatcherProvider>(svc => new DispatcherProvider());
            builder.Services.TryAddScoped(svc =>
            {
                var provider = svc.GetRequiredService <IDispatcherProvider>();
                if (DispatcherProvider.SetCurrent(provider))
                {
                    svc.CreateLogger <Dispatcher>()?.LogWarning("Replaced an existing DispatcherProvider with one from the service provider.");
                }

                return(Dispatcher.GetForCurrentThread() !);
            });
            builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped <IMauiInitializeScopedService, DispatcherInitializer>());

            return(builder);
        }
コード例 #13
0
        public static MauiAppBuilder ConfigureDispatching(this MauiAppBuilder builder)
        {
            builder.Services.TryAddSingleton <IDispatcherProvider>(svc =>
                                                                   // the DispatcherProvider might have already been initialized, so ensure that we are grabbing the
                                                                   // Current and putting it in the DI container.
                                                                   DispatcherProvider.Current);

            builder.Services.TryAddScoped(svc =>
            {
                var provider = svc.GetRequiredService <IDispatcherProvider>();
                if (DispatcherProvider.SetCurrent(provider))
                {
                    svc.CreateLogger <Dispatcher>()?.LogWarning("Replaced an existing DispatcherProvider with one from the service provider.");
                }

                return(Dispatcher.GetForCurrentThread() !);
            });
            builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped <IMauiInitializeScopedService, DispatcherInitializer>());

            return(builder);
        }
コード例 #14
0
 public void Setup()
 {
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
     DeviceInfo.SetCurrent(new MockDeviceInfo(platform: DevicePlatform.iOS));
 }
コード例 #15
0
 public DispatcherTests()
 {
     _dispatcherProvider = new DispatcherProviderStub();
     DispatcherProvider.SetCurrent(_dispatcherProvider);
 }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DispatcherObservableCollection{T}" /> class.
 /// </summary>
 /// <param name="provider">The value for the <see cref="DispatcherObservableCollection{T}.Provider" /> property.</param>
 /// <param name="prio">The value for the <see cref="DispatcherObservableCollection{T}.Priority" /> property.</param>
 /// <param name="isBackground">The value for the <see cref="DispatcherObservableCollection{T}.IsBackground" /> property.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="provider" /> is <see langword="null" />.
 /// </exception>
 public DispatcherObservableCollection(DispatcherProvider provider, DispatcherPriority prio, bool isBackground)
     : this(provider, prio, isBackground, new object())
 {
 }
コード例 #17
0
 public void Setup()
 {
     SeverityColorConverter.count = 0;
     InvertBoolenConverter.count  = 0;
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
 }
コード例 #18
0
ファイル: Gh7097.xaml.cs プロジェクト: josephwambura/maui
 public void Setup()
 {
     Device.PlatformServices = new MockPlatformServices();
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
 }
コード例 #19
0
 public void TearDown()
 {
     DispatcherProvider.SetCurrent(null);
     DeviceInfo.SetCurrent(null);
 }
コード例 #20
0
 public void Setup()
 {
     _dispatcherProvider = new MarshalingTestDispatcherProvider();
     DispatcherProvider.SetCurrent(_dispatcherProvider);
 }
コード例 #21
0
ファイル: Bz53381.xaml.cs プロジェクト: sung-su/maui
 public void TearDown()
 {
     Application.Current = null;
     DispatcherProvider.SetCurrent(null);
 }
コード例 #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DispatcherObservableCollection{T}" /> class.
 /// </summary>
 /// <param name="provider">The value for the <see cref="DispatcherObservableCollection{T}.Provider" /> property.</param>
 /// <param name="prio">The value for the <see cref="DispatcherObservableCollection{T}.Priority" /> property.</param>
 /// <param name="syncRoot">The value for the <see cref="SynchronizedObservableCollection{T}._SYNC" /> field.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="provider" /> and/or <paramref name="syncRoot" /> are <see langword="null" />.
 /// </exception>
 public DispatcherObservableCollection(DispatcherProvider provider, DispatcherPriority prio, object syncRoot)
     : this(provider, prio, false, syncRoot)
 {
 }
コード例 #23
0
ファイル: Issue1794.cs プロジェクト: sung-su/maui
 [SetUp] public void Setup() => DispatcherProvider.SetCurrent(new DispatcherProviderStub());
コード例 #24
0
 public Task RunAsync(Action a)
 {
     return(DispatcherProvider.RunOnUIThreadAsync(a));
 }
コード例 #25
0
ファイル: PlatformBindingTests.cs プロジェクト: sung-su/maui
 [TearDown] public void TearDown() => DispatcherProvider.SetCurrent(null);
コード例 #26
0
 public void TearDown()
 {
     DispatcherProvider.SetCurrent(null);
     DeviceInfo.SetCurrent(null);
     Device.PlatformServices = null;
 }
コード例 #27
0
 public void TearDown()
 {
     DispatcherProvider.SetCurrent(null);
     _dispatcherProvider.StopAllDispatchers();
     _dispatcherProvider = null;
 }
コード例 #28
0
 public virtual void Setup()
 {
     _defaultCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
     DispatcherProvider.SetCurrent(new DispatcherProviderStub());
 }
コード例 #29
0
 public void Dispose()
 {
     DispatcherProvider.SetCurrent(null);
     _dispatcherProvider.Dispose();
 }
コード例 #30
0
 public virtual void TearDown()
 {
     DispatcherProvider.SetCurrent(null);
     System.Threading.Thread.CurrentThread.CurrentCulture = _defaultCulture;
 }