2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Diagnostics.CodeAnalysis;
6using System.Runtime.CompilerServices;
7using System.Threading.Tasks;
9using System.Windows.Interop;
28 [SuppressMessage(
"ReSharper",
"MemberCanBePrivate.Global")]
33 INotifyPropertyChanged,
50 public System.Drawing.Icon
ButtonIcon {
get;
private set; } = Properties.Resources.MockNormal;
63 DoOnGUIThread(() => oneMore = MessageBox.Show(ownerWin,
"Start one more?",
65 MessageBoxButton.YesNo,
66 MessageBoxImage.Question) == MessageBoxResult.Yes);
91 var wih =
new WindowInteropHelper(win);
92 var winHandle = wih.EnsureHandle();
104 Helpers.
Debug.
TraceWrite($
"Just FYI: Standard sample lists are at {Helpers.Config.PathToSampleLists ?? "(N/A)
"} and methods are at {Helpers.Config.PathToMethods ?? "(N/A)
"}, the instrument config is at {Helpers.Config.PathToInstrumentConfig}");
106 System.Threading.Thread.Sleep(5000);
111 ExtendLastPlanner =
false,
112 StartAndWaitForEnd =
false,
113 SwitchToSchedulesView =
false,
114 RespectSelection =
false
119 System.Windows.Forms.MessageBox.Show(
Helpers.
Gui.
MainWindow,$
"Error: {ex.Message}",
"Plugin Provided Schedule",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Error);
135 win.AbortButton.Click += (s, e) =>
138 win.AbortButton.IsEnabled =
false;
140 abortWaiter.ContinueWith((t) =>
145 win.AbortButton.IsEnabled =
true;
159 win.StopButton.Click += (s, e) =>
161 win.StopButton.IsEnabled =
false;
163 stopWaiter.ContinueWith((t) =>
167 win.StopButton.IsEnabled =
true;
181 somePAL.Options.AlwaysResetAfterSequence =
false;
182 somePAL.Options.ResetBeforeSequence =
false;
192 mGuiFactory.StartNew(theAction).GetAwaiter().GetResult();
197 #region Sample List Access
210 #endregion Sample List Access
212 #region Implementation of IDirectDeviceAccess
227 PropertyChanged?.Invoke(
this,
new PropertyChangedEventArgs(propertyName));
239 for (var i = 1; i <= 5; ++i)
241 var fakePath = System.IO.Path.GetTempFileName();
242 System.IO.File.WriteAllText(fakePath, $
"Fake log entry in file {i} created at {DateTime.Now:hh:mm:ss} by {creator}");
243 yield
return fakePath;
Things provided by AxelSemrau Chronos - do not put your own code into this namespace.
Classes and interfaces that are meant for plugins. The classes and interfaces below this namespace ar...
delegate Exception RunSampleListHandler(object sender, RunSampleListEventArgs args)
Runs the given sample list.
The classes in this namespace demonstrate how to interact with the Chronos sample list.
Access to some parts of the core of the Chronos program.
static IScheduleQueue ExecutionQueue
The list of schedules that have run, are running or will be run.
void RemoveFailedPlanners()
Tries to remove failed planners. Use this if you are hiding the normal Chronos GUI from your user and...
Implement this interface if you need direct access to the list of configured devices.
Provides access to some options and configuration information for the PAL3 samplers even out of the s...
System.Threading.Tasks.TaskScheduler GuiThreadScheduler
Use this scheduler to do actions on the thread that owns the main GUI.
void OwnMyWindow(IntPtr handle)
Make the window with the given handle owned by the Chronos main window. This prevents it from droppin...
IWin32Window MainWindow
If you need to set the owner window yourself or want to show message boxes.
void TraceWrite(string text, params object[] arguments)
Write something to the Chronos trace log.
Static instance for access to utility functions and resources.
static IGuiHelper Gui
Utility functions for window handling.
static IDebugHelper Debug
Utility functions for debugging.
This can be called for a sample list worker or device that writes its own set of log files which shou...
Implement this interface with your device or sample list worker to get fine-grained control about sto...
Options for stopping the schedule/queue.
StopMode
Details how to stop the run.
For automatic generation of sample lists and running the resulting schedules.
Parameters for sample list loading and schedule creation.
Implement this interface in your sample list worker class if you need access to the content of cells.
Provides basic sample list information and lets you iterate over all lines.
Provides an endless supply of nonsense sample lists.
Func< StopRunArgs, Task > StopRun
Callback function returning a task that completes once the schedule queue was stopped.
Func< StopRunArgs, Task > mStopRun
virtual void OnPropertyChanged([CallerMemberName] string propertyName=null)
const string NormalButtonLabel
PropertyChangedEventHandler PropertyChanged
void HandleStopButton(ShowPluginIsInCharge win)
System.Drawing.Icon ButtonIcon
Shown in the button, preferred size 22x22.
void DoOnGUIThread(Action theAction)
Execute the specified action in the GUI thread's context.
bool OneMoreScheduleWanted(Window ownerWin)
Ask the user if he wants to start more schedules.
string ButtonCaption
Shown on the sample list page.
void HandleAbortButton(ShowPluginIsInCharge win)
RunSampleListHandler RunSampleList
IEnumerable< string > LogPaths
Provide full paths to each of your log files here.
void DoYourJob()
Take over control. When this function exits, Chronos is in charge again.
readonly TaskFactory mGuiFactory
static IEnumerable< string > GetFakeLogs(string creator)
Creates a few fake log files.
ISampleListAccessor SampleList
Here we get an helper that allows us to manipulate the current sample list.
IEnumerable< IDevice > ConfiguredDevices
List of IDevice for all configured devices in Chronos.
Example for communication with external programs.
static void StopService()
Interaction logic for ShowPluginIsInCharge.xaml.