コード例 #1
0
        /// <summary>
        /// Callback invoked, in the ambient mode, for every watch application tick.
        /// In the ambient mode the callback is invoked once every minute.
        /// </summary>
        /// <param name="time">Structure containing the current time data.</param>
        protected override void OnAmbientTick(TimeEventArgs time)
        {
            base.OnAmbientTick(time);
            WatchTime wt = time.Time;

            _mainPage.SetTime(wt.Year, wt.Month, wt.Day, wt.Hour, wt.Minute, wt.Second);
        }
コード例 #2
0
        public void WatchApplicationAmbientTickEventArgsWatchTimeSet()
        {
            tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsWatchTimeSet START");

            if (IsWearable())
            {
                var dummyWatchTime = new WatchTime();
                Assert.IsNotNull(dummyWatchTime, "should be not null");
                Assert.IsInstanceOf <WatchTime>(dummyWatchTime, "should be an instance of testing target class!");

                AmbientTickEventArgs testingTarget = new AmbientTickEventArgs();
                testingTarget.WatchTime = dummyWatchTime;

                var result = testingTarget.WatchTime;
                Assert.IsNotNull(result, "should be not null.");
                Assert.AreEqual(dummyWatchTime, result, "Retrieved result should be equal to dummyApplication. ");

                dummyWatchTime.Dispose();
                tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsWatchTimeSet END (OK)");
            }
            else
            {
                tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsWatchTimeSet END (OK)");
                Assert.Pass("Not Supported profile");
            }
        }
コード例 #3
0
ファイル: TSWatchTimeSignal.cs プロジェクト: yunmiha/TizenFX
        public void WatchTimeSignalEmit()
        {
            tlog.Debug(tag, $"WatchTimeSignalEmit START");

            if (IsWearable())
            {
                var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id;
                var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId;

                tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}");

                var testingTarget = new WatchTimeSignal();
                Assert.IsNotNull(testingTarget, "should be not null");
                Assert.IsInstanceOf <WatchTimeSignal>(testingTarget, "should be an instance of testing target class!");

                Application application = new Application();
                WatchTime   watchTime   = new WatchTime();
                testingTarget.Emit(application, watchTime);

                application.Dispose();
                watchTime.Dispose();
                testingTarget.Dispose();
                tlog.Debug(tag, $"WatchTimeSignalEmit END (OK)");
            }
            else
            {
                tlog.Debug(tag, $"WatchTimeSignalEmit END (OK)");
                Assert.Pass("Not Supported profile");
            }
        }
コード例 #4
0
ファイル: TSWatchTime.cs プロジェクト: wonrst/TizenFX
        public void WatchTimeGetWatchTimeFromPtr()
        {
            tlog.Debug(tag, $"WatchTimeGetWatchTimeFromPtr START");

            using (ImageView view = new ImageView())
            {
                var testingTarget = new WatchTime(view.SwigCPtr.Handle, false);
                Assert.IsNotNull(testingTarget, "should be not null");
                Assert.IsInstanceOf <WatchTime>(testingTarget, "Should be an instance of WatchTime type.");

                try
                {
                    WatchTime.GetWatchTimeFromPtr(testingTarget.SwigCPtr.Handle);
                }
                catch (Exception e)
                {
                    tlog.Debug(tag, e.Message.ToString());
                    Assert.Fail("Caught Exception: Failed!");
                }

                testingTarget.Dispose();
            }

            tlog.Debug(tag, $"WatchTimeGetWatchTimeFromPtr END (OK)");
        }
