Example #1
0
 public TestServices With(
     IAssetLoader assetLoader                      = null,
     IFocusManager focusManager                    = null,
     IInputManager inputManager                    = null,
     Func <IKeyboardDevice> keyboardDevice         = null,
     IKeyboardNavigationHandler keyboardNavigation = null,
     Func <IMouseDevice> mouseDevice               = null,
     IRuntimePlatform platform                     = null,
     IPlatformRenderInterface renderInterface      = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return(new TestServices(
                assetLoader: assetLoader ?? AssetLoader,
                focusManager: focusManager ?? FocusManager,
                inputManager: inputManager ?? InputManager,
                keyboardDevice: keyboardDevice ?? KeyboardDevice,
                keyboardNavigation: keyboardNavigation ?? KeyboardNavigation,
                mouseDevice: mouseDevice ?? MouseDevice,
                platform: platform ?? Platform,
                renderInterface: renderInterface ?? RenderInterface,
                scheduler: scheduler ?? Scheduler,
                standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
                styler: styler ?? Styler,
                theme: theme ?? Theme,
                threadingInterface: threadingInterface ?? ThreadingInterface,
                windowingPlatform: windowingPlatform ?? WindowingPlatform,
                windowImpl: windowImpl ?? WindowImpl));
 }
Example #2
0
 public TestServices With(
     IAssetLoader assetLoader              = null,
     IFocusManager focusManager            = null,
     IInputManager inputManager            = null,
     Func <IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager          = null,
     IRuntimePlatform platform             = null,
     IRenderer renderer = null,
     IPlatformRenderInterface renderInterface = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return(new TestServices(
                assetLoader: assetLoader ?? AssetLoader,
                focusManager: focusManager ?? FocusManager,
                inputManager: inputManager ?? InputManager,
                keyboardDevice: keyboardDevice ?? KeyboardDevice,
                layoutManager: layoutManager ?? LayoutManager,
                platform: platform ?? Platform,
                renderer: renderer ?? Renderer,
                renderInterface: renderInterface ?? RenderInterface,
                renderLoop: renderLoop ?? RenderLoop,
                scheduler: scheduler ?? Scheduler,
                standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
                styler: styler ?? Styler,
                theme: theme ?? Theme,
                threadingInterface: threadingInterface ?? ThreadingInterface,
                windowingPlatform: windowingPlatform ?? WindowingPlatform));
 }
Example #3
0
 public TestServices(
     IAssetLoader assetLoader                      = null,
     IFocusManager focusManager                    = null,
     IInputManager inputManager                    = null,
     Func <IKeyboardDevice> keyboardDevice         = null,
     IKeyboardNavigationHandler keyboardNavigation = null,
     Func <IMouseDevice> mouseDevice               = null,
     IRuntimePlatform platform                     = null,
     IPlatformRenderInterface renderInterface      = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     AssetLoader           = assetLoader;
     FocusManager          = focusManager;
     InputManager          = inputManager;
     KeyboardDevice        = keyboardDevice;
     KeyboardNavigation    = keyboardNavigation;
     MouseDevice           = mouseDevice;
     Platform              = platform;
     RenderInterface       = renderInterface;
     Scheduler             = scheduler;
     StandardCursorFactory = standardCursorFactory;
     Styler             = styler;
     Theme              = theme;
     ThreadingInterface = threadingInterface;
     WindowImpl         = windowImpl;
     WindowingPlatform  = windowingPlatform;
 }
Example #4
0
 public TestServices(
     IAssetLoader assetLoader              = null,
     IFocusManager focusManager            = null,
     IInputManager inputManager            = null,
     Func <IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager          = null,
     IRuntimePlatform platform             = null,
     IRenderer renderer = null,
     IPlatformRenderInterface renderInterface = null,
     IRenderLoop renderLoop = null,
     IScheduler scheduler   = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler      = null,
     Func <Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowingPlatform windowingPlatform           = null)
 {
     AssetLoader           = assetLoader;
     FocusManager          = focusManager;
     InputManager          = inputManager;
     KeyboardDevice        = keyboardDevice;
     LayoutManager         = layoutManager;
     Platform              = platform;
     Renderer              = renderer;
     RenderInterface       = renderInterface;
     RenderLoop            = renderLoop;
     Scheduler             = scheduler;
     StandardCursorFactory = standardCursorFactory;
     Styler             = styler;
     Theme              = theme;
     ThreadingInterface = threadingInterface;
     WindowingPlatform  = windowingPlatform;
 }
