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.Collapsed)
141 txtEditTitle.Text = Seci.Standard.Dae.RunTitle;
144 else if (txtTitle.Visibility == Visibility.Visible)
146 txtTitle.Text = Seci.Standard.Dae.RunTitle;
150 txtRunTime.Text = Seci.Standard.Dae.RunDurationTotal;
151 txtFrames.Text = Seci.Standard.Dae.GoodFramesTotal +
" / " + Seci.Standard.Dae.RawFramesTotal;
155 txtCurrTotal.Text = Seci.Standard.Dae.CountRate;
156 txtMonCounts.Text = Seci.Standard.Dae.TotalDaeCounts;
157 txtShutter.Text = Seci.Standard.BeamLogger.GetKickerStatus();
161 String curr = Seci.Standard.Dae.BeamCurrent;
162 String tot = Seci.Standard.Dae.TotalUAmps;
164 if (!curr.Contains(
"e") && curr.IndexOf(
'.') != -1 && curr.IndexOf(
'.') + 2 < curr.Length)
166 curr = curr.Substring(0, curr.IndexOf(
'.') + 2);
169 if (!tot.Contains(
"e") && tot.IndexOf(
'.') != -1 && tot.IndexOf(
'.') + 4 < tot.Length)
171 tot = tot.Substring(0, tot.IndexOf(
'.') + 4);
174 txtCurrTotal.Text = curr +
" / " + tot;
175 txtShutter.Text = Seci.Standard.BeamLogger.GetShutterStatus();
176 if (txtShutter.Text.ToLower() !=
"open")
184 txtMonCounts.Text = Seci.Standard.Dae.MonitorCounts;
187 txtTimeChannels.Text = Seci.Standard.Dae.NumberOfTimeChannels;
188 txtNumSpectra.Text = Seci.Standard.Dae.NumberOfSpectra;
189 txtDaeMemory.Text = Seci.Standard.Dae.DaeMemoryUsed;
190 txtTimingSource.Text = Seci.Standard.Dae.DaeTimingSource;
191 txtMethTemp.Text = Seci.Standard.BeamLogger.GetTs1MethaneTemp() +
"K";
196 string status = runStatus.ToUpper();
197 txtStatus.Text = status;
204 brush =
new SolidColorBrush(Colors.Yellow);
207 brush =
new SolidColorBrush(Colors.LightGreen);
210 brush =
new SolidColorBrush(Colors.LightBlue);
213 brush =
new SolidColorBrush(Colors.Red);
216 brush =
new SolidColorBrush(Colors.Goldenrod);
219 brush =
new SolidColorBrush(Colors.Goldenrod);
222 brush =
new SolidColorBrush(Colors.RoyalBlue);
225 brush =
new SolidColorBrush(Colors.RoyalBlue);
228 brush =
new SolidColorBrush(Colors.White);
232 topRow.Background = brush;
Interaction logic for PearlDashboard.xaml
static readonly RoutedEvent OnExpandedEvent
void txtTitle_TextChanged(object sender, TextChangedEventArgs e)
Boolean _codeChangingTitle
void btnCancel_Click(object sender, RoutedEventArgs e)
void setStatusColour(String runStatus)
void expander1_StateChanged(object sender, RoutedEventArgs e)
override Boolean IsExpanded()
void btnSet_Click(object sender, RoutedEventArgs e)
override void UpdateControl()
static readonly RoutedEvent OnUnexpandedEvent