« first day (1263 days earlier)      last day (1917 days later) » 
00:00 - 22:0022:00 - 00:00

10:00 PM
public override bool CanExecute(object parameter) in DelegateCommand and public virtual bool CanExecute(object parameter) => true; in CommandBase have fixed the red squigglies.
 
Change those protected to public.
That's the other problem.
Yeah. We couldn't change the visibility.
We could do it there because it isn't direct inheritance, but more of a wrapper.
 
At the very least I'm understanding the error messagies.
 
And one more thing:
Remove the OnPropertyChanged() from Text's setter.
Now, when you type, the textblock shouldn't get updated until you click the button.
 
public string Text
{
    get => _text;
    set
    {
        _text = value;
        //OnPropertyChanged();
    }
}
 
Delete it.
We're using source control, so you don't comment code.
 
10:02 PM
Gone.
cough Still working on that cough...
 
So, are the button and command implemented?
 
Just the 2 files. Need to get the button in.
 
OK.
So, that's how you get around handling click events in the code-behind.
You use commands.
 
@Hosch250 Missed this. Where do I put in this command?
I've only a vague idea of what's being done...
 
VM.
I may need to go offline soon. My computer is busy installing Windows.
 
10:12 PM
Got it in. Command="RefreshCommand" isn't happy on the button
 
Nope.
Another binding.
Command="{Binding RefreshCommand}"
 
As part of the click event?
ok.
I'm missing something. Clicking on the button didn't update the TextBlock
 
Show me your command implementation.
The RefreshCommand part.
 
Only what you had. DelegateCommand RefeshCommand { get; }
Let me see if I understand this enough to provide the implementation.
 
I did give you the implementation higher up.
Must've missed it.
 
10:18 PM
OnPropertyChanged and Text doen't exist in the current context.
 
Put your whole VM in a gist.
 
gist?
 
You started going too fast and I got lost.
 
LOL.
Sorry.
That's the awesome thing about online chats.
 
Holy cow.
What did you do?
I just want the raw C# code :P
 
it had .js at the end.
Now try it.
 
Ok.
So, internal will work, but we might as well make it public so it matches the rest of it.
 
Made them both public.
 
OK, I see the problem.
 
10:23 PM
the RefreshCommand and it's type DelegateCommand
In the DelegateCommand file is where the problem is.
 
Field/Property initializers are essentially static.
So, create a ctor for the VM and do the assignment there.
They have to be static because they run before the class ctor(s).
 
public ViewModel(string text, string foreground, string background)
{
    Text = text;
    Foreground = foreground;
    Background = background;
}
 
Nah.
 
Not understanding.
 
public ViewModel()
{
    RefreshCommand = new DelegateCommand(s => OnPropertyChanged(nameof(Text)));
}
The top one wouldn't hurt anything, but it's pretty useless at this point.
Try that, and see what happens.
(On the the other hand, you could do something like this:)
 
10:27 PM
@Hosch250 This is needed because as a DelegateCommand the field property RefreshCommand needs to have something be put-into-it/assigned like how an event handler subscribes to an event?
 
private void Refresh(object obj) { OnPropertyChanged(nameof(Text)); }
public ViewModel()
{
    RefreshCommand = new DelegateCommand(Refresh);
}
Yup.
RefreshCommand is returning null right now.
WPF is doing the check and/or swallowing the exception for you, but you could probably see it in the output window.
@IvenBach Second part of the statement is wrong.
You need to give RefreshCommand a value so it will do something.
 
Ok. I see that nothing happens when text is entered into the TextBox. I pretty much get that the button is doing the update now but don't really understand how.
This will take me a bit of time to go over.
 
When you click the button, it calls RefreshCommand.Execute(obj), where obj is the CommandParameter (null by default).
Execute is that delegate you passed into the DelegateCommand ctor.
 
I see that's what's happening but my brain's not grasping it in terms of code. This may take me a little bit to absorb because of the new parts.
 
Yup. Don't worry.
This is the core of WPF.
Bindings are awesome, but they take a bit to swallow.
(It doesn't help that there isn't a default implementation of the ICommand interface.)
 
