aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin1835008 -> 1835008 bytes
-rw-r--r--Software/Graphics/Mobile/setup.pngbin0 -> 21794 bytes
-rw-r--r--Software/Graphics/setup.pngbin0 -> 21794 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml1
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml6
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs5
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Application/SetupRequiredEventArgs.cs23
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs13
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs12
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs1
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs5
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj9
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Images/setup.pngbin0 -> 21794 bytes
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs82
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj15
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs9
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs22
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs186
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml46
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml.cs28
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml1
-rw-r--r--Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs11
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchNativeListBox.cs6
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs39
26 files changed, 484 insertions, 38 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index b3a7afdae..4cb6b5227 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index 648b0bd9a..d92419b3f 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
diff --git a/Software/Graphics/Mobile/setup.png b/Software/Graphics/Mobile/setup.png
new file mode 100644
index 000000000..fe7309a00
--- /dev/null
+++ b/Software/Graphics/Mobile/setup.png
Binary files differ
diff --git a/Software/Graphics/setup.png b/Software/Graphics/setup.png
new file mode 100644
index 000000000..fe7309a00
--- /dev/null
+++ b/Software/Graphics/setup.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml
index 291766e7d..12fd53b45 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml
@@ -121,6 +121,7 @@
<MultiBinding Converter="{StaticResource JobCollectionToCategoryCountConverter}">
<Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Jobs" />
<Binding Path="Value" Mode="OneWay"></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Jobs.Count" Mode="OneWay" />
</MultiBinding>
</Run.Text>
</Run><Run>)</Run>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
index 0e8b5a474..c69c4f3f4 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
@@ -28,10 +28,10 @@
<Grid Grid.Row="1">
<DockPanel>
<Grid Background="{StaticResource TangoPrimaryBackgroundBrush}" DockPanel.Dock="Bottom">
- <StackPanel Margin="50 20" Orientation="Horizontal" HorizontalAlignment="Right">
- <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="200" Height="60" CornerRadius="30" Margin="0 0 30 0" Command="{Binding DiscardCommand}">DISCARD</touch:TouchButton>
+ <StackPanel Margin="50 20" Orientation="Horizontal" HorizontalAlignment="Right">
+ <!--<touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="200" Height="60" CornerRadius="30" Margin="0 0 30 0" Command="{Binding DiscardCommand}">DISCARD</touch:TouchButton>-->
<touch:TouchButton Width="200" Height="60" CornerRadius="30" Command="{Binding SaveCommand}">SAVE</touch:TouchButton>
- </StackPanel>
+ </StackPanel>
</Grid>
<Grid ClipToBounds="True">
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs
index 16e31b5a3..6b2fbc4b5 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs
@@ -31,6 +31,11 @@ namespace Tango.PPC.Common.Application
event EventHandler ModulesInitialized;
/// <summary>
+ /// Occurs when machine setup is required.
+ /// </summary>
+ event EventHandler<SetupRequiredEventArgs> SetupRequired;
+
+ /// <summary>
/// Gets a value indicating whether the application is shutting down.
/// </summary>
bool IsShuttingDown { get; }
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/SetupRequiredEventArgs.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/SetupRequiredEventArgs.cs
new file mode 100644
index 000000000..9a545d781
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/SetupRequiredEventArgs.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.Application
+{
+ public class SetupRequiredEventArgs : EventArgs
+ {
+ private Action _continueAction;
+
+ public SetupRequiredEventArgs(Action continueAction)
+ {
+ _continueAction = continueAction;
+ }
+
+ public void Continue()
+ {
+ _continueAction?.Invoke();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs
new file mode 100644
index 000000000..025402122
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.MachineSetup
+{
+ public interface IMachineSetupManager
+ {
+ void Setup(String serialNumber, String hostAddress);
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
new file mode 100644
index 000000000..a93a449f7
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.MachineSetup
+{
+ class MachineSetupManager
+ {
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs
index 6f9efc4cc..9f9ac3b6a 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs
@@ -14,6 +14,7 @@ namespace Tango.PPC.Common.Navigation
LoadingView,
LayoutView,
LoginView,
+ MachineSetupView,
ExternalBridgeView,
HomeModule,
ShutdownView,
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
index 5ed4c35d9..751f31175 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
@@ -25,6 +25,11 @@ namespace Tango.PPC.Common
public List<LogCategory> LoggingCategories { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether this instance has setup.
+ /// </summary>
+ public bool HasSetup { get; set; }
+
+ /// <summary>
/// Initializes a new instance of the <see cref="PPCSettings"/> class.
/// </summary>
public PPCSettings()
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
index d09920b1b..148bb046f 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
@@ -94,6 +94,7 @@
<Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
+ <Compile Include="Application\SetupRequiredEventArgs.cs" />
<Compile Include="Connection\DefaultMachineProvider.cs" />
<Compile Include="Connection\IMachineProvider.cs" />
<Compile Include="Connection\MachineOperatorChangedEventArgs.cs" />
@@ -106,6 +107,8 @@
<Compile Include="ExternalBridge\IPPCExternalBridgeService.cs" />
<Compile Include="ExternalBridge\PPCExternalBridgeService.cs" />
<Compile Include="IPPCView.cs" />
+ <Compile Include="MachineSetup\IMachineSetupManager.cs" />
+ <Compile Include="MachineSetup\MachineSetupManager.cs" />
<Compile Include="Messages\MachineSettingsSavedMessage.cs" />
<Compile Include="Modules\IPPCModuleLoader.cs" />
<Compile Include="Navigation\INavigationBlocker.cs" />
@@ -225,6 +228,10 @@
<Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project>
<Name>Tango.SharedUI</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.SQLExaminer\Tango.SQLExaminer.csproj">
+ <Project>{e1e66ed9-597d-45fa-8048-de90a6930484}</Project>
+ <Name>Tango.SQLExaminer</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.Touch\Tango.Touch.csproj">
<Project>{fd86424c-6e84-491b-8df9-3d0f5c236a2a}</Project>
<Name>Tango.Touch</Name>
@@ -257,7 +264,7 @@
</Target>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/setup.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/setup.png
new file mode 100644
index 000000000..fe7309a00
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/setup.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
index 01dfed9d0..01f963df3 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
@@ -19,6 +19,8 @@ using System.Windows.Threading;
using Tango.Transport.Adapters;
using Tango.PMR.Connection;
using Tango.PPC.Common.Connection;
+using Tango.SQLExaminer;
+using System.Data.SqlClient;
namespace Tango.PPC.UI.PPCApplication
{
@@ -70,6 +72,8 @@ namespace Tango.PPC.UI.PPCApplication
{
_notifiedViewModels = new List<PPCViewModel>();
+ PPCSettings settings = null;
+
MainWindow.Instance.ContentRendered += async (_, __) =>
{
await Task.Factory.StartNew(() =>
@@ -88,7 +92,7 @@ namespace Tango.PPC.UI.PPCApplication
File.Copy(Path.Combine(PathHelper.GetStartupPath(), "DB", "Tango.mdf"), CoreSettings.DefaultDataBaseSource);
}
- var settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
+ settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
var coreSettings = SettingsManager.Default.GetOrCreate<CoreSettings>();
if (!SettingsManager.Default.IsFileExists())
@@ -96,42 +100,67 @@ namespace Tango.PPC.UI.PPCApplication
settings.Save();
}
- ObservablesEntitiesAdapter.Instance.Initialize();
+ if (settings.HasSetup)
+ {
+ ObservablesEntitiesAdapter.Instance.Initialize();
+ }
});
- ApplicationStarted?.Invoke(this, new EventArgs());
- foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<PPCViewModel>())
+ if (settings.HasSetup)
+ {
+ PostSetup();
+ }
+ else
{
- if (!_notifiedViewModels.Contains(vm))
+ SetupRequiredEventArgs args = new SetupRequiredEventArgs(async () =>
{
- vm.OnApplicationStarted();
- _notifiedViewModels.Add(vm);
- }
+ ObservablesEntitiesAdapter.Instance.Initialize();
+
+ InvokeUI(() =>
+ {
+ PostSetup();
+ });
+ });
+ SetupRequired?.Invoke(this, args);
}
+ };
+ }
+ }
+
+ private void PostSetup()
+ {
+ ApplicationStarted?.Invoke(this, new EventArgs());
+
+ foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<PPCViewModel>())
+ {
+ if (!_notifiedViewModels.Contains(vm))
+ {
+ vm.OnApplicationStarted();
+ _notifiedViewModels.Add(vm);
+ }
+ }
- TangoIOC.Default.GetInstanceWhenAvailable<IPPCModuleLoader>((loader) =>
+ TangoIOC.Default.GetInstanceWhenAvailable<IPPCModuleLoader>((loader) =>
+ {
+ loader.ModulesLoaded += (x, y) =>
+ {
+ if (loader.UserModules.Count > 0)
{
- loader.ModulesLoaded += (x, y) =>
+ if (loader.UserModules.ToList().Exists(m => !m.IsInitialized))
{
- if (loader.UserModules.Count > 0)
+ loader.UserModules.LastOrDefault().Initialized += (e, f) =>
{
- if (loader.UserModules.ToList().Exists(m => !m.IsInitialized))
- {
- loader.UserModules.LastOrDefault().Initialized += (e, f) =>
- {
- FinalizeModuleInitialization();
- };
- }
- else
- {
- FinalizeModuleInitialization();
- }
- }
- };
- });
+ FinalizeModuleInitialization();
+ };
+ }
+ else
+ {
+ FinalizeModuleInitialization();
+ }
+ }
};
- }
+ });
}
private void FinalizeModuleInitialization()
@@ -164,5 +193,6 @@ namespace Tango.PPC.UI.PPCApplication
}
public event EventHandler Ready;
+ public event EventHandler<SetupRequiredEventArgs> SetupRequired;
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj
index 768b9b5ba..fd054e71f 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj
@@ -129,6 +129,7 @@
<Compile Include="ViewModels\LayoutViewVM.cs" />
<Compile Include="ViewModels\LoadingViewVM.cs" />
<Compile Include="ViewModels\LoginViewVM.cs" />
+ <Compile Include="ViewModels\MachineSetupViewVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
<Compile Include="ViewsContracts\ILayoutView.cs" />
<Compile Include="Views\ExternalBridgeView.xaml.cs">
@@ -143,6 +144,9 @@
<Compile Include="Views\LoginView.xaml.cs">
<DependentUpon>LoginView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\MachineSetupView.xaml.cs">
+ <DependentUpon>MachineSetupView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
@@ -190,6 +194,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\MachineSetupView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\MainView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -266,6 +274,10 @@
<Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project>
<Name>Tango.SharedUI</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.SQLExaminer\Tango.SQLExaminer.csproj">
+ <Project>{e1e66ed9-597d-45fa-8048-de90a6930484}</Project>
+ <Name>Tango.SQLExaminer</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.TFS\Tango.TFS.csproj">
<Project>{998f8471-dc1b-41b6-9d96-354e1b4e7a32}</Project>
<Name>Tango.TFS</Name>
@@ -335,6 +347,7 @@
<Link>Tango.ColorLib.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Resource Include="Images\setup.png" />
<Resource Include="Images\machine-trans.png" />
<Resource Include="Images\Twine_Loading_GIF.gif" />
<Resource Include="Images\GlobalStatus\standby.png" />
@@ -405,7 +418,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140d.dll" "$(TargetDir)"</
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
index 83be2ee65..3a49845dd 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
@@ -68,6 +68,7 @@ namespace Tango.PPC.UI
TangoIOC.Default.Register<LoginViewVM>();
TangoIOC.Default.Register<LayoutViewVM>();
TangoIOC.Default.Register<ExternalBridgeViewVM>();
+ TangoIOC.Default.Register<MachineSetupViewVM>();
TangoIOC.Default.GetInstance<IPPCApplicationManager>().ApplicationStarted += (_, __) =>
@@ -123,5 +124,13 @@ namespace Tango.PPC.UI
return TangoIOC.Default.GetInstance<ExternalBridgeViewVM>();
}
}
+
+ public static MachineSetupViewVM MachineSetupViewVM
+ {
+ get
+ {
+ return TangoIOC.Default.GetInstance<MachineSetupViewVM>();
+ }
+ }
}
} \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
index 38616f39f..d5915eeb0 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
@@ -27,6 +27,8 @@ namespace Tango.PPC.UI.ViewModels
/// <seealso cref="Tango.PPC.Common.PPCViewModel" />
public class LoadingViewVM : PPCViewModel
{
+ private bool _setup;
+
/// <summary>
/// Gets or sets the module loader.
/// </summary>
@@ -46,9 +48,19 @@ namespace Tango.PPC.UI.ViewModels
/// <summary>
/// Initializes a new instance of the <see cref="LoadingViewVM"/> class.
/// </summary>
- public LoadingViewVM()
+ public LoadingViewVM(IPPCApplicationManager applicationManager)
{
- Task.Delay(1000).ContinueWith((x) => { IsLoading = true; });
+ if (!DesignMode)
+ {
+ applicationManager.SetupRequired += ApplicationManager_SetupRequired;
+ Task.Delay(1000).ContinueWith((x) => { IsLoading = true; });
+ }
+ }
+
+ private void ApplicationManager_SetupRequired(object sender, SetupRequiredEventArgs e)
+ {
+ _setup = true;
+ NavigationManager.NavigateTo(NavigationView.MachineSetupView);
}
/// <summary>
@@ -56,8 +68,12 @@ namespace Tango.PPC.UI.ViewModels
/// </summary>
public override void OnApplicationStarted()
{
- NavigationManager.NavigateTo(NavigationView.LoginView);
IsLoading = false;
+
+ if (!_setup)
+ {
+ NavigationManager.NavigateTo(NavigationView.LoginView);
+ }
}
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs
new file mode 100644
index 000000000..6be3d8ca0
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs
@@ -0,0 +1,186 @@
+using System;
+using System.Collections.Generic;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+using Tango.Core.Commands;
+using Tango.PPC.Common;
+using Tango.PPC.Common.Application;
+using Tango.Settings;
+using Tango.SQLExaminer;
+
+namespace Tango.PPC.UI.ViewModels
+{
+ public class MachineSetupViewVM : PPCViewModel
+ {
+ private bool _postSetp;
+
+ private SetupRequiredEventArgs _setupRequiredEventArgs;
+
+ private String _serialNumber;
+ public String SerialNumber
+ {
+ get { return _serialNumber; }
+ set { _serialNumber = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
+ private String _hostAddress;
+ public String HostAddress
+ {
+ get { return _hostAddress; }
+ set { _hostAddress = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
+ private String _log;
+ public String Log
+ {
+ get { return _log; }
+ set { _log = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isWorking;
+ public bool IsWorking
+ {
+ get { return _isWorking; }
+ set { _isWorking = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
+ public RelayCommand StartCommand { get; set; }
+
+ public MachineSetupViewVM(IPPCApplicationManager applicationManager)
+ {
+ HostAddress = "localhost\\SQLEXPRESS";
+ SerialNumber = "1111";
+
+ AppendLog("Ready to start...");
+ StartCommand = new RelayCommand(StartSetup, () => !String.IsNullOrWhiteSpace(HostAddress) && !String.IsNullOrWhiteSpace(SerialNumber) && !IsWorking);
+
+ applicationManager.SetupRequired += ApplicationManager_SetupRequired;
+ }
+
+ private void ApplicationManager_SetupRequired(object sender, SetupRequiredEventArgs e)
+ {
+ _setupRequiredEventArgs = e;
+ }
+
+ public override void OnApplicationStarted()
+ {
+ if (_postSetp)
+ {
+ NavigationManager.NavigateTo(Common.Navigation.NavigationView.LoginView);
+ }
+ }
+
+ public override void OnNavigatedTo()
+ {
+ base.OnNavigatedTo();
+ }
+
+ private void AppendLog(String msg)
+ {
+ Log += msg + Environment.NewLine;
+ }
+
+ private void StartSetup()
+ {
+ IsWorking = true;
+
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ String db_name = "Tango";
+
+ String localAddress = SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource;
+
+ var tempFolder = TemporaryManager.CreateFolder("Machine Setup");
+ String report_file = tempFolder.CreateImaginaryFile(".xml");
+ String config_file = tempFolder.CreateImaginaryFile(".xml");
+
+ DbManager db = new DbManager(new SqlConnection(String.Format("Server={0};Integrated security=SSPI", localAddress)));
+
+ if (!db.Exists("Tango"))
+ {
+ throw new InvalidProgramException("Database tango does not exists.");
+ }
+
+ //Create schema configuration
+ ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.Schema);
+
+ builder.
+ SetSourceServer(HostAddress, db_name).
+ SetTargetServer(localAddress, db_name).
+ Synchronize();
+
+ //Synchronize Source schema with Target schema
+
+ var process = new ExaminerProcess(builder.Build(), ExaminerProcessType.Schema);
+ process.Progress += (x, msg) =>
+ {
+ AppendLog(msg);
+ };
+ var result = process.Execute().Result;
+
+ //Synchronization was successful
+ if (result.ExitCode != ExaminerProcessExitCode.Success)
+ {
+ throw new InvalidProgramException("Error while trying to synchronize database schema.");
+ }
+
+ //Create override data configuration
+ builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.OverrideData);
+
+ builder.
+ SetSourceServer(HostAddress, db_name).
+ SetTargetServer(localAddress, db_name).
+ Synchronize();
+
+ process = new ExaminerProcess(builder.Build(), ExaminerProcessType.Data);
+ process.Progress += (x, msg) =>
+ {
+ AppendLog(msg);
+ };
+ result = process.Execute().Result;
+
+ //Synchronization was successful
+ if (result.ExitCode != ExaminerProcessExitCode.Success)
+ {
+ throw new InvalidProgramException("Error while trying to synchronize database schema.");
+ }
+
+ //Provision Target
+ builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.ProvisionMachine);
+
+ builder.
+ SetSourceServer(HostAddress, db_name).
+ SetTargetServer(localAddress, db_name).
+ SetMachineSerialNumber(SerialNumber).
+ Synchronize();
+
+ result = new ExaminerProcess(builder.Build(), ExaminerProcessType.Data).Execute().Result;
+
+ //Synchronization was successful
+ if (result.ExitCode != ExaminerProcessExitCode.Success)
+ {
+ throw new InvalidProgramException("Error while trying to synchronize database schema.");
+ }
+
+ Settings.HasSetup = true;
+ _postSetp = true;
+ Settings.Save();
+ _setupRequiredEventArgs.Continue();
+ }
+ catch (Exception ex)
+ {
+ NotificationProvider.ShowError(ex.Message);
+ }
+ finally
+ {
+ IsWorking = false;
+ }
+ });
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml
index 9e7861595..36baf413d 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LoadingView.xaml
@@ -10,7 +10,7 @@
xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
xmlns:local="clr-namespace:Tango.PPC.UI.Views"
mc:Ignorable="d"
- d:DesignHeight="1280" d:DesignWidth="720" d:DataContext="{d:DesignInstance Type=vm:LoadingViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LoadingView}">
+ d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:LoadingViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LoadingView}">
<Grid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Image gif:ImageBehavior.EnableAnimation="{Binding IsLoading}" gif:ImageBehavior.AnimatedSource="/Images/Twine_Loading_GIF.gif" Margin="100" RenderTransformOrigin="0.5,0.5" RenderOptions.BitmapScalingMode="Fant">
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml
new file mode 100644
index 000000000..c20ed0966
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml
@@ -0,0 +1,46 @@
+<UserControl x:Class="Tango.PPC.UI.Views.MachineSetupView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels"
+ xmlns:global="clr-namespace:Tango.PPC.UI"
+ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ xmlns:local="clr-namespace:Tango.PPC.UI.Views"
+ mc:Ignorable="d"
+ d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MachineSetupViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineSetupViewVM}">
+ <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}">
+ <Grid x:Name="Container">
+ <DockPanel>
+
+ <Grid DockPanel.Dock="Bottom" Height="200" Background="{StaticResource TangoMidBackgroundBrush}">
+ <Border BorderThickness="0 1 0 0" BorderBrush="{StaticResource TangoGrayBrush}">
+ <TextBox Text="{Binding Log}" IsReadOnly="True" Padding="5" Background="Transparent" AcceptsReturn="True" TextWrapping="Wrap" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
+
+ </TextBox>
+ </Border>
+ </Grid>
+
+ <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
+ <Image Source="/Images/setup.png" Width="180" Height="180" />
+ <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" Margin="30">MACHINE SETUP</TextBlock>
+ <TextBlock TextAlignment="Center">
+ <Run>This machine has not been configured yet and require several steps in order to be ready.</Run>
+ <LineBreak/>
+ <Run>Enter this machine serial number, synchronization server address and tap 'START'.</Run>
+ </TextBlock>
+
+ <StackPanel Width="500" Margin="0 100 0 0" TextElement.FontSize="{StaticResource TangoTitleFontSize}">
+ <TextBlock>SERIAL NUMBER</TextBlock>
+ <touch:TouchTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="0 10 0 0" Text="{Binding SerialNumber}" KeyboardContainer="{Binding ElementName=Container}" />
+
+ <TextBlock Margin="0 40 0 0">HOST ADDRESS</TextBlock>
+ <touch:TouchTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="0 10 0 0" Text="{Binding HostAddress}" KeyboardContainer="{Binding ElementName=Container}" />
+
+ <touch:TouchButton Margin="0 100 0 0" Padding="30" CornerRadius="40" Command="{Binding StartCommand}">START</touch:TouchButton>
+ </StackPanel>
+ </StackPanel>
+ </DockPanel>
+ </Grid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml.cs
new file mode 100644
index 000000000..b27d835a8
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.PPC.UI.Views
+{
+ /// <summary>
+ /// Interaction logic for MachineSetupView.xaml
+ /// </summary>
+ public partial class MachineSetupView : UserControl
+ {
+ public MachineSetupView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
index ef21ebc85..07c1b29a2 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
@@ -43,6 +43,7 @@
<local:LoginView></local:LoginView>
<local:LayoutView></local:LayoutView>
<local:ExternalBridgeView></local:ExternalBridgeView>
+ <local:MachineSetupView></local:MachineSetupView>
</controls:NavigationControl>
</touch:TouchPanel>
</Grid>
diff --git a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs
index aa75b9577..5318d08e4 100644
--- a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs
+++ b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerConfigurationBuilder.cs
@@ -105,6 +105,17 @@ namespace Tango.SQLExaminer
return this;
}
+ public ExaminerConfigurationBuilder NoSynchronize()
+ {
+ var sync_action = _config.Actions.SingleOrDefault(x => x.Type == "synchronize");
+
+ if (sync_action != null)
+ {
+ _config.Actions.Remove(sync_action);
+ }
+ return this;
+ }
+
public ExaminerConfigurationBuilder SetReportFile(String path)
{
var Report_action = _config.Actions.SingleOrDefault(x => x.Type == "report");
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNativeListBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNativeListBox.cs
index ea464e8db..0a7e29c0a 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNativeListBox.cs
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNativeListBox.cs
@@ -61,12 +61,12 @@ namespace Tango.Touch.Controls
FrameworkElement element = obj as FrameworkElement;
if (element != null)
{
- if (SelectedValuePath == null)
+ if (String.IsNullOrWhiteSpace(SelectedValuePath))
{
ListBoxItem item = element as ListBoxItem;
- if (item != null && this.Items.Contains(item))
+ if (item != null)
{
- this.SelectedItem = item;
+ this.SelectedItem = item.DataContext;
}
}
else
diff --git a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs
index 32aaa4485..980dd7a27 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs
@@ -328,6 +328,45 @@ namespace Tango.UnitTesting
}
//Now change configuration in source and push to machine
+ using (var context = ObservablesContext.CreateDefault("localhost\\SQLEXPRESS", source_db))
+ {
+ var machine = context.Machines.SingleOrDefault(x => x.SerialNumber == machine_serial_number);
+ machine.Configuration.Name = "Test Name " + new Random().Next(0, 1000);
+ context.SaveChanges();
+ }
+
+ //Update the machine from source
+ builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.UpdateMachine);
+
+ builder.
+ SetSourceServer("localhost\\SQLEXPRESS", source_db).
+ SetTargetServer("localhost\\SQLEXPRESS", target_db).
+ SetMachineSerialNumber(machine_serial_number).
+ Synchronize().
+ SetReportFile(report_file);
+
+ result = new ExaminerProcess(builder.Build(), ExaminerProcessType.Data).Execute().Result;
+
+ //Synchronization was successful
+ Assert.AreEqual(result.ExitCode, ExaminerProcessExitCode.Success);
+
+ data_report = ExaminerDataReport.FromFile(report_file);
+
+ //Should have differences
+ Assert.IsTrue(data_report.HasDifferences);
+
+
+ //Check no difference after update
+ builder.NoSynchronize();
+ result = new ExaminerProcess(builder.Build(), ExaminerProcessType.Data).Execute().Result;
+
+ //Synchronization was successful
+ Assert.AreEqual(result.ExitCode, ExaminerProcessExitCode.Success);
+
+ data_report = ExaminerDataReport.FromFile(report_file);
+
+ //Should have no differences!
+ Assert.IsFalse(data_report.HasDifferences);
}
}
}