Пример #1
0
            public bool StartConfigure(int startDays, int startHour, int durationDays, int endHour)
            {
                // 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          = "record -id $id -startdays $startdays -starthour $starthour -durationdays $durationdays -endhour $endhour";
                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);

                return(true);
            }
Пример #2
0
            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);
            }
Пример #3
0
            public bool StartConfigure(int startDays, int startHour, int durationDays, int endHour)
            {
                // 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 = "record -id $id -startdays $startdays -starthour $starthour -durationdays $durationdays -endhour $endhour";
                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);

                return true;
            }