Giter VIP home page Giter VIP logo

Comments (8)

IanYates avatar IanYates commented on May 20, 2024

The first thing that comes to mind with notification is that you'd naturally have cross-thread issues (why else have a lock?).
I can see merit in the idea but there'd have to be warnings for people to not rely on it as a "this lock is available" because race conditions, yada yada :)

Nothing that can't be solved with a bit of documentation I suppose :)

from asyncex.

sjb-sjb avatar sjb-sjb commented on May 20, 2024

I agree with your comment about the race condition. However I don't see any other way to notify a button that it needs to disable itself when the critical section has been entered.. If there is some other way to do it then please let me know. I do think we need to be able to notify the UI that a critical section is active / locked.

I also agree with the cross-thread comment, although I would say this is kind of a "normal" problem.

from asyncex.

StephenCleary avatar StephenCleary commented on May 20, 2024

The IsTaken is being considered as part of the new API. It won't ever notify, though; updating the UI is a completely disparate operation than serialization of access.

@sjb-sjb Enabling/disabling a control based on something outside the user's control seems like very odd UX to me. The user could easily click on a button, see it become disabled, and yet not have any response to their action. If you could describe your use case in more detail, maybe I can suggest an alternative approach?

from asyncex.

sjb-sjb avatar sjb-sjb commented on May 20, 2024

Well, I am copying my sqlite database to and from the appdir so that the user can see their file in their documents directory. I have file open and file new commands that copy an existing or new file respectively. I want to disable file new while file open is in the critical section (which is pretty much all of file open) and vice versa.

Thanks for your comments.

from asyncex.

StephenCleary avatar StephenCleary commented on May 20, 2024

In that case, I'd just disable the New button while the Open command is in progress.

from asyncex.

sjb-sjb avatar sjb-sjb commented on May 20, 2024

Well, yes, I agree. It's just a question of whether "in progress" is coming from the ViewModel or from the Model / service. I just thought the service (file service in this case) should be able to tell all users whether or not an operation is in progress / the service is busy.

Sent from my iPhone

On May 30, 2016, at 10:15 AM, Stephen Cleary [email protected] wrote:

In that case, I'd just disable the New button while the Open command is in progress.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

from asyncex.

StephenCleary avatar StephenCleary commented on May 20, 2024

If your Model uses INotifyPropertyChanged, then there's no reason not to expose AsyncCommands / NotifyTask from your Model. Personally, I usually don't write my models like that, but if you do, they should work just fine.

from asyncex.

StephenCleary avatar StephenCleary commented on May 20, 2024

There appear to be more appropriate alternative solutions for this use case rather than exposing IsTaken.

from asyncex.

Related Issues (20)

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.