Example #1
0
 public void CreateDigitalClockWithTimer()
 {
     // Whenever the timer ticks, the clock will be updated and will redisplay
     // itself appropriately.
     ClockTimer   timer        = new ClockTimer();
     DigitalClock digitalClock = new DigitalClock(timer);
 }
        public void TestMultiplySinks()
        {
            var sink2 = new DigitalClock(_source);

            _source.RegisterObserver(sink2);

            _source.SetTime(1, 2, 3);

            AssertSinkEquals(_sink, 1, 2, 3);
            AssertSinkEquals(sink2, 1, 2, 3);
        }
        public void CreateAdapter_WhenDigitalClockIsValid_ShouldNotThrowArgumentNullException()
        {
            // Arrange
            DigitalClock digitalClock = new DigitalClock();

            // Act
            Action action = () => new ClockAdapter(digitalClock);

            // Assert
            action
            .Should()
            .NotThrow <ArgumentNullException>();
        }
        public void IsObjectsEqualTest_AllDigitalClock()
        {
            var d1DigitalClock = new DigitalClock(true, new[] { 1, 2 },
                                                  new Calendar(3, new Time("2016", 1.5F, 3, 1.2, new List <string> {
                "", ""
            }, 4, 34)), "2015", 1.2F, 11,
                                                  1.12,
                                                  new List <string> {
                "df", "asd"
            }, 1, 9);
            var resultNoDiffClock = _dDigitalClock.GetDistinctions(d1DigitalClock);

            resultNoDiffClock.Should().BeEmpty();
        }
Example #5
0
        static void Main(string[] args)
        {
            DigitalClock digitalClock = new DigitalClock();

            Console.WriteLine(digitalClock.DigitalClockInfo());

            FlipClock flipClock = new FlipClock();

            Console.WriteLine(flipClock.FlipClockInfo());

            QuartzClock quartzClock = new QuartzClock();

            Console.WriteLine(quartzClock.QuartzClockInfo());
        }
        public void IsObjectsEqualTestWhenIgnoreInnerObject()
        {
            var d2DigitalClock = new DigitalClock(true, new[] { 1, 2 },
                                                  new Calendar(3, new Time("wrong", 1.5F, 3, 1.2, new List <string> {
                "", ""
            }, 4, 34)), "2015", 1.2F, 11,
                                                  1.12,
                                                  new List <string> {
                "df", "asd"
            }, 1, 9);
            var resultNoDiffTime1 =
                _dDigitalClock.GetDistinctions(d2DigitalClock, "PropCalendar.PropTimePanel.PropYear");

            resultNoDiffTime1.Should().BeEmpty();
        }
Example #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ReportSick);
            // Create your application here

            GetMobileNumber();
            GetDateTime();
            GetreportSick();
            _time               = (DigitalClock)FindViewById(Resource.Id.CurrentTime);
            _ReportSick         = (Button)FindViewById(Resource.Id.btnReportSick);
            _ReportSick.Click  += (o, e) => { SetReportSick(); };
            _Back2WHPage        = (Button)FindViewById(Resource.Id.btnBack2WHPage);
            _Back2WHPage.Click += (o, e) => { ReturnWhPage(); };
        }
Example #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            _Time              = FindViewById <DigitalClock>(Resource.Id.Clock);
            spinner            = (ProgressBar)FindViewById(Resource.Id.progressBarLogin);
            spinner.Visibility = Android.Views.ViewStates.Invisible;
            _login             = (Button)FindViewById(Resource.Id.LogIn);
            _login.Click      += (o, e) => { GetLogin(); };
            // load your calss
            Load();
        }
        public void ProperlyNamePropertiesForInnerObjects()
        {
            var d2DigitalClock = new DigitalClock(true, new[] { 1, 2 },
                                                  new Calendar(3, new Time("wrong", 1.5F, 3, 1.2, new List <string> {
                "", ""
            }, 4, 34)), "2015", 1.2F, 11,
                                                  1.12,
                                                  new List <string> {
                "df", "asd"
            }, 1, 9);
            var resultNoDiffTime1 = _dDigitalClock.GetDistinctions(d2DigitalClock);

            resultNoDiffTime1.Should().NotBeEmpty().And.ContainSingle(x =>
                                                                      x.Name ==
                                                                      $"{nameof(d2DigitalClock.PropCalendar)}.{nameof(d2DigitalClock.PropCalendar.PropTimePanel)}.{nameof(d2DigitalClock.PropCalendar.PropTimePanel.PropYear)}");
        }
