void clockRadio_CheckedChanged(object sender, EventArgs e) { ClockFace oldClockFace = currentClockFace; if (clock10Radio.Selected) { currentClockFace = ClockFace.Clock10; rdaPanel.Visible = true; rdaReductionGroup.SelectedButton = mildRDAReductionButton; } else if (clock11Radio.Selected) { currentClockFace = ClockFace.Clock11; rdaPanel.Visible = false; } else if (clock12Radio.Selected) { currentClockFace = ClockFace.Clock12; rdaPanel.Visible = false; } if (allowClockChangeEventFire && oldClockFace != currentClockFace) { if (CurrentStageChanged != null) { CurrentStageChanged.Invoke(this, EventArgs.Empty); } } }
public SettingsForm(ClockFace clockFace, float makeEverythingBiggerScaling) { this.clockFace = clockFace; InitializeComponent(); if (makeEverythingBiggerScaling > 1) { // Barker: Account for text scaling in this dialog. } this.radioButton1.Checked = (this.clockFace.VisibleHandCount > 1); this.radioButton2.Checked = !this.radioButton1.Checked; var imageRunning = global::GFClockWinForms.Properties.Resources.ClockFace; var imageNotRunning = new Bitmap(1, 1); // Barker Todo: Localize all this! dataGridViewDetails.Rows.Add(imageRunning, "Sundials", "2000 years ago", "Sundials"); dataGridViewDetails.Rows.Add(imageNotRunning, "Big Ben", "1859", "Big Ben"); dataGridViewDetails.Rows.Add(imageRunning, "Dad's Grandfather Clock", "1777", "GFClock"); dataGridViewDetails.Rows.Add(imageNotRunning, "Deep Space Atomic Clock", "2019", "NASA"); dataGridViewDetails.SortCompare += DataGridViewDetails_SortCompare; dataGridViewDetails.Columns[0].SortMode = DataGridViewColumnSortMode.Automatic; this.FormClosing += SettingsForm_FormClosing; }
public SettingsWindow(ClockFace clockFace) { InitializeComponent(); // Prevent alt+tab being able to switch to the main window or // the Settings window separately. this.Owner = App.Current.MainWindow; this.clockFace = clockFace; this.ShowInTaskbar = false; ObservableCollection <ClockData> clockData = new ObservableCollection <ClockData>(); clockData.Add(new ClockData(false, "Sundials", "2000 years ago", "Sundials")); clockData.Add(new ClockData(true, "Big Ben", "1859", "Big Ben")); clockData.Add(new ClockData(false, "Dad's Grandfather Clock", "1777", "GFClock")); clockData.Add(new ClockData(true, "Deep Space Atomic Clock", "2019", "NASA")); DetailsDataGrid.DataContext = clockData; this.Loaded += SettingsWindow_Loaded; // Don't auto-check the radio buttons on focus. // Keyboard.AddKeyboardInputProviderAcquireFocusHandler(this, CheckRadioButton); this.Closing += SettingsWindow_Closing; }
public IHttpActionResult GetAngle(int hours, int minutes, int width, int height) { ClockFace clock = new ClockFace(width, height); clock.SetTime(new TimeSpan(hours, minutes, 0)); return(Ok(clock)); }
public Form1() { InitializeComponent(); // Support the clock face being rather small. this.MinimumSize = new Size(200, 200); var hMon = NativeMethods.MonitorFromWindow(this.Handle, NativeMethods.MONITOR_DEFAULTTONEAREST); NativeMethods.MONITOR_DPI_TYPE monDpiType = NativeMethods.MONITOR_DPI_TYPE.MDT_EFFECTIVE_DPI; int dpiX; int dpiY; NativeMethods.GetDpiForMonitor(hMon, monDpiType, out dpiX, out dpiY); makeEverythingBiggerScaling = ((float)dpiY / DeviceDpi); // The Clock control has a Dock of Fill, as that makes it easy // for it to be autosized as the window size changes. But that // also means the control occupies the same space as the menu. // So always offset the Clock visuals to be below the menu. this.clockFace = new ClockFace(this.menuStrip1.Bottom, makeEverythingBiggerScaling); this.Controls.Add(clockFace); this.clockFace.SetClockHands(); Microsoft.Win32.SystemEvents.UserPreferenceChanged += new Microsoft.Win32.UserPreferenceChangedEventHandler( this.UserPreferenceChanged); }
private void PerformTick(object sender, EventArgs e) { k = (DateTime.Now.Hour) % 12 * 5 + j / 12; j = DateTime.Now.Minute; i = DateTime.Now.Second; ClockFace.Invalidate(); }
public Form1() { InitializeComponent(); clock = new ClockFace(clockFace.Width, clockFace.Height); clockFace.Image = new Bitmap(clockFace.Width, clockFace.Height); Redraw(); }
public async Task <Answer> Add(Request request) { try { if (string.IsNullOrEmpty(request.Sequence) || request.Observation == null || string.IsNullOrEmpty(request.Observation.Color) || !(request.Observation.Color == "green" || request.Observation.Color == "red")) { throw new Exception("No solutions found"); } var sequense = await db.Sequences.FirstOrDefaultAsync(x => x.Id == request.Sequence); // try to find sequence if (sequense == null) { throw new Exception("The sequence isn't found"); } if (request.Observation.Color == "red") { sequense = ClockFace.Update(sequense, 0, 0, true); } if (request.Observation.Color == "green") { sequense = ClockFace.Update(sequense, Convert.ToInt32(request.Observation.Numbers[0], 2), Convert.ToInt32(request.Observation.Numbers[1], 2)); if (sequense.Broken) { throw new Exception("No solutions found"); } db.Entry(sequense).State = EntityState.Modified; await db.SaveChangesAsync(); } return(new Answer { Status = "ok", Responce = new Responce { Start = JsonConvert.DeserializeObject <List <NumInfo> >(sequense.Start).Select(x => x.Start).ToArray(), Missing = new string[] { Convert.ToString(sequense.FirstMissing, 2).PadLeft(7, '0'), Convert.ToString(sequense.SecondMissing, 2).PadLeft(7, '0') } } }); } catch (Exception exe) { return(new Answer { Status = "error", Msg = exe.Message }); } }
public static int? IntValue(Keys keyData, ClockFace clockFace) { if (clockFace == ClockFace.Hours) { if (keyData >= Keys.D1 && keyData <= Keys.D9) return (int) keyData - (int) Keys.D0; if (keyData == Keys.D0) return 10; if (keyData >= Keys.NumPad1 && keyData <= Keys.NumPad9) return (int) keyData - (int) Keys.D0; if (keyData == Keys.NumPad0) return 10; } else if (clockFace == ClockFace.Minutes) { if (keyData >= Keys.D0 && keyData <= Keys.D5) return 10 * ((int) keyData - (int) Keys.D0); if (keyData >= Keys.NumPad0 && keyData <= Keys.NumPad5) return 10 * ((int) keyData - (int) Keys.NumPad0); } return null; }
public ZegarekViewModel() { Clock = new ClockFace(ClockFaceWidth, ClockFaceHeight); Clock.SetTime(DateTime.Now); }
public ClockFaceView(IntPtr ptr, JniHandleOwnership jni) : base(ptr, jni) { _clockFace = new ClockFace(); PaintSurface += OnPaintCanvas; }
public void CalculateAngleTest_Angle() { ClockFace testClock = new ClockFace(); Assert.AreEqual(157.5, testClock.CalculateAngle(3, 45)); }
private void ClockFace_SizeChanged(object sender, SizeChangedEventArgs e) { ClockFace.ResizeHands(); }
private void SetClockFace(ClockFace clockFace) { if (clockFace == this.clockFace) return; SuspendLayout(); if (clockFace == ClockFace.Minutes) { this.clockFace = ClockFace.Minutes; foreach (var item in hourItems) item.Visible = false; foreach (var item in minuteItems) item.Visible = true; ClockItemHour.IsSelected = false; ClockItemMinute.IsSelected = true; if (FocusedItem is ClockNumberItem) tabIndex = Items.IndexOf(GetMinuteItem(ClockMinute)); } else { this.clockFace = ClockFace.Hours; foreach (var item in minuteItems) item.Visible = false; foreach (var item in hourItems) item.Visible = true; ClockItemHour.IsSelected = true; ClockItemMinute.IsSelected = false; if (FocusedItem is ClockNumberItem) tabIndex = Items.IndexOf(GetHourItem(ClockHour)); } ResumeLayout(true); Refresh(); }
public ClockFaceView(Context context) : base(context) { _clockFace = new ClockFace(); PaintSurface += OnPaintCanvas; }
private void SetValue(ClockFace cf, int value) { valueSelected = (FocusedItem is ClockNumberItem); String t = null; ClockItem header = null; if (cf == ClockFace.Hours) { header = ClockItemHour; t = value.ToString(); } else { header = ClockItemMinute; t = value.ToString("00"); } if (t == header.Text.Trim()) return; // only update the focused item if cf is the current clock face if (TabStop && ClockFace == cf && FocusedItem is ClockNumberItem) { if (cf == ClockFace.Hours) tabIndex = Items.IndexOf(GetHourItem(value)); else tabIndex = Items.IndexOf(GetMinuteItem(value)); } SuspendLayout(); header.Text = t; ResumeLayout(false); var v = Value; Value = v; }
public ClockFaceView(Context context, IAttributeSet attributes, int defStyleAtt) : base(context, attributes, defStyleAtt) { _clockFace = new ClockFace(); PaintSurface += OnPaintCanvas; }
public ClockFaceView() { _clockFace = new ClockFace(); BackgroundColor = Color.Transparent; PaintSurface += OnPaintCanvas; }
private void computeDiscSpaceStage() { stageMap[PiperStage.I] = 0; stageMap[PiperStage.II] = 0; stageMap[PiperStage.IIIa] = 0; stageMap[PiperStage.IIIb] = 0; stageMap[PiperStage.IVa] = 0; stageMap[PiperStage.IVb] = 0; stageMap[PiperStage.Va] = 0; stageMap[PiperStage.Vb] = 0; clockFaceMap[ClockFace.Clock10] = 0; clockFaceMap[ClockFace.Clock11] = 0; clockFaceMap[ClockFace.Clock12] = 0; switch (verticalSpaceCombo.SelectedIndex) { case 0: //Normal stageMap[PiperStage.I] += 1; stageMap[PiperStage.II] += 1; stageMap[PiperStage.IIIa] += 1; stageMap[PiperStage.IIIb] += 1; //stageMap[PiperStage.IVa] += 1; clockFaceMap[ClockFace.Clock11] += 1; break; case 1: //Increased stageMap[PiperStage.IVa] += 1; clockFaceMap[ClockFace.Clock11] += 1; clockFaceMap[ClockFace.Clock12] += 2; break; case 2: //Decreased stageMap[PiperStage.IVa] += 1; stageMap[PiperStage.IVb] += 1; clockFaceMap[ClockFace.Clock11] += 1; clockFaceMap[ClockFace.Clock10] += 2; break; case 3: //Bone on Bone stageMap[PiperStage.Va] += 10; stageMap[PiperStage.Vb] += 10; break; } switch (horizontalSpaceCombo.SelectedIndex) { case 0: //Normal stageMap[PiperStage.I] += 1; stageMap[PiperStage.II] += 1; stageMap[PiperStage.IIIa] += 1; stageMap[PiperStage.IIIb] += 1; stageMap[PiperStage.IVa] += 1; stageMap[PiperStage.IVb] += 1; stageMap[PiperStage.Va] += 1; stageMap[PiperStage.Vb] += 1; break; case 1: //Posterior Shift stageMap[PiperStage.IVa] += 2; clockFaceMap[ClockFace.Clock11] += 2; break; } switch (condyleShapeCombo.SelectedIndex) { case 0: //Normal stageMap[PiperStage.I] += 1; stageMap[PiperStage.II] += 1; stageMap[PiperStage.IIIa] += 1; stageMap[PiperStage.IIIb] += 1; stageMap[PiperStage.IVa] += 1; stageMap[PiperStage.IVb] += 1; stageMap[PiperStage.Va] += 1; break; case 1: //Osteophyte stageMap[PiperStage.Vb] += 10; break; } //Find the largest piper stage number int largest = 0; foreach (int value in stageMap.Values) { if (value > largest) { largest = value; } } //Find all matching stages and return them PiperStage stages = PiperStage.Unknown; foreach (PiperStage stage in stageMap.Keys) { if (stageMap[stage] == largest) { stages |= stage; } } //Find the largest clock face number largest = 0; foreach (int value in clockFaceMap.Values) { if (value > largest) { largest = value; } } ClockFace clockFaces = ClockFace.Unknown; foreach (ClockFace clockFace in clockFaceMap.Keys) { if (clockFaceMap[clockFace] == largest) { clockFaces |= clockFace; } } allowStageChangeEventFire = false; allowRdaReductionEventFire = false; allowClockChangeEventFire = false; //Update UI bool activatedLowest = false; processStageButton(stageIButton, (int)PiperStage.I, (int)stages, ref activatedLowest); processStageButton(stageIIButton, (int)PiperStage.II, (int)stages, ref activatedLowest); processStageButton(stageIIIaButton, (int)PiperStage.IIIa, (int)stages, ref activatedLowest); processStageButton(stageIIIbButton, (int)PiperStage.IIIb, (int)stages, ref activatedLowest); processStageButton(stageIVaButton, (int)PiperStage.IVa, (int)stages, ref activatedLowest); processStageButton(stageIVbButton, (int)PiperStage.IVb, (int)stages, ref activatedLowest); processStageButton(stageVaButton, (int)PiperStage.Va, (int)stages, ref activatedLowest); processStageButton(stageVbButton, (int)PiperStage.Vb, (int)stages, ref activatedLowest); activatedLowest = false; processClockButton(clock12Radio, (int)ClockFace.Clock12, (int)clockFaces, ref activatedLowest); processClockButton(clock11Radio, (int)ClockFace.Clock11, (int)clockFaces, ref activatedLowest); processClockButton(clock10Radio, (int)ClockFace.Clock10, (int)clockFaces, ref activatedLowest); allowStageChangeEventFire = true; allowRdaReductionEventFire = true; allowClockChangeEventFire = true; if (CurrentStageChanged != null) { CurrentStageChanged.Invoke(this, EventArgs.Empty); } }