SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
BaseDashboardControl.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Windows;
6 using System.Windows.Controls;
7 
8 namespace SeciControls
9 {
10  public class BaseDashboardControl : UserControl
11  {
12  public static readonly RoutedEvent OnExpandedEvent = EventManager.RegisterRoutedEvent("OnExpandedEvent", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BaseDashboardControl));
13  public static readonly RoutedEvent OnUnexpandedEvent = EventManager.RegisterRoutedEvent("OnUnexpandedEvent", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BaseDashboardControl));
14 
15  public event RoutedEventHandler OnExpanded
16  {
17  add { AddHandler(OnExpandedEvent, value); }
18  remove { RemoveHandler(OnExpandedEvent, value); }
19  }
20 
21  public event RoutedEventHandler OnUnexpanded
22  {
23  add { AddHandler(OnUnexpandedEvent, value); }
24  remove { RemoveHandler(OnUnexpandedEvent, value); }
25  }
26 
27  #region IsMuon Dependency Property
28 
29  public static readonly DependencyProperty IsMuonProperty
30  = DependencyProperty.Register("IsMuon", typeof(bool), typeof(BaseDashboardControl), new FrameworkPropertyMetadata(false, new PropertyChangedCallback(OnExperimentTypeChanged)));
31 
32  public bool IsMuon
33  {
34  get { return (bool)GetValue(IsMuonProperty); }
35  set { SetValue(IsMuonProperty, value); }
36  }
37 
38  private static void OnExperimentTypeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
39  {
40  StandardDashboard temp = sender as StandardDashboard;
41  bool muon = (bool)e.NewValue;
42 
43  if (muon)
44  {
45  temp.lblMonCounts.Text = "Total MEv:";
46  temp.lblCurrTotal.Text = "Count Rate:";
47  temp.lblShutter.Text = "Kicker Status:";
48  }
49  else
50  {
51  temp.lblMonCounts.Text = "Monitor Counts:";
52  temp.lblCurrTotal.Text = "Current/Total µA:";
53  temp.lblShutter.Text = "Shutter Status:";
54  }
55  }
56 
57  #endregion
58 
59  #region IsBigFontsProperty Dependency Property
60 
61  public static readonly DependencyProperty IsBigFontsProperty = DependencyProperty.RegisterAttached("IsBigFonts", typeof(Boolean),
62  typeof(BaseDashboardControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits));
63 
64  public static void SetIsBigFonts(UIElement element, Boolean value)
65  {
66  element.SetValue(IsBigFontsProperty, value);
67  }
68 
69  public static Boolean GetIsBigFonts(UIElement element)
70  {
71  return (Boolean)element.GetValue(IsBigFontsProperty);
72  }
73 
74  #endregion
75 
76  public virtual Boolean IsExpanded()
77  {
78  return true;
79  }
80 
81  public virtual void UpdateControl()
82  {
83  }
84  }
85 }
static Boolean GetIsBigFonts(UIElement element)
static readonly DependencyProperty IsBigFontsProperty
static readonly DependencyProperty IsMuonProperty
static readonly RoutedEvent OnExpandedEvent
static void OnExperimentTypeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
static void SetIsBigFonts(UIElement element, Boolean value)
static readonly RoutedEvent OnUnexpandedEvent
Interaction logic for StandardDashboard.xaml