in Tools/UIRecorder/UIRecorder/MainWindow.xaml.cs [61:117]
public static IntPtr RunOnUiThread(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
handled = false;
if (s_mainWin.IsRecording == true)
{
if (msg == (int)UiThreadTask.Active)
{
s_mainWin.gridTextRecording.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x40, 0x40));
s_mainWin.textBoxRecording.Text = "Active";
s_mainWin.gridTextRecording.UpdateLayout();
}
else if (msg == (int)UiThreadTask.XPathReady)
{
s_mainWin.gridTextRecording.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x40, 0x40, 0xff));
s_mainWin.textBoxRecording.Text = "XPath Ready";
s_mainWin.gridTextRecording.UpdateLayout();
}
else if (msg == (int)UiThreadTask.ActionAdded)
{
s_mainWin.gridTextRecording.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x40, 0xff, 0x40));
s_mainWin.textBoxRecording.Text = "UI Action Added";
s_mainWin.gridTextRecording.UpdateLayout();
}
else if (msg == (int)UiThreadTask.PauseRecording)
{
s_mainWin.gridTextRecording.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x80, 0x80, 0x80));
s_mainWin.gridTextRecording.UpdateLayout();
}
}
if (msg == (int)UiThreadTask.RemoveInspectNode)
{
s_mainWin.DeleteRecordedUiTask(s_inspectUi);
}
else if (msg == (int)UiThreadTask.UpdateTreeView)
{
if (s_mainWin.SelectChangedSource == UiSelectChangedSource.SelectChangeFinished)
{
lock (RecordedUiTask.s_lockRecordedUi)
{
if (RecordedUiTask.s_listRecordedUi.Count > 0)
{
// reset ItemsSource to null and s_listRecordedUi will force combobox value to update
s_mainWin.comboBoxRecordedUi.ItemsSource = null;
s_mainWin.comboBoxRecordedUi.ItemsSource = RecordedUiTask.s_listRecordedUi;
s_mainWin.comboBoxRecordedUi.SelectedIndex = RecordedUiTask.s_listRecordedUi.Count - 1;
s_mainWin.comboBoxRecordedUi.Items.Refresh();
s_mainWin.treeUiPath.Items.Refresh();
}
}
}
}
return IntPtr.Zero;
}