Example #5
0
 public TestServices(
     IAssetLoader assetLoader = null,
     IFocusManager focusManager = null,
     IInputManager inputManager = null,
     Func<IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager = null,
     IRuntimePlatform platform = null,
     IPlatformRenderInterface renderInterface = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler = null,
     Func<Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     AssetLoader = assetLoader;
     FocusManager = focusManager;
     InputManager = inputManager;
     KeyboardDevice = keyboardDevice;
     LayoutManager = layoutManager;
     Platform = platform;
     RenderInterface = renderInterface;
     StandardCursorFactory = standardCursorFactory;
     Styler = styler;
     Theme = theme;
     ThreadingInterface = threadingInterface;
     WindowImpl = windowImpl;
     WindowingPlatform = windowingPlatform;
 }
Example #6
0
        protected DevelopmemtHub(IRuntimePlatform platform, string pnsHandle, string deviceId, string userId)
            : base(platform: platform, pnsHandle: pnsHandle, deviceId: deviceId, userId: userId)
        {
            NotificationHubConnectionString =
                "Endpoint=sb://minegame-development-hub-namespace.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=CJ6p8lBbpOXiEfKzrIwd2dR2TSj59EIBF54b3xnNL68=";

            NotificationHubName = "minegame-development-hub";
        }
        protected StagingHub(IRuntimePlatform platform, string pnsHandle, string deviceId)
            : base(platform: platform, pnsHandle: pnsHandle, deviceId: deviceId, userId: "e23bc901-4c0f-40bd-8351-7491a04b5b62")
        {
            NotificationHubConnectionString =
                "Endpoint=sb://minegame-staging-hub-namespace.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=FlBdlcSCnmiPBaCGrlcHr3+xSdmZrTNFSmfigcEKk7I=";

            NotificationHubName = "minegame-staging-hub";
        }
        protected StagingHub(IRuntimePlatform platform, string pnsHandle, string deviceId)
            : base(platform: platform, pnsHandle: pnsHandle, deviceId: deviceId, userId: "04e21f11-174c-4970-b9a3-193615d25873")
        {
            NotificationHubConnectionString =
                "Endpoint=sb://moonbase-staging-hub-namespace.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=JOczSUq4pT98SzUkfD+xtLsgyxmp0jcac9gZFaGJ+hw=";

            NotificationHubName = "moonbase-staging-hub";
        }
Example #9
0
 public ManagedCairoSurface(int width, int height)
 {
     _plat   = AvaloniaLocator.Current.GetService <IRuntimePlatform>();
     Stride  = width * 4;
     _size   = height * Stride;
     _blob   = _plat.AllocBlob(_size * 2);
     Buffer  = _blob.Address;
     Surface = Native.CairoImageSurfaceCreateForData(Buffer, 1, width, height, Stride);
 }
