/// <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); }
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; }
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); })); }
static void Main(string[] args) { OptionList menu = new OptionList("System zarządzania"); menu.Add(new DishesPage("Dania")); menu.Add(new OrdersPage("Zamówienia")); menu.Add(new Exit("Wyjście")); menu.Start(); }
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 }
private void CreateOptions() { options.AddOption("Enabled", tabControl1, x => x.Enabled); //options.AddOption(tabControl1, "TCS_SCROLLOPPOSITE", x => x.); // 0x0001 options.AddOption("TCS_BOTTOM", tabControl1, x => x.Alignment, TabAlignment.Bottom, TabAlignment.Top); options.AddOption("TCS_RIGHT", tabControl1, x => x.Alignment, TabAlignment.Right, TabAlignment.Left); //options.AddOption(tabControl1, "TCS_MULTISELECT", x => x.); // 0x0004 options.AddOption("TCS_FLATBUTTONS", tabControl1, x => x.Appearance, TabAppearance.FlatButtons, TabAppearance.Normal); //options.AddOption(tabControl1, "TCS_FORCEICONLEFT", x => x.); // 0x0010 //options.AddOption(tabControl1, "TCS_FORCELABELLEFT", x => x.); // 0x0020 options.AddOption("TCS_HOTTRACK", tabControl1, x => x.HotTrack); //options.AddOption(tabControl1, "TCS_VERTICAL", x => x.); // 0x0080 options.AddOption("TCS_TABS", tabControl1, x => x.Tabs); // 0x0000 options.AddOption("TCS_BUTTONS", tabControl1, x => x.Appearance, TabAppearance.Buttons, TabAppearance.Normal); //options.AddOption(tabControl1, "TCS_SINGLELINE", x => x.); // 0x0000 options.AddOption("TCS_MULTILINE", tabControl1, x => x.Multiline); //options.AddOption(tabControl1, "TCS_RIGHTJUSTIFY", x => x.); // 0x0000 options.AddOption("TCS_FIXEDWIDTH", tabControl1, x => x.SizeMode, TabSizeMode.Fixed, TabSizeMode.Normal); options.AddOption("TCS_RAGGEDRIGHT", tabControl1, x => x.SizeMode, TabSizeMode.Normal, TabSizeMode.FillToRight); //options.AddOption(tabControl1, "TCS_FOCUSONBUTTONDOWN", x => x.); // 0x1000 options.AddOption("TCS_OWNERDRAWFIXED", tabControl1, x => x.DrawMode, TabDrawMode.OwnerDrawFixed, TabDrawMode.Normal); options.AddOption("TCS_TOOLTIPS", tabControl1, x => x.ShowToolTips); //options.AddOption(tabControl1, "TCS_FOCUSNEVER", x => x.); // 0x8000 //options.AddOption(tabControl1, "TCS_EX_FLATSEPARATORS", x => x.); // 0x00000001 //options.AddOption(tabControl1, "TCS_EX_REGISTERDROP", x => x.); // 0x00000002 options.Add(new GenericBoolOption("Single Tab", GetSingleTab, SetSingleTab)); }
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); } }
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(); }
private void CreateOptions() { options.Add(new IntControlOption <ProgressBar>( new ProgressBar[] { progressBar7 }, "MarqueeSpeed", c => c.MarqueeAnimationSpeed, (c, v) => c.MarqueeAnimationSpeed = v)); }
public TabControlSampleWpf() { InitializeComponent(); options.AddOption("Enabled", tabControl1, l => l.IsEnabled); options.AddOption("Tabs Right", tabControl1, l => l.TabStripPlacement, Dock.Right, Dock.Left); options.AddOption("Tabs Bottom", tabControl1, l => l.TabStripPlacement, Dock.Bottom, Dock.Top); options.Add(new GenericBoolOption("Single Tab", GetSingleTab, SetSingleTab)); }
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> /// OptionListにoptionを追加する。 /// nameが重複していれば追加せずに置き換える。 /// </summary> /// <param name="option"></param> private void AddOption(UsiOption option) { for (int i = 0; i < OptionList.Count; ++i) { if (OptionList[i].Name == option.Name) { OptionList[i] = option; return; } } OptionList.Add(option); }
public ListViewSampleWpf() { InitializeComponent(); foreach (var item in ItemGenerator.Generate()) { var tuple = Tuple.Create(item[0], item[1], item[2]); lv1.Items.Add(tuple); lv2.Items.Add(tuple); } options = new OptionList(); options.AddOption("Enabled", lv1, l => l.IsEnabled); options.AddOption("Enabled", lv2, l => l.IsEnabled); options.Add(new GenericBoolOption( "GridView", () => lv1.View is GridView, v => { lv1.View = v ? gridView1 : null; lv2.View = v ? gridView2 : null; })); }
public bool GenerateOption(OptionMetadata optionMetadata, IServiceProvider services) { if (optionMetadata == null) { throw new ArgumentNullException(nameof(optionMetadata)); } Console.Write("Processing option '{0}'", optionMetadata?.Label?.UserLocalizedLabel?.Label); string metadataName = ServiceHelper.TransformMetadataName(optionMetadata?.Label?.UserLocalizedLabel?.Label); if (string.IsNullOrWhiteSpace(metadataName)) { Console.WriteLine(" ... ignored."); return(false); } else if (OptionList.Contains(metadataName)) { Console.WriteLine(" ... ignored because '{0}' already exists in the option list."); return(false); } else { Console.WriteLine(" ... added as '{0}'.", metadataName); OptionList.Add(metadataName); optionMetadata.Label.UserLocalizedLabel.Label = metadataName; foreach (LocalizedLabel ll in optionMetadata.Label.LocalizedLabels) { ll.Label = metadataName; } return(true); } }
public void Add <T>(T model) { var theType = model.GetType().Name; switch (theType) { case "User": UsersList.Add(model as User); return; case "News": NewsesList.Add(model as Dal.Models.News); return; case "Category": CategoriesList.Add(model as Category); return; case "Magazine": MagazinesList.Add(model as Magazine); return; case "SmartLink": SmartLinksList.Add(model as SmartLink); return; case "Comment": CommentsList.Add(model as Comment); return; case "Visit": VisitsList.Add(model as Visit); return; case "NewsLetter": NewsLettersList.Add(model as NewsLetter); return; case "Slider": SlidersList.Add(model as Slider); return; case "Slide": SlidesList.Add(model as Slide); return; case "UserMagazine": UserMagazinesList.Add(model as UserMagazine); return; case "State": StatesList.Add(model as State); return; case "City": CitiesList.Add(model as City); return; case "Media": MediasList.Add(model as Media); return; case "Report": ReportsList.Add(model as Report); return; case "Vote": VotesList.Add(model as Vote); return; case "Advertise": AdvertisesList.Add(model as Advertise); return; case "AdCategory": AdCategoriesList.Add(model as AdCategory); return; case "Galery": GaleriesList.Add(model as Galery); return; case "GaleryImage": GaleryImagesList.Add(model as GaleryImage); return; case "Image": ImagesList.Add(model as Image); return; case "KeyPoint": KeyPointsList.Add(model as KeyPoint); return; case "KeyPointsContainer": KeyPointsContainersList.Add(model as KeyPointsContainer); return; case "Quiz": QuizesList.Add(model as Quiz); return; case "Question": QuestionsList.Add(model as Question); return; case "Answer": AnswersList.Add(model as Answer); return; case "Option": OptionList.Add(model as Option); return; case "ItemList": ItemsListList.Add(model as ItemList); return; default: throw new Exception("The type " + theType + " is not supported."); } }