public static void SetMode(ClockMode mode)
 {
     if (clockMode != mode)
     {
         _dirty = true;
     }
     clockMode = mode;
 }
 public void Load()
 {
     _Virtual_Timerate     = _settings.GetValue(_section, "Virtual_Timerate", _Virtual_Timerate);
     _Enable_Top_Clock     = _settings.GetValue(_section, "Enable_Top_Clock", _Enable_Top_Clock);
     _Show_Seconds         = _settings.GetValue(_section, "Show_Seconds", _Show_Seconds);
     _Military_Time_Format = _settings.GetValue(_section, "Military_Time_Format", _Military_Time_Format);
     _Clock_Mode           = _settings.GetValue(_section, "Clock_Mode", _Clock_Mode);
 }
Ejemplo n.º 3
0
        public ClockModel(Dispatcher dispatcher, EventHandler tickHandler)
        {
            mode = ClockMode.Terminated;

            timer           = new DispatcherTimer(DispatcherPriority.DataBind, dispatcher);
            timer.IsEnabled = false;
            timer.Tick     += tickHandler;
        }
Ejemplo n.º 4
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            ClockMode mode = (ClockMode)value;

            if (mode == ClockMode.Digital)
            {
                return(Visibility.Visible);
            }
            else
            {
                return(Visibility.Collapsed);
            }
        }
Ejemplo n.º 5
0
 public Clock(Framework framework, ClockType type = ClockType.Local, bool isStandalone = false)
 {
     this.framework    = framework;
     Type              = type;
     this.isStandalone = isStandalone;
     this.dateTime     = DateTime.MinValue;
     this.mode         = this.framework.Mode == FrameworkMode.Realtime ? ClockMode.Realtime : ClockMode.Simulation;
     this.initTicks    = DateTime.Now.Ticks;
     this.stopwatch    = Stopwatch.StartNew();
     if (this.isStandalone)
     {
         throw new NotImplementedException("don't know when to use it");
     }
 }
Ejemplo n.º 6
0
 public Clock(Framework framework, ClockMode mode = ClockMode.Realtime, bool isStandalone = false)
 {
     this.framework    = framework;
     this.mode         = mode;
     this.isStandalone = isStandalone;
     this.hires_offset = DateTime.Now.Ticks;
     this.hires_watch  = Stopwatch.StartNew();
     if (isStandalone)
     {
         this.reminderThread              = new Thread(new ThreadStart(this.ThreadRun));
         this.reminderThread.Name         = "Clock Thread";
         this.reminderThread.IsBackground = true;
         this.reminderThread.Start();
     }
 }
Ejemplo n.º 7
0
 private void changeModeBtn_Click(object sender, EventArgs e)
 {
     if (mode == ClockMode.Digital) //to analog mode
     {
         clock = new AnologTimeDecorator();
         mode  = ClockMode.Analog;
         changeModeBtn.Text = "Digital";
     }
     else // to digital mode
     {
         clock = new DigitalTimeDecorator();
         mode  = ClockMode.Digital;
         changeModeBtn.Text = "Analog";
     }
     Draw();
 }
Ejemplo n.º 8
0
        public CtlClock()
        {
            InitializeComponent();

            mode       = ClockMode.Analog;
            timeOffset = 0;

            watch          = new WatchPatterns.Watch(timeOffset);
            watchDecorator = new WatchPatterns.DigitalTimeDecorator();
            watchDecorator.SetWatch(watch);

            timer           = new System.Timers.Timer();
            timer.Interval  = 1000;
            timer.Elapsed  += Timer_Elapsed;
            timer.AutoReset = true;
            timer.Enabled   = true;
            timer.Start();
        }