Example #10
0
        /// <summary>
        /// Provides the implementation of starting the timer.
        /// </summary>
        /// <param name="tick">The method to call on each tick.</param>
        /// <remarks>
        /// This can be overridden by platform implementations to use a specialized timer
        /// implementation.
        /// </remarks>
        protected virtual IDisposable StartCore(Action tick)
        {
            if (_runtime == null)
            {
                _runtime = AvaloniaLocator.Current.GetService <IRuntimePlatform>();
            }

            return(_runtime.StartSystemTimer(TimeSpan.FromSeconds(1.0 / FramesPerSecond), tick));
        }
 private DeviceTarget(IRuntimePlatform platform, string pushNotificationServicesHandle)
 {
     if (string.IsNullOrWhiteSpace(pushNotificationServicesHandle))
     {
         throw new ArgumentException("PushNotificationServicesHandle is required");
     }
     Platform = platform;
     PushNotificationServicesHandle = pushNotificationServicesHandle;
 }
        protected BaseAspersHub(IRuntimePlatform platform, string pnsHandle, string deviceId)
            : base(platform, pnsHandle, deviceId, "A5D675FF-3F38-4FA4-9677-E30787676B0A")
        {
            NotificationHubConnectionString =
                "Endpoint=sb://reveye-push.servicebus.windows.net/;" +
                "SharedAccessKeyName=DefaultFullSharedAccessSignature;" +
                "SharedAccessKey=mk4xOnfkwdbOAZ7CvAyAX0FwgOTm8TJFisEhj6hdhOE=";//";" +
            //"EntityPath=reveye-push-aspers";

            NotificationHubName = "reveye-push-aspers";
        }
        protected BaseBuckysHub(IRuntimePlatform platform, string pnsHandle, string deviceId, string userId)
            : base(platform: platform, pnsHandle: pnsHandle, deviceId: deviceId, userId: userId)
        {
            NotificationHubConnectionString =
                "Endpoint=sb://reveye-push.servicebus.windows.net/;" +
                "SharedAccessKeyName=DefaultFullSharedAccessSignature;" +
                "SharedAccessKey=Q9Tqvo+hqBx4XuTR/dwMfp2jSQtR0x9kGA6krkvKCK4=;" +
                "EntityPath=reveye-push-buckys";

            NotificationHubName = "reveye-push-buckys";
        }
        protected BaseRainbowHub(IRuntimePlatform platform, string pnsHandle, string deviceId, string userId)
            : base(platform: platform, pnsHandle: pnsHandle, deviceId: deviceId, userId: userId)
        {
            NotificationHubConnectionString =
                "Endpoint=sb://reveye-push.servicebus.windows.net/;" +
                "SharedAccessKeyName=DefaultFullSharedAccessSignature;" +
                "SharedAccessKey=6JvabD86nZm2+LRVyDs67r/T1X5gc8SebLDs6pU7FVw=;" +
                "EntityPath=reveye-push-rainbow";

            NotificationHubName = "reveye-push-rainbow";
        }
        public Response <NativeNotification> ExtractNotification(IRuntimePlatform platform, IPushNotification pushNotification)
        {
            if ((RuntimePlatform)platform == RuntimePlatform.iOS)
            {
                return(ExtractIosNotification(pushNotification));
            }
            if ((RuntimePlatform)platform == RuntimePlatform.UWP)
            {
                return(ExtractUwpNotification(pushNotification));
            }
            if ((RuntimePlatform)platform == RuntimePlatform.Android)
            {
                return(ExtractAndroidNotification(pushNotification));
            }

            throw new NotImplementedException("Only iOS, Android and UWP are supported platforms for push notifications");
        }
        public static NotificationPlatform ToNotificationPlatform(this IRuntimePlatform runtimePlatform)
        {
            if (runtimePlatform.Equals(RuntimePlatform.iOS))
            {
                return(NotificationPlatform.Apns);
            }
            if (runtimePlatform.Equals(RuntimePlatform.Android))
            {
                return(NotificationPlatform.Fcm);
            }
            if (runtimePlatform.Equals(RuntimePlatform.UWP))
            {
                return(NotificationPlatform.Wns);
            }

            throw new ArgumentException($"{runtimePlatform} is not currently available as a push notification platform");
        }
        public static List <string> GetForPlatform(IRuntimePlatform platform)
        {
            if (platform.Value == RuntimePlatform.UWP.Value)
            {
                return(Uwp);
            }
            if (platform.Value == RuntimePlatform.Android.Value)
            {
                return(Android);
            }
            if (platform.Value == RuntimePlatform.iOS.Value)
            {
                return(Ios);
            }

            return(new List <string>());
        }
Example #18
0
        private static IPushNotificationsServerService Setup(BasePushRunnerHub hub)
        {
            var services = new ServiceCollection();

            services.AddSingleton <IBuildConfig>(BuildConfig.Debug);

            services.AddPushNotificationsServer();
            services.RegisterConsoleLoggerService(new ConsoleTraceListener());
            NotificationHubPath = hub.NotificationHubName;
            DeviceId            = hub.DeviceId;
            PnsHandle           = hub.PnsHandle;
            ConnectionString    = hub.NotificationHubConnectionString;
            Platform            = hub.Platform;
            UserId = hub.UserId;
            Target = hub.DeviceTarget;
            Hub    = hub;

            Client = new NotificationHubClientProxy(BuildConfig.Debug);
            Client.Initialize(Hub);

            return(services.BuildServiceProvider().GetRequiredService <IPushNotificationsServerService>());
        }
        protected BasePushRunnerHub(IRuntimePlatform platform, string pnsHandle, string deviceId, string userId)
        {
            DeviceId  = deviceId == "" ? platform.Value + "_deviceId" : deviceId;
            Platform  = platform;
            PnsHandle = pnsHandle;
            UserId    = userId;

            if (!string.IsNullOrEmpty(pnsHandle))
            {
                if ((RuntimePlatform)platform == RuntimePlatform.iOS)
                {
                    DeviceTarget = Server.Service.DeviceTarget.iOS(pnsHandle);
                }
                else if ((RuntimePlatform)platform == RuntimePlatform.UWP)
                {
                    DeviceTarget = Server.Service.DeviceTarget.UWP(pnsHandle);
                }
                else if ((RuntimePlatform)platform == RuntimePlatform.Android)
                {
                    DeviceTarget = Server.Service.DeviceTarget.Android(pnsHandle);
                }
            }
        }
