/// <summary> /// Sets Paperless Print Mode to ON or OFF on the device /// </summary> /// <param name="paperlessModeOn"></param> /// <returns></returns> private bool SetPaperlessPrintMode(string ipAddress, string adminPassword) { JobMediaMode mode = PaperlessModeOn ? JobMediaMode.Paperless : JobMediaMode.Paper; bool success = false; try { using (var device = DeviceFactory.Create(ipAddress, adminPassword)) { try { IDeviceSettingsManager manager = DeviceSettingsManagerFactory.Create(device); success = manager.SetJobMediaMode(mode); } catch (DeviceFactoryCoreException) { return(false); } } } catch (Exception ex) { return(false); } return(success); }
public static void SetPaperlessMode(IPAddress ipaddress, bool paperlessModeOn) { JobMediaMode mode = paperlessModeOn ? JobMediaMode.Paperless : JobMediaMode.Paper; using (IDevice device = DeviceFactory.Create(ipaddress, "!QAZ2wsx")) { IDeviceSettingsManager manager = DeviceSettingsManagerFactory.Create(device); manager.SetJobMediaMode(mode); } Console.WriteLine(string.Format("Paperless mode was turned {0}.", paperlessModeOn ? "on" : "off")); }
public static bool SetPaperlessPrintMode(bool PaperlessModeOn, IDevice device) { JobMediaMode mode = PaperlessModeOn ? JobMediaMode.Paperless : JobMediaMode.Paper; bool success = false; try { IDeviceSettingsManager manager = DeviceSettingsManagerFactory.Create(device); success = manager.SetJobMediaMode(mode); } catch (DeviceFactoryCoreException) { return(false); } return(success); }
public static void SetPaperlessMode(string address, string adminPassword, bool paperlessModeOn) { JobMediaMode mode = paperlessModeOn ? JobMediaMode.Paperless : JobMediaMode.Paper; IPAddress ipaddress; if (IPAddress.TryParse(address, out ipaddress)) { using (IDevice device = DeviceFactory.Create(ipaddress, adminPassword)) { IDeviceSettingsManager manager = DeviceSettingsManagerFactory.Create(device); manager.SetJobMediaMode(mode); } MessageBox.Show(string.Format("Paperless mode was turned {0}.", paperlessModeOn ? "on" : "off")); } else { MessageBox.Show("IP address was invalid."); } }
public void ExecuteReboot() { JobMediaMode jobMediaModeNeeded = JobMediaMode.Paper; RebootDeviceActivityData activityData = _activityData; IDevice device = DeviceConstructor.Create(_deviceInfo); IDeviceSettingsManager settingsManager = DeviceSettingsManagerFactory.Create(device); if (activityData.JobMediaMode == JobMediaModeDesired.Preserve) { OnUpdateStatus("Getting job media mode because it will return to default after a reboot..."); jobMediaModeNeeded = settingsManager.GetJobMediaMode(); OnUpdateStatus($"Current job media mode is {jobMediaModeNeeded}."); } else { jobMediaModeNeeded = EnumUtil.Parse <JobMediaMode>(activityData.JobMediaMode.ToString()); } DateTime startTime = DateTime.Now; if (activityData.ShouldWaitForReady) { OnUpdateStatus("Reboot Begin"); } Reboot(activityData.ShouldWaitForReady); if (activityData.ShouldWaitForReady) { OnUpdateStatus("Reboot Complete"); ExecutionServices.SystemTrace.LogDebug($"Device rebooted"); if (jobMediaModeNeeded == JobMediaMode.Paperless) { OnUpdateStatus($"Setting job media mode to {jobMediaModeNeeded}."); settingsManager.SetJobMediaMode(JobMediaMode.Paperless); } } }