Example #10
0
        public MainWindow()
        {
            InitializeComponent();
            int coreCount = GetThreadsCount();

            ThreadsValue.Maximum = coreCount;
            progressBar          = AlgoTime;
            waveFormTimeLine     = waveform;
            digitalClock         = clockDisplay;
            startTime            = repeatStartTimeEdit;
            stopTime             = repeatStopTimeEdit;
            scrollViewerText     = OutputLogText;
            scrollViewerLog      = OutputLog;

            outputLogWriter.SubscripeToOpeningClosingAudioEvents();
        }
        public void IsObjectsEqualTestWhenSetStrategyInnerObject()
        {
            const int page           = 4;
            var       d2DigitalClock = new DigitalClock(true, new[] { 1, 2 },
                                                        new Calendar(4, new Time("2016", 1.5F, 3, 1.2, new List <string> {
                "", ""
            }, 4, 34)), "2015", 1.2F, 11,
                                                        1.12,
                                                        new List <string> {
                "df", "asd"
            }, 1, 9);
            var str = new Strategies <DigitalClock>().Set(x => x.PropCalendar.Page,
                                                          (s, s1) => s1 == page);
            var resultNoDiffTime1 = _dDigitalClock.GetDistinctions(d2DigitalClock, str);

            resultNoDiffTime1.Should().BeEmpty();
        }
 // Use this for initialization
 void OnEnable()
 {
     digitalClock = transform.GetComponentInChildren<DigitalClock> ();
     analogicClock = transform.GetComponentInChildren<AnalogicClock>();
     if (digitalClock != null) {
         digitalClock.clockSpeed = clockSpeed;
         digitalClock.SetReverseClock(reverse);
         if (!pointFlicker)digitalClock.pointFlicker=false;
         if (digitalClock.hoursDCV!=null)digitalClock.hoursDCV.ChangeToTargetTime (initialHoursValue);
         if (digitalClock.minutesDCV!=null)digitalClock.minutesDCV.ChangeToTargetTime (initialMinutesValue);
         if (digitalClock.secondsDCV!=null)digitalClock.secondsDCV.ChangeToTargetTime (initialSecondsValue);
     }
     if (analogicClock != null) {
         if (reverse)analogicClock.clockSpeed=-clockSpeed;
         else analogicClock.clockSpeed=clockSpeed;
         analogicClock.SetTime(initialHoursValue,initialMinutesValue,initialSecondsValue);
     }
 }
        public void IsObjectsFallTest_DigitalClock_BoolDiff()
        {
            const bool act            = false;
            var        d2DigitalClock = new DigitalClock(act, new[] { 1, 2 },
                                                         new Calendar(3, new Time("2016", 1.5F, 3, 1.2, new List <string> {
                "", ""
            }, 4, 34)), "2015", 1.2F, 11,
                                                         1.12,
                                                         new List <string> {
                "df", "asd"
            }, 1, 9);
            var resultBoolDiffClock = _dDigitalClock.GetDistinctions(d2DigitalClock);

            resultBoolDiffClock.Should().NotBeEmpty();
            var diff = resultBoolDiffClock.First();

            diff.ActuallyValue.Should().Be(act);
            diff.ExpectedValue.Should().Be(_dDigitalClock.ClickTimer);
        }
        public void IsObjectsFallTest_DigitalClock_ArrayDiff()
        {
            const int act            = 11;
            var       d3DigitalClock = new DigitalClock(true, new[] { act, 2 },
                                                        new Calendar(3, new Time("2016", 1.5F, 3, 1.2, new List <string> {
                "", ""
            }, 4, 34)), "2015", 1.2F, 11,
                                                        1.12,
                                                        new List <string> {
                "df", "asd"
            }, 1, 9);
            var resultArrayDiffClock = _dDigitalClock.GetDistinctions(d3DigitalClock);

            resultArrayDiffClock.Should().NotBeEmpty();
            var diff = resultArrayDiffClock.First();

            diff.Name.Should().BeEquivalentTo(nameof(d3DigitalClock.NumberMonth) + "[0]");
            diff.ActuallyValue.Should().Be(act);
            diff.ExpectedValue.Should().Be(_dDigitalClock.NumberMonth[0]);
        }
