-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4eb2f1
commit a190de9
Showing
20 changed files
with
279 additions
and
502 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
NumberRecognizer/NumberRecognizer.App/Common/SelectionChangedCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Input; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
|
||
namespace NumberRecognizer.App.Common | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public static class SelectionChangedCommand | ||
{ | ||
/// <summary> | ||
/// The command property | ||
/// </summary> | ||
public static readonly DependencyProperty CommandProperty = | ||
DependencyProperty.RegisterAttached("Command", typeof(ICommand), | ||
typeof(SelectionChangedCommand), new PropertyMetadata(null, OnCommandPropertyChanged)); | ||
|
||
/// <summary> | ||
/// Sets the command. | ||
/// </summary> | ||
/// <param name="d">The d.</param> | ||
/// <param name="value">The value.</param> | ||
public static void SetCommand(DependencyObject d, ICommand value) | ||
{ | ||
d.SetValue(CommandProperty, value); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the command. | ||
/// </summary> | ||
/// <param name="d">The d.</param> | ||
/// <returns></returns> | ||
public static ICommand GetCommand(DependencyObject d) | ||
{ | ||
return (ICommand)d.GetValue(CommandProperty); | ||
} | ||
|
||
/// <summary> | ||
/// Called when [command property changed]. | ||
/// </summary> | ||
/// <param name="d">The d.</param> | ||
/// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> | ||
private static void OnCommandPropertyChanged(DependencyObject d, | ||
DependencyPropertyChangedEventArgs e) | ||
{ | ||
var control = d as ListViewBase; | ||
if (control != null) | ||
control.SelectionChanged += OnSelectionChanged; | ||
} | ||
|
||
/// <summary> | ||
/// Called when [item click]. | ||
/// </summary> | ||
/// <param name="sender">The sender.</param> | ||
/// <param name="e">The <see cref="ItemClickEventArgs" /> instance containing the event data.</param> | ||
private static void OnSelectionChanged(object sender, SelectionChangedEventArgs e) | ||
{ | ||
var control = sender as ListViewBase; | ||
var command = GetCommand(control); | ||
|
||
if (command != null && command.CanExecute(e)) | ||
command.Execute(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 0 additions & 110 deletions
110
NumberRecognizer/NumberRecognizer.App/View/GroupDetailPage.xaml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.