Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Zytek committed Dec 17, 2014
1 parent 3f2c7ee commit c0fda30
Show file tree
Hide file tree
Showing 18 changed files with 277 additions and 310 deletions.
37 changes: 20 additions & 17 deletions NumberRecognizer/NumberRecognizer.App/Common/ItemClickCommand.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
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;

//-----------------------------------------------------------------------
// <copyright file="ItemClickCommand.cs" company="FH Wr.Neustadt">
// Copyright Markus Zytek. All rights reserved.
// </copyright>
// <author>Markus Zytek</author>
// <summary>Item Click Command.</summary>
//-----------------------------------------------------------------------
namespace NumberRecognizer.App.Common
{
using System.Windows.Input;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

/// <summary>
///
/// Item Click Command.
/// </summary>
public static class ItemClickCommand
{
/// <summary>
/// The command property
/// </summary>
public static readonly DependencyProperty CommandProperty =
DependencyProperty.RegisterAttached("Command", typeof(ICommand),
typeof(ItemClickCommand), new PropertyMetadata(null, OnCommandPropertyChanged));
public static readonly DependencyProperty CommandProperty = DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(ItemClickCommand), new PropertyMetadata(null, OnCommandPropertyChanged));

/// <summary>
/// Sets the command.
Expand All @@ -34,8 +34,8 @@ public static void SetCommand(DependencyObject d, ICommand value)
/// <summary>
/// Gets the command.
/// </summary>
/// <param name="d">The d.</param>
/// <returns></returns>
/// <param name="d">The dependent.</param>
/// <returns>The command.</returns>
public static ICommand GetCommand(DependencyObject d)
{
return (ICommand)d.GetValue(CommandProperty);
Expand All @@ -46,12 +46,13 @@ public static ICommand GetCommand(DependencyObject d)
/// </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)
private static void OnCommandPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = d as ListViewBase;
if (control != null)
{
control.ItemClick += OnItemClick;
}
}

/// <summary>
Expand All @@ -65,7 +66,9 @@ private static void OnItemClick(object sender, ItemClickEventArgs e)
var command = GetCommand(control);

if (command != null && command.CanExecute(e.ClickedItem))
{
command.Execute(e.ClickedItem);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
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;

//-----------------------------------------------------------------------
// <copyright file="SelectionChangedCommand.cs" company="FH Wr.Neustadt">
// Copyright Markus Zytek. All rights reserved.
// </copyright>
// <author>Markus Zytek</author>
// <summary>Selection Changed Command.</summary>
//-----------------------------------------------------------------------
namespace NumberRecognizer.App.Common
{
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;

/// <summary>
///
/// Selection Changed Command.
/// </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));
public static readonly DependencyProperty CommandProperty = DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(SelectionChangedCommand), new PropertyMetadata(null, OnCommandPropertyChanged));

/// <summary>
/// Sets the command.
Expand All @@ -34,8 +39,8 @@ public static void SetCommand(DependencyObject d, ICommand value)
/// <summary>
/// Gets the command.
/// </summary>
/// <param name="d">The d.</param>
/// <returns></returns>
/// <param name="d">The dependent.</param>
/// <returns>The command.</returns>
public static ICommand GetCommand(DependencyObject d)
{
return (ICommand)d.GetValue(CommandProperty);
Expand All @@ -46,12 +51,13 @@ public static ICommand GetCommand(DependencyObject d)
/// </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)
private static void OnCommandPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = d as ListViewBase;
if (control != null)
{
control.SelectionChanged += OnSelectionChanged;
}
}

/// <summary>
Expand All @@ -65,7 +71,9 @@ private static void OnSelectionChanged(object sender, SelectionChangedEventArgs
var command = GetCommand(control);

if (command != null && command.CanExecute(e))
{
command.Execute(e);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
// <author>Markus Zytek</author>
// <summary>The Supension Manager.</summary>
//-----------------------------------------------------------------------

using System.Diagnostics;

namespace NumberRecognizer.App.Common
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.Serialization;
using System.Threading.Tasks;
Expand Down
22 changes: 11 additions & 11 deletions NumberRecognizer/NumberRecognizer.App/Control/InkCanvasRT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ public void RefreshCanvas()
this.RenderStrokes();
}

/// <summary>
/// Clears the ink.
/// </summary>
public void ClearInk()
{
this.Children.Clear();
this.inkManager = new InkManager();
}

/// <summary>
/// Distance to the specified previous point.
/// </summary>
Expand All @@ -135,16 +144,7 @@ private static double Distance(Point previousPoint, Point currentPoint)
/// <param name="e">The <see cref="RightTappedRoutedEventArgs"/> instance containing the event data.</param>
private void InkCanvasRT_RightTapped(object sender, RightTappedRoutedEventArgs e)
{
ClearInk();
}

/// <summary>
/// Clears the ink.
/// </summary>
public void ClearInk()
{
this.Children.Clear();
this.inkManager = new InkManager();
this.ClearInk();
}

/// <summary>
Expand All @@ -154,7 +154,7 @@ public void ClearInk()
/// <param name="e">The <see cref="PointerRoutedEventArgs"/> instance containing the event data.</param>
private void InkCanvasRT_PointerPressed(object sender, PointerRoutedEventArgs e)
{
inkManager.SetDefaultDrawingAttributes(new InkDrawingAttributes()
this.inkManager.SetDefaultDrawingAttributes(new InkDrawingAttributes()
{
FitToCurve = false,
IgnorePressure = true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;

//-----------------------------------------------------------------------
// <copyright file="BooleanToVisibilityConverter.cs" company="FH Wr.Neustadt">
// Copyright Markus Zytek. All rights reserved.
// </copyright>
// <author>Markus Zytek</author>
// <summary>Boolean To Visibility Converter.</summary>
//-----------------------------------------------------------------------
namespace NumberRecognizer.App.Converter
{
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;

/// <summary>
/// Wertkonverter, der TRUE in <see cref="Visibility.Visible"/> und FALSE in
/// <see cref="Visibility.Collapsed"/> übersetzt.
/// Boolean To Visibility Converter.
/// </summary>
public class BooleanToVisibilityConverter : IValueConverter
{
/// <summary>
/// Ändert die Quelldaten vor der Übergabe an das Ziel zur Anzeige in der Benutzeroberfläche.
/// Modifies the source data before passing it to the target for display in the UI.
/// </summary>
/// <param name="value">Die Quelldaten, die ans Ziel übergeben werden.</param>
/// <param name="targetType">Der Typ der Zieleigenschaft. Dadurch wird ein anderer Typ verwendet, abhängig davon, ob Sie mit Microsoft .NET oder Visual&amp;nbsp;C++-Komponentenerweiterungen (C++/CX) programmieren. Siehe Hinweise.</param>
/// <param name="parameter">Ein optionaler Parameter, der in der Konverterlogik verwendet wird.</param>
/// <param name="language">Die Sprache der Konvertierung.</param>
/// <param name="value">The source data being passed to the target.</param>
/// <param name="targetType">The type of the target property. This uses a different type depending on whether you're programming with Microsoft .NET or Visual C++ component extensions (C++/CX). See Remarks.</param>
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
/// <param name="language">The language of the conversion.</param>
/// <returns>
/// Der Wert, der an die Zielabhängigkeitseigenschaft übergeben werden soll.
/// The value to be passed to the target dependency property.
/// </returns>
public object Convert(object value, Type targetType, object parameter, string language)
{
if (parameter != null)
{
return (value is bool && (bool)value) ? Visibility.Collapsed : Visibility.Visible;
}

return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed;
}

/// <summary>
/// Ändert die Zieldaten vor der Übergabe an das Quellobjekt. Diese Methode wird nur in TwoWay-Bindungen aufgerufen.
/// Modifies the target data before passing it to the source object. This method is called only in TwoWay bindings.
/// </summary>
/// <param name="value">Die Zieldaten, die an die Quelle übergeben werden.</param>
/// <param name="targetType">Der Typ der Zieleigenschaft, angegeben durch eine Hilfestruktur, die den Typnamen umschließt.</param>
/// <param name="parameter">Ein optionaler Parameter, der in der Konverterlogik verwendet wird.</param>
/// <param name="language">Die Sprache der Konvertierung.</param>
/// <param name="value">The target data being passed to the source.</param>
/// <param name="targetType">The type of the target property, specified by a helper structure that wraps the type name.</param>
/// <param name="parameter">An optional parameter to be used in the converter logic.</param>
/// <param name="language">The language of the conversion.</param>
/// <returns>
/// Der Wert, der an das Quellobjekt weitergeleitet wird.
/// The value to be passed to the source object.
/// </returns>
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// <author>Markus Zytek</author>
// <summary>Training Image RT.</summary>
//-----------------------------------------------------------------------


namespace NumberRecognizer.App.DataModel
{
using NumberRecognizer.App.NumberRecognizerService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@
// <author>Markus Zytek</author>
// <summary>Network Info Group.</summary>
//-----------------------------------------------------------------------

using NumberRecognizer.Cloud.Contract.Data;

namespace NumberRecognizer.App.DataModel
{
using System.Collections.ObjectModel;
using System.Windows.Input;
using NumberRecognizer.App.Common;
using NumberRecognizer.App.View;
using NumberRecognizer.Cloud.Contract.Data;
using PropertyChanged;

/// <summary>
Expand Down Expand Up @@ -65,6 +60,5 @@ public NetworkInfoGroup(string uniqueId, string title)
/// The networks.
/// </value>
public ObservableCollection<NetworkInfo> Networks { get; set; }

}
}
4 changes: 1 addition & 3 deletions NumberRecognizer/NumberRecognizer.App/Help/ImageHelperRT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
// <author>Markus Zytek</author>
// <summary>ImageHelper for RT.</summary>
//-----------------------------------------------------------------------

using System.Diagnostics;

namespace NumberRecognizer.App.Help
{
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Graphics.Imaging;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
Style="{StaticResource NavigationBackButtonNormalStyle}"
Expand All @@ -52,7 +50,7 @@
<StackPanel Orientation="Horizontal" Grid.Column="1">
<TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Style="{StaticResource CustomHeaderTextBlockStyle}"
IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
<TextBlock x:Name="pageSubtitle" Text="- Create new Network" Style="{StaticResource CustomSecondaryHeaderTextBlockStyle}"
<TextBlock x:Name="pageSubtitle" Text="- Create New Network" Style="{StaticResource CustomSecondaryHeaderTextBlockStyle}"
IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
</StackPanel>

Expand All @@ -76,9 +74,10 @@
<TextBlock Grid.Row="0" Grid.Column="0" Text="Name &#42;" FontSize="28" Margin="2" VerticalAlignment="Bottom" Foreground="Orange"/>
<TextBox Grid.Row="0" Grid.Column="1" Name="NetworkNameTextBox" Text="{Binding NetworkName, Mode=TwoWay}" FontSize="30" Margin="0,0,240,0"/>
<AppBarButton Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Command="{Binding LabelingCommand}" Label="Show Bounding Rectangles" Icon="Crop" HorizontalAlignment="Right" Margin="0,-10,110,0"/>
<AppBarButton Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Command="{Binding NextCommand}" Label="View Training Data" Icon="Forward" HorizontalAlignment="Right" Margin="0,-10,0,0" />
<ProgressRing Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" IsActive="{Binding IsLoading}" Foreground="Orange" Height="100" Width="100" HorizontalAlignment="Right" Margin="0,-10,110,0"/>
<AppBarButton Grid.Column="1" Grid.Row="0" Grid.RowSpan="2" Command="{Binding NextCommand}" Label="View Training Images" Icon="Forward" HorizontalAlignment="Right" Margin="0,-10,0,0" />
<TextBlock Grid.Row="1" Grid.Column="1" Visibility="{Binding IsShowHint, Converter={StaticResource boolToVisibilityConverter}}"
Text="Please write at least one number on each canvas."
Text="Please enter a network name and write at least one number on each canvas."
Style="{StaticResource SubheaderTextBlockStyle}" VerticalAlignment="Center" Foreground="Orange"/>
<ScrollViewer Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ private void InitializePage()
Button clearButton = new Button()
{
Content = "\ue107",
Command = viewModel.ClearCanvas,
Command = this.viewModel.ClearCanvas,
CommandParameter = inkCanvasRT,
FontFamily= new FontFamily("Segoe UI Symbol"),
FontFamily = new FontFamily("Segoe UI Symbol"),
BorderBrush = null,
Margin = inkCanvasRT.Margin
};
Expand Down
Loading

0 comments on commit c0fda30

Please sign in to comment.