Coder Social home page Coder Social logo

updatecontrols's People

Contributors

fesquivel avatar michaellperry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

updatecontrols's Issues

No license

This project has no license attached. Is this intentional?

Binding to IndependentList<string> means that everytime the collection is modified, the whole collection is enumerated

Consider the following example model and view model:

    public class ViewModel
    {
        private readonly Model model;

        public ViewModel(Model model)
        {
            this.model = model;
        }

        public IEnumerable<string> Data => model.Data.Select(
            x =>
            {
                Thread.Sleep(500);
                return x;
            });
    }

    public class Model
    {
        private readonly IndependentList<string> data = new IndependentList<string>();

        public IEnumerable<string> Data => data;

        public void Add(string s) => data.Add(s);
    }

If you bind to the Data property of the view model, and then you call model.Add, this will cause ViewModel.Data enumerable to be enumerated again.

INotifyCollectionChanged.CollectionChanged is raised which is good. But I think that only this event should be raised and WPF shouldn't have to enumerate the collection again. If the list has a huge number of items this will be a performance issue.

In the example, I wait 0.5 second to simulate the cost of enumeration.

The expected behavior is that when you add a new item, you should wait 0.5 seconds. However, currently you wait 0.5 * the number of items in the list.

I suggest something like this in the ViewModel:

public IEnumerable<string> Data {get;} = new SomeDependentList(model.Data, x => { Thread.Sleep(500); return x;});

SomeDependentList in this case wraps the independent list. When it receives the notification that an item was added, it transforms it via the function passed to it and then it sends a transformed notification to WPF.

Unable to work in Winforms

Hi,

I used the Install-Package updatecontrols to install for a winform project in VS2019.
However, pressing Ctrl-D, Ctrl-G does not bring up the tool to generate the codes.
Instead after Ctrl-G, it simply asks which row I wish to skip to.

The MSI installer link is also broken https://updatecontrols.net/bin/UpdateControls.2.2.5.0.msi

Is this supposed to work for VS2019? If yes, is Install-Package updatecontrols all that is required?
Thank you.

Improve performance

Back when I used Update Controls, I loved it, with a couple of exceptions, both performance-related:

  1. It doesn't understand lists. A list is handled the same way as a single datum, so if you've got an IndependentList<Foo> and a DependentList<FooViewModel> and you add a single item to the IndependentList, the entire DependentList is recomputed from scratch, as well as anything else that depends on it.
  2. It doesn't understand changes that have no effect. Suppose I have a Dependent<int> C that computes the maximum value of two other precedents A and B, and then I decrease the smaller precedent A. In this case C does not change, but anything that depends on C is updated anyway. Not only are the dependents updated, but there is no way to suppress this behavior.

Solving these problems is nontrivial, but I have outlined a solution to problem 2 here that appears like it would work. I wouldn't blame @michaellperry if the solution only goes into the replacement project Assisticant though.

Why has this library gotten so little attention?

I am building my first WPF application -- having come from a background in server development, so the MVVM pattern is new to me. So far I've been very happy with an MVVM framework I decided upon called Stylet.

I got to a point in my project where I have this dilemma that I need to maintain a list of objects that are displayed in the GUI. These objects represent program state and are also stored in a database so that whenever the user exits and relaunches the application, the app resumes from where user left off. As a result, I am storing information about the objects as well as their order that they appear in the UI.

The weirdness here is that the data is clearly reflective of the UI state itself, but I don't want to tie it directly to the WPF implementation. I decided to abstract it into a model, but then that became overly complex because I have to implement additional plumbing in the viewModel just to interact with the model. So that got me to start asking questions about what exactly a model really is and the nature of its data.

I read that you shouldn't put ObservableCollections directly in models, which stunned me because in this case I need to maintain data abstracted away from the UI for the sake of code reuse for other platform.
Because the data is itself directly representative of the UI, it doesn't make any sense to have this secondary layer of observable collection in the viewmodel and all the plumbing code to bind it to another collection in the model.

That's when I found out about UpdateControls and the concept of Independent and Dependent data. I read about it briefly and thought "wow. this makes a ton of sense. why haven't I heard about this before?" And then I look at the github. I see Michael has been maintaining the project actively, but the userbase is practically non-existant.

So as a developer new to MVVM on this first big desktop app project, I wonder if you can shine any light in the hole for me. Is there some reason why this library didn't take off when it was introduced many years ago? Do people just not understand the problem it solves? Is my particular problem an ideal example of where UpdateControls would shine?

Hope to hear from you. Thanks for taking the time to read this and consider! :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.