Ejemplo n.º 1
0
        protected override void OnPreCreate()
        {
            base.OnPreCreate();
            Application.ClearCurrent();

            if (DotnetUtil.TizenAPIVersion < 5)
            {
                // We should set the env variable to support IsolatedStorageFile on tizen 4.0 or lower version.
                Environment.SetEnvironmentVariable("XDG_DATA_HOME", Current.DirectoryInfo.Data);
            }

            var type = typeof(EWindow);
            // Use reflection to avoid breaking compatibility. ElmSharp.Window.CreateWindow() is has been added since API6.
            var     methodInfo = type.GetMethod("CreateWindow", BindingFlags.NonPublic | BindingFlags.Static);
            EWindow window     = null;

            if (methodInfo != null)
            {
                window              = (EWindow)methodInfo.Invoke(null, new object[] { "FormsWindow" });
                BaseLayout          = (ELayout)window.GetType().GetProperty("BaseLayout")?.GetValue(window);
                BaseCircleSurface   = (CircleSurface)window.GetType().GetProperty("BaseCircleSurface")?.GetValue(window);
                Forms.CircleSurface = BaseCircleSurface;
            }
            else             // in case of Xamarin Preload
            {
                window = PreloadedWindow.GetInstance() ?? new EWindow("FormsWindow");
                if (window is PreloadedWindow precreated)
                {
                    BaseLayout = precreated.BaseLayout;
                }
            }
            MainWindow = window;
        }
Ejemplo n.º 2
0
        private void EnsureMainWindow()
        {
            if (Window != null)
            {
                return;
            }

            Window = new TizenWindow("ElmSharpApp")
            {
                AvailableRotations =
                    DisplayRotation.Degree_0 |
                    DisplayRotation.Degree_180 |
                    DisplayRotation.Degree_270 |
                    DisplayRotation.Degree_90
            };
            Window.IndicatorMode      = IndicatorMode.Hide;
            Window.BackButtonPressed += (s, e) =>
            {
                if (!SystemNavigationManager.GetForCurrentView().RequestBack())
                {
                    Exit();
                }
            };
            Window.Show();

            Canvas = new UnoCanvas(Window);
            Canvas.Show();

            var conformant = new Conformant(Window);

            conformant.Show();
            conformant.SetContent(Canvas);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The class constructor.
        /// The displayed widget geometries are set here.
        /// </summary>
        /// <param name="win">The application's main window.</param>
        public MainPage(Window win)
        {
            BadgeController badgeController = new Controller.BadgeController();

            this._win = win;
            Point point = new Point
            {
                Y = 208,
                X = 147
            };

            try
            {
                _createBackground();
                _callBadge = new BadgeView(_win, "icon_missed_calls.png", point);

                _createImage(@"hands_center.png", new Rect(360 / 2 - 9, 360 / 2 - 9, 18, 18));
                _hourImage = _createImage(@"hand_hour.png", new Rect(360 / 2 - 7, 360 / 2 - 83, 12, 83));
                _minute    = _createImage(@"hand_minute.png", new Rect(360 / 2 - 5, 360 / 2 - 105, 12, 105));
                _second    = _createImage(@"hand_second.png", new Rect(360 / 2 - 8, 65, 18, 9));
            }
            catch (Exception e)
            {
                global::Tizen.Log.Error(((Program)Application.Current).LogTag,
                                        "Failed to load image. Exception: " + e.Message);
            }

            badgeController.BadgeStatusChanged += _onBadgeStatusChanged;
        }
Ejemplo n.º 4
0
        internal AlertRequestHelper(EWindow window, IMauiContext mauiContext)
        {
            Window      = window;
            MauiContext = mauiContext;

            MessagingCenter.Subscribe <Page, bool>(Window, Page.BusySetSignalName, OnBusySetRequest);
            MessagingCenter.Subscribe <Page, AlertArguments>(Window, Page.AlertSignalName, OnAlertRequest);
            MessagingCenter.Subscribe <Page, ActionSheetArguments>(Window, Page.ActionSheetSignalName, OnActionSheetRequest);
            MessagingCenter.Subscribe <Page, PromptArguments>(Window, Page.PromptSignalName, OnPromptRequested);
        }
Ejemplo n.º 5
0
        internal void Unsubscribe(Window window)
        {
            IMauiContext mauiContext  = window?.MauiContext;
            EWindow      nativeWindow = mauiContext.GetPlatformWindow();

            var toRemove = Subscriptions.Where(s => s.Window == nativeWindow).ToList();

            foreach (AlertRequestHelper alertRequestHelper in toRemove)
            {
                alertRequestHelper.Dispose();
                Subscriptions.Remove(alertRequestHelper);
            }
        }
Ejemplo n.º 6
0
        internal void Subscribe(Window window)
        {
            IMauiContext mauiContext    = window?.MauiContext;
            EWindow      platformWindow = mauiContext.GetPlatformWindow();

            if (mauiContext == null || platformWindow == null)
            {
                return;
            }

            if (Subscriptions.Any(s => s.Window == platformWindow))
            {
                return;
            }

            Subscriptions.Add(new AlertRequestHelper(platformWindow, mauiContext));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates and initializes a new instance of the Window class.
 /// </summary>
 /// <param name="parent">
 /// Parent widget which this window is created on.
 /// </param>
 /// <param name="name">
 /// Window name.
 /// </param>
 /// <remarks>
 /// Window constructor.show window indicator, set callback
 /// when closing the window in any way outside the program control,
 /// and set callback when window rotation is changed.
 /// </remarks>
 /// <since_tizen> preview </since_tizen>
 public Window(Window parent, string name) : this(parent, name, WindowType.Basic)
 {
 }