Example #15
0
        public Panel()
        {
            InitializeComponent();

            // set the base properties
            Text           = "Tidal Clock";
            DoubleBuffered = true;
            Height         = 800;
            Width          = 1280;
            DoubleBuffer   = BufferedGraphicsManager.Current.Allocate(CreateGraphics(), new Rectangle(0, 0, Width, Height));
            Canvas         = DoubleBuffer.Graphics;
            Resize        += ResizeWindow;
            Paint         += PaintWindow;

            // create drawable surface
            TideClockImage    = new WritableBitmap(width: 4096, height: 4096);                     // keep 1:1 ratio
            DigitalClockImage = new WritableBitmap(width: 4096, height: (int)(4096f * (1f / 2f))); // keep 2:1 ratio
            DetailListImage   = new WritableBitmap(width: 4096, height: (int)(4096f * (4f / 5f))); // keep 5:4 ratio
            WeatherListImage  = new WritableBitmap(width: 4096, height: (int)(4096f * (2f / 5f))); // keep 5:2 ratio

            // https://www.tidesandcurrents.noaa.gov/tide_predictions.html
            External = new Predictions("La Push, WA", noahStationId: 9442396, lat: 47.9133f, lng: -124.6369f, subnet: "");

            // create clock face
            TideClock             = new TideClock(TideClockImage.Canvas, External);
            TideClock.OnRendered += FrameRender;

            // create the digital clock
            DigitalClock             = new DigitalClock(DigitalClockImage.Canvas, hasseconds: true, digitalclockface: true);
            DigitalClock.OnRendered += FrameRender;

            // create detail list
            DetailList             = new DetailList(DetailListImage.Canvas, External);
            DetailList.OnRendered += FrameRender;

            // create weather list
            WeatherList             = new WeatherList(WeatherListImage.Canvas, External);
            WeatherList.OnRendered += FrameRender;
        }