10:35 PM
@Hosch250 This is part of what I'm wrapping my noodle around right now.
Duck with me on this:
Command="{Binding RefreshCommand}" is the button that does something when it's clicked.
 
Yeah.
 
public DelegateCommand RefreshCommand { get; } grabs what it was assigned as RefreshCommand = new DelegateCommand(Refresh); when the VM was initialized.
 
Yeah.
 
private void Refresh(object obj) { OnPropertyChanged(nameof(Text)); } is the part I'm misfiring on.
 
So, this is what is happening.
If you go back to:
public DelegateCommand(Action<object> execute, Predicate<object> canExecute = null)
{
    _canExecute = canExecute;
    _execute = execute;
}
 
10:40 PM
There
 
You are passing Refresh into it as the execute parameter. The canExecute is null.
 
Ok.
 
Then, the binding runs .Execute({command-parameter}).
Except .Execute() really is Refresh()
So, you could set the command parameter to "Text".
 
The binding is the Command=... part?
 
Then, you would do OnPropertyChanged((string) obj) in Refresh instead.
Yup.
 
10:42 PM
I'm not understanding what the object obj is on Refresh
 
That's the command parameter.
 
This is part of where my disconnect is.
 
So, back to your button, add this:
CommandParameter="Text"
And change Refresh to have this: OnPropertyChanged((string) obj)
 
@Hosch250 would then correspond to the Text property on the VM?
 
No.
That's just a string literal.
You can do bindings there.
 
10:45 PM
Hence the Blue color and not peach-ish color.
 
But when it is run in OnPropertyChanged, there is a property with that name, so in a way it does correspond to it.
Yup.
But, as far as the compiler knows, it is just a string literal.
 
I've changed it to have (string) obj
 
Is it still working?
Put a breakpoint in Refresh and see what the value is.
 
obj = "Text"
 
Good.
Does it make more sense now?
 
10:49 PM
Not quite.
I typically struggle with new stuff quite a bit.
 
Do you get where the obj value is coming from now?
 
(string)obj is fed in statically from MainWindow.xaml the parameter CommandParameter="Text"
I'm comfortable with that now.
 
Yup. It comes from the UI.
It can be set up with a binding (we do that a lot in RD).
 
OnPropertyChanged(nameof(Text)) which was the original is just feeding in the name of the Text Property into OnPropertyChanged causing whatever is bound to it to be alerted by the event that's raised to update?
 
Yup.
 
10:53 PM
That was the other disconnect I was having.
 
And nameof(Text) just translates to the string literal "Text".
 
I'd seen OnPropertyChanged and at a high level understood what it was doing. When down in the code I had to stop and think hard what was going on.
Ok. Removed that CommandParameter and reverted to original implementation.
 
Cool.
 
I may get something at a high level, but I don't feel good about it till I can use it almost effortlessly.
The button has the command bound to it through Binding RefreshCommand. RefreshCommand has the private void Refresh(object obj) { OnPropertyChanged(nameof(Text)); } assigned to it initially. But the argument isn't being used why is it there?
 
Because it has to implement ICommand.
If we had Execute() and Execute(object), it would add a lot of overhead.
And what if we had an object only sometimes?
Because that does happen.
 
10:59 PM
ICommand brings with it CanExecute(object param), Execute(object param) and EventHandler CanExecuteChanged.
 
Basically, it doesn't know whether we do or don't have a parameter, and doesn't care.
Yeah, but you don't really care about that event.
The UI listens to that event.
It would be much, much messier if we had versions without the parameter and versions with the parameter.
Basically, WPF needs the parameter for when there is a parameter, and we just ignore it if we don't need it.
TTQW.
 
I'm struggling over the minor detail of why Refresh(object obj) has the parameter.
 
Because it is the implementation of Execute(object).
Basically, we did Execute = Refresh.
 
This will probably take me a little while to progress through.
I don't want to keep you while I'm working through it.
 
Yeah, read about method groups again.
See you later.
 
