Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
hauerCodes committed Dec 17, 2014
1 parent 3642f5b commit b311230
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public NetworkInfo SelectedLocalNetwork
/// <summary>
/// Initializes the properties.
/// </summary>
private async void Initialize()
private void Initialize()
{
this.LoadDesignDataNetworksAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private void InitializeCommands()
{
this.CreateNetworkCommand = new DependentRelayCommand(() => App.RootFrame.Navigate(typeof(CreateNetworkPage)), () => this.SelectedNetwork == null, this, () => this.SelectedNetwork);
this.DeleteNetworkCommand = new DependentRelayCommand(this.DeleteNetwork, () => this.SelectedNetwork != null, this, () => this.SelectedNetwork);
this.RefreshCommand = new DependentRelayCommand(() => this.LoadNetworksAsync(), () => this.IsLoading == false && this.IsSyncEnabled == false, this, () => this.IsLoading, () => this.IsSyncEnabled);
this.RefreshCommand = new DependentRelayCommand(async () => await this.LoadNetworksAsync(), () => this.IsLoading == false && this.IsSyncEnabled == false, this, () => this.IsLoading, () => this.IsSyncEnabled);
this.NetworkClicked = new RelayCommand<NetworkInfo>((item) => App.RootFrame.Navigate(typeof(NetworkRecognizePage), item), (item) => item.Status == NetworkStatusType.Ready);
this.NetworkDetails = new DependentRelayCommand(() => App.RootFrame.Navigate(typeof(NetworkDetailPage), this.SelectedNetwork), () => this.SelectedNetwork != null && this.SelectedNetwork.Calculated, this, () => this.SelectedNetwork);
this.ToggleSyncCommand = new RelayCommand(() => this.IsSyncEnabled = !this.IsSyncEnabled);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Windows.UI.Xaml.Media.Imaging;
using GalaSoft.MvvmLight;
using NumberRecognizer.Cloud.Contract.Data;
using PropertyChanged;
using NumberRecognition.Labeling;
using NumberRecognizer.App.Common;
using NumberRecognizer.App.Control;
using NumberRecognizer.App.DataModel;
using NumberRecognizer.App.Help;
using NumberRecognizer.App.NumberRecognizerService;
using RelayCommand = GalaSoft.MvvmLight.Command.RelayCommand;
//-----------------------------------------------------------------------
// <copyright file="NetworkRecognizeViewModel.cs" company="FH Wr.Neustadt">
// Copyright Markus Zytek. All rights reserved.
// </copyright>
// <author>Markus Zytek</author>
// <summary>Network Detail Page ViewModel.</summary>
//-----------------------------------------------------------------------

namespace NumberRecognizer.App.ViewModel
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using GalaSoft.MvvmLight;
using NumberRecognition.Labeling;
using NumberRecognizer.App.Common;
using NumberRecognizer.App.Control;
using NumberRecognizer.App.DataModel;
using NumberRecognizer.App.Help;
using NumberRecognizer.App.NumberRecognizerService;
using NumberRecognizer.Cloud.Contract.Data;
using PropertyChanged;

using Windows.UI.Xaml.Media.Imaging;
using RelayCommand = GalaSoft.MvvmLight.Command.RelayCommand;

/// <summary>
///
/// NetworkRecognize ViewModel.
/// </summary>
[ImplementPropertyChanged]
public class NetworkRecognizeViewModel : ViewModelBase
{

/// <summary>
/// Initializes a new instance of the <see cref="NetworkRecognizeViewModel"/> class.
/// Initializes a new instance of the <see cref="NetworkRecognizeViewModel" /> class.
/// </summary>
/// <param name="networkInfo">The network information.</param>
public NetworkRecognizeViewModel(NetworkInfo networkInfo)
{
this.Network = networkInfo;
this.InitializeCommands();
}

/// <summary>
/// Initializes the commands.
/// </summary>
private void InitializeCommands()
{
this.RecognizeNumber = new RelayCommand(this.ExecuteRecognizeNumber);
this.ClearResult = new RelayCommand(this.ClearPage);
this.ResetInkCanvasCommand = new RelayCommand(this.ResetInkCanvas);
}

/// <summary>
/// Gets or sets the network identifier.
/// </summary>
Expand Down Expand Up @@ -110,6 +109,16 @@ private void InitializeCommands()
/// </value>
public ObservableCollection<RecognitionImage> RecognitionImages { get; set; }

/// <summary>
/// Initializes the commands.
/// </summary>
private void InitializeCommands()
{
this.RecognizeNumber = new RelayCommand(this.ExecuteRecognizeNumber);
this.ClearResult = new RelayCommand(this.ClearPage);
this.ResetInkCanvasCommand = new RelayCommand(this.ResetInkCanvas);
}

/// <summary>
/// Resets the ink canvas.
/// </summary>
Expand All @@ -126,15 +135,15 @@ private void ResetInkCanvas()
/// </summary>
private async void ExecuteRecognizeNumber()
{
if (InkCanvas == null)
if (this.InkCanvas == null)
{
return;
}

RecognitionImages = new ObservableCollection<RecognitionImage>();
this.RecognitionImages = new ObservableCollection<RecognitionImage>();

await LabelingHelperRT.ConnectedComponentLabelingForInkCanvasRT(InkCanvas);
foreach (ConnectedComponent component in InkCanvas.Labeling.ConnectedComponents.OrderBy(p => p.MinBoundingRect.Left).ToList())
await LabelingHelperRT.ConnectedComponentLabelingForInkCanvasRT(this.InkCanvas);
foreach (ConnectedComponent component in this.InkCanvas.Labeling.ConnectedComponents.OrderBy(p => p.MinBoundingRect.Left).ToList())
{
try
{
Expand All @@ -156,27 +165,24 @@ private async void ExecuteRecognizeNumber()
try
{
NumberRecognizerServiceClient serviceProxy = new NumberRecognizerServiceClient();
Result = await serviceProxy.RecognizePhoneNumberAsync(Network.NetworkId, RecognitionImages);
this.Result = await serviceProxy.RecognizePhoneNumberAsync(this.Network.NetworkId, this.RecognitionImages);

this.CreateChartData();
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}

}

/// <summary>
/// Creates the chart data.
/// </summary>
private void CreateChartData()
{
bool first = false;

ChartResult = new ObservableCollection<object>();
this.ChartResult = new ObservableCollection<object>();

foreach (NumberRecognitionResultItem item in Result.Items)
foreach (NumberRecognitionResultItem item in this.Result.Items)
{
var posNumberPropabilities = new ObservableCollection<ChartPopulation>();
var negNumberPropabilities = new ObservableCollection<ChartPopulation>();
Expand All @@ -201,15 +207,15 @@ private void CreateChartData()
}
}

ChartResult.Add(new
this.ChartResult.Add(new
{
Number = item.NumericCharacter.ToString(),
Values = posNumberPropabilities,
NegValues = negNumberPropabilities
});
}

RaisePropertyChanged(() => ChartResult);
this.RaisePropertyChanged(() => this.ChartResult);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@
<DependentUpon>NumberRecognizerService.svc</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebRole.cs" />
<Compile Include="WebRole.cs">
<ExcludeFromStyleCop>True</ExcludeFromStyleCop>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace NumberRecognizer.Cloud.Service
using NumberRecognizer.Cloud.Data;
using NumberRecognizer.Lib.DataManagement;
using NumberRecognizer.Lib.Network;
using NumberRecognizer.Cloud.Contract.Data;

/// <summary>
/// NumberRecognizerService - Service Role.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using System.Reflection;
//-----------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="FH Wr.Neustadt">
// Copyright Markus Zytek. All rights reserved.
// </copyright>
// <author>Markus Zytek</author>
// <summary>AssemblyInfo Data.</summary>
//-----------------------------------------------------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WorkerRole.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<ExcludeFromStyleCop>True</ExcludeFromStyleCop>
</Compile>
<Compile Include="WorkerRole.cs">
<ExcludeFromStyleCop>False</ExcludeFromStyleCop>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
using System.Reflection;
//-----------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="FH Wr.Neustadt">
// Copyright Markus Zytek. All rights reserved.
// </copyright>
// <author>Markus Zytek</author>
// <summary>AssemblyInfo Data.</summary>
//-----------------------------------------------------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down
Loading

0 comments on commit b311230

Please sign in to comment.