コード例 #5
0
 public void Emit(Application arg1, WatchTime arg2)
 {
     NDalicManualPINVOKE.WatchTimeSignal_Emit(swigCPtr, Application.getCPtr(arg1), WatchTime.getCPtr(arg2));
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #6
0
 protected void endStat(string info, params object[] args)
 {
     if (m_wt != null)
     {
         m_wt.end(info, args);
         m_wt = null;
     }
 }
コード例 #7
0
 public void Emit(Application arg1, WatchTime arg2)
 {
     Interop.Watch.WatchTimeSignalEmit(SwigCPtr, Application.getCPtr(arg1), WatchTime.getCPtr(arg2));
     if (NDalicPINVOKE.SWIGPendingException.Pending)
     {
         throw NDalicPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #8
0
        internal static WatchTime GetWatchTimeFromPtr(global::System.IntPtr cPtr)
        {
            WatchTime ret = new WatchTime(cPtr, false);

            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #9
0
ファイル: TSWatchTime.cs プロジェクト: wonrst/TizenFX
        public void WatchTimeConstructor()
        {
            tlog.Debug(tag, $"WatchTimeConstructor START");

            using (ImageView view = new ImageView())
            {
                var testingTarget = new WatchTime(view.SwigCPtr.Handle, false);
                Assert.IsNotNull(testingTarget, "should be not null");
                Assert.IsInstanceOf <WatchTime>(testingTarget, "Should be an instance of WatchTime type.");

                testingTarget.Dispose();
            }

            tlog.Debug(tag, $"WatchTimeConstructor END (OK)");
        }
コード例 #10
0
 // Raised when the screen of the device is on/off/dim.
 private void Display_StateChanged(object sender, TSystem.DisplayStateChangedEventArgs e)
 {
     Console.WriteLine("[Display_StateChanged] " + e.State);
     // When device's screen turns on
     if (e.State == TSystem.DisplayState.Normal)
     {
         // Update Time for UI update
         WatchTime time = GetCurrentTime();
         _viewModel.Time = time.UtcTimestamp + TimeSpan.FromMilliseconds(time.Millisecond);
         // Update Information about Weather & Battery
         _viewModel.UpdateInformation();
     }
     else if (e.State == TSystem.DisplayState.Off)
     {
         // When the screen of the device is off
         _viewModel.UnregisterEvents();
     }
 }
コード例 #11
0
ファイル: TSWatchTime.cs プロジェクト: yunmiha/TizenFX
        public void WatchTimeConstructor()
        {
            tlog.Debug(tag, $"WatchTimeConstructor START");

            if (IsWearable())
            {
                var testingTarget = new WatchTime();
                Assert.IsNotNull(testingTarget, "should be not null");
                Assert.IsInstanceOf <WatchTime>(testingTarget, "Should be an instance of WatchTime type.");

                testingTarget.Dispose();
                tlog.Debug(tag, $"WatchTimeConstructor END (OK)");
            }
            else
            {
                tlog.Debug(tag, $"WatchTimeConstructor END (OK)");
                Assert.Pass("Not Supported profile");
            }
        }
コード例 #12
0
        public void WatchApplicationAmbientTickArgsWatchTime()
        {
            tlog.Debug(tag, $"WatchApplicationAmbientTickArgsWatchTime START");

            var testingTarget = new AmbientTickEventArgs();

            Assert.IsNotNull(testingTarget, "should be not null");
            Assert.IsInstanceOf <AmbientTickEventArgs>(testingTarget, "should be an instance of testing target class!");

            Widget widget = new Widget();

            using (WatchTime time = new WatchTime(widget.GetIntPtr(), false))
            {
                testingTarget.WatchTime = time;
                Assert.IsNotNull(testingTarget.WatchTime);
            }

            widget.Dispose();
            widget = null;
            tlog.Debug(tag, $"WatchApplicationAmbientTickArgsWatchTime END (OK)");
        }
コード例 #13
0
ファイル: TSWatchTime.cs プロジェクト: yunmiha/TizenFX
        public void WatchTimeDaylightSavingTimeStatus()
        {
            tlog.Debug(tag, $"WatchTimeDaylightSavingTimeStatus START");

            if (IsWearable())
            {
                var testingTarget = new WatchTime();
                Assert.IsNotNull(testingTarget, "should be not null");
                Assert.IsInstanceOf <WatchTime>(testingTarget, "Should be an instance of WatchTime type.");

                bool status = testingTarget.DaylightSavingTimeStatus;
                Assert.AreEqual(false, status, "Should be the default value");

                testingTarget.Dispose();
                tlog.Debug(tag, $"WatchTimeDaylightSavingTimeStatus END (OK)");
            }
            else
            {
                tlog.Debug(tag, $"WatchTimeDaylightSavingTimeStatus END (OK)");
                Assert.Pass("Not Supported profile");
            }
        }
コード例 #14
0
ファイル: TSWatchTime.cs プロジェクト: yunmiha/TizenFX
        public void WatchTimeTimeZone()
        {
            tlog.Debug(tag, $"WatchTimeTimeZone START");

            if (IsWearable())
            {
                var testingTarget = new WatchTime();
                Assert.IsNotNull(testingTarget, "should be not null");
                Assert.IsInstanceOf <WatchTime>(testingTarget, "Should be an instance of WatchTime type.");

                string zone = testingTarget.TimeZone;
                Assert.IsNotEmpty(zone, "TimeZone is empty");

                testingTarget.Dispose();
                tlog.Debug(tag, $"WatchTimeTimeZone END (OK)");
            }
            else
            {
                tlog.Debug(tag, $"WatchTimeTimeZone END (OK)");
                Assert.Pass("Not Supported profile");
            }
        }
コード例 #15
0
ファイル: TSWatchTime.cs プロジェクト: yunmiha/TizenFX
        public void WatchTimeSecond()
        {
            tlog.Debug(tag, $"WatchTimeSecond START");

            if (IsWearable())
            {
                var testingTarget = new WatchTime();
                Assert.IsNotNull(testingTarget, "should be not null");
                Assert.IsInstanceOf <WatchTime>(testingTarget, "Should be an instance of WatchTime type.");

                int second = testingTarget.Second;
                Assert.IsTrue(second >= 0.0f);

                testingTarget.Dispose();
                tlog.Debug(tag, $"WatchTimeSecond END (OK)");
            }
            else
            {
                tlog.Debug(tag, $"WatchTimeSecond END (OK)");
                Assert.Pass("Not Supported profile");
            }
        }
コード例 #16
0
 protected void beginStat(string info, params object[] args)
 {
     m_wt = new WatchTime();
     m_wt.start(info, args);
 }
コード例 #17
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WatchTime obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #18
0
 // Update the rotation of the watch hands about the Z-axis.
 private void UpdateTime(WatchTime time)
 {
     RotationSecond = time.Second * 6.0;
     RotationMinute = time.Minute * 6.0 + time.Second / 10.0;
     RotationHour   = (time.Hour % 12) * 30.0 + time.Minute / 2.0;
 }