private void UpdateUsersAndSites(Instrument settings) { if (settings.Type == DeviceType.GBPLS) // GBPlus also has no sites or users. { return; } // Set the instrument's users. _instCtrlr.SetUsers(settings.Users); Master.Instance.SwitchService.Instrument.Users = settings.Users; if (settings.Type == DeviceType.MX6 || settings.Type == DeviceType.SC) { // Calling setUsers on an MX6 instrument (tested with v4.10.02) will clear the active // user once the instrument is undocked if it is not reset. Therefore, the active user // must always be set to avoid having to check if the users need to change on the // instrument in the first place. LogUpdate("ActiveUser", settings.ActiveUser, Master.Instance.SwitchService.Instrument.ActiveUser); _instCtrlr.SetActiveUser(settings.ActiveUser); Master.Instance.SwitchService.Instrument.ActiveUser = settings.ActiveUser; } // Set the instrument's sites. _instCtrlr.SetSites(settings.Sites); Master.Instance.SwitchService.Instrument.Sites = settings.Sites; if (settings.Type == DeviceType.MX6 || settings.Type == DeviceType.SC) { // Calling setSites on an MX6 instrument (tested with v4.10.02) will clear the active // site once the instrument is undocked if it is not reset. Therefore, the active site // must always be set to avoid having to check if the sites need to change on the // instrument in the first place. LogUpdate("ActiveSite", settings.ActiveSite, Master.Instance.SwitchService.Instrument.ActiveSite); _instCtrlr.SetActiveSite(settings.ActiveSite); Master.Instance.SwitchService.Instrument.ActiveSite = settings.ActiveSite; } // INS-8548 RHP v7.5 - override the instrument specific "User Security Level" multioption with instrument's Activer User's security level if (settings.Type == DeviceType.VPRO) { if (settings.AccessLevel >= 0) { DeviceOption option = settings.Options.Find(op => op.Code.StartsWith("USL") && op.Enabled); if (option != null) { settings.Options.Remove(option); // settings.AccessLevel is a nullable short and input may varry from 0 to 10. // The Multi-option code mapptings are 0->USL0, 1 -> USL1 , and so on til 10->USLA. Hence the conversion ToString("X") settings.Options.Add(new DeviceOption("USL" + (settings.AccessLevel ?? 0).ToString("X"), true)); LogUpdate("UserSecurityLevel", settings.AccessLevel, option.Code); } } } }