ListItems getExampleData()
    {
        ListItems result = new ListItems();

        result.Add(new ListItem()
        {
            TextValue = "Item 1", OrderValue = 0
        });
        result.Add(new ListItem()
        {
            TextValue = "Item 5", OrderValue = 4
        });
        result.Add(new ListItem()
        {
            TextValue = "Item 3", OrderValue = 2
        });
        result.Add(new ListItem()
        {
            TextValue = "Item 4", OrderValue = 3
        });
        result.Add(new ListItem()
        {
            TextValue = "Item 2", OrderValue = 1
        });
        return(result);
    }
Exemplo n.º 2
0
 public override void OnOpening()
 {
     content = new ListItems();
     content.Add(new SingleItem
     {
         Label = "First Item"
         ,
         SuperTip = "The First Item"
         ,
         Image = ResizeImage.Resize(Properties.Resources.one, 16, 16)
     });
     content.Add(new SingleItem
     {
         Label = "Second Item"
         ,
         SuperTip = "The Second Item"
         ,
         Image = ResizeImage.Resize(Properties.Resources.two, 16, 16)
     });
     content.Add(new SingleItem
     {
         Label = "Third Item"
         ,
         SuperTip = "The Third Item"
         ,
         Image = ResizeImage.Resize(Properties.Resources.three, 16, 16)
     });
 }
Exemplo n.º 3
0
        public override void OnOpening()
        {
            AddinContext.ExcelApp.SheetChangeEvent += (a, e) => Ribbon.Invalidate();

            content = new ListItems();
            content.Add(new SingleItem {
                Label    = "First Item",
                SuperTip = "The first Item",
                Image    = ResizeImage.Resize(Properties.Resources.one, 16, 16)
            });
            content.Add(new SingleItem {
                Label    = "Second Item",
                SuperTip = "The second Item",
                Image    = ResizeImage.Resize(Properties.Resources.two, 16, 16)
            });
            content.Add(new SingleItem {
                Label    = "Third Item",
                SuperTip = "The third Item",
                Image    = ResizeImage.Resize(Properties.Resources.three, 16, 16)
            });
            content.Add(new SingleItem {
                Label    = "Fourth Item",
                SuperTip = "The fourth Item",
                Image    = ResizeImage.Resize(Properties.Resources.four, 16, 16)
            });
            content.Add(new SingleItem {
                Label    = "Fifth Item",
                SuperTip = "The fifth Item",
                Image    = ResizeImage.Resize(Properties.Resources.five, 16, 16)
            });

            GallerySelectedIndex = 0;

            this.CreateRibbonCommand(_commands);
        }
