public bool StartConfigure(Program.Mode programMode, int startDays, int startHour, int durationDays, int endHour, int debugMode) { // See if a charging device should be configured if (Mode != DeviceStatus.DeviceMode.Charging) { return(false); } Mode = DeviceStatus.DeviceMode.Configuring; // Create the command-line-interface wrapper Configure configure; string configCommand = @"omapi-examples.exe"; string args = null; if (programMode == Program.Mode.Setup) { args = "record -id $id -startdays $startdays -starthour $starthour -durationdays $durationdays -endhour $endhour -debugmode $debugmode"; } else if (programMode == Program.Mode.RechargeClear) { args = "clear -checkversion -timesync $id"; } else if (programMode == Program.Mode.Recharge) { args = "clear -noclear $id"; } if (args == null) { Console.WriteLine("ERROR: No command arguments."); return(false); } string basePath; //basePath = AppDomain.CurrentDomain.BaseDirectory; basePath = Path.GetDirectoryName(Application.ExecutablePath); configCommand = Path.Combine(basePath, configCommand); configure = new Configure(configCommand, args); configure.Completed += configure_Completed; // Begin background configure configure.ConfigureAsync(Id, startDays, startHour, durationDays, endHour, debugMode); return(true); }
public MainForm(string loadFile, Program.Mode programMode, bool autoAdd, int minBattery, int startDays, int startHour, int durationDays, int endHour, int debugMode) { InitializeComponent(); (new TextBoxStreamWriter(textBoxLog)).SetConsoleOut(); this.ProgramMode = programMode; this.autoAdd = autoAdd; this.MinBattery = minBattery; this.StartDays = startDays; this.StartHour = startHour; this.DurationDays = durationDays; this.EndHour = endHour; this.DebugMode = debugMode; this.Text = this.Text + " [" + this.ProgramMode + "]"; Console.WriteLine("Started."); }