11:03 PM
> #2497 API changed: -> repository.commit() now mandates 'author' and 'commiter' as two distinct parameters. I pass into both the same value by default. -> repository.Stage() passes to the static class 'Commands' taking the repo as a first parameters. -> repository.Pull() undergoes the same change -> repository.Checkout() also -> repository.Remove() also -> repository.Fetch() takes the biggest changes. -It now requires by default a refSpec. As we will usually fetch everything, I hardcoded on...
the code the classic "+refs/heads/*:refs/remotes/origin/*". -It also requires a logMessage, which I hardoced empty ("") -> repository.Branches[branch].Remote changes as well. Now this collection moves to the .Network class member of the repository, as repo.Network.Remotes[branch] Changes to be committed: modified: RetailCoder.VBE/Rubberduck.csproj modified: RetailCoder.VBE/packages.config modified: Rubberduck.SourceControl/GitProvider.cs modified:...
Rubberduck.SourceControl/Rubberduck.SourceControl.csproj new file: Rubberduck.SourceControl/_SourceControlClassDiagram.cd modified: Rubberduck.SourceControl/packages.config modified: RubberduckTests/RubberduckTests.csproj Yeah, sorry for the ClassDiagram. But it's really helping me visualise the whole structure of the project
 
Because Execute's signature is void Execute(object), if we are doing to assign another method to it, it has to have the void and the (object) part.
 
> So I've just sent you my changes on a pull request. Just a bunch of API differences. To be honest I find the repo.command(parameters) more intuitive than the command(repo,parameters). I'm acting on my repo object actually. But that's basically the main change from the guys at libgit.
[rubberduck-vba/Rubberduck] build for commit d7fc5efe on unknown branch: AppVeyor build failed
BUILD FAILURE!
 
Hosch, I just belatedly realized something - we have this: public sealed partial class ReorderParametersDialog : Form, IRefactoringDialog<ReorderParametersViewModel> -- very good. But then we have those.... public ReorderParametersViewModel ViewModel { get; } and public ReorderParametersDialog(ReorderParametersViewModel vm)... shouldn't those be made generic so that we don't have to define the presenter for each dialog?
seems to me we only need one presenter class for all dialogs, since winforms should be really dumb.
 
11:21 PM
Ah. So when you click the button you are Executeing the command. By traipsing back to the source is Refresh(object obj) which is mandated because Execute(object parameter). :lightbulb:
I think I've understood why now.
Confirmed it with CommandParameter="Doesn't Matter" and stepping through to private void Refresh(object obj) { OnPropertyChanged(nameof(Text)); }.
@Hosch250 Thank you, a lot. For taking the time to inform me about this. I'd be in a world of hurt if I tried to fly solo and learn this.
I have a side question regarding DelegateCommand.CanExecute. Is this method invoked every time a command is shown? I had a breakpoint set and I'd see it is checked, twice, before the main window is shown. Once the window popped up in F5 mode it'd enter into an infinite loop of checking. Why?
I hypo-the-size that when VS gets focus and runs through the check and the focus is sent back to the window the CanExecute fires causing the loop. Is this so a command can't be run in an invalid state?
 
A return false greys out the button IE enable = false. I'm attempting to make sure I'm groking correctly.
 
do we have a policy on versioning class-diagrams?
 
11:33 PM
@Vogel612 Is your use of signpost just flagging attention to your already addressed issue?
 
no... wait...
 
Want to make sure it's not additional lingo for something else.
 
it's for an already admonished issue, but to keep track of all occurences
 
:+1: Thanks.
 
the issue isn't addressed yet. That's the whole point of signposts :)
 
11:34 PM
Addressed as in your comment github.com/rubberduck-vba/Rubberduck/pull/….
 
addressed would be commonly understood as "taken care of" or "no more relevant"
 
I'm starting to see why RD are sticklers for comments in code. It could easily get out of hand.
 
at least that's how I understand the word
 
My battle with words continues...
 
11:47 PM
> when directly fetching the tip of your branch, I count 16 compile errors, according to my visual studio.
 
00:00 - 22:0022:00 - 00:00

« first day (1263 days earlier)      last day (1917 days later) »