3 using System.Windows.Controls;
4 using System.Windows.Media;
5 using System.Globalization;
6 using System.Text.RegularExpressions;
23 InitializeComponent();
24 _brushWarning = (SolidColorBrush)this.FindResource(
"WarningTextBrush");
25 _brushNormal = (SolidColorBrush)this.FindResource(
"NormalTextBrush");
27 if (!Seci.Definitions.Status.EnableDashboardTitleEdit)
29 txtTitle.Visibility = System.Windows.Visibility.Visible;
30 txtEditTitle.Visibility = System.Windows.Visibility.Collapsed;
36 return expander1.IsExpanded;
43 if (btnSet.Visibility == Visibility.Collapsed)
45 btnSet.Visibility = Visibility.Visible;
46 btnCancel.Visibility = Visibility.Visible;
54 if (
_oldTitle.Trim() != Seci.Standard.Dae.RunTitle.Trim())
57 if (MessageBox.Show(
"The current run title has been changed to \"" + Seci.Standard.Dae.RunTitle +
58 "\" do you wish to replace it with your changes?",
"Title Changed During Edit",
59 MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
61 txtTitle.Text = Seci.Standard.Dae.RunTitle;
62 btnSet.Visibility = Visibility.Collapsed;
63 btnCancel.Visibility = Visibility.Collapsed;
70 Seci.Standard.Dae.SetTitle(txtEditTitle.Text);
72 btnSet.Visibility = Visibility.Collapsed;
73 btnCancel.Visibility = Visibility.Collapsed;
77 txtTitle.Text =
"Updating...";
83 txtTitle.Text = Seci.Standard.Dae.RunTitle;
84 btnSet.Visibility = Visibility.Collapsed;
85 btnCancel.Visibility = Visibility.Collapsed;
93 if (expander1.IsExpanded)
95 mainGrid.Visibility = Visibility.Visible;
97 RaiseEvent(newEventArgs);
101 mainGrid.Visibility = Visibility.Collapsed;
103 RaiseEvent(newEventArgs);
111 txtInst.Text = Seci.Definitions.Status.Instrument.ToUpper();
113 if (Seci.Standard.Dae.RunNumber == null)
116 txtStatus.Text =
"UNKNOWN";
121 txtRunNum.Text = Regex.Replace(Seci.Standard.Dae.RunNumber,
@"^0*",
"");
124 if (Seci.Standard.Dae.RunStatus ==
"SETUP")
126 txtRunNumLabel.Text =
"Next Run";
130 txtRunNumLabel.Text =
"Run";
134 DateTime time = DateTime.Now;
135 txtTime.Text = time.ToShortTimeString() +
" " + time.Day +
" " + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(time.Month) +
" " + time.Year;
136 txtUsers.Text = Seci.Standard.Dae.UserName;
139 if (txtEditTitle.Visibility == Visibility.Visible && btnSet.Visibility == Visibility.Collapsed)
142 txtEditTitle.Text = Seci.Standard.Dae.RunTitle;
145 else if (txtTitle.Visibility == Visibility.Visible)
147 txtTitle.Text = Seci.Standard.Dae.RunTitle;
151 txtRunTime.Text = Seci.Standard.Dae.RunDurationTotal;
152 txtFrames.Text = Seci.Standard.Dae.GoodFramesTotal +
" / " + Seci.Standard.Dae.RawFramesTotal;
156 txtCurrTotal.Text = Seci.Standard.Dae.CountRate;
157 txtMonCounts.Text = Seci.Standard.Dae.TotalDaeCounts;
158 txtShutter.Text = Seci.Standard.BeamLogger.GetKickerStatus();
162 txtCurrTotal.Text = Seci.Standard.Dae.BeamCurrent +
" / " + Seci.Standard.Dae.TotalUAmps;
163 txtShutter.Text = Seci.Standard.BeamLogger.GetShutterStatus();
164 if (txtShutter.Text.ToLower() !=
"open")
172 txtMonCounts.Text = Seci.Standard.Dae.MonitorCounts;
175 txtPeriod.Text = Seci.Standard.Dae.CurrentPeriod +
" of " + Seci.Standard.Dae.NumberOfPeriods;
180 string status = runStatus.ToUpper();
181 txtStatus.Text = status;
188 brush =
new SolidColorBrush(Colors.Yellow);
191 brush =
new SolidColorBrush(Colors.LightGreen);
194 brush =
new SolidColorBrush(Colors.LightBlue);
197 brush =
new SolidColorBrush(Colors.Red);
200 brush =
new SolidColorBrush(Colors.Goldenrod);
203 brush =
new SolidColorBrush(Colors.Goldenrod);
206 brush =
new SolidColorBrush(Colors.RoyalBlue);
209 brush =
new SolidColorBrush(Colors.RoyalBlue);
212 brush =
new SolidColorBrush(Colors.White);
216 topRow.Background = brush;
void btnSet_Click(object sender, RoutedEventArgs e)
void setStatusColour(String runStatus)
void btnCancel_Click(object sender, RoutedEventArgs e)
static readonly RoutedEvent OnExpandedEvent
void txtTitle_TextChanged(object sender, TextChangedEventArgs e)
override Boolean IsExpanded()
void expander1_StateChanged(object sender, RoutedEventArgs e)
override void UpdateControl()
Boolean _codeChangingTitle
static readonly RoutedEvent OnUnexpandedEvent
Interaction logic for StandardDashboard.xaml