Example #20
0
        protected OnPlatformOrientation()
        {
            MessagingCenter.Subscribe <object>((object)this, "InvalidateDeviceOrientation", new Action <object>(this.OnOrientationChanged), (object)null);
            switch (Device.RuntimePlatform)
            {
            case nameof(Android):
                if (Device.Idiom == TargetIdiom.Phone)
                {
                    this.runtimePlatform = (IRuntimePlatform <T>) new AndroidPhonePlatform <T>();
                    break;
                }
                if (Device.Idiom != TargetIdiom.Tablet)
                {
                    break;
                }
                this.runtimePlatform = (IRuntimePlatform <T>) new AndroidTabletPlatform <T>();
                break;

            case nameof(iOS):
                if (Device.Idiom == TargetIdiom.Phone)
                {
                    this.runtimePlatform = (IRuntimePlatform <T>) new iOSPhonePlatform <T>();
                    break;
                }
                if (Device.Idiom != TargetIdiom.Tablet)
                {
                    break;
                }
                this.runtimePlatform = (IRuntimePlatform <T>) new iOSTabletPlatform <T>();
                break;

            case nameof(UWP):
                this.runtimePlatform = (IRuntimePlatform <T>) new Desktop <T>();
                break;
            }
        }
Example #21
0
 public TestServices With(
     IAssetLoader assetLoader = null,
     IFocusManager focusManager = null,
     IInputManager inputManager = null,
     Func<IKeyboardDevice> keyboardDevice = null,
     ILayoutManager layoutManager = null,
     IRuntimePlatform platform = null,
     IPlatformRenderInterface renderInterface = null,
     IStandardCursorFactory standardCursorFactory = null,
     IStyler styler = null,
     Func<Styles> theme = null,
     IPlatformThreadingInterface threadingInterface = null,
     IWindowImpl windowImpl = null,
     IWindowingPlatform windowingPlatform = null)
 {
     return new TestServices(
         assetLoader: assetLoader ?? AssetLoader,
         focusManager: focusManager ?? FocusManager,
         inputManager: inputManager ?? InputManager,
         keyboardDevice: keyboardDevice ?? KeyboardDevice,
         layoutManager: layoutManager ?? LayoutManager,
         platform: platform ?? Platform,
         renderInterface: renderInterface ?? RenderInterface,
         standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
         styler: styler ?? Styler,
         theme: theme ?? Theme,
         threadingInterface: threadingInterface ?? ThreadingInterface,
         windowImpl: windowImpl ?? WindowImpl,
         windowingPlatform: windowingPlatform ?? WindowingPlatform);
 }
Example #22
0
 protected AppBuilderBase(IRuntimePlatform platform, Action platformSevices)
 {
     RuntimePlatform         = platform;
     RuntimePlatformServices = platformSevices;
 }
Example #23
0
 protected AppBuilderBase(IRuntimePlatform platform, Action <TAppBuilder> platformServices)
 {
     RuntimePlatform = platform;
     RuntimePlatformServicesInitializer = () => platformServices((TAppBuilder)this);
 }
Example #24
0
        public static KeyValuePair <string, InstallationTemplate> ToPlatform(this IPushNotificationTemplate template, IRuntimePlatform platform)
        {
            if (platform.Value == RuntimePlatform.Android.Value)
            {
                return(new KeyValuePair <string, InstallationTemplate>(template.NotificationName, ToAndroid(template)));
            }

            if (platform.Value == RuntimePlatform.iOS.Value)
            {
                return(new KeyValuePair <string, InstallationTemplate>(template.NotificationName, ToIos(template)));
            }

            if (platform.Value == RuntimePlatform.UWP.Value)
            {
                return(new KeyValuePair <string, InstallationTemplate>(template.NotificationName, ToUwp(template)));
            }

            throw new ArgumentException($"{platform.Value} is not supported");
        }
 public AvaloniaBlazorAppBuilder(IRuntimePlatform platform, Action <AvaloniaBlazorAppBuilder> platformServices)
     : base(platform, platformServices)
 {
 }