Skip to content

Converted GazeInteraction project from C++ to C#. #3427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
21 commits merged into from
Oct 6, 2020
Merged

Converted GazeInteraction project from C++ to C#. #3427

21 commits merged into from
Oct 6, 2020

Conversation

azchohfi
Copy link
Contributor

Unifies Toolkit language to be only C#.

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)

What is the current behavior?

C++, boo.

What is the new behavior?

All C# 🦙🎉

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Pull Request has been submitted to the documentation repository instructions. Link:
  • Sample in sample app has been added / updated (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

This is not exporting WinMDs, so C++ devs will be stuck on 6.x, and this is expected.

@ghost
Copy link

ghost commented Aug 13, 2020

Thanks azchohfi for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from michael-hawker and Kyaa-dost August 13, 2020 03:01
@azchohfi azchohfi changed the title Converted GazeInteraction project for C++ to C#. Converted GazeInteraction project from C++ to C#. Aug 13, 2020
Kyaa-dost
Kyaa-dost previously approved these changes Aug 13, 2020
Copy link
Contributor

@Kyaa-dost Kyaa-dost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 🚀

@azchohfi
Copy link
Contributor Author

azchohfi commented Aug 13, 2020

Two awesome things about this PR:

  • Build times reduced ~15%.
  • The old NuGet package had 7.8Mb, whereas the new NuGet package is 39KB!

@Kyaa-dost Kyaa-dost added this to the 7.0 milestone Aug 25, 2020
@michael-hawker michael-hawker added reviewers wanted ✋ for-review 📖 To evaluate and validate the Issues or PR labels Sep 1, 2020
@michael-hawker
Copy link
Member

@azchohfi just tested in the sample app and was working great! For some reason the store app interaction traction wasn't working for me, but worked perfectly here with the new code! 🎉🎉🎉

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @azchohfi some initial feedback on the port. I think there's a few things we could take the opportunity to improve with the change to C#. Feel free to just say that we should file issues for future improvements on things. There definitely did seem to be an issue with ComboBox though.

Haven't quite completed looking at everything, but figured this would get us started again on trying to wrap this up. Thanks!


namespace Microsoft.Toolkit.Uwp.Input.GazeInteraction
{
internal class ComboBoxItemGazeTargetItem : GazeTargetItem
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a ComboBox to the example:

        <ComboBox SelectedIndex="0" Margin="100,100">
          <x:String>One Thing</x:String>
          <x:String>Two Things</x:String>
          <x:String>Three Things</x:String>
          <x:String>Four Things</x:String>
        </ComboBox>

However, while it opens the combobox, it doesn't show the cursor or allow me to invoke item selection with it. Is that because we're missing the XamlRoot now or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is related to XamlRoot. Not sure what is happening. What was the behavior on the old version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old version wasn't working for me at all, so I couldn't compare... @peteams was the cursor supposed to move to the pop-up element and show in the drop-down?

Copy link
Member

@michael-hawker michael-hawker Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, so investigated this a bit. The old code did a better job with the highlight rectangles on the ComboBox, even though I've fixed that now in the C#, the code is the same within the GazeTargetItem.RaiseProgressEvent method, so I'm not sure why it behaves differently, though maybe has to do with how the visual tree is searched in that logic? Doesn't seem to make a difference using x:String elements vs ComboBoxItem elements directly in my example above.

I am basically noticing that sometimes it does find the ComboBoxItem and can select it, other times it shows the highlight rectangle briefly, but most times there's no visual indications (the cursor is behind the pop-up too), and it seems like the UIElement selector is grabbing the 'TextBlock' element within the ComboBoxItem instead of looking up and grabbing the ComboBoxItem itself, this I think is the main thing breaking the logic here. Will try and poke a bit more, but may be easier to have someone from @peteams group take a look and help us with this fix.

Since this also wasn't working great in the C++ version, I think we should just add it to our #3497 list or a separate issue, and not block this PR. I think the PR should be good to go otherwise.

// Setup a new app service connection
AppServiceConnection connection = new AppServiceConnection();
connection.AppServiceName = "com.microsoft.ectksettings";
connection.PackageFamilyName = "Microsoft.EyeControlToolkitSettings_s9y1p3hwd5qda";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the system app? Is this documented somewhere we should probably have a comment? FYI @peteams

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find docs for this anywhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From an internet search, it almost appears like it's grabbing from an app service that's only from a sample here:

      <Extensions>
        <uap:Extension Category="windows.appService">
          <uap3:AppService Name="com.microsoft.ectksettings" SupportsRemoteSystems="true" />
        </uap:Extension>
      </Extensions>

@joncamp do you remember what this is about? It's unlikely for someone to compile and install this other sample app locally. Should we bother having this extra code in the Toolkit? It seems like it's not referenced anywhere within the codebase itself?

Copy link
Contributor

@vgromfeld vgromfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@michael-hawker
Copy link
Member

@azchohfi since this is already working better than what was in the Toolkit, should we merge this and open an issue to track the ComboBox problem separately?

@azchohfi
Copy link
Contributor Author

I believe we should, yes.

@michael-hawker michael-hawker dismissed Kyaa-dost’s stale review September 22, 2020 20:32

As an extra precaution against accidental merge

@michael-hawker
Copy link
Member

michael-hawker commented Sep 22, 2020

@azchohfi any idea why I'm seeing the output directories in this project?

image

Is this if I don't clean when switching from the C++ project?

@azchohfi
Copy link
Contributor Author

It might be, but it's fine to see those files there, they won't be built or anything.

@michael-hawker
Copy link
Member

michael-hawker commented Sep 22, 2020

Think all the minor details are smoothed out enough for this PR. Should follow-up on the Settings with the Gaze team as well as a general review, and later as another PR we should fix the ComboBox behavior for #3497, and investigate tidying up some code and performance with our VisualTree investigation as part of #3487.

It'd also be good to know if we can mimic these Gaze events with WinAppDriver or other tooling so that it's easier to try and reply specific scenarios for debugging and testing.

@michael-hawker
Copy link
Member

@azchohfi package step failed now?

@azchohfi
Copy link
Contributor Author

Oh, that is the design package that is not updated properly. I can fix that.

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move ahead and we can fix anything else in the future, but pretty sure we're in the same space we should have been with the C++ version.

@ghost
Copy link

ghost commented Oct 6, 2020

Hello @michael-hawker!

Because this pull request has the auto merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 6583c81 into master Oct 6, 2020
@ghost ghost deleted the gazeCS branch October 6, 2020 22:05
@michael-hawker michael-hawker mentioned this pull request Oct 13, 2020
70 tasks
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merge ⚡ for-review 📖 To evaluate and validate the Issues or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants