/// <summary> /// Retrieves the new settings as a vif object. You will need to set the VM field to use these settings in a vif action /// </summary> /// <returns></returns> public VIF GetNewSettings() { var newVif = new VIF(); if (ExistingVif != null) { newVif.UpdateFrom(ExistingVif); } newVif.network = new XenRef <XenAPI.Network>(SelectedNetwork.opaque_ref); newVif.MAC = SelectedMac; newVif.device = Device.ToString(); if (checkboxQoS.Checked) { newVif.qos_algorithm_type = VIF.RATE_LIMIT_QOS_VALUE; } else if (ExistingVif != null && ExistingVif.qos_algorithm_type == VIF.RATE_LIMIT_QOS_VALUE) { newVif.qos_algorithm_type = ""; } // else ... we leave it alone. Currently we only deal with "ratelimit" and "", don't overwrite the field if it's something else // preserve this param even if we turn off qos if (!string.IsNullOrEmpty(promptTextBoxQoS.Text)) { newVif.qos_algorithm_params = new Dictionary <string, string> { { VIF.KBPS_QOS_PARAMS_KEY, promptTextBoxQoS.Text } } } ; return(newVif); }