public void RefreshOptions() { CustomOptions?.Clear(); if (this.typeConverter != null) { if (string.IsNullOrEmpty(UnmodifiedVariableName)) { throw new InvalidOperationException("UnmodifiedVariableName must be set first."); } var descriptor = new TypeDescriptorContext(UnmodifiedVariableName); var values = typeConverter.GetStandardValues(descriptor); List <object> valuesAsList = new List <object>(); if (values.Count != 0 && CustomOptions == null) { CustomOptions = new List <object>(); } foreach (var item in values) { CustomOptions.Add(item); } } }
private void BindApplicationSettings(IServiceCollection services) { var customOptions = new CustomOptions(); Configuration.GetSection(CustomOptions.SectionName).Bind(customOptions); services.AddSingleton(customOptions); }
public Valiente() { d_options = new CustomOptions(); d_nodes = new List <Node>(); d_mapping = new Dictionary <Node, Node>(); d_reverseMapping = new Dictionary <Node, List <Node> >(); }
/// <summary> /// Removes a title menu button. /// </summary> /// <param name="key"> /// The key of the button to remove. /// </param> public static void RemoveCustomTileButton(string key) { var removedItems = CustomOptions.Where(n => n.Key == key); foreach (var item in removedItems) { CustomOptions.Remove(item); } }
public JsonSerializingTests() { _options = new CustomOptions { ConfigureJsonSerializerSettings = (settings) => { settings.Converters.Add(new VersionJsonConverter()); } }; }
public DialogResult ShowDialog(Window parent) { var parentWindow = parent != null ? (Gtk.Window)parent.ControlObject : null; Control = new Gtk.PrintUnixDialog(string.Empty, parentWindow); if (parent != null) { Control.TransientFor = ((Gtk.Window)parent.ControlObject); Control.Modal = true; } const Gtk.PrintCapabilities caps = Gtk.PrintCapabilities.Preview | Gtk.PrintCapabilities.Collate | Gtk.PrintCapabilities.GeneratePdf | Gtk.PrintCapabilities.Copies | Gtk.PrintCapabilities.PageSet | Gtk.PrintCapabilities.GeneratePs | Gtk.PrintCapabilities.Scale | Gtk.PrintCapabilities.NumberUp | Gtk.PrintCapabilities.Reverse; var printSettingsHandler = (PrintSettingsHandler)PrintSettings.Handler; Control.PageSetup = PrintSettings.ToGtkPageSetup(); Control.PrintSettings = PrintSettings.ToGtkPrintSettings(); var customOptions = new CustomOptions(); customOptions.SelectionOnly.Active = printSettingsHandler.SelectionOnly; if (AllowSelection) { Control.AddCustomTab(customOptions, new Gtk.Label { Text = "Other Options" }); } NativeMethods.gtk_print_unix_dialog_set_embed_page_setup(Control.Handle, true); Control.ManualCapabilities = caps; Control.ShowAll(); var response = (Gtk.ResponseType)Control.Run(); Control.Hide(); Control.Unrealize(); printSettingsHandler.Set(Control.PrintSettings, Control.PageSetup, customOptions.SelectionOnly.Active); if (response == Gtk.ResponseType.Apply) { printSettingsHandler.ShowPreview = true; return(DialogResult.Ok); } return(response.ToEto()); }
public override void performButtonAction(string which) { base.performButtonAction(which); var customPressed = CustomOptions.Where(n => n.Key == which); foreach (var customAction in customPressed) { customAction.OnClick?.Invoke(this, which); } }
OptionFetcher <E> EnumFetcher <E>(CustomOptions options) { return((int i, out E v) => { if (options.TryGetInt32(i, out int value)) { v = (E)(object)value; return true; } else { v = default(E); return false; } }); }
/// <summary> /// Saves the configuration into the XML node. /// </summary> public void SaveToXml(XmlElement xmlElem) { if (xmlElem == null) { throw new ArgumentNullException(nameof(xmlElem)); } xmlElem.SetAttribute("active", Active); xmlElem.SetAttribute("isBound", IsBound); xmlElem.SetAttribute("number", CommLineNum); xmlElem.SetAttribute("name", Name); LineOptions.SaveToXml(xmlElem.AppendElem("LineOptions")); Channel.SaveToXml(xmlElem.AppendElem("Channel")); CustomOptions.SaveToXml(xmlElem.AppendElem("CustomOptions")); XmlElement devicePollingElem = xmlElem.AppendElem("DevicePolling"); foreach (DeviceConfig device in DevicePolling) { device.SaveToXml(devicePollingElem.AppendElem("Device")); } }
/// <summary> /// Loads the configuration from the XML node. /// </summary> public void LoadFromXml(XmlElement xmlElem) { if (xmlElem == null) { throw new ArgumentNullException(nameof(xmlElem)); } Active = xmlElem.GetAttrAsBool("active"); IsBound = xmlElem.GetAttrAsBool("isBound"); CommLineNum = xmlElem.GetAttrAsInt("number"); Name = xmlElem.GetAttrAsString("name"); if (xmlElem.SelectSingleNode("LineOptions") is XmlNode lineOptionsNode) { LineOptions.LoadFromXml(lineOptionsNode); } if (xmlElem.SelectSingleNode("Channel") is XmlElement channelElem) { Channel.LoadFromXml(channelElem); } if (xmlElem.SelectSingleNode("CustomOptions") is XmlNode customOptionsNode) { CustomOptions.LoadFromXml(customOptionsNode); } if (xmlElem.SelectSingleNode("DevicePolling") is XmlNode devicePollingNode) { foreach (XmlElement deviceElem in devicePollingNode.SelectNodes("Device")) { DeviceConfig deviceConfig = new DeviceConfig { Parent = this }; deviceConfig.LoadFromXml(deviceElem); DevicePolling.Add(deviceConfig); } } }
public async Task <IActionResult> HeaderTest() { var options = new CustomOptions { HeaderHtml = "http://localhost/header.html", PageOrientation = Wkhtmltopdf.NetCore.Options.Orientation.Landscape }; _generatePdf.SetConvertOptions(options); var data = new TestData { Text = "This is a test", Number = 123456 }; var pdf = await _generatePdf.GetByteArray("Views/Test.cshtml", data); var pdfStream = new System.IO.MemoryStream(); pdfStream.Write(pdf, 0, pdf.Length); pdfStream.Position = 0; return(new FileStreamResult(pdfStream, "application/pdf")); }
internal CustomOptions(CustomOptions copyFrom) : base(copyFrom) { this.CustomProperty = copyFrom.CustomProperty; }
/// <summary> /// Registers a new title menu to display on screen. /// </summary> /// <param name="button"> /// The button to add. /// </param> public static void RegisterNewTitleButton(CustomTitleOption button) { CustomOptions.Add(button); }
public AtawCustomOptionCreator() { fCustomOptions = new CustomOptions(); BaseOptions = fCustomOptions; }
public CustomOptionsController(CustomOptions customOptions) { _customOptions = customOptions; }