Skip to content

Commit 419d121

Browse files
Cleanup and more notes
1 parent 012fa46 commit 419d121

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

AlpacaDriverDemo/Program.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ namespace AlpacaDriverDemo
1212
{
1313
public class Program
1414
{
15+
//ToDo
1516
//Fill this with your driver name
1617
internal const string DriverID = "Alpaca.CustomDevice";
1718

1819
//Change this to a unique value
1920
//You should offer a way for the end user to customize this via the command line so it can be changed in the case of a collision.
21+
//This supports --urls=http://*:port by default.
2022
internal const int DefaultPort = 1234;
2123

2224
//Fill these out
@@ -32,10 +34,14 @@ public class Program
3234
public static void Main(string[] args)
3335
{
3436
//First fill in information for your driver in the Alpaca Configuration Class. Some of these you may want to store in a user changeable settings file.
37+
//The fill in the ToDos in this file. Each is marked with a //ToDo
38+
//You shouldn't need to do anything in the Startup and Logging or Finish Building and Start Server regions
3539

3640
//For Debug ConsoleLogger is very nice. For production TraceLogger is recommended.
3741
Logger = new ASCOM.Tools.ConsoleLogger();
3842

43+
44+
#region Startup and Logging
3945
Logger.LogInformation($"{ServerName} version {ServerVersion}");
4046
Logger.LogInformation($"Running on: {RuntimeInformation.OSDescription}.");
4147

@@ -132,6 +138,10 @@ public static void Main(string[] args)
132138

133139
var builder = WebApplication.CreateBuilder(args);
134140

141+
#endregion
142+
143+
//ToDo you can add devices here
144+
135145
//Attach the logger
136146
ASCOM.Alpaca.Logging.AttachLogger(Logger);
137147

@@ -143,6 +153,8 @@ public static void Main(string[] args)
143153
//For each device you add you should add a setting page to the settings folder and an entry in the Shared NavMenu
144154
ASCOM.Alpaca.DeviceManager.LoadSafetyMonitor(0, new Drivers.BasicMonitor(), "Really Basic Safety Monitor", ServerSettings.GetDeviceUniqueId("SafetyMonitor", 0));
145155

156+
#region Finish Building and Start server
157+
146158
// Add services to the container.
147159
builder.Services.AddRazorPages();
148160
builder.Services.AddServerSideBlazor();
@@ -199,15 +211,20 @@ public static void Main(string[] args)
199211
}
200212
}
201213

214+
#endregion
215+
202216
Lifetime = app.Lifetime;
203217

204-
//Put code here that should run at shutdown
218+
//ToDo Put code here that should run at shutdown
205219
Lifetime.ApplicationStopping.Register(() =>
206220
{
207221
Logger.LogInformation($"{ServerName} Stopping");
208222
});
209223

224+
//Start the Alpaca Server
210225
app.Run();
226+
227+
211228
}
212229

213230
/// <summary>

0 commit comments

Comments
 (0)