Exemplo n.º 1
0
        public static void Initialize(Windows.UI.Xaml.Application app, string licenseKey = null)
        {
            _initizalized = true;
            Xamarin.Forms.DependencyService.Register <ApplicationInfoService>();
            Xamarin.Forms.DependencyService.Register <DescendentBounds>();
            Xamarin.Forms.DependencyService.Register <InstalledFont>();
            Xamarin.Forms.DependencyService.Register <FontService>();
            Xamarin.Forms.DependencyService.Register <HtmlToPngService>();
            Xamarin.Forms.DependencyService.Register <KeyboardService>();
            Xamarin.Forms.DependencyService.Register <OsInfoService>();
            Xamarin.Forms.DependencyService.Register <WebViewExtensionsService>();
            Xamarin.Forms.DependencyService.Register <Settings>();
            Xamarin.Forms.DependencyService.Register <SharingService>();
            Xamarin.Forms.DependencyService.Register <ClipboardService>();

            Application = app;
            FormsGestures.UWP.Settings.Init(app);
            Rg.Plugins.Popup.Popup.Init();

            //var forms9PatchResources = GetResources();
            //Windows.UI.Xaml.Application.Current.Resources.MergedDictionaries.Add(forms9PatchResources);

            if (licenseKey != null)
            {
                System.Console.WriteLine("Forms9Patch is now open source using the MIT license ... so it's free, including for commercial use.  Why?  The more people who use it, the faster bugs will be found and fixed - which helps me and you.  So, please help get the word out - tell your friends, post on social media, write about it on the bathroom walls at work!  If you have purchased a license from me, please don't get mad - you did a good deed.  They really were not that expensive and you did a great service in encouraging me keep working on Forms9Patch.");
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <CameraView> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                _app             = Application.Current;
                _app.Suspending += OnAppSuspending;
                _app.Resuming   += OnAppResuming;

                _captureElement = new CaptureElement {
                    Stretch = Stretch.UniformToFill
                };

                SetupCamera();
                SetNativeControl(_captureElement);
            }
            if (e.OldElement != null)
            {
                Tapped -= OnCameraPreviewTapped;
                _displayInformation.OrientationChanged -= OnOrientationChanged;
                _app.Suspending -= OnAppSuspending;
                _app.Resuming   -= OnAppResuming;
            }
            if (e.NewElement != null)
            {
                Tapped += OnCameraPreviewTapped;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WindowsXamlHostBase"/> class.
        /// Default constructor is required for use in WPF markup.
        /// (When the default constructor is called, object properties have not been set. Put WPF logic in OnInitialized.)
        /// </summary>
        public WindowsXamlHostBase()
        {
            // Create a custom UWP XAML Application object that implements reflection-based XAML metdata probing.
            // Instantiation of the application object must occur before creating the DesktopWindowXamlSource instance.
            // DesktopWindowXamlSource will create a generic Application object unable to load custom UWP XAML metadata.
            if (_application == null)
            {
                try
                {
                    // global::Windows.UI.Xaml.Application.Current may throw if DXamlCore has not been initialized.
                    // Treat the exception as an uninitialized global::Windows.UI.Xaml.Application condition.
                    _application = Windows.UI.Xaml.Application.Current as XamlApplication;
                }
                catch
                {
                    _application = new XamlApplication();
                }
            }

            // Create an instance of the WindowsXamlManager. This initializes and holds a
            // reference on the UWP XAML DXamlCore and must be explicitly created before
            // any UWP XAML types are programmatically created.  If WindowsXamlManager has
            // not been created before creating DesktopWindowXamlSource, DesktopWindowXaml source
            // will create an instance of WindowsXamlManager internally.  (Creation is explicit
            // here to illustrate how to initialize UWP XAML before initializing the DesktopWindowXamlSource.)
            _windowsXamlManager = Windows.UI.Xaml.Hosting.WindowsXamlManager.InitializeForCurrentThread();

            // Create DesktopWindowXamlSource, host for UWP XAML content
            desktopWindowXamlSource = new Windows.UI.Xaml.Hosting.DesktopWindowXamlSource();

            // Hook OnTakeFocus event for Focus processing
            desktopWindowXamlSource.TakeFocusRequested += OnTakeFocusRequested;
        }
Exemplo n.º 4
0
        public static void Init(Windows.UI.Xaml.Application app, CoreDispatcher dispatcher, string key)
        {
            SLWIOC.RegisterSingleton <ILogger>(new Loggers.AppCenterLogger(key));
            SLWIOC.RegisterSingleton <IDispatcherServices>(new DispatcherServices(dispatcher));
            SLWIOC.RegisterSingleton <IStorageService>(new StorageService());
            SLWIOC.RegisterSingleton <IPopupServices>(new PopupsService());

            SLWIOC.RegisterSingleton <IDeviceManager>(new DeviceManager());

            SLWIOC.RegisterSingleton <INetworkService>(new NetworkService());
            SLWIOC.Register <IImaging>(new Imaging());
            SLWIOC.Register <IBindingHelper>(new BindingHelper());

            SLWIOC.RegisterSingleton <ISSDPClient>(new SSDPClient());
            SLWIOC.RegisterSingleton <IWebServer>(new WebServer());

            SLWIOC.Register <ISSDPClient>(typeof(SSDPClient));
            SLWIOC.Register <IWebServer>(typeof(WebServer));
            SLWIOC.Register <ISecureStorage>(new SecureStorage());
            SLWIOC.Register <ISSDPServer>(new SSDPServer());

            SLWIOC.Register <ITimerFactory>(new TimerFactory());

            SLWIOC.Register <IDirectoryServices>(new DirectoryServices());

            IconFonts.IconFontSupport.RegisterFonts();
        }
Exemplo n.º 5
0
 public OtpManager(string tid, string index, string userId)
 {
     this.tid          = tid;
     this.userIndex    = index;
     this.userId       = userId;
     applicationContex = Windows.UI.Xaml.Application.Current;
 }
Exemplo n.º 6
0
 static void Init()
 {
     IsInitialized = true;
     Application   = Windows.UI.Xaml.Application.Current;
     FormsGestures.UWP.Settings.Init(Windows.UI.Xaml.Application.Current);
     OnInitialized?.Invoke(null, EventArgs.Empty);
     LinkAssemblies();
 }
Exemplo n.º 7
0
        public static void Initialize(Windows.UI.Xaml.Application app, string licenseKey = null)
        {
            //Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

            Init();
            if (licenseKey != null)
            {
                System.Console.WriteLine("Forms9Patch is now open source using the MIT license ... so it's free, including for commercial use.  Why?  The more people who use it, the faster bugs will be found and fixed - which helps me and you.  So, please help get the word out - tell your friends, post on social media, write about it on the bathroom walls at work!  If you have purchased a license from me, please don't get mad - you did a good deed.  They really were not that expensive and you did a great service in encouraging me keep working on Forms9Patch.");
            }
        }
Exemplo n.º 8
0
		public NativeApplication(Windows.UI.Xaml.Application app, IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer)
			: this(() => app, javaReference, transfer)
		{
			if (this.Log().IsEnabled(LogLevel.Warning))
			{
				this.Log().LogWarning(
					"The constructor on Windows.UI.Xaml.NativeApplication uses an explicitly created Windows.UI.Xaml.Application instance. " +
					"Instead, use the constructor that requires a Windows.UI.Xaml.NativeApplication.AppBuilder delegate.");
			}
		}
Exemplo n.º 9
0
 public static void Init(Windows.UI.Xaml.Application applcation)
 {
     if (_application != null)
     {
         return;
     }
     Application = applcation;
     P42.Utils.UWP.Settings.Init(Application);
     Xamarin.Forms.DependencyService.Register <DisplayService>();
     Xamarin.Forms.DependencyService.Register <GestureService>();
 }
        /// <summary>
        /// Jaffaフレームワークにアプリケーション開始を通知します。
        /// InitializeComponentの前に実行する必要があります。
        /// </summary>
        /// <param name="app">Jaffaフレームワークを利用するアプリケーションのインスタンスを指定します。</param>
        public static void Start(Windows.UI.Xaml.Application app)
        {
            // リソースローダー初期化
            try
            {
                resLoader = new Windows.ApplicationModel.Resources.ResourceLoader();
            }
            catch { }

            // 起動時のカルチャー名を記憶
            Jaffa.International.GetResourceCultureName(System.Globalization.CultureInfo.CurrentCulture.Name);

            // ページ追加通知を設定
            Jaffa.UI.Controls.Page.Creating += Page_Creating;

            // コアライブラリ初期化
            Jaffa.Internal.Core.Initialize();
        }
Exemplo n.º 11
0
 /// <summary>
 /// Gets and returns the current UWP XAML Application instance in a reference parameter.
 /// If the current XAML Application instance has not been created for the process (is null),
 /// a new <see cref="Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication" /> instance is created and returned.
 /// </summary>
 internal static void GetOrCreateXamlApplicationInstance(ref Windows.UI.Xaml.Application application)
 {
     // Instantiation of the application object must occur before creating the DesktopWindowXamlSource instance.
     // DesktopWindowXamlSource will create a generic Application object unable to load custom UWP XAML metadata.
     if (application == null)
     {
         try
         {
             // Windows.UI.Xaml.Application.Current may throw if DXamlCore has not been initialized.
             // Treat the exception as an uninitialized Windows.UI.Xaml.Application condition.
             application = Windows.UI.Xaml.Application.Current;
         }
         catch
         {
             // Create a custom UWP XAML Application object that implements reflection-based XAML metadata probing.
             application = new XamlApplication();
         }
     }
 }
Exemplo n.º 12
0
        public static void Initialize(Windows.UI.Xaml.Application application)
#endif
        {
            if (_initialized)
            {
                return;
            }

            // Hook into application unhandled exceptions
#if WINDOWS_PHONE
            application.UnhandledException += (sender, e) => { LogException(e.ExceptionObject, "Unhandled Exception"); };
#else
            application.UnhandledException += (sender, e) => { LogMessage(e.Message, "Unhandled Exception"); };
#endif

            // Send previous log if it exists
            SendExceptionLog();

            _initialized = true;
        }
        public WindowsXamlHostBase()
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            // Respond to size changes on this Control
            SizeChanged += WindowsXamlHost_SizeChanged;

            // Create a custom UWP XAML Application object that implements reflection-based XAML metdata probing.
            // Instantiation of the application object must occur before creating the DesktopWindowXamlSource instance.
            // DesktopWindowXamlSource will create a generic Application object unable to load custom UWP XAML metadata.
            if (_application == null)
            {
                try
                {
                    // global::Windows.UI.Xaml.Application.Current may throw if DXamlCore has not been initialized.
                    // Treat the exception as an uninitialized global::Windows.UI.Xaml.Application condition.
                    _application = Windows.UI.Xaml.Application.Current as XamlApplication;
                }
                catch
                {
                    _application = new XamlApplication();
                }
            }

            // Create an instance of the WindowsXamlManager. This initializes and holds a
            // reference on the UWP XAML DXamlCore and must be explicitly created before
            // any UWP XAML types are programmatically created.  If WindowsXamlManager has
            // not been created before creating DesktopWindowXamlSource, DesktopWindowXaml source
            // will create an instance of WindowsXamlManager internally.  (Creation is explicit
            // here to illustrate how to initialize UWP XAML before initializing the DesktopWindowXamlSource.)
            _windowsXamlManager = Windows.UI.Xaml.Hosting.WindowsXamlManager.InitializeForCurrentThread();

            // Create DesktopWindowXamlSource, host for UWP XAML content
            desktopWindowXamlSource = new Windows.UI.Xaml.Hosting.DesktopWindowXamlSource();
        }
 public static void Init(UWPApplication app)
 {
     Current = new TetraPakAppDelegate(app);
 }
Exemplo n.º 15
0
 public NativeApplication(Windows.UI.Xaml.Application app, IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer)
     : base(javaReference, transfer)
 {
     _app = app;
 }
Exemplo n.º 16
0
 public NativeApplication(Windows.UI.Xaml.Application app, IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer)
     : base(javaReference, transfer)
 {
     _app = app;
     ResourceHelper.ResourcesService = new ResourcesService(this);
 }
Exemplo n.º 17
0
 public RegisterSentryAsUnhandledExceptionHandler(Windows.UI.Xaml.Application application)
 {
     _application = application;
 }
Exemplo n.º 18
0
 public static void ShinyInit <TBgTask>(this Windows.UI.Xaml.Application app, IShinyStartup startup) where TBgTask : IBackgroundTask
 {
     UwpPlatform.SetBackgroundTask(typeof(TBgTask));
     ShinyHost.Init(new UwpPlatform(app), startup);
 }
 TetraPakAppDelegate(UWPApplication app)
 {
     _app = app;
     Authorization.RegisterAppDelegate(() => this);
 }
Exemplo n.º 20
0
 public static void ShinyInit(this Windows.UI.Xaml.Application app, IShinyStartup?startup = null)
 => ShinyHost.Init(new UwpPlatform(app), startup);
 public RegisterLoggerUncaughtExceptionHandler(Windows.UI.Xaml.Application application, ILogger logger)
 {
     _application = application;
     _logger      = logger;
 }
Exemplo n.º 22
0
        //public static void ConfigureJobs(this IServiceCollection services)
        //{
        //    //JobBackgroundTask.PeriodicRunTime
        //}

        public static void ShinyInit(this Windows.UI.Xaml.Application app, IShinyStartup?startup = null, IShinyModule?platformModule = null)
        => UwpShinyHost.Init(app, startup, platformModule);