Inheritance: ObservableCollection
Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();

            this._WindowTestsViewModel = new WindowTitleVmCollection(null);
            this.LstTitles.ItemsSource = this._WindowTestsViewModel;
        }
Beispiel #2
0
        /// <summary>
        /// Converts to observable collection.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source">The col.</param>
        public static NotifyObservableCollection <T> ToObservableCollection <T>(this IEnumerable <T> source) where T : INotifyPropertyChanged
        {
            var list = new NotifyObservableCollection <T>();

            source.ForEach(p => list.Add(p));  // make sure each item raised property changed
            return(list);
        }
        void InitCategories()
        {
            string basePath = Environment.CurrentDirectory;

            Categories = new NotifyObservableCollection <Category>();
            Category cat1 = new Category("Category1");

            cat1.Items.Add(new Item("Jerry", 1.5m, string.Format("{0}\\images\\jerry.png", basePath)));
            cat1.Items.Add(new Item("Tom", 1.25m, string.Format("{0}\\images\\tom.png", basePath)));
            Categories.Add(cat1);


            Category cat2 = new Category("Category2");

            cat2.Items.Add(new Item("mario", 2.5m, string.Format("{0}\\images\\mario.png", basePath)));
            cat2.Items.Add(new Item("speedy", 2.75m, string.Format("{0}\\images\\speedy.png", basePath)));
            Categories.Add(cat2);

            Category cat3 = new Category("Category3");

            cat3.Items.Add(new Item("Woody Wood Pecker", 3.5m, string.Format("{0}\\images\\pecker.png", basePath)));
            cat3.Items.Add(new Item("Bugz Bunny", 1.25m, string.Format("{0}\\images\\bugz.png", basePath)));
            Categories.Add(cat3);

            Category cat4 = new Category("Category4");

            cat4.Items.Add(new Item("Burger", 5.5m, string.Format("{0}\\images\\food1.jpg", basePath)));
            cat4.Items.Add(new Item("Strawberry", 2.95m, string.Format("{0}\\images\\food2.jpg", basePath)));
            cat4.Items.Add(new Item("Cherry", 2.15m, string.Format("{0}\\images\\food3.jpg", basePath)));
            Categories.Add(cat4);
        }
Beispiel #4
0
        public DashboardPageModel(ICoreServiceDependencies coreServiceDependencies,
                                  IGenericService <PortalListRecord> portalService)
        {
            HttpService        = coreServiceDependencies.HttpService;
            AppSettingsService = coreServiceDependencies.AppSettingsService;
            PortalService      = portalService;

            WidgetOptions = new NotifyObservableCollection <object>();
        }
        public Workspace(SerializationInfo info, StreamingContext context)
        {
            AddToFactory = new DelegateCommand <BaseFlowNode>(AddedToFactory);
            UseRecipe    = new DelegateCommand <Tuple <BaseFlowNode, Recipe> >(SelectorRecipeUsed);

            ProductionNodes = new ObservableCollection <BaseFlowNode>((BaseFlowNode[])info.GetValue("Nodes", typeof(BaseFlowNode[])));

            /*foreach (var node in ProductionNodes)
             *  Bind(node);*/
            //_satisfierNodes = ProductionNodes.SelectMany(x => x.Results).ToLookup(x => x.RealItem, x => x.Parent).ToDictionary(x => x.Key, x => x.First());
            _selectedRecipies = ((SelectedRecipe[])info.GetValue("SelectedRecipes", typeof(SelectedRecipe[])))
                                .ToDictionary(x => x.KV.Key, x => x.KV.Value);
            WantedResults   = new NotifyObservableCollection <ProducibleItemWithAmount>(((ProducibleItemWithAmount[])info.GetValue("Egress", typeof(ProducibleItemWithAmount[]))));
            ExistingSources = new NotifyObservableCollection <ProducibleItemWithAmount>(((ProducibleItemWithAmount[])info.GetValue("Ingress", typeof(ProducibleItemWithAmount[]))));
            BindCommands();
            FixProductionFlow();
        }
 public MainWindowViewModel()
 {
     InitCategories();
     InputCategories = new NotifyObservableCollection<Category>();
     Categories.CollectionChanged += Categories_CollectionChanged;
 }
        void InitCategories()
        {
            string basePath = Environment.CurrentDirectory;

            Categories = new NotifyObservableCollection<Category>();
            Category cat1 = new Category("Category1") ;
            cat1.Items.Add(new Item("Jerry",1.5m, string.Format("{0}\\images\\jerry.png",basePath)));
            cat1.Items.Add(new Item("Tom", 1.25m, string.Format("{0}\\images\\tom.png", basePath)));
            Categories.Add(cat1);

            Category cat2 = new Category("Category2");
            cat2.Items.Add(new Item("mario", 2.5m, string.Format("{0}\\images\\mario.png", basePath)));
            cat2.Items.Add(new Item("speedy", 2.75m, string.Format("{0}\\images\\speedy.png", basePath)));
            Categories.Add(cat2);

            Category cat3 = new Category("Category3");
            cat3.Items.Add(new Item("Woody Wood Pecker", 3.5m, string.Format("{0}\\images\\pecker.png", basePath)));
            cat3.Items.Add(new Item("Bugz Bunny", 1.25m, string.Format("{0}\\images\\bugz.png", basePath)));
            Categories.Add(cat3);

            Category cat4 = new Category("Category4");
            cat4.Items.Add(new Item("Burger", 5.5m, string.Format("{0}\\images\\food1.jpg", basePath)));
            cat4.Items.Add(new Item("Strawberry", 2.95m, string.Format("{0}\\images\\food2.jpg", basePath)));
            cat4.Items.Add(new Item("Cherry", 2.15m, string.Format("{0}\\images\\food3.jpg", basePath)));
            Categories.Add(cat4);
        }
 public MainWindowViewModel()
 {
     InitCategories();
     InputCategories = new NotifyObservableCollection <Category>();
     Categories.CollectionChanged += Categories_CollectionChanged;
 }