private void window_Loaded(object sender, RoutedEventArgs e) { AClockData clock = new AClockData(); clock.BackColor = new SolidColorBrush(Colors.Black); clock.TickColor = new SolidColorBrush(Colors.White); clock.TickThicknessDivisor = 130; clock.NumbersColor = new SolidColorBrush(Colors.Yellow); clock.NumbersFontFamily = new FontFamily("Calibri"); clock.NumbersSize = 14; clock.HourHand.HandColor = new SolidColorBrush(Colors.LightGray); clock.HourHand.LengthMultiplier = 0.48F; clock.HourHand.ThicknessDivisor = 100; clock.MinuteHand.HandColor = new SolidColorBrush(Colors.DarkGray); clock.MinuteHand.LengthMultiplier = 0.58F; clock.MinuteHand.ThicknessDivisor = 150; clock.SecondsHand.HandColor = new SolidColorBrush(Colors.Red); clock.SecondsHand.LengthMultiplier = 0.68F; clock.SecondsHand.ThicknessDivisor = 200; ClockControl.StartClock(clock); }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { if (ClockMenu != null) { ClockMenu.Dispose(); } ClockMenu = null; } }
public MainWindow() { InitializeComponent(); clock = Clock.GetDefaultClock(); clockControl = new ClockControl(clock, pnl); tmr = new DispatcherTimer(); tmr.Interval = TimeSpan.FromMilliseconds(25); tmr.Tick += new EventHandler(timer_Tick); tmr.Start(); }
public void ClockControl_InitializeFromRegisterValue(byte registerValue, ClockControl.DriveStrength driveStrength, ClockControl.InputSource inputSource, ClockControl.Inversion inversion, ClockControl.DividerSource dividerSource, ClockControl.IntegerMode integerMode, ClockControl.PowerState powerState) { var register = new ClockControl(0, registerValue); Assert.Equal(driveStrength, register.OutputDriveStrength); Assert.Equal(inputSource, register.ClockInputSource); Assert.Equal(inversion, register.OutputInversion); Assert.Equal(dividerSource, register.MultiSynthDividerSource); Assert.Equal(integerMode, register.MultiSynthIntegerMode); Assert.Equal(powerState, register.OutputPowerState); }
public void ClockControl_InitializeFromSettings_CheckPropertiesAndRegisterValue(ClockControl.DriveStrength driveStrength, ClockControl.InputSource inputSource, ClockControl.Inversion inversion, ClockControl.DividerSource dividerSource, ClockControl.IntegerMode integerMode, ClockControl.PowerState powerState, byte registerValue) { var register = new ClockControl(0, driveStrength, inputSource, inversion, dividerSource, integerMode, powerState); Assert.Equal(driveStrength, register.OutputDriveStrength); Assert.Equal(inputSource, register.ClockInputSource); Assert.Equal(inversion, register.OutputInversion); Assert.Equal(dividerSource, register.MultiSynthDividerSource); Assert.Equal(integerMode, register.MultiSynthIntegerMode); Assert.Equal(powerState, register.OutputPowerState); Assert.Equal(registerValue, register.ToByte()); }
public AnalogClock() { Text = "Analog Clock"; BackColor = SystemColors.Window; ForeColor = SystemColors.WindowText; clkctl = new ClockControl(); clkctl.Parent = this; clkctl.Time = DateTime.Now; clkctl.Dock = DockStyle.Fill; clkctl.BackColor = Color.Black; clkctl.ForeColor = Color.White; Timer timer = new Timer(); timer.Interval = 100; timer.Tick += new EventHandler(TimerOnTick); timer.Start(); }
//public static void Main() // { // Application.Run(new Timer_1()); // } Timer_1() { Text = "Timer.."; ForeColor = SystemColors.WindowText; BackColor = Color.White; ResizeRedraw = true; MinimumSize = SystemInformation.MinimizedWindowSize + new Size(0, 1); clkcon1 = new ClockControl(); clkcon1.Parent = this; clkcon1.Time = DateTime.Now; clkcon1.Dock = DockStyle.None; clkcon1.BackColor = Color.PaleVioletRed; clkcon1.ForeColor = Color.Blue; dt = DateTime.Now; Timer timer = new Timer(); timer.Interval = 1000; timer.Tick += new EventHandler(TimerAnalog); timer.Tick += new EventHandler(TimerOnTick); timer.Enabled = true; }
///<summary> ///<para>Creates a time picker with the specified number of millisecond digits. The base format ///will be HH:mm:ss when the use24HourClock parameter is true, otherwise the base format ///will be hh:mm:ss. The milliseconds are appended at the end, e.g. HH:mm:ss.ffff ///</para> ///<para>Call the MimicDateTimePicker() to mimic the same style of input.</para> ///<para>Use the Value property to access the current DateTime value.</para> ///<para>Use the ValueChanged event to listen for DateTime changes.</para> ///<para>Use the TimeFormat and Mask in conjuction to change the format.</para> ///<para>The Arrays MinValues, MaxValues, PageUpDownDeltas and ByValues must ///contain at least the number of tokens as the TimeFormat contains.</para> ///</summary> ///<param name="addUpDownSpinner">An option to display up-down buttonS.</param> ///<param name="immediateValueChange">An option if changing the clock menu value requires clicking the OK button, or if the change is instant.</param> ///<param name="numMilliDigits">The number of milliseconds to show.</param> ///<param name="showClockMenu">An option to show a clock menu when this control gets the focus or is clicked.</param> ///<param name="use24HourClock">An option to show hours 0 to 23 or 1 to 12.</param> public TimePicker(int numMilliDigits = 3, bool use24HourClock = true, bool addUpDownSpinner = true, bool showClockMenu = true, bool immediateValueChange = true) : base(addUpDownSpinner) { //Using 9s produces more natural usability than 0s. String mask = "99:99:99"; String timeFormat = (use24HourClock ? "HH:mm:ss" : "hh:mm:ss"); int maxValue = 1; if (numMilliDigits > 0) { mask += "." + new String('9', numMilliDigits); timeFormat += "." + new String('f', numMilliDigits); for (int i = 0; i < numMilliDigits; i++) { maxValue *= 10; } } dateTimeFormat = timeFormat; this.Mask = mask; if (use24HourClock) { Tokens[0].MaxValue = 24; } else { Tokens[0].MinValue = 1; Tokens[0].MaxValue = 13; } Tokens[2].MaxValue = 60; Tokens[4].MaxValue = 60; //-- Tokens[0].BigIncrement = 4; Tokens[2].BigIncrement = 10; Tokens[4].BigIncrement = 10; //-- MimicDateTimePicker(); Value = DateTime.Now; ClockMenu = new ClockControl(); //false, false, false); if (showClockMenu) { attacher = new ToolStripDropDownAttacher(ClockMenu, this); } ClockMenu.ButtonClicked += ClockMenu_ButtonClicked; this.ValueChanged += delegate { ClockMenu.Value = this.Value; }; DateTime origValue = DateTime.MinValue; ClockMenu.VisibleChanged += delegate { if (ClockMenu.Visible) { origValue = this.Value; ClockMenu.Value = this.Value; } }; ClockMenu.Closed += (o, e) => { // escape key is used if (e.CloseReason == ToolStripDropDownCloseReason.Keyboard) { this.Value = origValue; } else { this.Value = ClockMenu.Value; } }; ClockMenu.ValueChanged += delegate { if (immediateValueChange) { this.Value = ClockMenu.Value; } }; attacher.MenuShowing += delegate { Token t = this.TokenAt(this.SelectionStart); if (t.SeqNo == 0) { ClockMenu.ClockFace = ClockFace.Hours; } else if (t.SeqNo == 2) { ClockMenu.ClockFace = ClockFace.Minutes; } }; }
public OutputBlock() { _clockControlRegister = new ClockControl(1, 0); }