Exemplo n.º 4
0
        public MatchPlayersAdapter(IEnumerable <Player> homePlayers, IEnumerable <Player> awayPlayers, IEnumerable <LocalDB.Tables.Event> events) : base(new List <MatchPlayerItemModel>())
        {
            List <PlayerWithEventsModel> homePlayersWithEvents = CreatePlayerEventsModel(homePlayers, events);
            List <PlayerWithEventsModel> awayPlayersWithEvents = CreatePlayerEventsModel(awayPlayers, events);

            ListItems = homePlayersWithEvents.Zip(awayPlayersWithEvents, (h, a) => new MatchPlayerItemModel {
                HomePlayer = h, AwayPlayer = a
            }).ToList();

            if (homePlayersWithEvents.Count < awayPlayersWithEvents.Count)
            {
                for (int i = homePlayersWithEvents.Count; i < awayPlayersWithEvents.Count; i++)
                {
                    ListItems.Add(new MatchPlayerItemModel {
                        AwayPlayer = awayPlayersWithEvents[i]
                    });
                }
            }
            else
            {
                for (int i = awayPlayersWithEvents.Count; i < homePlayersWithEvents.Count; i++)
                {
                    ListItems.Add(new MatchPlayerItemModel {
                        HomePlayer = homePlayersWithEvents[i]
                    });
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        ///		Crea un nuevo elemento
        /// </summary>
        protected override bool NewItem()
        {
            FilesModelCollection files = new FilesModelCollection(Project);
            bool isUpdated             = false;

            // Obtiene los archivos de la lista
            foreach (PageListItemViewModel item in ListItems)
            {
                files.Add(item.File);
            }
            // Abre la ventana de selección de documentos
            if (DocWriterViewModel.Instance.ViewsController.SelectFilesProject
                    (Project, FileModel.DocumentType.Document,
                    files, out FilesModelCollection filesSelected) == SystemControllerEnums.ResultType.Yes)
            {
                // Limpia la lista
                ListItems.Clear();
                // Añade los elementos
                foreach (FileModel file in filesSelected)
                {
                    ListItems.Add(new PageListItemViewModel(file));
                }
                // Indica que ha habido modificaciones
                isUpdated = true;
            }
            // Devuelve el valor que indica si se ha dado alguno de alta
            return(isUpdated);
        }
Exemplo n.º 6
0
        private async Task CreateListItems()
        {
            try
            {
                var source  = new CancellationTokenSource();
                var results = await UserDialogs.Instance.LoadingDelayedAsync(_meetingHub.GetResults(_meeting.Id), source);

                if (results == null)
                {
                    return;
                }

                foreach (var e in Enum.GetValues(typeof(EvaluationItem)))
                {
                    var score = results.SingleOrDefault(x => x.EvaluationItem == (Data.EvaluationItem)e).Score;
                    var item  = new ListItemViewModel
                    {
                        Text       = e.ToString(),
                        DetailText = (score == null) ? "評価結果はありません" : $"{((double)score).ToString("0.0")} 点",
                        Image      = $"evaluation_{e.ToString().ToLower()}",
                        Selectable = false,
                    };
                    ListItems.Add(item);
                }
            }
            catch (AggregateException) { return; }
            catch (TaskCanceledException) { return; }
        }
Exemplo n.º 7
0
        void RefreshList()
        {
            var selectedItems = new List <string>();

            {
                foreach (var item in ListItems)
                {
                    if (item.Selected)
                    {
                        selectedItems.Add(item.Expression);
                    }
                }
            }

            ListItems.Clear();

            if (Revit.ActiveDBDocument != null)
            {
                using (var collector = new FilteredElementCollector(Revit.ActiveDBDocument))
                {
                    foreach (var family in collector.OfClass(typeof(Family)).Cast <Family>().OrderBy((x) => x.Name))
                    {
                        var item = new GH_ValueListItem(family.Name, family.Id.IntegerValue.ToString());
                        item.Selected = selectedItems.Contains(item.Expression);
                        ListItems.Add(item);
                    }
                }
            }
        }
Exemplo n.º 8
0
        internal override void Draw(int indexOffset)
        {
            if (ItemsCount < 1)
            {
                // Add a dummy item to prevent the other while loops from freezing the game.
                ListItems.Add("N/A");
            }

            while (ListIndex < 0)
            {
                ListIndex += ItemsCount;
            }

            while (ListIndex >= ItemsCount)
            {
                ListIndex -= ItemsCount;
            }

            if (HideArrowsWhenNotSelected && !Selected)
            {
                Label = GetCurrentSelection() ?? "~r~N/A";
            }
            else
            {
                Label = $"~s~← {GetCurrentSelection() ?? "~r~N/A~s~"} ~s~→";
            }

            base.Draw(indexOffset);
        }
Exemplo n.º 9
0
        public LayerFunction_ValueList()
        {
            Category    = "Revit";
            SubCategory = "Input";
            Name        = "Layer Function";
            NickName    = "LF";
            Description = "Picker for layer function of a wall compound structure layer";

            ListItems.Clear();
            ListItems.Add(
                new GH_ValueListItem("Structure", ((int)DB.MaterialFunctionAssignment.Structure).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Substrate", ((int)DB.MaterialFunctionAssignment.Substrate).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Insulation", ((int)DB.MaterialFunctionAssignment.Insulation).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Finish 1", ((int)DB.MaterialFunctionAssignment.Finish1).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Finish 2", ((int)DB.MaterialFunctionAssignment.Finish2).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Membrane", ((int)DB.MaterialFunctionAssignment.Membrane).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("StructuralDeck", ((int)DB.MaterialFunctionAssignment.StructuralDeck).ToString())
                );
        }
Exemplo n.º 10
0
        /// <summary>
        /// Get items from the list control
        /// </summary>
        /// <param name="list">list control</param>
        private void GetItemsFromListControl(GUIListControl list)
        {
            //make sure the list isn't in the progress of being filled (list count growing)
            int itemCount = 0;

            for (int i = 0; i < 20; i++)
            {
                Thread.Sleep(200);

                if (list.Count > 0 && list.Count == itemCount)
                {
                    break;
                }
                itemCount = list.Count;
            }

            WifiRemote.LogMessage("Retrieving " + itemCount + " dialog list items: ", WifiRemote.LogType.Debug);

            List <GUIListItem> items = list.ListItems;

            for (int i = 0; i < itemCount; i++)
            {
                FacadeItem item = new FacadeItem(list[i]);
                //WifiRemote.LogMessage("Add dialog list items: " + item.Label, WifiRemote.LogType.Debug);
                ListItems.Add(item);
            }
        }
Exemplo n.º 11
0
        protected override void CollectVolatileData_Custom()
        {
            var selectedItems = ListItems.Where(x => x.Selected).Select(x => x.Expression).ToList();

            ListItems.Clear();

            if (Revit.ActiveDBDocument is object)
            {
                foreach (var group in Revit.ActiveDBDocument.Settings.Categories.Cast <DB.Category>().GroupBy(x => x.CategoryType).OrderBy(x => x.Key))
                {
                    foreach (var category in group.OrderBy(x => x.Name).Where(x => CategoryIsInSet(x)))
                    {
                        if (category.CategoryType == DB.CategoryType.Invalid)
                        {
                            continue;
                        }

                        var item = new GH_ValueListItem(category.Name, category.Id.IntegerValue.ToString());
                        item.Selected = selectedItems.Contains(item.Expression);
                        ListItems.Add(item);
                    }
                }

                if (selectedItems.Count == 0 && ListMode != GH_ValueListMode.CheckList)
                {
                    foreach (var item in ListItems)
                    {
                        item.Selected = item.Expression == ((int)DefaultBuiltInCategory).ToString();
                    }
                }
            }

            base.CollectVolatileData_Custom();
        }
Exemplo n.º 12
0
        void RefreshList()
        {
            var selectedItems = ListItems.Where(x => x.Selected).Select(x => x.Expression).ToList();

            ListItems.Clear();

            if (Revit.ActiveDBDocument != null)
            {
                foreach (var group in Revit.ActiveDBDocument.Settings.Categories.Cast <Category>().GroupBy((x) => x.CategoryType).OrderBy((x) => x.Key))
                {
                    foreach (var category in group.OrderBy((x) => x.Name))
                    {
                        var item = new GH_ValueListItem(category.Name, category.Id.IntegerValue.ToString());
                        item.Selected = selectedItems.Contains(item.Expression);
                        ListItems.Add(item);
                    }
                }

                // Preselect OST_GenericModel category by default
                if (selectedItems.Count == 0 && ListMode != GH_ValueListMode.CheckList)
                {
                    foreach (var item in ListItems)
                    {
                        item.Selected = item.Expression == ((int)BuiltInCategory.OST_GenericModel).ToString();
                    }
                }
            }
        }
Exemplo n.º 13
0
        public void RefreshList()
        {
            var selectedItems = ListItems.Where(x => x.Selected).Select(x => x.Expression).ToList();

            ListItems.Clear();
            var profileNames = new HashSet <string>();
            var standards    = Bricscad.Bim.BIMProfile.GetAllProfileStandards(null);

            foreach (var standard in standards)
            {
                foreach (var entry in Bricscad.Bim.BIMProfile.GetAllProfileNames(standard, null))
                {
                    foreach (var profileName in entry.Value)
                    {
                        if (!profileNames.Contains(profileName))
                        {
                            var item = new GH_ValueListItem(profileName, "\"" + profileName + "\"");
                            item.Selected = selectedItems.Contains(item.Expression);
                            ListItems.Add(item);
                            profileNames.Add(profileName);
                        }
                    }
                }
            }
        }
        private async Task <List <ShoppingList> > GetAllShoppingLists()
        {
            var Url = "http://sync.jhonny.se/api/Values/";
            List <ShoppingList> model = new List <ShoppingList>();

            try
            {
                _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                Task <string> contentsTask = _client.GetStringAsync(Url);
                string        contents     = await contentsTask.ConfigureAwait(false);

                AllShoppingLists = JsonConvert.DeserializeObject <ObservableCollection <ShoppingList> >(contents);
                _activeList      = AllShoppingLists.First();
                ActiveListName   = _activeList.Name;
                foreach (var item in _activeList.Items.OrderBy(n => n.Name))
                {
                    ListItems.Add(item);
                }
            }
            catch (Exception ex)
            {
                var error = ex.Message;
            }
            return(model);
        }
Exemplo n.º 15
0
        public DummyPropertyPages()
        {
            Name                          = "Dummy Connection Settings".TLL();
            TemplateName                  = "Dummy Template Settings".TLL();
            Icon                          = ImageAccessor.GetIcon("Icon.png");
            HandledObjectType             = typeof(RoyalRDSConnection);
            SupportsConnectionCredentials = true;
            SupportsWindowMode            = true;

            // Dummy
            SourceListItem itemDummyCat = new SourceListItem("Dummy".TL())
            {
                IsCategory = true
            };

            InsertCommonCategoryAfter = itemDummyCat;

            IPropertyPage propPageDummyMain = new PropertyPageDummyMainController().InitPropertyPage() as IPropertyPage;

            itemDummyCat.MutableChildNodes.AddObject(propPageDummyMain.ListItem);

            // Set Properties
            DefaultItem = propPageDummyMain.ListItem;

            PropertyPages.Add(propPageDummyMain);

            ListItems.Add(itemDummyCat);
        }
        public WallLocationLine_ValueList()
        {
            Category    = "Revit";
            SubCategory = "Input";
            Name        = "Wall Location Line";
            NickName    = "WLL";
            Description = "Picker for builtin Wall location line options";

            ListItems.Clear();
            ListItems.Add(
                new GH_ValueListItem("Wall Centerline", ((int)DB.WallLocationLine.WallCenterline).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Core Centerline", ((int)DB.WallLocationLine.CoreCenterline).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Finish (Exterior Face)", ((int)DB.WallLocationLine.FinishFaceExterior).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Finish (Interior Face)", ((int)DB.WallLocationLine.FinishFaceInterior).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Core (Exterior Face)", ((int)DB.WallLocationLine.CoreExterior).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Core (Interior Face)", ((int)DB.WallLocationLine.CoreInterior).ToString())
                );
        }
Exemplo n.º 17
0
        void RefreshList()
        {
            var selectedItems = new List <string>();

            {
                foreach (var item in ListItems)
                {
                    if (item.Selected)
                    {
                        selectedItems.Add(item.Expression);
                    }
                }
            }

            ListItems.Clear();

            if (Revit.ActiveDBDocument != null)
            {
                using (var collector = new FilteredElementCollector(Revit.ActiveDBDocument))
                {
                    foreach (var level in collector.OfClass(typeof(Level)).ToElements().Cast <Level>().OrderByDescending((x) => x.Elevation))
                    {
                        var item = new GH_ValueListItem(level.Name, level.Id.IntegerValue.ToString());
                        item.Selected = selectedItems.Contains(item.Expression);
                        ListItems.Add(item);
                    }
                }
            }
        }
        /// <summary>
        /// Move the selected item to the UpDownListView
        /// </summary>
        public void Remove()
        {
            if (AvailableListItems == null || AvailableListItems.Count == 0)
            {
                return;
            }

            if (ListItems == null)
            {
                ListItems = new ObservableCollection <ListItem>();
            }

            var selectedIndex = 0;
            var count         = AvailableListItems.Count;

            for (int j = 0; j < count; j++)
            {
                selectedIndex = count - j - 1;
                ListItem item = AvailableListItems[selectedIndex];

                if (item.IsSelected == false)
                {
                    continue;
                }

                ListItems.Add(item);
                AvailableListItems.Remove(item);
            }
        }
Exemplo n.º 19
0
        void RefreshList()
        {
            var selectedItems = new List <string>();

            {
                foreach (var item in ListItems)
                {
                    if (item.Selected)
                    {
                        selectedItems.Add(item.Expression);
                    }
                }
            }

            ListItems.Clear();

            if (Revit.ActiveDBDocument != null)
            {
                foreach (var group in Revit.ActiveDBDocument.Settings.Categories.Cast <Category>().GroupBy((x) => x.CategoryType).OrderBy((x) => x.Key))
                {
                    foreach (var category in group.OrderBy((x) => x.Name))
                    {
                        var item = new GH_ValueListItem(category.Name, category.Id.IntegerValue.ToString());
                        item.Selected = selectedItems.Contains(item.Expression);
                        ListItems.Add(item);
                    }
                }
            }
        }
Exemplo n.º 20
0
 private void DoSaveItem()
 {
     Item.TaskName = this.TaskName;
     //Item.TaskContent = this.TaskContent;
     ListItems.Add(Item);
     GoBack();
 }
Exemplo n.º 21
0
        protected override void CollectVolatileData_Custom()
        {
            var selectedItems = ListItems.Where(x => x.Selected).Select(x => x.Expression).ToList();

            ListItems.Clear();

            if (Revit.ActiveDBDocument != null)
            {
                foreach (var group in Revit.ActiveDBDocument.Settings.Categories.Cast <Autodesk.Revit.DB.Category>().GroupBy(x => x.CategoryType).OrderBy(x => x.Key))
                {
                    foreach (var category in group.OrderBy(x => x.Name).Where(x => !x.IsHidden()))
                    {
                        if (CategoryType != CategoryType.Invalid && category.CategoryType != CategoryType)
                        {
                            continue;
                        }

                        var item = new GH_ValueListItem(category.Name, category.Id.IntegerValue.ToString());
                        item.Selected = selectedItems.Contains(item.Expression);
                        ListItems.Add(item);
                    }
                }

                // Preselect OST_GenericModel category by default
                if (selectedItems.Count == 0 && ListMode != GH_ValueListMode.CheckList)
                {
                    foreach (var item in ListItems)
                    {
                        item.Selected = item.Expression == ((int)DefaultBuiltInCategory).ToString();
                    }
                }
            }

            base.CollectVolatileData_Custom();
        }
Exemplo n.º 22
0
        private void SetAccountList()
        {
            ListItems.Clear();
            var accounts = AccountManager.GetAccounts();
            var defaultAccount = AccountManager.GetDefaultAccount();
            int index = 0, defaultAccountIndex = 0;

            if (accounts.ToList().Count == 0)
            {
                ListItems.Add(new GH_ValueListItem("No accounts where found on this machine. Right-click for more options.", ""));
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No accounts found. Please use the Speckle Manager to manage your accounts on this computer.");
                SelectItem(0);
                return;
            }

            foreach (var account in accounts)
            {
                if (defaultAccount != null && account.id == defaultAccount.id)
                {
                    defaultAccountIndex = index;
                }

                ListItems.Add(new GH_ValueListItem(account.ToString(), $"\"{account.id}\""));
                index++;
            }

            SelectItem(defaultAccountIndex);
        }
Exemplo n.º 23
0
        public DirectShapeCategories()
        {
            Category    = "Revit";
            SubCategory = "Build";
            Name        = "DirectShape.Categories";
            NickName    = "Categories";
            Description = "Provides a picker of a valid DirectShape category";

            ListItems.Clear();

            var ActiveDBDocument = Revit.ActiveDBDocument;

            if (ActiveDBDocument == null)
            {
                return;
            }

            var genericModel = Autodesk.Revit.DB.Category.GetCategory(ActiveDBDocument, BuiltInCategory.OST_GenericModel);

            var directShapeCategories = ActiveDBDocument.Settings.Categories.Cast <Category>().Where((x) => DirectShape.IsValidCategoryId(x.Id, ActiveDBDocument));

            foreach (var group in directShapeCategories.GroupBy((x) => x.CategoryType).OrderBy((x) => x.Key))
            {
                foreach (var category in group.OrderBy(x => x.Name))
                {
                    ListItems.Add(new GH_ValueListItem(category.Name, category.Id.IntegerValue.ToString()));
                    if (category.Id.IntegerValue == (int)BuiltInCategory.OST_GenericModel)
                    {
                        SelectItem(ListItems.Count - 1);
                    }
                }
            }
        }
Exemplo n.º 24
0
        /// <summary>Initializes a new instance of the <see cref="MoviePage"/> class.
        /// Adds the default template values for the movie. then calls the fillContent method
        /// </summary>
        public MoviePage()
        {
            InitializeComponent();

            string coverurl = "https://pdfimages.wondershare.com/forms-templates/medium/movie-poster-template-3.png";


            Genre genreName = new Genre()
            {
                GenreName = "Fetching"
            };

            ListItems.Add(
                new Movie
            {
                Title        = "Title: Fetching...",
                GenreName    = "Fetching",
                Genre        = genreName,
                DirectorName = "Fetching",
                WriterName   = "Fetching",
                StarName     = "Fetching",
                Summary      = "Summary: Fetching",
                CoverImage   = coverurl,
                Rating       = 5
            });


            //Loading the information sent from the onNavigateTo() parameters
            Loaded += (sender, args) => FillContentAsync(this);
        }
Exemplo n.º 25
0
        public WallFunction_ValueList()
        {
            Category    = "Revit";
            SubCategory = "Input";
            Name        = "Wall Function";
            NickName    = "WF";
            Description = "Picker for builtin predefined Wall functions";

            ListItems.Clear();
            ListItems.Add(
                new GH_ValueListItem("Interior", ((int)DB.WallFunction.Interior).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Exterior", ((int)DB.WallFunction.Exterior).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Foundation", ((int)DB.WallFunction.Foundation).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Retaining", ((int)DB.WallFunction.Retaining).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Soffit", ((int)DB.WallFunction.Soffit).ToString())
                );
            ListItems.Add(
                new GH_ValueListItem("Core-Shaft", ((int)DB.WallFunction.Coreshaft).ToString())
                );
        }
Exemplo n.º 26
0
 /// <summary>
 /// Initializes a new instance of InputList with a NameValueCollection allowing quick collection initializer.
 /// </summary>
 /// <param name="values">The NameValueCollection containing display texts and valid values.</param>
 /// <param name="required">Whether this field is required.</param>
 public InputList(NameValueCollection values, bool required = true)
 {
     Required = required;
     foreach (var key in values.AllKeys)
     {
         ListItems.Add(new SelectListItem(values[key], key));
     }
 }
Exemplo n.º 27
0
 /// <summary>
 /// Initializes a new instance of InputList with specified list of items that will be used for both the value and text.
 /// </summary>
 /// <param name="values">A list of string values reprenting valid values.</param>
 /// <param name="required">Whether this field is required.</param>
 public InputList(IEnumerable <string> values, bool required = true)
 {
     Required = required;
     foreach (var item in values)
     {
         ListItems.Add(new SelectListItem(item, item));
     }
 }
        private Controls.ListItem AddListItem(DeviceDescription device)
        {
            var listItem = new Controls.ListItem(device);

            ListItems.Add(listItem);

            return(listItem);
        }
Exemplo n.º 29
0
 public List <KeyValueItem> Add(params KeyValueItem[] items)
 {
     foreach (var item in items)
     {
         ListItems.Add(item);
     }
     return(ListItems);
 }
Exemplo n.º 30
0
        public MainPage()
        {
            InitializeComponent();

            ListItems.Add(new Grouping <string, string>("Star Wars", StarWarsItems));
            ListItems.Add(new Grouping <string, string>("Star Trek", StarTrekItems));

            BindingContext = this;
        }