3 using System.Windows.Controls;
4 using System.Windows.Media;
5 using System.Globalization;
6 using System.Text.RegularExpressions;
22 InitializeComponent();
23 _brushWarning = (SolidColorBrush)this.FindResource(
"WarningTextBrush");
24 _brushNormal = (SolidColorBrush)this.FindResource(
"NormalTextBrush");
26 if (!Seci.Definitions.Status.EnableDashboardTitleEdit)
28 txtTitle.Visibility = System.Windows.Visibility.Visible;
29 txtEditTitle.Visibility = System.Windows.Visibility.Collapsed;
35 return expander1.IsExpanded;
42 if (btnSet.Visibility == Visibility.Collapsed)
44 btnSet.Visibility = Visibility.Visible;
45 btnCancel.Visibility = Visibility.Visible;
53 if (
_oldTitle.Trim() != Seci.Standard.Dae.RunTitle.Trim())
56 if (MessageBox.Show(
"The current run title has been changed to \"" + Seci.Standard.Dae.RunTitle +
57 "\" do you wish to replace it with your changes?",
"Title Changed During Edit",
58 MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
60 txtTitle.Text = Seci.Standard.Dae.RunTitle;
61 btnSet.Visibility = Visibility.Collapsed;
62 btnCancel.Visibility = Visibility.Collapsed;
69 Seci.Standard.Dae.SetTitle(txtEditTitle.Text);
71 btnSet.Visibility = Visibility.Collapsed;
72 btnCancel.Visibility = Visibility.Collapsed;
76 txtTitle.Text =
"Updating...";
82 txtTitle.Text = Seci.Standard.Dae.RunTitle;
83 btnSet.Visibility = Visibility.Collapsed;
84 btnCancel.Visibility = Visibility.Collapsed;
92 if (expander1.IsExpanded)
94 mainGrid.Visibility = Visibility.Visible;
96 RaiseEvent(newEventArgs);
100 mainGrid.Visibility = Visibility.Collapsed;
102 RaiseEvent(newEventArgs);
110 txtInst.Text = Seci.Definitions.Status.Instrument.ToUpper();
112 if (Seci.Standard.Dae.RunNumber == null)
115 txtStatus.Text =
"UNKNOWN";
120 txtRunNum.Text = Regex.Replace(Seci.Standard.Dae.RunNumber,
@"^0*",
"");
123 if (Seci.Standard.Dae.RunStatus ==
"SETUP")
125 txtRunNumLabel.Text =
"Next Run";
129 txtRunNumLabel.Text =
"Run";
133 DateTime time = DateTime.Now;
134 txtTime.Text = time.ToShortTimeString() +
" " + time.Day +
" " + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(time.Month) +
" " + time.Year;
135 txtUsers.Text = Seci.Standard.Dae.UserName;
138 if (txtEditTitle.Visibility == Visibility.Visible && btnSet.Visibility == Visibility.Visible)
140 if (
_oldTitle.Trim() != Seci.Standard.Dae.RunTitle.Trim())
142 txtEditTitle.Text = Seci.Standard.Dae.RunTitle;
143 btnSet.Visibility = Visibility.Collapsed;
144 btnCancel.Visibility = Visibility.Collapsed;
147 else if (txtEditTitle.Visibility == Visibility.Visible)
150 txtEditTitle.Text = Seci.Standard.Dae.RunTitle;
153 else if (txtTitle.Visibility == Visibility.Visible)
155 txtTitle.Text = Seci.Standard.Dae.RunTitle;
159 txtRunTime.Text = Seci.Standard.Dae.RunDurationTotal;
160 txtFrames.Text = Seci.Standard.Dae.GoodFramesTotal +
" / " + Seci.Standard.Dae.RawFramesTotal;
164 txtCurrTotal.Text = Seci.Standard.Dae.CountRate;
165 txtMonCounts.Text = Seci.Standard.Dae.TotalDaeCounts;
166 txtShutter.Text = Seci.Standard.BeamLogger.GetKickerStatus();
170 String curr = Seci.Standard.Dae.BeamCurrent;
171 String tot = Seci.Standard.Dae.TotalUAmps;
173 if (!curr.Contains(
"e") && curr.IndexOf(
'.') != -1 && curr.IndexOf(
'.') + 2 < curr.Length)
175 curr = curr.Substring(0, curr.IndexOf(
'.') + 2);
178 if (!tot.Contains(
"e") && tot.IndexOf(
'.') != -1 && tot.IndexOf(
'.') + 4 < tot.Length)
180 tot = tot.Substring(0, tot.IndexOf(
'.') + 4);
183 txtCurrTotal.Text = curr +
" / " + tot;
184 txtShutter.Text = Seci.Standard.BeamLogger.GetShutterStatus();
185 if (txtShutter.Text.ToLower() !=
"open")
193 txtMonCounts.Text = Seci.Standard.Dae.MonitorCounts;
196 txtPeriod.Text = Seci.Standard.Dae.CurrentPeriod +
" of " + Seci.Standard.Dae.NumberOfPeriods;
197 txtPeriodFrames.Text = Seci.Standard.Dae.GoodFramesPeriod +
" / " + Seci.Standard.Dae.RawFramesPeriod;
198 txtPeriodRunTime.Text = Seci.Standard.Dae.RunDurationPeriod;
203 string status = runStatus.ToUpper();
204 txtStatus.Text = status;
211 brush =
new SolidColorBrush(Colors.Yellow);
214 brush =
new SolidColorBrush(Colors.LightGreen);
217 brush =
new SolidColorBrush(Colors.LightBlue);
220 brush =
new SolidColorBrush(Colors.Red);
223 brush =
new SolidColorBrush(Colors.Goldenrod);
226 brush =
new SolidColorBrush(Colors.Goldenrod);
229 brush =
new SolidColorBrush(Colors.RoyalBlue);
232 brush =
new SolidColorBrush(Colors.RoyalBlue);
235 brush =
new SolidColorBrush(Colors.White);
239 topRow.Background = brush;
override Boolean IsExpanded()
Boolean _codeChangingTitle
void setStatusColour(String runStatus)
static readonly RoutedEvent OnExpandedEvent
override void UpdateControl()
void expander1_StateChanged(object sender, RoutedEventArgs e)
void btnSet_Click(object sender, RoutedEventArgs e)
Interaction logic for AlternativeDashboard.xaml
void btnCancel_Click(object sender, RoutedEventArgs e)
void txtTitle_TextChanged(object sender, TextChangedEventArgs e)
static readonly RoutedEvent OnUnexpandedEvent