Example #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.WH);
            // Create your application here
            GetDateTime();
            GetMobileNumber();
            GetCurrentLocation();
            CheckReportingTodayDate();
            _time               = (DigitalClock)FindViewById(Resource.Id.CurrentTime);
            _btnReportIn        = (Button)FindViewById(Resource.Id.btnReportIn);
            _btnReportIn.Click += (o, e) => { SetReportIn(); };

            _reportOut        = (Button)FindViewById(Resource.Id.btnReportOut);
            _reportOut.Click += (o, e) => { SetReportOut(); };

            _btnReportSick        = (Button)FindViewById(Resource.Id.btnReportSick);
            _btnReportSick.Click += (o, e) => { ReportSickDay(); };

            _btnReportDayOff        = (Button)FindViewById(Resource.Id.btnDayOff);
            _btnReportDayOff.Click += (o, e) => { ReportDayOff(); };
        }
 // Use this for initialization
 void OnEnable()
 {
     digitalClock  = transform.GetComponentInChildren <DigitalClock> ();
     analogicClock = transform.GetComponentInChildren <AnalogicClock>();
     if (digitalClock != null)
     {
         digitalClock.clockSpeed = clockSpeed;
         digitalClock.SetReverseClock(reverse);
         if (!pointFlicker)
         {
             digitalClock.pointFlicker = false;
         }
         if (digitalClock.hoursDCV != null)
         {
             digitalClock.hoursDCV.ChangeToTargetTime(initialHoursValue);
         }
         if (digitalClock.minutesDCV != null)
         {
             digitalClock.minutesDCV.ChangeToTargetTime(initialMinutesValue);
         }
         if (digitalClock.secondsDCV != null)
         {
             digitalClock.secondsDCV.ChangeToTargetTime(initialSecondsValue);
         }
     }
     if (analogicClock != null)
     {
         if (reverse)
         {
             analogicClock.clockSpeed = -clockSpeed;
         }
         else
         {
             analogicClock.clockSpeed = clockSpeed;
         }
         analogicClock.SetTime(initialHoursValue, initialMinutesValue, initialSecondsValue);
     }
 }
        public void GetHhHandPosition_WhenDigitalClockIsValid_ShouldReturnCorrectValues()
        {
            // Arrange
            DigitalClock digitalClock = new DigitalClock();

            // Act
            ClockAdapter clockAdapter = new ClockAdapter(digitalClock);

            // Assert
            clockAdapter.GetHhHandPosition()
            .Should()
            .NotBeEmpty()
            .And.HaveCount(2)
            .And.ContainItemsAssignableTo <double>();

            clockAdapter.GetHhHandPosition()[0]
            .Should()
            .BeApproximately(Math.Sin(RADIAN * (int)(digitalClock.Hh * HOUR_ANGLE + digitalClock.Mm * HOUR_OFFSET)), 0.01f);

            clockAdapter.GetHhHandPosition()[1]
            .Should()
            .BeApproximately(Math.Cos(RADIAN * (int)(digitalClock.Hh * HOUR_ANGLE + digitalClock.Mm * HOUR_OFFSET)), 0.01f);
        }
Example #19
0
    // Play audio sequence and show congratulatory messsage for escaping room
    public void Escape()
    {
        DigitalClock clock       = GameObject.FindGameObjectWithTag("digitalLED").GetComponent <DigitalClock>();
        AudioSource  breakEffect = GameObject.FindWithTag("mirror").GetComponent <AudioSource>();

        breakEffect.Play();
        GameObject.Destroy(GameObject.FindGameObjectWithTag("reflectionProbe"));
        string form = (clock.score == 1) ? "minute" : "minutes";

        gameObject.GetComponent <Usable>().Inspect(
            string.Format("You've successfully escaped in {0} {1}!", clock.score, form)
            );
        GameObject.FindWithTag("mirror").GetComponent <Usable>().enabled      = false;
        GameObject.FindWithTag("mirror").GetComponent <Collectable>().enabled = false;
        GameObject.FindWithTag("mirror").GetComponent <Collider>().enabled    = false;
        AudioSource bgAudio = GameObject.Find("Background Music").GetComponent <AudioSource>();

        bgAudio.Stop();
        StopCoroutine("PlayTime");
        if (clock.pointFlicker && clock.secondsDCV == null)
        {
            StopCoroutine("PlayPointFlicker");
        }
    }
Example #20
0
 public static void Render(Graphics g, DigitalClock digitalClock, DateTime time)
 {
 }
 public void TearDown()
 {
     _sink   = null;
     _source = null;
 }
 public void SetUp()
 {
     _source = new Clock();
     _sink   = new DigitalClock(_source);
     _source.RegisterObserver(_sink);
 }
 private void AssertSinkEquals(DigitalClock sink, int hours, int minutes, int seconds)
 {
     Assert.AreEqual(hours, sink.Hours);
     Assert.AreEqual(minutes, sink.Minutes);
     Assert.AreEqual(seconds, sink.Seconds);
 }