public static void Init(string[] args) { bool useSetting = args.Length == 0; foreach (string op in args) { if (op.StartsWith("--setting")) { useSetting = true; break; } } Parse(args); if (!File.Exists(Options.setting)) { list.Save(Options.setting); } if (useSetting) { list = OptionList.Load(Options.setting); } }
public void CanGenerateCorrectSelectionData() { OptionList options = GetSampleOptions(); VariantList target = new VariantList(); MerchantTribeApplication mtapp = MerchantTribeApplication.InstantiateForMemory(new RequestContext()); List <OptionSelectionList> data = mtapp.CatalogServices.VariantsGenerateAllPossibleSelections(options); Assert.IsNotNull(data, "Data should not be null"); Assert.AreEqual(6, data.Count, "There should be six possible combinations"); List <string> keys = new List <string>(); foreach (OptionSelectionList o in data) { string k = OptionSelection.GenerateUniqueKeyForSelections(o); keys.Add(k); } Assert.AreEqual(6, keys.Count, "Key Count should be six."); Assert.IsTrue(keys.Contains("1-101|2-201|"), "Keys should contain 1-101|2-201|"); Assert.IsTrue(keys.Contains("1-101|2-202|"), "Keys should contain 1-101|2-202|"); Assert.IsTrue(keys.Contains("1-101|2-203|"), "Keys should contain 1-101|2-203|"); Assert.IsTrue(keys.Contains("1-102|2-201|"), "Keys should contain 1-102|2-201|"); Assert.IsTrue(keys.Contains("1-102|2-202|"), "Keys should contain 1-102|2-202|"); Assert.IsTrue(keys.Contains("1-102|2-203|"), "Keys should contain 1-102|2-203|"); }
private void addOption(Option newOpt) { switch (ModItem.ItemCategory) { case Category.Panty: newOpt.BodyMeshes.Add(new BodyMesh(BodyMeshType.Torso)); newOpt.BodyMeshes.Add(new BodyMesh(BodyMeshType.Groin)); break; case Category.Bra: newOpt.BodyMeshes.Add(new BodyMesh(BodyMeshType.Breast)); break; case Category.Gloves: newOpt.BodyMeshes.Add(new BodyMesh(BodyMeshType.Arm)); newOpt.BodyMeshes.Add(new BodyMesh(BodyMeshType.FingerNail)); break; case Category.Shoes: newOpt.BodyMeshes.Add(new BodyMesh(BodyMeshType.Leg)); newOpt.BodyMeshes.Add(new BodyMesh(BodyMeshType.ToeNail)); break; } newOpt.Name = "Option_" + (OptionList.Count + 1); OptionList.Add(newOpt); this.optionsBox.SelectedItem = newOpt; UpdateDisplayForItem(); }
public CmdLineSettings() { // Set the program details ProgramDescription = "Author: ing. M. Behrens. 2019,2020 \n" + "MSG64 gateway application.\n" + "Creates a bridge between a physical interface and a Mosquitto broker."; ProgramName = Assembly.GetExecutingAssembly().GetName().Name; ProgramVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); // Add all to the main option list. OptionList.Add(Device); OptionList.Add(Baudrate); OptionList.Add(Background); OptionList.Add(WinTerm); OptionList.Add(NoNotice); OptionList.Add(NoWarming); OptionList.Add(NoError); OptionList.Add(NoCritical); OptionList.Add(BrokerAddress); OptionList.Add(ServerTopic); AddStandardVersionOption(); // add default show version AddStandardHelpOption(); // add default help AddStandardShowConfigOption(); // add default showconfig }
public async Task <IActionResult> PutOptionList([FromRoute] int id, [FromBody] OptionList optionList) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != optionList.Id) { return(BadRequest()); } _context.Entry(optionList).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OptionListExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public TesterOptions(OptionList options) { ReadMode = options.GetValueAsEnum <ReadMode>("ReadMode"); BufferLength = options.GetValueAsInt("BufferLength", 100); BinStopCode = (byte)options.GetValueAsInt("BinStopCode"); StopEnding = options.GetValueAsString("StopEnding"); }
public void CreateOptionListTest() { var optionList = new OptionList { name = "sample list", elements = new List <Option>() { new Option() { displayName = "sample name", value = "sample value" } } }; OptionList returnedList = null; try { returnedList = _helper.CreateOptionList(optionList); Assert.IsNotNull(returnedList); } finally { if (returnedList != null) { _helper.DeleteOptionList(returnedList.id); } } }
public ActionData(IFile file, IActionPropertySet inputSet, OptionList options) { m_file = file; m_actionProps = new ActionPropertySet(inputSet); IActionProperty actionPropertyName = new ActionProperty("FileName", typeof(System.String), PropertyDisplayType.Default, false, false, m_file.FileName, true); IActionProperty actionPropertyDisplay = new ActionProperty("DisplayName", typeof(System.String), PropertyDisplayType.Default, false, false, m_file.DisplayName, true); IActionProperty actionPropertyType = new ActionProperty("FileType", typeof(System.String), PropertyDisplayType.Default, false, false, FileTypeBridge.GetFileType(m_file.FileType), true); m_actionProps.SystemProperties["FileName"] = actionPropertyName; m_actionProps.SystemProperties["DisplayName"] = actionPropertyDisplay; m_actionProps.SystemProperties["FileType"] = actionPropertyType; m_properties["FileName"] = actionPropertyName.Value.ToString(); m_properties["DisplayName"] = actionPropertyDisplay.Value.ToString(); m_properties["FileType"] = actionPropertyType.Value.ToString(); foreach (KeyValuePair<string, IActionProperty> prop in m_actionProps) { if (options.Contains(prop.Key)) prop.Value.Value = options[prop.Key].Checked; } if (m_actionProps.ContainsKey("HandleFootnotesHiddenData") && options.Contains("Footnotes") && options["Footnotes"].Checked) { m_actionProps["HandleFootnotesHiddenData"].Value = true; } FileName = m_file.FileName; }
public TreeViewSampleWpf() { InitializeComponent(); DataContext = this; var root = ItemGenerator.GetTree(); AddItem(treeView1.Items, root); AddItem(treeView2.Items, root); options = new OptionList(); options.AddOption("Enabled", treeView1, treeView2, l => l.IsEnabled); options.Add(new GenericBoolOption( "FullRowSelect", () => TreeViewService.GetFullRowSelect(treeView1), v => { TreeViewService.SetFullRowSelect(treeView1, v); TreeViewService.SetFullRowSelect(treeView2, v); })); options.Add(new GenericIntOption( "ItemHeight", () => itemHeight, v => { itemHeight = v; SetItemHeight(treeView1.Items, itemHeight > 0 ? (double?)itemHeight : null); SetItemHeight(treeView2.Items, itemHeight > 0 ? (double?)itemHeight : null); })); }
private void LoadDictionary() { dicListOptions = new Dictionary <string, List <OptionList> >(); //TODO: ESTO DEBE VENIR DE ELA BASE DE DATOS var lst = new List <OptionList>(); var option = new OptionList { ListId = "LST_GENERO", Value = "M", Description = "Masculino" }; lst.Add(option); option = new OptionList { ListId = "LST_GENERO", Value = "F", Description = "Femenino" }; lst.Add(option); option = new OptionList { ListId = "LST_GENERO", Value = "O", Description = "Otros" }; lst.Add(option); dicListOptions.Add("LST_GENERO", lst); }
public DataGridSampleWpf() { InitializeComponent(); DataContext = this; Items = new ItemsCollection(); var options = new OptionList(); options.AddOption("Enabled", dataGrid, l => l.IsEnabled); options.AddOption("Multiple Rows", dataGrid, c => c.SelectionMode, DataGridSelectionMode.Extended, DataGridSelectionMode.Single); options.AddOption("Full Row Select", dataGrid, c => c.SelectionUnit, DataGridSelectionUnit.FullRow, DataGridSelectionUnit.CellOrRowHeader); options.AddEnumOption("Grid Lines", dataGrid, c => c.GridLinesVisibility); options.AddEnumOption("Headers", dataGrid, c => c.HeadersVisibility); options.AddOption("Wide Row Header", dataGrid, c => c.RowHeaderWidth, 25, double.NaN); options.AddOption("Frozen Columns", dataGrid, c => c.FrozenColumnCount); options.AddOption("Row Details", dataGrid, c => c.RowDetailsVisibilityMode, DataGridRowDetailsVisibilityMode.Visible, DataGridRowDetailsVisibilityMode.Collapsed); Options = options; }
/// <summary> /// Sets the controls according to the options. /// </summary> public void OptionsToControls(OptionList options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } try { lvCustomOptions.BeginUpdate(); lvCustomOptions.Items.Clear(); foreach (KeyValuePair <string, string> pair in options) { lvCustomOptions.Items.Add(CreateOptionItem(pair.Key, pair.Value)); } if (lvCustomOptions.Items.Count > 0) { lvCustomOptions.Items[0].Selected = true; } } finally { lvCustomOptions.EndUpdate(); } }
public List <OptionList> RetrieveById(OptionList option) { try { if (option.ListId == "LST_TIPO_HABITACIONES") { return(LoadTipoHabitaciones()); } if (option.ListId == "LST_HOTEL") { return(LoadHoteles()); } if (option.ListId == "LST_ROL") { return(LoadRoles()); } else if (dicListOptions.ContainsKey(option.ListId)) { return(dicListOptions[option.ListId]); } } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } return(new List <OptionList>());; }
private void deselect_Click(object sender, EventArgs e) { for (int i = 0; i < OptionList.Items.Count; i++) { OptionList.SetItemChecked(i, false); } }
private static void label_classifier(string datacfg, string filename, string weightfile) { int i; Network net = Parser.parse_network_cfg(filename); Network.set_batch_network(net, 1); if (string.IsNullOrEmpty(weightfile)) { Parser.load_weights(net, weightfile); } var options = OptionList.read_data_cfg(datacfg); string labelList = OptionList.option_find_str(options, "names", "Data.Data/labels.list"); string testList = OptionList.option_find_str(options, "test", "Data.Data/train.list"); int classes = OptionList.option_find_int(options, "classes", 2); string[] labels = Data.Data.get_labels(labelList); string[] paths = Data.Data.GetPaths(testList); int m = paths.Length; for (i = 0; i < m; ++i) { Image im = LoadArgs.load_image_color(paths[i], 0, 0); Image resized = LoadArgs.resize_min(im, net.W); Image crop = LoadArgs.crop_image(resized, (resized.W - net.W) / 2, (resized.H - net.H) / 2, net.W, net.H); float[] pred = Network.network_predict(net, crop.Data); int ind = Utils.max_index(pred, classes); Console.Write($"%s\n", labels[ind]); } }
private void BindItemData(GridView itemsview, int TopicID) { DataTable table = (DataTable) this.ViewState["dtcount"]; DataRow[] rowArray = table.Select("TopicID=" + TopicID); object obj2 = table.Compute("sum(SubmitNum)", "TopicID=" + TopicID); int num = 0; if (obj2.ToString() != "") { num = int.Parse(obj2.ToString()); } ArrayList list = new ArrayList(); for (int i = 0; i < rowArray.Length; i++) { string str = rowArray[i]["Name"].ToString(); int num3 = int.Parse(rowArray[i]["SubmitNum"].ToString()); OptionList list2 = new OptionList { name = str, count = num3.ToString(), totalcount = num.ToString() }; list.Add(list2); } itemsview.DataSource = list; itemsview.DataBind(); }
private OptionList GetSampleOptions() { OptionList result = new OptionList(); MerchantTribe.Commerce.Catalog.Option option1 = Option.Factory(OptionTypes.DropDownList); option1.Name = "Color"; option1.Bvin = "1"; option1.IsShared = false; option1.IsVariant = true; option1.Items.Add(new OptionItem() { Bvin = "101", Name = "Red", OptionBvin = "1", SortOrder = 1, IsLabel = false }); option1.Items.Add(new OptionItem() { Bvin = "102", Name = "Green", OptionBvin = "1", SortOrder = 2, IsLabel = false }); result.Add(option1); MerchantTribe.Commerce.Catalog.Option option2 = Option.Factory(OptionTypes.RadioButtonList); option2.Name = "Size"; option2.Bvin = "2"; option2.IsShared = false; option2.IsVariant = true; option2.Items.Add(new OptionItem() { Bvin = "201", Name = "S", OptionBvin = "2", SortOrder = 1, IsLabel = false }); option2.Items.Add(new OptionItem() { Bvin = "202", Name = "M", OptionBvin = "2", SortOrder = 2, IsLabel = false }); option2.Items.Add(new OptionItem() { Bvin = "203", Name = "L", OptionBvin = "2", SortOrder = 3, IsLabel = false }); result.Add(option2); return result; }
/// <summary> /// Adds the options to the list. /// </summary> public override void AddToOptionList(OptionList options) { base.AddToOptionList(options); options["UseStorageConn"] = UseStorageConn.ToLowerString(); options["Connection"] = Connection; options["MaxQueueSize"] = MaxQueueSize.ToString(); }
//public static select GetSelectDom(string name_dom_object, OptionList ListItems, string selected_option_value = null, bool input_readonly = false, bool required = false, bool groups_only = true, bool groups_clickable = true) => GetSelectDom(name_dom_object, ListItems, new string[] { selected_option_value }, input_readonly, required); public static select GetSelectDom(string name_dom_object, OptionList ListItems, string[] selected_option_values = null, bool input_readonly = false, bool required = false, bool groups_only = true, bool groups_clickable = true) { select ret_select = new select() { Name_DOM = name_dom_object }; if (selected_option_values is null) { selected_option_values = new string[] { "0" }; ListItems.ListItems.Insert(0, new DataTreeItem() { Disabled = true, Tag = "элемент-заглушка", Title = "Выбор значения...", Tooltip = "Выберете значение", Value = "0" }); } WriteSelectDom(ref ret_select.Childs, ListItems.ListItems, selected_option_values, groups_only, groups_clickable); if (required) { ret_select.SetAttribute("required", null); } if (input_readonly) { ret_select.CustomAttributes.Add("readonly", null); } return(ret_select); }
public BaseVideoPreset() : base() { OptionList resolutons = new OptionList("resolutions"); resolutons.Description = "Video Resolution"; resolutons.Values.Add("Same as input", ""); resolutons.Values.Add("320 x 240 (4:3)", "-vf scale=320:240"); resolutons.Values.Add("640 x 480 (4:3)", "-vf scale=640:480"); resolutons.Values.Add("720 x 480 (4:3 NTSC DVD)", "-vf scale=720:480 -aspect 4:3"); resolutons.Values.Add("720 x 480 (16:9 NTSC DVD)", "-vf scale=720:480 -aspect 16:9"); resolutons.Values.Add("720 x 576 (4:3 PAL DVD)", "-vf scale=720:576 -aspect 4:3"); resolutons.Values.Add("720 x 576 (16:9 PAL DVD)", "-vf scale=720:576 -aspect 16:9"); resolutons.Values.Add("800 x 600 (4:3)", "-vf scale=800:600"); resolutons.Values.Add("854 x 480 (16:9)", "-vf scale=854:480"); resolutons.Values.Add("1280 x 720 (16:9)", "-vf scale=1280:720"); resolutons.Values.Add("1920 x 1080 (16:9)", "-vf scale=1920:1080"); resolutons.Values.Add("3840 x 2160 (16:9)", "-vf scale=3840:2160"); resolutons.SelectedIndex = 0; OptionList framerate = new OptionList("framerate"); framerate.Description = "Video Framerate"; framerate.Values.Add("Same as input", ""); framerate.Values.Add("24 fps", "-framerate 24"); framerate.Values.Add("25 fps", "-framerate 25"); framerate.Values.Add("29.97 fps", "-framerate 29.97"); framerate.Values.Add("30 fps", "-framerate 30"); framerate.Values.Add("50 fps", "-framerate 50"); framerate.Values.Add("59.94 fps", "-framerate 59.94"); framerate.Values.Add("60 fps", "-framerate 60"); framerate.SelectedIndex = 0; Controls.Add(resolutons); Controls.Add(framerate); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public PostgreCAO(OptionList options) : base(options) { UseStorageConn = options.GetValueAsBool("UseStorageConn", true); Connection = options.GetValueAsString("Connection"); MaxQueueSize = options.GetValueAsInt("MaxQueueSize", ModuleUtils.DefaultQueueSize); }
/// <summary> /// Merges the product option. /// </summary> //[TestMethod] public void MergeProductOption() { //Arrange var prj = GetRootProduct(); var lst = _irepoproductchoice.GetProductOptionList(); var oplst = new OptionList(); foreach (var op in lst) { var obj = prj.Options.FirstOrDefault(x => x.Name.Equals(op)); if (obj == null) { var op1 = new Option { StoreId = _application.CurrentStore.Id, IsShared = false, IsVariant = false, Name = op, }; op1.SetProcessor((OptionTypes)200); oplst.Add(op1); } else { oplst.Add(obj); } } //Act _application.CatalogServices.ProductOptions.MergeList(prj.Bvin, oplst); //Assert var prj1 = GetRootProduct(); Assert.AreEqual(lst.Count, prj1.Options.Count); }
public static List <ProductAtrributeOptionsViewModel> GetProductAtrributeOptionById(int id) { ResponseViewModel <ProductAtrributeOptionsViewModel> viewModel = new ResponseViewModel <ProductAtrributeOptionsViewModel>(); List <ProductAtrributeOptionsViewModel> attributeOptionViewModelList = new List <ProductAtrributeOptionsViewModel>(); using (EcommerceEntities entities = new EcommerceEntities()) { List <ProductAttributeOption> options = new List <ProductAttributeOption>(); List <ProductAttribute> attributes = new List <ProductAttribute>(); List <OptionList> optionsList = null; attributes = entities.ProductAttributes.Where(entry => entry.ProductSubCategoryID == id).ToList(); foreach (var attribute in attributes) { ProductAtrributeOptionsViewModel attributeOptionViewModel = new ProductAtrributeOptionsViewModel(); attributeOptionViewModel.attributeName = attribute.Name; attributeOptionViewModel.attributeId = Convert.ToInt32(attribute.ID); options = entities.ProductAttributeOptions.Where(entry => entry.ProductAtrributeID == attribute.ID).ToList(); if (options != null) { optionsList = new List <OptionList>(); foreach (var option in options) { OptionList optionViewModel = new OptionList(); optionViewModel.optionName = option.Value; optionViewModel.optionId = Convert.ToInt32(option.ID); optionsList.Add(optionViewModel); } } attributeOptionViewModel.optionList = optionsList; attributeOptionViewModelList.Add(attributeOptionViewModel); } return(attributeOptionViewModelList); } }
public void SetConfig(CCModConfig.Item modItem, ModelType modelType) { ModItem = modItem; currentModelType = modelType; BindingSource bodyFormatSource = new BindingSource(); bodyFormatSource.DataSource = ModPackGui.formatList; this.comboBoxBodyFormat.DataSource = bodyFormatSource; BindingSource nailFormatSource = new BindingSource(); nailFormatSource.DataSource = ModPackGui.formatList; this.comboNailFormat.DataSource = nailFormatSource; this.optionsBox.SelectedItem = null; OptionList.Clear(); foreach (Option opt in ModItem.Options) { OptionList.Add(opt); } this.textBoxIcon.Text = ModItem.Icon; if (ModItem.Icon != null) { this.iconGraphic.ImageLocation = Path.Combine(ModPackGui.WorkspaceDirectory, ModItem.Icon); } this.textBoxPreview.Text = ModItem.Preview; if (ModItem.Preview != null) { this.previewGraphic.ImageLocation = Path.Combine(ModPackGui.WorkspaceDirectory, ModItem.Preview); } }
/// <summary> /// Add a system level list by key/value options /// </summary> /// <param name="name"></param> /// <param name="options"></param> public void AddSystemLevelList(string name, IEnumerable <Option> options) { var list = new OptionList(name); list.AddOptions(options.ToArray()); Lists[name] = list; }
/// <summary> /// Add a system level selection list by string values /// </summary> /// <param name="name"></param> /// <param name="values"></param> public void AddSystemLevelList(string name, IEnumerable <string> values) { var list = new OptionList(name); list.AddValues(values.ToArray()); Lists[name] = list; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public DataSourceConfig() { Active = false; Code = ""; Name = ""; Driver = ""; CustomOptions = new OptionList(); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public ArchiveConfig() { Active = false; Code = ""; Name = ""; Kind = ArchiveKind.Unspecified; CustomOptions = new OptionList(); }
public void AddToOptionList(OptionList options) { options.Clear(); options["ReadMode"] = ReadMode.ToString(); options["BufferLength"] = BufferLength.ToString(); options["BinStopCode"] = BinStopCode.ToString(); options["StopEnding"] = StopEnding; }
/// <summary> /// Initializes a new instance of the class. /// </summary> public TcpServerChannelOptions(OptionList options) { TcpPort = options.GetValueAsInt("TcpPort", 502); // Modbus port ClientLifetime = options.GetValueAsInt("ClientLifetime", 60); Behavior = options.GetValueAsEnum("Behavior", ChannelBehavior.Master); ConnectionMode = options.GetValueAsEnum("ConnectionMode", ConnectionMode.Individual); DeviceMapping = options.GetValueAsEnum("DeviceMapping", DeviceMapping.ByIPAddress); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public UdpChannelOptions(OptionList options) { LocalUdpPort = options.GetValueAsInt("LocalUdpPort", 1); RemoteUdpPort = options.GetValueAsInt("RemoteUdpPort", 1); RemoteIpAddress = options.GetValueAsString("RemoteIpAddress"); Behavior = options.GetValueAsEnum("Behavior", ChannelBehavior.Master); DeviceMapping = options.GetValueAsEnum("DeviceMapping", DeviceMapping.ByIPAddress); }
/// <summary> /// Initializes a new instance of the class. /// </summary> public SchemeOptions(OptionList options) { ArgumentNullException.ThrowIfNull(options, nameof(options)); RefreshRate = options.GetValueAsInt("RefreshRate", 1000); ScaleType = options.GetValueAsEnum("ScaleType", ScaleType.Numeric); ScaleValue = options.GetValueAsDouble("ScaleValue", 100) / 100; RememberScale = options.GetValueAsBool("RememberScale", true); }
private void CreateFighter() { var options = OptionList.Where(o => o.Selected).Select(o => o.Name); _fighter = _fighterFactory.CreateFighter(Lives, AttackValue, DefenseValue, options); _canCreateFighter = false; CreateFighterCommand.RaiseCanExecuteChanged(); }
/// <summary> /// Creates the ComicsScreen /// </summary> public ComicsScreen() { SnapStream.Logging.WriteLog("Comics Plugin Started"); System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.FileInfo fi = new System.IO.FileInfo( a.Location ); _homeDirectory = fi.DirectoryName; // Create a new updater //_updater = new ComicsUpdater(); SingletonComicsUpdater.Instance.Initialize( fi.DirectoryName ); // Register the handler for changing days daysChanged.Execute += new CommandExecuteHandler( daysChanged_Execute ); // Text Objects // Show the instructions _instructions = new TextWindow(); Add( _instructions ); // Create the viewer window for the comics _comicsViewer = new VariableItemList(); Add( _comicsViewer ); // Sort by option _sortBy = new OptionList(); _sortBy.DefaultItemTextHeightPercent = 0.5; OptionListItem byWhat = new OptionListItem("Sort By"); byWhat.AddSelectorItem("Date","Date"); byWhat.AddSelectorItem("Comic","Comic"); _sortBy.AddItem(byWhat); Add ( _sortBy ); byWhat.SelectorValueChanged += new SelectorValueChangedEventHandler( sortBy_SelectorValueChanged ); _sortBy.Visible = false; _comicsViewer.ItemActivated += new ItemActivatedEventHandler(ComicsViewer_ItemActivated); _comicsViewer.Visible = true; _comicsViewer.Focus(); _comicsViewer.Height = 480; this.Render(); _comicsViewer.HighlightItemImage = String.Empty; _comicsViewer.DefaultItemImage = String.Empty; return; }
public static bool ContainsInvalidSelectionForOptions(OptionList options, List<OptionSelection> selections) { // Checks to see if a list of selection data contains a selection // that isn't a valid variant in a list of options bool result = false; foreach( OptionSelection sel in selections) { if (!options.ContainsVariantSelection(sel)) { return true; } } return result; }
public void TestOptionsBelongToWord() { OptionList list = new OptionList(); FileType[] types = { FileType.WordDocument, FileType.WordDocumentX, FileType.WordDocumentMacroX, FileType.WordDocumentTemplateX, FileType.WordDocumentMacroTemplateX }; foreach (FileType type in types) { //Assert.IsTrue(list["Footnotes"].Filetypes.Contains(type)); //Assert.IsTrue(list["DocumentStatistics"].Filetypes.Contains(type)); Assert.IsTrue(list["BuiltInProperties"].Filetypes.Contains(type)); Assert.IsFalse(list["Headers"].Filetypes.Contains(type)); Assert.IsFalse(list["Footers"].Filetypes.Contains(type)); Assert.IsTrue(list["SmartTags"].Filetypes.Contains(type)); Assert.IsTrue(list["Template"].Filetypes.Contains(type)); Assert.IsTrue(list["CustomProperties"].Filetypes.Contains(type)); Assert.IsTrue(list["DocumentVariables"].Filetypes.Contains(type)); Assert.IsTrue(list["Fields"].Filetypes.Contains(type)); Assert.IsTrue(list["Macros"].Filetypes.Contains(type)); Assert.IsTrue(list["RoutingSlip"].Filetypes.Contains(type)); Assert.IsFalse(list["SpeakerNotes"].Filetypes.Contains(type)); Assert.IsFalse(list["Links"].Filetypes.Contains(type)); Assert.IsTrue(list["Reviewers"].Filetypes.Contains(type)); Assert.IsTrue(list["TrackChanges"].Filetypes.Contains(type)); Assert.IsTrue(list["Comments"].Filetypes.Contains(type)); Assert.IsTrue(list["SmallText"].Filetypes.Contains(type)); Assert.IsTrue(list["WhiteText"].Filetypes.Contains(type)); //Assert.IsTrue(list["Authors"].Filetypes.Contains(type)); Assert.IsTrue(list["HiddenText"].Filetypes.Contains(type)); Assert.IsFalse(list["HiddenSlides"].Filetypes.Contains(type)); Assert.IsTrue(list["AutoVersion"].Filetypes.Contains(type)); Assert.IsTrue(list["Versions"].Filetypes.Contains(type)); } }
public void TestContains() { OptionList list = new OptionList(); Assert.IsTrue(list.Contains("Footnotes")); Assert.IsTrue(list.Contains("DocumentStatistics")); Assert.IsTrue(list.Contains("BuiltInProperties")); Assert.IsTrue(list.Contains("Headers")); Assert.IsTrue(list.Contains("Footers")); Assert.IsTrue(list.Contains("SmartTags")); Assert.IsTrue(list.Contains("Template")); Assert.IsTrue(list.Contains("CustomProperties")); Assert.IsTrue(list.Contains("DocumentVariables")); Assert.IsTrue(list.Contains("Fields")); Assert.IsTrue(list.Contains("Macros")); Assert.IsTrue(list.Contains("RoutingSlip")); Assert.IsTrue(list.Contains("SpeakerNotes")); Assert.IsTrue(list.Contains("Links")); Assert.IsTrue(list.Contains("Reviewers")); Assert.IsTrue(list.Contains("TrackChanges")); Assert.IsTrue(list.Contains("Comments")); Assert.IsTrue(list.Contains("SmallText")); Assert.IsTrue(list.Contains("WhiteText")); Assert.IsTrue(list.Contains("Authors")); Assert.IsTrue(list.Contains("HiddenText")); Assert.IsTrue(list.Contains("HiddenSlides")); Assert.IsTrue(list.Contains("AutoVersion")); Assert.IsTrue(list.Contains("Versions")); Assert.IsTrue(list.Contains("Markups")); Assert.IsTrue(list.Contains("Properties")); Assert.IsTrue(list.Contains("Attachments")); Assert.IsTrue(list.Contains("Bookmarks")); Assert.IsFalse(list.Contains("something")); }
private bool InitialiseOptionList(bool all, List<string> include, List<string> exclude) { OptionList validList = new OptionList(); if (!all) { foreach (string item in include) { if (!validList.Contains(item)) return false; } Options.AddRange(include); } else { foreach (string item in exclude) { if (!validList.Contains(item)) return false; } if (!exclude.Contains("Footnotes")) Options.Add("Footnotes"); if (!exclude.Contains("DocumentStatistics")) Options.Add("DocumentStatistics"); if (!exclude.Contains("BuiltInProperties")) Options.Add("BuiltInProperties"); if (!exclude.Contains("Headers")) Options.Add("Headers"); if (!exclude.Contains("Footers")) Options.Add("Footers"); if (!exclude.Contains("SmartTags")) Options.Add("SmartTags"); if (!exclude.Contains("Template")) Options.Add("Template"); if (!exclude.Contains("CustomProperties")) Options.Add("CustomProperties"); if (!exclude.Contains("DocumentVariables")) Options.Add("DocumentVariables"); if (!exclude.Contains("Fields")) Options.Add("Fields"); if (!exclude.Contains("Macros")) Options.Add("Macros"); if (!exclude.Contains("RoutingSlip")) Options.Add("RoutingSlip"); if (!exclude.Contains("SpeakerNotes")) Options.Add("SpeakerNotes"); if (!exclude.Contains("Links")) Options.Add("Links"); if (!exclude.Contains("Reviewers")) Options.Add("Reviewers"); if (!exclude.Contains("TrackChanges")) Options.Add("TrackChanges"); if (!exclude.Contains("Comments")) Options.Add("Comments"); if (!exclude.Contains("SmallText")) Options.Add("SmallText"); if (!exclude.Contains("WhiteText")) Options.Add("WhiteText"); if (!exclude.Contains("Authors")) Options.Add("Authors"); if (!exclude.Contains("HiddenText")) Options.Add("HiddenText"); if (!exclude.Contains("HiddenSlides")) Options.Add("HiddenSlides"); if (!exclude.Contains("AutoVersion")) Options.Add("AutoVersion"); if (!exclude.Contains("Versions")) Options.Add("Versions"); } return true; }
public Control CreateControl(ControlType controlType) { var result = default(Control); switch (controlType) { case ControlType.FreeText: result = new FreeText { ControlType = ControlType.FreeText, Text = Resource.FreeTextDefaultText, FontSize = 12, Color = "#000000", Strong = false }; break; case ControlType.TextBox: result = new TextBox { ControlType = ControlType.TextBox, Label = Resource.TextBoxLabel, Size = 200, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { ValidationType = ValidationType.Required, IsRequired = false }, new ValidationRules.Length { ValidationType = ValidationType.Length } } }; break; case ControlType.Number: result = new Number { ControlType = ControlType.Number, Label = Resource.NumberLabel, Size = 200, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { ValidationType = ValidationType.Required, IsRequired = false }, new ValidationRules.Length { ValidationType = ValidationType.Length }, new ValidationRules.Number { ValidationType = ValidationType.Number } } }; break; case ControlType.Email: result = new Email { ControlType = ControlType.Number, Label = Resource.EmailLabel, Size = 200, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { ValidationType = ValidationType.Required, IsRequired = false }, new ValidationRules.Length { ValidationType = ValidationType.Length }, new ValidationRules.Email { ValidationType = ValidationType.Email } } }; break; case ControlType.FormattedNumber: result = new FormattedNumber { ControlType = ControlType.FormattedNumber, Label = Resource.FormattedNumberLabel, Separator = FormSettings.DEFAULT_FORMAT_SEPARATOR, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { ValidationType = ValidationType.Required, IsRequired = false }, new ValidationRules.FormattedNumber { ValidationType = ValidationType.FormattedNumber } } }; break; case ControlType.DropDown: result = new DropDown { ControlType = ControlType.DropDown, Label = Resource.DropDownLabel, Value = 0.ToString(), EmptyOption = new Option{Id = -1, Value = string.Empty}, Options = new List<Option> { new Option{Id = 1, Value = Resource.FirstOption}, new Option{Id = 2, Value = Resource.SecondOption}, new Option{Id = 3, Value = Resource.ThirdOption} }, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { IsRequired = false, ValidationType = ValidationType.Required } } }; break; case ControlType.CheckList: result = new CheckList { ControlType = ControlType.CheckList, Label = Resource.CheckListLabel, OptionLayoutType = OptionLayoutType.OneColumn, SelectedValues = new List<int>{}, Options = new List<Option> { new Option{Id = 1, Value = Resource.FirstOption}, new Option{Id = 2, Value = Resource.SecondOption}, new Option{Id = 3, Value = Resource.ThirdOption} }, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { IsRequired = false, ValidationType = ValidationType.Required } } }; break; case ControlType.OptionList: result = new OptionList { ControlType = ControlType.OptionList, Label = Resource.OptionListLabel, OptionLayoutType = OptionLayoutType.OneColumn, AllowOther = false, OtherValue = string.Empty, OtherOption = new Option { Id = -1, Value = Resource.OtherValue }, Options = new List<Option> { new Option{Id = 1, Value = Resource.FirstOption}, new Option{Id = 2, Value = Resource.SecondOption}, new Option{Id = 3, Value = Resource.ThirdOption} }, ValidationRules = new List<ValidationRule> { new ValidationRules.Required { IsRequired = false, ValidationType = ValidationType.Required } } }; break; default: throw new Exception(Resource.InvalidControlType); break; } return result; }
public void TestShouldShowOptionForFileList() { OptionList list = new OptionList(); File wordFile = new File(TEST_FOLDER + "small.doc", "small.doc"); File excelFile = new File(TEST_FOLDER + "small.xls", "small.xls"); File powerpointFile = new File(TEST_FOLDER + "test.ppt", "test.ppt"); Collection<IContainer> wrd_excel = new Collection<IContainer>(); Collection<IContainer> wrd_power = new Collection<IContainer>(); Collection<IContainer> wrd_excel_power = new Collection<IContainer>(); Collection<IContainer> excel_power = new Collection<IContainer>(); wrd_excel.Add(wordFile); wrd_excel.Add(excelFile); wrd_power.Add(wordFile); wrd_power.Add(powerpointFile); wrd_excel_power.Add(wordFile); wrd_excel_power.Add(excelFile); wrd_excel_power.Add(powerpointFile); excel_power.Add(excelFile); excel_power.Add(powerpointFile); Assert.IsTrue(list.ShouldShowOptionForFileList("Footnotes", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("Footnotes", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Footnotes", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("Footnotes", excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("DocumentStatistics", wrd_excel)); Assert.IsFalse(list.ShouldShowOptionForFileList("DocumentStatistics", wrd_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("DocumentStatistics", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("DocumentStatistics", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("BuiltInProperties", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("BuiltInProperties", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("BuiltInProperties", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("BuiltInProperties", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Headers", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("Headers", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Headers", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Headers", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Footers", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("Footers", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Footers", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Footers", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("SmartTags", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("SmartTags", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("SmartTags", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("SmartTags", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Template", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("Template", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Template", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("Template", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("CustomProperties", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("CustomProperties", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("CustomProperties", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("CustomProperties", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("DocumentVariables", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("DocumentVariables", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("DocumentVariables", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("DocumentVariables", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Fields", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("Fields", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Fields", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Fields", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Macros", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("Macros", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Macros", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Macros", excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("Macros", new Collection<IContainer> { powerpointFile })); Assert.IsTrue(list.ShouldShowOptionForFileList("RoutingSlip", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("RoutingSlip", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("RoutingSlip", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("RoutingSlip", excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("SpeakerNotes", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("SpeakerNotes", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("SpeakerNotes", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("SpeakerNotes", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Links", wrd_excel)); Assert.IsFalse(list.ShouldShowOptionForFileList("Links", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Links", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Links", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Reviewers", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("Reviewers", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Reviewers", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("Reviewers", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("TrackChanges", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("TrackChanges", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("TrackChanges", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("TrackChanges", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Comments", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("Comments", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Comments", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Comments", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("SmallText", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("SmallText", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("SmallText", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("SmallText", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("WhiteText", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("WhiteText", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("WhiteText", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("WhiteText", excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("Authors", wrd_excel)); Assert.IsFalse(list.ShouldShowOptionForFileList("Authors", wrd_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("Authors", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("Authors", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenText", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenText", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenText", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("HiddenText", excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("HiddenSlides", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenSlides", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenSlides", wrd_excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("HiddenSlides", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("AutoVersion", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("AutoVersion", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("AutoVersion", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("AutoVersion", excel_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Versions", wrd_excel)); Assert.IsTrue(list.ShouldShowOptionForFileList("Versions", wrd_power)); Assert.IsTrue(list.ShouldShowOptionForFileList("Versions", wrd_excel_power)); Assert.IsFalse(list.ShouldShowOptionForFileList("Versions", excel_power)); }
public void TestOptionsBelongToPDF() { OptionList list = new OptionList(); FileType[] types = { FileType.PDFDocument }; foreach (FileType type in types) { Assert.IsFalse(list["HiddenText"].Filetypes.Contains(type)); Assert.IsFalse(list["AutoVersion"].Filetypes.Contains(type)); Assert.IsFalse(list["Versions"].Filetypes.Contains(type)); Assert.IsFalse(list["HiddenSlides"].Filetypes.Contains(type)); Assert.IsTrue(list["Markups"].Filetypes.Contains(type)); Assert.IsTrue(list["Properties"].Filetypes.Contains(type)); Assert.IsTrue(list["Attachments"].Filetypes.Contains(type)); Assert.IsTrue(list["Bookmarks"].Filetypes.Contains(type)); } }
public void TestCount() { OptionList list = new OptionList(); Assert.AreEqual(list.Count, 28); }
public List<OptionSelectionList> VariantsGenerateAllPossibleSelections(OptionList options) { List<OptionSelectionList> data = new List<OptionSelectionList>(); List<Option> variantOptions = options.VariantsOnly(); if (variantOptions == null) return data; if (variantOptions.Count < 1) return data; OptionSelectionList selections = new OptionSelectionList(); GenerateVariantSelections(data, variantOptions, 0, selections); return data; }