Ejemplo n.º 9
0
        public void SetMode(ClockMode mode)
        {
            Mode = mode;
            switch (mode)
            {
            case ClockMode.Clock:
                _timerModel.Period = 1000;
                break;

            case ClockMode.Chronometer:
                _timerModel.Period = 10;
                _chronometerStatus = ChronometerStatus.NotStarted;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 10
0
        public static IServiceCollection AddModes(this IServiceCollection serviceCollection)
        {
            var clockMode = new ClockMode();

            serviceCollection.AddSingleton <IClockMode>(clockMode);
            serviceCollection.AddSingleton(clockMode);
            var timerMode = new TimerMode();

            serviceCollection.AddSingleton <IClockMode>(timerMode);
            serviceCollection.AddSingleton(timerMode);
            var dateMode = new DateMode();

            serviceCollection.AddSingleton <IClockMode>(dateMode);
            serviceCollection.AddSingleton(dateMode);
            var stopperMode = new StopperMode();

            serviceCollection.AddSingleton <IClockMode>(stopperMode);
            serviceCollection.AddSingleton(stopperMode);
            return(serviceCollection);
        }
Ejemplo n.º 11
0
 public void SetToStopWatch()
 {
     currentMode = ClockMode.StopWatch;
     ResetTimer();
     paused = true;
 }
Ejemplo n.º 12
0
 public Clock(ClockMode mode)
 {
     _mode = mode;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ClockFace"/> class.
        /// </summary>
        public ClockFace()
        {
            this.InitializeComponent();
            this.seconds = -1;
            this.clockMode = ClockMode.Clock;

            // Create a temporary timer, untill the Dispatcher creates the real one.
            this.timer = new DispatcherTimer();

            // We must let WPF calculate the size of the elements before we can go on
            // and use them in the code. Therefore we must use the Dispatcher.
            this.clockFace.Dispatcher.BeginInvoke(
                new DispatcherOperationCallback(delegate(object arg)
                {
                    this.DrawClockFace();
                    this.timer = new DispatcherTimer(new TimeSpan(0, 0, 0, 0, 250), DispatcherPriority.Loaded, new EventHandler(this.Timer_Elapsed), this.clockFace.Dispatcher);
                    if (this.ClockMode != ClockMode.Clock)
                    {
                        this.timer.Stop();
                    }

                    return null;
                }),
                DispatcherPriority.Background,
                this);
        }
 public static void SetMode(this Clock clock, ClockMode mode)
 {
     ClockModeFiled.Setter(clock, mode);
 }
Ejemplo n.º 15
0
 public Clock(Framework framework, ClockType type = ClockType.Local, bool isStandalone = false)
 {
     this.framework = framework;
     Type = type;
     this.isStandalone = isStandalone;
     this.dateTime = DateTime.MinValue;
     this.mode = this.framework.Mode == FrameworkMode.Realtime ? ClockMode.Realtime : ClockMode.Simulation;
     this.initTicks = DateTime.Now.Ticks;
     this.stopwatch = Stopwatch.StartNew();
     if (this.isStandalone)
     {
         throw new NotImplementedException("don't know when to use it");
     }
 }
 public override void ControlClock(DeviceUnits units, ClockFunction clockFunction, int clockId, int hours, int minutes, int seconds, int row, int column, VideoAttributes attribute, ClockMode mode)
 {
     VerifyResult(_cco.ControlClock((int)units, (int)clockFunction, clockId, hours, minutes, seconds, row, column, (int)attribute, (int)mode));
 }
Ejemplo n.º 17
0
		public Clock(Framework framework, ClockMode mode = ClockMode.Realtime, bool isStandalone = false)
		{
			this.framework = framework;
			this.mode = mode;
			this.isStandalone = isStandalone;
			this.hires_offset = DateTime.Now.Ticks;
			this.hires_watch = Stopwatch.StartNew();
			if (isStandalone)
			{
				this.reminderThread = new Thread(new ThreadStart(this.ThreadRun));
				this.reminderThread.Name = "Clock Thread";
				this.reminderThread.IsBackground = true;
				this.reminderThread.Start();
			}
		}
Ejemplo n.º 18
0
 /// <summary>
 /// Creates new instance of <see cref="Clock"/> using supplied mode. 
 /// </summary>
 public Clock(ClockMode mode)
 {
     Mode = mode;
     _latch = new object();
 }
Ejemplo n.º 19
0
 public Clock(ClockMode mode)
 {
   _mode = mode;
 }
Ejemplo n.º 20
0
 public void SetToTimeMode()
 {
     currentMode = ClockMode.Clock;
 }
Ejemplo n.º 21
0
 public void SetToCountDown()
 {
     currentMode = ClockMode.CountDown;
     ResetTimer();
     paused = true;
 }
Ejemplo n.º 22
0
 public Clock(Framework framework, ClockMode mode = ClockMode.Simulation, bool isStandalone = false)
 {
     this.Mode = mode;
     throw new System.NotImplementedException();
 }