/// <summary> /// Interface function to drive setting of data fields and return results upstream /// </summary> /// <param name="device"></param> /// <param name="assetInfo"></param> /// <param name="pluginExecutionData"></param> /// <returns>result</returns> public DataPair <string> SetFields(JediDevice device, AssetInfo assetInfo, Framework.Plugin.PluginExecutionData data) { _failedSettings = new StringBuilder(); var result = ExecuteJob(device, assetInfo, data); return(new DataPair <string> { Key = _failedSettings.ToString(), Value = result }); }
/// <summary> /// Execution Entry point /// Individual function differences separated into delagate methods. /// </summary> /// <param name="device"></param> /// <param name="assetInfo"></param> /// <param name="data"></param> /// <returns></returns> public bool ExecuteJob(JediDevice device, AssetInfo assetInfo, Framework.Plugin.PluginExecutionData data) { ITraySettingsApp traySettingsApp = TraySettingsAppFactory.Create(device); try { NetworkCredential cred = new NetworkCredential("admin", device.AdminPassword); AuthenticationCredential auhcred = new AuthenticationCredential(cred); IAuthenticator auth = AuthenticatorFactory.Create(device, auhcred, AuthenticationProvider.Auto); if (CheckExecuteStatus(_traySettings)) { traySettingsApp.Launch(auth, AuthenticationMode.Lazy); traySettingsApp.ManageTraySettings(this._traySettings); } return(true); } catch (Exception ex) { _failedSettings.AppendLine($"Failed to set field speed Dial: {ex.Message}"); throw new DeviceWorkflowException("Manage Trays cannot be created."); } }
/// <summary> /// Execution Entry point /// Individual function differences separated into delagate methods. /// </summary> /// <param name="device"></param> /// <param name="assetInfo"></param> /// <param name="data"></param> /// <returns></returns> public bool ExecuteJob(JediDevice device, AssetInfo assetInfo, Framework.Plugin.PluginExecutionData data) { IContactsApp contactsApp = ContactsAppFactory.Create(device); try { if (DisplayName.Value) { NetworkCredential cred = new NetworkCredential("admin", device.AdminPassword); AuthenticationCredential auhcred = new AuthenticationCredential(cred); IAuthenticator auth = AuthenticatorFactory.Create(device, auhcred, AuthenticationProvider.Auto); contactsApp.Launch(auth, AuthenticationMode.Lazy); int speedDialNumber; speedDialNumber = contactsApp.CreateSpeedDial(DisplayName.Key, SpeedDialNumber.Key, FaxNumbers.Key); } } catch (Exception ex) { _failedSettings.AppendLine($"Failed to set field speed Dial: {ex.Message}"); throw new DeviceWorkflowException("Speed dial cannot be created.", ex); } return(true); }
/// <summary> /// ManageTraysSettings utilizes the UI and not available web settings. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="ChangeValue"></param> /// <param name="device"></param> /// <param name="data"></param> /// <param name="urn"></param> /// <param name="endpoint"></param> /// <param name="assetInfo"></param> /// <param name="activity"></param> /// <param name="pluginExecutionData"></param> /// <returns>Success bool</returns> public bool UpdateField <T>(Func <WebServiceTicket, WebServiceTicket> changeValue, JediDevice device, DataPair <T> data, string urn, string endpoint, AssetInfo assetInfo, string fieldChanged, Framework.Plugin.PluginExecutionData pluginData) { throw new NotImplementedException(); }