diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-08 13:35:27 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-08 13:35:27 +0300 |
| commit | 57ae9d131e898a35061507bc8497bcf648cf00d1 (patch) | |
| tree | 91e5c55fdcced791f509b24d13c4a73294a295f2 /Software | |
| parent | 8dac70e25c92eea8278c564615509386a1a0182d (diff) | |
| download | Tango-57ae9d131e898a35061507bc8497bcf648cf00d1.tar.gz Tango-57ae9d131e898a35061507bc8497bcf648cf00d1.zip | |
Working on machine setup !
Diffstat (limited to 'Software')
30 files changed, 558 insertions, 141 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 4cb6b5227..ff6024fa8 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex d92419b3f..43d0b72c2 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Graphics/Mobile/package.png b/Software/Graphics/Mobile/package.png Binary files differnew file mode 100644 index 000000000..46446c02f --- /dev/null +++ b/Software/Graphics/Mobile/package.png 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 6b2fbc4b5..e1d06034f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -21,6 +21,11 @@ namespace Tango.PPC.Common.Application event EventHandler ApplicationStarted; /// <summary> + /// Occurs when the main window content has been rendered. + /// </summary> + event EventHandler ContentRendered; + + /// <summary> /// Occurs when the all components are ready. /// </summary> event EventHandler Ready; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs index 025402122..69acfbbcf 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/IMachineSetupManager.cs @@ -8,6 +8,9 @@ namespace Tango.PPC.Common.MachineSetup { public interface IMachineSetupManager { - void Setup(String serialNumber, String hostAddress); + MachineSetupSteps CurrentStep { get; } + event EventHandler<String> ProgressLog; + event EventHandler<MachineSetupSteps> ProgressStep; + Task 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 index a93a449f7..51c906019 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -1,12 +1,125 @@ 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.IO; +using Tango.Settings; +using Tango.SQLExaminer; namespace Tango.PPC.Common.MachineSetup { - class MachineSetupManager + public class MachineSetupManager : ExtendedObject, IMachineSetupManager { + public event EventHandler<string> ProgressLog; + public event EventHandler<MachineSetupSteps> ProgressStep; + + private MachineSetupSteps _currentStep; + public MachineSetupSteps CurrentStep + { + get { return _currentStep; } + set + { + _currentStep = value; + RaisePropertyChangedAuto(); + ProgressStep?.Invoke(this, _currentStep); + } + } + + public Task Setup(string serialNumber, string hostAddress) + { + return Task.Factory.StartNew(() => + { + CurrentStep = MachineSetupSteps.SynchronizingSchema; + + String db_name = "Tango"; + + String localAddress = SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource; + + var tempFolder = TemporaryManager.Default.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) => + { + ProgressLog?.Invoke(this, msg); + }; + var result = process.Execute().Result; + + //Synchronization was successful + if (result.ExitCode != ExaminerProcessExitCode.Success) + { + throw new InvalidProgramException("Error while trying to synchronize database schema."); + } + + CurrentStep = MachineSetupSteps.SynchronizingData; + + //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) => + { + ProgressLog?.Invoke(this, msg); + }; + result = process.Execute().Result; + + //Synchronization was successful + if (result.ExitCode != ExaminerProcessExitCode.Success) + { + throw new InvalidProgramException("Error while trying to synchronize data."); + } + + CurrentStep = MachineSetupSteps.SynchronizingMachineConfiguration; + + //Provision Target + builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.ProvisionMachine); + + builder. + SetSourceServer(hostAddress, db_name). + SetTargetServer(localAddress, db_name). + SetMachineSerialNumber(serialNumber). + Synchronize(); + + + process = new ExaminerProcess(builder.Build(), ExaminerProcessType.Data); + process.Progress += (x, msg) => + { + ProgressLog?.Invoke(this, msg); + }; + result = process.Execute().Result; + + //Synchronization was successful + if (result.ExitCode != ExaminerProcessExitCode.Success) + { + throw new InvalidProgramException("Error while trying to synchronize database schema."); + } + }); + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResult.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResult.cs new file mode 100644 index 000000000..5887a6d34 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResult.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 class MachineSetupResult + { + public bool Completed { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs new file mode 100644 index 000000000..53a7780ec --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupSteps.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Common.MachineSetup +{ + public enum MachineSetupSteps + { + [Description("Synchronizing Schema")] + SynchronizingSchema, + [Description("Synchronizing Data")] + SynchronizingData, + [Description("Configuring Machine")] + SynchronizingMachineConfiguration + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs index 94a2e8d35..8df0a7fb8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs @@ -49,6 +49,12 @@ namespace Tango.PPC.Common.Navigation Task<bool> NavigateTo(NavigationView view, bool pushToHistory = true); /// <summary> + /// Navigates to the specified PPC view with the specified receive object. + /// </summary> + /// <param name="view">The view.</param> + Task<bool> NavigateWithObject<TPass>(NavigationView view, TPass obj, bool pushToHistory = true); + + /// <summary> /// Navigates to the specified module. /// </summary> /// <typeparam name="T"></typeparam> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs index b9114dba4..b2475b139 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs @@ -173,10 +173,22 @@ namespace Tango.PPC.Common /// <seealso cref="Tango.SharedUI.ViewModel" /> public abstract class PPCViewModel<T> : PPCViewModel where T : IPPCView { + private T _view; /// <summary> /// Gets the IPPCView instance. /// </summary> - public T View { get; private set; } + [TangoInject(TangoInjectMode.WhenAvailable)] + public T View + { + get { return _view; } + set + { + _view = value; + ViewAttached = true; + OnViewAttached(); + } + } + /// <summary> /// Gets a value indicating whether the instance of IPPCView is available. @@ -188,12 +200,7 @@ namespace Tango.PPC.Common /// </summary> public override void OnApplicationStarted() { - TangoIOC.Default.GetInstanceWhenAvailable<T>((view) => - { - ViewAttached = true; - View = view; - OnViewAttached(); - }); + } /// <summary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index fe5640b44..f1cb91572 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -42,6 +42,7 @@ <converters:TimeSpanToLabelConverter x:Key="TimeSpanToLabelConverter" /> <converters:GreaterThanToBooleanConverter x:Key="GreaterThanToBooleanConverter" /> <converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter" /> + <converters:EnumToVisibilityConverter x:Key="EnumToVisibilityConverter" /> <Style TargetType="FrameworkElement"> <Setter Property="TextElement.FontFamily" Value="{StaticResource TangoFlexoFontFamily}"></Setter> 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 148bb046f..0e2f3302c 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 @@ -109,6 +109,8 @@ <Compile Include="IPPCView.cs" /> <Compile Include="MachineSetup\IMachineSetupManager.cs" /> <Compile Include="MachineSetup\MachineSetupManager.cs" /> + <Compile Include="MachineSetup\MachineSetupResult.cs" /> + <Compile Include="MachineSetup\MachineSetupSteps.cs" /> <Compile Include="Messages\MachineSettingsSavedMessage.cs" /> <Compile Include="Modules\IPPCModuleLoader.cs" /> <Compile Include="Navigation\INavigationBlocker.cs" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/package.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/package.png Binary files differnew file mode 100644 index 000000000..46446c02f --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/package.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs index f06bd88de..a05d5fc5c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs @@ -108,6 +108,26 @@ namespace Tango.PPC.UI.Navigation } /// <summary> + /// Navigates to the specified PPC view with the specified receive object. + /// </summary> + /// <param name="view">The view.</param> + /// <param name="obj"></param> + /// <param name="pushToHistory"></param> + /// <returns></returns> + public Task<bool> NavigateWithObject<TPass>(NavigationView view, TPass obj, bool pushToHistory = true) + { + MainView.Instance.NavigationControl.NavigateTo(view.ToString()); + INavigationObjectReceiver<TPass> receiver = MainView.Instance.NavigationControl.Elements.FirstOrDefault(x => (x.GetType().Name == view.ToString() || NavigationControl.GetNavigationName(x) == view.ToString()) && x.DataContext is INavigationObjectReceiver<TPass>).DataContext as INavigationObjectReceiver<TPass>; + + if (receiver != null) + { + receiver.OnNavigatedToWithObject(obj); + } + + return Task.FromResult(true); + } + + /// <summary> /// Navigates to the specified module. /// </summary> /// <typeparam name="T"></typeparam> 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 01f963df3..e75a0616c 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -76,6 +76,8 @@ namespace Tango.PPC.UI.PPCApplication MainWindow.Instance.ContentRendered += async (_, __) => { + ContentRendered?.Invoke(this, new EventArgs()); + await Task.Factory.StartNew(() => { //TODO: Use this in the future. @@ -113,13 +115,16 @@ namespace Tango.PPC.UI.PPCApplication } else { - SetupRequiredEventArgs args = new SetupRequiredEventArgs(async () => + SetupRequiredEventArgs args = new SetupRequiredEventArgs(() => { - ObservablesEntitiesAdapter.Instance.Initialize(); - - InvokeUI(() => + Task.Factory.StartNew(() => { - PostSetup(); + ObservablesEntitiesAdapter.Instance.Initialize(); + + InvokeUI(() => + { + PostSetup(); + }); }); }); SetupRequired?.Invoke(this, args); @@ -194,5 +199,6 @@ namespace Tango.PPC.UI.PPCApplication public event EventHandler Ready; public event EventHandler<SetupRequiredEventArgs> SetupRequired; + public event EventHandler ContentRendered; } } 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 fd054e71f..594afcc86 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 @@ -132,6 +132,7 @@ <Compile Include="ViewModels\MachineSetupViewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewsContracts\ILayoutView.cs" /> + <Compile Include="ViewsContracts\IMachineSetupView.cs" /> <Compile Include="Views\ExternalBridgeView.xaml.cs"> <DependentUpon>ExternalBridgeView.xaml</DependentUpon> </Compile> @@ -347,6 +348,7 @@ <Link>Tango.ColorLib.dll</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <Resource Include="Images\package.png" /> <Resource Include="Images\setup.png" /> <Resource Include="Images\machine-trans.png" /> <Resource Include="Images\Twine_Loading_GIF.gif" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index 3a49845dd..7c3e7b9cf 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -9,6 +9,7 @@ using Tango.PPC.Common.Connection; using Tango.PPC.Common.Diagnostics; using Tango.PPC.Common.EventLogging; using Tango.PPC.Common.ExternalBridge; +using Tango.PPC.Common.MachineSetup; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; @@ -49,6 +50,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Unregister<IEventLogger>(); TangoIOC.Default.Unregister<ITeamFoundationServiceClient>(); TangoIOC.Default.Unregister<IPPCExternalBridgeService>(); + TangoIOC.Default.Unregister<IMachineSetupManager>(); TangoIOC.Default.Register<IDispatcherProvider, DefaultDispetcherProvider>(new DefaultDispetcherProvider(Application.Current.Dispatcher)); TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>(); @@ -61,6 +63,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<IDiagnosticsFrameProvider, DefaultDiagnosticsFrameProvider>(); TangoIOC.Default.Register<IEventLogger, DefaultEventLogger>(); TangoIOC.Default.Register<IPPCExternalBridgeService, PPCExternalBridgeService>(); + TangoIOC.Default.Register<IMachineSetupManager, MachineSetupManager>(); //TangoIOC.Default.Register<TeamFoundationServiceExtendedClient>(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); TangoIOC.Default.Register<LoadingViewVM>(); @@ -71,9 +74,10 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<MachineSetupViewVM>(); - TangoIOC.Default.GetInstance<IPPCApplicationManager>().ApplicationStarted += (_, __) => + TangoIOC.Default.GetInstance<IPPCApplicationManager>().ContentRendered += (_, __) => { TangoIOC.Default.Register<ILayoutView, LayoutView>(LayoutView.Instance); + TangoIOC.Default.Register<IMachineSetupView, MachineSetupView>(MachineSetupView.Instance); }; //TangoIOC.Default.Register<LoadingViewVM>(); 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 d5915eeb0..2a76ba80f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -12,6 +12,7 @@ using Tango.Core.Helpers; using Tango.PPC.Common; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; +using Tango.PPC.Common.MachineSetup; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; @@ -25,9 +26,11 @@ namespace Tango.PPC.UI.ViewModels /// Represents the PPC loading splash screen view model. /// </summary> /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> - public class LoadingViewVM : PPCViewModel + public class LoadingViewVM : PPCViewModel, INavigationObjectReceiver<MachineSetupResult> { private bool _setup; + private SetupRequiredEventArgs _setupArgs; + private bool _post_setup; /// <summary> /// Gets or sets the module loader. @@ -59,6 +62,7 @@ namespace Tango.PPC.UI.ViewModels private void ApplicationManager_SetupRequired(object sender, SetupRequiredEventArgs e) { + _setupArgs = e; _setup = true; NavigationManager.NavigateTo(NavigationView.MachineSetupView); } @@ -70,10 +74,23 @@ namespace Tango.PPC.UI.ViewModels { IsLoading = false; - if (!_setup) + if (!_setup || _post_setup) { NavigationManager.NavigateTo(NavigationView.LoginView); } } + + public async void OnNavigatedToWithObject(MachineSetupResult machineSetupResult) + { + if (machineSetupResult.Completed) + { + _post_setup = true; + _setup = false; + IsLoading = true; + + await Task.Delay(500); + _setupArgs.Continue(); + } + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs index 6be3d8ca0..7b4016341 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs @@ -8,17 +8,31 @@ using Tango.Core; using Tango.Core.Commands; using Tango.PPC.Common; using Tango.PPC.Common.Application; +using Tango.PPC.Common.MachineSetup; +using Tango.PPC.Common.Navigation; +using Tango.PPC.UI.ViewsContracts; using Tango.Settings; +using Tango.SharedUI.Helpers; using Tango.SQLExaminer; namespace Tango.PPC.UI.ViewModels { - public class MachineSetupViewVM : PPCViewModel + public class MachineSetupViewVM : PPCViewModel<IMachineSetupView> { + public enum MachineSetupStates + { + None, + Working, + Completed, + Failed, + } + private bool _postSetp; private SetupRequiredEventArgs _setupRequiredEventArgs; + public IMachineSetupManager MachineSetupManager { get; set; } + private String _serialNumber; public String SerialNumber { @@ -40,22 +54,28 @@ namespace Tango.PPC.UI.ViewModels set { _log = value; RaisePropertyChangedAuto(); } } - private bool _isWorking; - public bool IsWorking + private MachineSetupStates _state; + public MachineSetupStates State { - get { return _isWorking; } - set { _isWorking = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + get { return _state; } + set { _state = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } public RelayCommand StartCommand { get; set; } - public MachineSetupViewVM(IPPCApplicationManager applicationManager) + public RelayCommand CompleteCommand { get; set; } + + public MachineSetupViewVM(IPPCApplicationManager applicationManager, IMachineSetupManager machineSetupManager) { + MachineSetupManager = machineSetupManager; + MachineSetupManager.ProgressLog += (x, msg) => AppendLog(msg); + MachineSetupManager.ProgressStep += (x, step) => AppendLog(Environment.NewLine + "-----------" + step.ToDescription().ToUpper() + "-----------" + Environment.NewLine); + HostAddress = "localhost\\SQLEXPRESS"; SerialNumber = "1111"; - AppendLog("Ready to start..."); - StartCommand = new RelayCommand(StartSetup, () => !String.IsNullOrWhiteSpace(HostAddress) && !String.IsNullOrWhiteSpace(SerialNumber) && !IsWorking); + StartCommand = new RelayCommand(StartSetup, () => !String.IsNullOrWhiteSpace(HostAddress) && !String.IsNullOrWhiteSpace(SerialNumber) && State == MachineSetupStates.None); + CompleteCommand = new RelayCommand(CompleteSetup, () => State == MachineSetupStates.Completed); applicationManager.SetupRequired += ApplicationManager_SetupRequired; } @@ -67,6 +87,8 @@ namespace Tango.PPC.UI.ViewModels public override void OnApplicationStarted() { + base.OnApplicationStarted(); + if (_postSetp) { NavigationManager.NavigateTo(Common.Navigation.NavigationView.LoginView); @@ -80,107 +102,37 @@ namespace Tango.PPC.UI.ViewModels private void AppendLog(String msg) { - Log += msg + Environment.NewLine; + if (msg != null && !msg.Contains("SQL Examiner")) + { + InvokeUI(() => + { + View.AppendLog(msg + Environment.NewLine); + }); + } } - private void StartSetup() + private async void StartSetup() { - IsWorking = true; + State = MachineSetupStates.Working; - Task.Factory.StartNew(() => + try { - 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."); - } + await MachineSetupManager.Setup(SerialNumber, HostAddress); + Settings.HasSetup = true; + _postSetp = true; + Settings.Save(); + State = MachineSetupStates.Completed; + } + catch (Exception ex) + { + State = MachineSetupStates.Failed; + await NotificationProvider.ShowInfo(ex.Message); + } + } - Settings.HasSetup = true; - _postSetp = true; - Settings.Save(); - _setupRequiredEventArgs.Continue(); - } - catch (Exception ex) - { - NotificationProvider.ShowError(ex.Message); - } - finally - { - IsWorking = false; - } - }); + private void CompleteSetup() + { + NavigationManager.NavigateWithObject(NavigationView.LoadingView, new MachineSetupResult() { Completed = true }); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml index c20ed0966..b7bd4d803 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml @@ -5,39 +5,73 @@ 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:setup="clr-namespace:Tango.PPC.Common.MachineSetup;assembly=Tango.PPC.Common" 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}"> + d:DesignHeight="2000" 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}"> + <Grid DockPanel.Dock="Bottom" Height="200" Background="{StaticResource TangoMidBackgroundBrush}" Visibility="{Binding State,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Working,Failed,Completed'}"> <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 x:Name="txtLog" SelectionBrush="Transparent" 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"> + + <StackPanel HorizontalAlignment="Center" Margin="0 200 0 0"> + <Image Source="/Images/package.png" Width="180" Height="180" /> + <TextBlock HorizontalAlignment="Center" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoHeaderFontSize}" Margin="30">MACHINE SETUP</TextBlock> + + <StackPanel Visibility="{Binding State,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='None'}"> + <TextBlock TextAlignment="Center" LineHeight="25"> <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> + <Run>Enter this machine serial number, synchronization server address and tap 'INSTALL'.</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}" /> - <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}" /> + <touch:TouchButton Margin="0 200 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding StartCommand}">INSTALL</touch:TouchButton> + </StackPanel> + </StackPanel> + + <StackPanel Visibility="{Binding State,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Working'}"> + <TextBlock TextAlignment="Center"> + <Run>Please wait while we setting up this machine.</Run> + <Run>Do not turn off this PC.</Run> + </TextBlock> + + <touch:TouchBusyIndicator Width="100" Height="100" Margin="0 80 0 0"> + <touch:TouchBusyIndicator.Style> + <Style TargetType="touch:TouchBusyIndicator"> + <Setter Property="IsIndeterminate" Value="False"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding State}" Value="Working"> + <Setter Property="IsIndeterminate" Value="True"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchBusyIndicator.Style> + </touch:TouchBusyIndicator> + <touch:TouchStepProgressBar Width="720" Height="50" Margin="0 100 0 0" ItemsSource="{Binding Source={x:Type setup:MachineSetupSteps},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineSetupManager.CurrentStep}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" /> + </StackPanel> - <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}" /> + <StackPanel Visibility="{Binding State,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Completed'}"> + <StackPanel HorizontalAlignment="Center" Margin="0 50 0 0"> + <touch:TouchIcon Icon="Check" Foreground="{StaticResource TangoSuccessBrush}" Width="70" Height="70" /> + <TextBlock VerticalAlignment="Center" Margin="0 10 0 0" Foreground="{StaticResource TangoSuccessBrush}" FontSize="{StaticResource TangoTitleFontSize}">Setup completed successfully. Machine is ready!</TextBlock> + </StackPanel> - <touch:TouchButton Margin="0 100 0 0" Padding="30" CornerRadius="40" Command="{Binding StartCommand}">START</touch:TouchButton> + <touch:TouchButton Margin="0 200 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding CompleteCommand}">START</touch:TouchButton> </StackPanel> </StackPanel> </DockPanel> 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 index b27d835a8..a2c20ecc2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml.cs @@ -12,17 +12,28 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.PPC.UI.ViewsContracts; namespace Tango.PPC.UI.Views { /// <summary> /// Interaction logic for MachineSetupView.xaml /// </summary> - public partial class MachineSetupView : UserControl + public partial class MachineSetupView : UserControl, IMachineSetupView { + public static MachineSetupView Instance { get; set; } + public MachineSetupView() { InitializeComponent(); + Instance = this; + } + + public void AppendLog(string log) + { + txtLog.AppendText(log); + txtLog.SelectionStart = txtLog.Text.Length; + txtLog.ScrollToEnd(); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IMachineSetupView.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IMachineSetupView.cs new file mode 100644 index 000000000..3926f07be --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IMachineSetupView.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.UI.ViewsContracts +{ + public interface IMachineSetupView : IPPCView + { + void AppendLog(String log); + } +} diff --git a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerProcess.cs b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerProcess.cs index 2cc93b138..ef088fdba 100644 --- a/Software/Visual_Studio/Tango.SQLExaminer/ExaminerProcess.cs +++ b/Software/Visual_Studio/Tango.SQLExaminer/ExaminerProcess.cs @@ -34,6 +34,8 @@ namespace Tango.SQLExaminer return Task.Factory.StartNew<ExaminerProcessResult>(() => { Process p = new Process(); + p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + p.StartInfo.CreateNoWindow = true; if (ProcessType == ExaminerProcessType.Schema) { diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToVisibilityConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToVisibilityConverter.cs new file mode 100644 index 000000000..831f34841 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/EnumToVisibilityConverter.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; + +namespace Tango.SharedUI.Converters +{ + public class EnumToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (parameter != null) + { + if (parameter is String) + { + if (parameter.ToString().Contains(",")) + { + String[] values = parameter.ToString().Split(','); + return values.Contains(value.ToString()) ? Visibility.Visible : Visibility.Collapsed; + } + else + { + return value.ToString() == parameter.ToString() ? Visibility.Visible : Visibility.Collapsed; + } + } + else + { + return value == parameter ? Visibility.Visible : Visibility.Collapsed; + } + } + + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index 0fb339486..5aa7f9806 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -92,6 +92,7 @@ <Compile Include="Converters\DoubleToIntConverter.cs" /> <Compile Include="Converters\EnumToDescriptionConverter.cs" /> <Compile Include="Converters\EnumToItemsSourceConverter.cs" /> + <Compile Include="Converters\EnumToVisibilityConverter.cs" /> <Compile Include="Converters\EnumToXamlVectorConverter.cs" /> <Compile Include="Converters\IsEqualConverter.cs" /> <Compile Include="Converters\IsNotConverter.cs" /> @@ -224,7 +225,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchStepProgressBar.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchStepProgressBar.cs new file mode 100644 index 000000000..33bcfd796 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchStepProgressBar.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +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.Touch.Controls +{ + public class TouchStepProgressBar : ListBox + { + private bool _selecting; + + public CornerRadius CornerRadius + { + get { return (CornerRadius)GetValue(CornerRadiusProperty); } + set { SetValue(CornerRadiusProperty, value); } + } + public static readonly DependencyProperty CornerRadiusProperty = + DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(TouchStepProgressBar), new PropertyMetadata(default(CornerRadius))); + + protected override void OnSelectionChanged(SelectionChangedEventArgs e) + { + if (_selecting) return; + + base.OnSelectionChanged(e); + + _selecting = true; + + if (SelectedItem != null) + { + for (int i = 0; i < Items.IndexOf(SelectedItem); i++) + { + var container = ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem; + container.IsSelected = true; + } + } + + _selecting = false; + } + + static TouchStepProgressBar() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchStepProgressBar), new FrameworkPropertyMetadata(typeof(TouchStepProgressBar))); + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchStepProgressBar.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchStepProgressBar.xaml new file mode 100644 index 000000000..99953afe2 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchStepProgressBar.xaml @@ -0,0 +1,75 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:local="clr-namespace:Tango.Touch.Controls"> + + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="../Resources/Colors.xaml" /> + </ResourceDictionary.MergedDictionaries> + + <converters:DisplayMemberPathConverter x:Key="DisplayMemberPathConverter" /> + + <Style TargetType="{x:Type local:TouchStepProgressBar}"> + <Setter Property="CornerRadius" Value="20"></Setter> + <Setter Property="Height" Value="40"></Setter> + <Setter Property="SelectionMode" Value="Multiple"></Setter> + <Setter Property="IsHitTestVisible" Value="False"></Setter> + <Setter Property="Focusable" Value="False"></Setter> + <Setter Property="Background" Value="{StaticResource TangoPrimaryBackgroundBrush}"></Setter> + <Setter Property="ItemsPanel"> + <Setter.Value> + <ItemsPanelTemplate> + <UniformGrid Rows="1" /> + </ItemsPanelTemplate> + </Setter.Value> + </Setter> + <Setter Property="ItemContainerStyle"> + <Setter.Value> + <Style TargetType="ListBoxItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ListBoxItem"> + <DockPanel Margin="1 0" x:Name="dock"> + <TextBlock DockPanel.Dock="Top"> + <TextBlock.Text> + <MultiBinding Converter="{StaticResource DisplayMemberPathConverter}"> + <Binding/> + <Binding RelativeSource="{RelativeSource AncestorType=local:TouchStepProgressBar}" Path="DisplayMemberPath" /> + </MultiBinding> + </TextBlock.Text> + </TextBlock> + <Rectangle Margin="0 10 0 0" Fill="{StaticResource TangoPrimaryAccentBrush}" /> + </DockPanel> + + <ControlTemplate.Triggers> + <Trigger Property="IsSelected" Value="False"> + <Setter TargetName="dock" Property="Opacity" Value="0.5"></Setter> + </Trigger> + <Trigger Property="IsSelected" Value="True"> + <Setter TargetName="dock" Property="Opacity" Value="1"></Setter> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </Setter.Value> + </Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:TouchStepProgressBar}"> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}"> + + <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj index ad9917a13..3e7a68897 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -82,6 +82,7 @@ <Compile Include="Controls\TouchSlider.cs" /> <Compile Include="Controls\TouchStaticListBox.cs" /> <Compile Include="Controls\TouchStaticListBoxItem.cs" /> + <Compile Include="Controls\TouchStepProgressBar.cs" /> <Compile Include="Controls\TouchTable.cs" /> <Compile Include="Controls\TouchTextBox.cs" /> <Compile Include="Controls\TouchPanel.cs" /> @@ -204,6 +205,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Controls\TouchStepProgressBar.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Controls\TouchTextBox.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -364,7 +369,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml index e8cd8b6a8..288307852 100644 --- a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml @@ -40,6 +40,7 @@ <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchNativeListBox.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchGifAnimation.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchFlatListBox.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchStepProgressBar.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchToggleButton.xaml" /> diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml index 6f821d30f..bccc5f3cc 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml @@ -16,6 +16,9 @@ Title="MainWindow" Height="500" Width="800" Foreground="Red" DataContext="{Binding RelativeSource={RelativeSource Self}}"> <Grid> - <touch:TouchNumericTextBox Value="{Binding Value}" Minimum="1" Maximum="100" Margin="0 100 0 0" VerticalAlignment="Top" Width="100" /> + + <StackPanel VerticalAlignment="Center"> + <touch:TouchRingProgress Width="100" Height="100" Value="100" Maximum="100" IsIndeterminate="True" /> + </StackPanel> </Grid> </Window> |
