From de514b47f502ace13335e2a432b896f16af55039 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 20 Dec 2017 10:17:08 +0200 Subject: MERGE. --- .../MachineStudioSettings/SynchronizationModule.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs (limited to 'Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs') diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs new file mode 100644 index 000000000..18e50da90 --- /dev/null +++ b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Settings.MachineStudioSettings +{ + public class SynchronizationModule + { + public String LocalMasterDBFile { get; set; } + + public String LocalSlaveDBFile { get; set; } + } +} -- cgit v1.3.1 From 6091da506db1083f6ca707c24e509ca3470f6a73 Mon Sep 17 00:00:00 2001 From: Roy Date: Fri, 22 Dec 2017 13:28:53 +0200 Subject: Implemented Remote To Local File Synchronization. --- Software/DB/Tango.db | Bin 557056 -> 557056 bytes Software/DB/Tango.mdf | Bin 8388608 -> 8388608 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../Tango.MachineStudio.Synchronization/App.config | 15 + .../AutoComplete/MachinesProvider.cs | 19 + .../Tango.MachineStudio.Synchronization.csproj | 32 +- .../UserControl1.xaml | 12 - .../UserControl1.xaml.cs | 28 -- .../ViewModelLocator.cs | 9 + .../ViewModels/LocalSynchronizationViewVM.cs | 81 ++- .../ViewModels/RemoteSynchronizationViewVM.cs | 372 ++++++++++++++ .../Views/LocalSynchronizationView.xaml | 13 +- .../Views/RemoteSynchronizationView.xaml | 164 ++++++- .../packages.config | 1 + .../Resources/MaterialDesign.xaml | 113 +++++ .../StudioApplication/IStudioApplicationManager.cs | 1 + .../Tango.MachineStudio.Common.csproj | 4 + .../Tango.MachineStudio.UI/App.config | 10 +- .../MachineStudio/Tango.MachineStudio.UI/App.xaml | 59 +-- .../Navigation/DefaultNavigationManager.cs | 5 +- .../DefaultStudioApplicationManager.cs | 12 +- .../Tango.AutoComplete/BindingEvaluator.cs | 56 +++ .../Editors/AutoCompleteTextBox.cs | 545 +++++++++++++++++++++ .../Editors/ISuggestionProvider.cs | 17 + .../Tango.AutoComplete/Editors/SelectionAdapter.cs | 131 +++++ .../Editors/SuggestionProvider.cs | 39 ++ .../Tango.AutoComplete/Editors/Themes/Generic.xaml | 157 ++++++ .../SideChains/Tango.AutoComplete/Enumerations.cs | 5 + .../Tango.AutoComplete/Properties/AssemblyInfo.cs | 53 ++ .../Properties/Resources.Designer.cs | 63 +++ .../Tango.AutoComplete/Properties/Resources.resx | 117 +++++ .../Properties/Settings.Designer.cs | 26 + .../Properties/Settings.settings | 7 + .../Tango.AutoComplete/Tango.AutoComplete.csproj | 100 ++++ .../Tango.AutoComplete/Themes/Generic.xaml | 7 + .../Tango.DAL.Remote/Partials/RemoteDB.cs | 6 +- .../MachineStudioSettings/SynchronizationModule.cs | 2 + .../Tango.Synchronization/Local/SqliteDataBase.cs | 4 +- .../Remote/RemoteDBComparer.cs | 2 +- Software/Visual_Studio/Tango.sln | 25 +- 40 files changed, 2181 insertions(+), 131 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/App.config create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/AutoComplete/MachinesProvider.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/UserControl1.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/UserControl1.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/RemoteSynchronizationViewVM.cs create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/BindingEvaluator.cs create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/ISuggestionProvider.cs create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/SelectionAdapter.cs create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/SuggestionProvider.cs create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/Themes/Generic.xaml create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Enumerations.cs create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Resources.resx create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Settings.settings create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Tango.AutoComplete.csproj create mode 100644 Software/Visual_Studio/SideChains/Tango.AutoComplete/Themes/Generic.xaml (limited to 'Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs') diff --git a/Software/DB/Tango.db b/Software/DB/Tango.db index 00c79da9c..0419b065c 100644 Binary files a/Software/DB/Tango.db and b/Software/DB/Tango.db differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index fb25f3c28..2123553a2 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 6deb366c2..74ecadd2d 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/App.config new file mode 100644 index 000000000..00d1c3941 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/App.config @@ -0,0 +1,15 @@ + + + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/AutoComplete/MachinesProvider.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/AutoComplete/MachinesProvider.cs new file mode 100644 index 000000000..887cb842d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/AutoComplete/MachinesProvider.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.AutoComplete.Editors; +using Tango.DAL.Observables; + +namespace Tango.MachineStudio.Synchronization.AutoComplete +{ + public class MachinesProvider : ISuggestionProvider + { + public IEnumerable GetSuggestions(string filter) + { + return ObservablesEntitiesAdapter.Instance.Machines.Where(x => x.SerialNumber.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj index 8b2f0ae82..12323ff91 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Tango.MachineStudio.Synchronization.csproj @@ -12,6 +12,8 @@ 512 {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 + + true @@ -31,6 +33,12 @@ 4 + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + ..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll @@ -56,6 +64,7 @@ ..\..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll + ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll @@ -74,12 +83,14 @@ + + RemoteSynchronizationView.xaml @@ -92,18 +103,10 @@ MenuView.xaml - - MSBuild:Compile - Designer - GlobalVersionInfo.cs - - UserControl1.xaml - Code - MSBuild:Compile Designer @@ -139,6 +142,7 @@ ResXFileCodeGenerator Resources.Designer.cs + SettingsSingleFileGenerator @@ -146,14 +150,26 @@ + + {bb2abb74-ba58-4812-83aa-ec8171f42df4} + Tango.AutoComplete + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core + + {0e0eef3e-8f4e-4f23-9d19-479fd8d76c12} + Tango.DAL.Local + {0ecd6da8-7aa6-48d9-8b65-279d176ad9af} Tango.DAL.Observables + + {38197109-8610-4d3f-92b9-16d48df94d7c} + Tango.DAL.Remote + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} Tango.Logging diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/UserControl1.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/UserControl1.xaml deleted file mode 100644 index 50afe7e4e..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/UserControl1.xaml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/UserControl1.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/UserControl1.xaml.cs deleted file mode 100644 index 16186b6bd..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/UserControl1.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -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.MachineStudio.Synchronization -{ - /// - /// Interaction logic for UserControl1.xaml - /// - public partial class UserControl1 : UserControl - { - public UserControl1() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModelLocator.cs index 8eac609c2..a58ffe64b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModelLocator.cs @@ -21,6 +21,7 @@ namespace Tango.MachineStudio.Synchronization SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); + SimpleIoc.Default.Register(); SimpleIoc.Default.Unregister(); @@ -50,5 +51,13 @@ namespace Tango.MachineStudio.Synchronization return ServiceLocator.Current.GetInstance(); } } + + public static RemoteSynchronizationViewVM RemoteSynchronizationViewVM + { + get + { + return ServiceLocator.Current.GetInstance(); + } + } } } \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/LocalSynchronizationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/LocalSynchronizationViewVM.cs index 773080813..9c805cca4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/LocalSynchronizationViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/LocalSynchronizationViewVM.cs @@ -46,20 +46,21 @@ namespace Tango.MachineStudio.Synchronization.ViewModels BrowseMasterDBCommand = new RelayCommand(BrowseMasterDB, (x) => !_isWorking); BrowseSlaveDBCommand = new RelayCommand(BrowseSlaveDB, (x) => !_isWorking); - CompareCommand = new RelayCommand(Compare, (x) => _masterDBFile != null && _slaveDBFile != null && !_isWorking); + CompareCommand = new RelayCommand(Compare, (x) => MasterDBFile != null && SlaveDBFile != null && !_isWorking); CommitCommand = new RelayCommand(Commit, (x) => SelectedDifference != null && !_isWorking); CommitAllCommand = new RelayCommand(CommitAll, (x) => Differences.Count > 0 && !_isWorking); + CleanCommand = new RelayCommand(CleanSlave, (x) => !_isWorking && SlaveDBFile != null); if (File.Exists(SettingsManager.Default.MachineStudio.SynchronizationModule.LocalMasterDBFile)) { - _masterDBFile = SettingsManager.Default.MachineStudio.SynchronizationModule.LocalMasterDBFile; - MasterDBName = Path.GetFileName(_masterDBFile); + MasterDBFile = SettingsManager.Default.MachineStudio.SynchronizationModule.LocalMasterDBFile; + MasterDBName = Path.GetFileName(MasterDBFile); } if (File.Exists(SettingsManager.Default.MachineStudio.SynchronizationModule.LocalSlaveDBFile)) { - _slaveDBFile = SettingsManager.Default.MachineStudio.SynchronizationModule.LocalSlaveDBFile; - SlaveDBName = Path.GetFileName(_slaveDBFile); + SlaveDBFile = SettingsManager.Default.MachineStudio.SynchronizationModule.LocalSlaveDBFile; + SlaveDBName = Path.GetFileName(SlaveDBFile); } } @@ -96,6 +97,11 @@ namespace Tango.MachineStudio.Synchronization.ViewModels /// Gets or sets the commit all command. /// public RelayCommand CommitAllCommand { get; set; } + + /// + /// Gets or sets the clean command. + /// + public RelayCommand CleanCommand { get; set; } #endregion #region Properties @@ -140,13 +146,68 @@ namespace Tango.MachineStudio.Synchronization.ViewModels set { _slaveDBName = value; RaisePropertyChanged(nameof(SlaveDBName)); } } + /// + /// Gets or sets the slave database file. + /// + public String SlaveDBFile + { + get { return _slaveDBFile; } + set { _slaveDBFile = value; RaisePropertyChangedAuto(); } + } + + /// + /// Gets or sets the master database file. + /// + public String MasterDBFile + { + get { return _masterDBFile; } + set { _masterDBFile = value; RaisePropertyChangedAuto(); } + } + #endregion #region Private Methods + private async void CleanSlave() + { + if (_notification.ShowQuestion("Are you sure you want to erase all data on slave database?")) + { + using (_notification.PushTaskItem("Clearing database...")) + { + try + { + _isWorking = true; + await Task.Factory.StartNew(() => + { + SQLiteDataBase localDB = new SQLiteDataBase(SlaveDBFile); + localDB.LoadTables(); + localDB.ClearDataBase(); + try + { + localDB.Dispose(); + } + catch { } + }); + + Differences.Clear(); + } + catch (Exception ex) + { + ShowError(LogManager.Log(ex).Message); + } + finally + { + _isWorking = false; + InvalidateRelayCommands(); + SelectedDifference = null; + } + } + } + } + private void Compare() { - _comparer = new LocalDBComparer(new SQLiteDataBase(_masterDBFile), new SQLiteDataBase(_slaveDBFile)); + _comparer = new LocalDBComparer(new SQLiteDataBase(MasterDBFile), new SQLiteDataBase(SlaveDBFile)); Task.Factory.StartNew(() => { @@ -179,8 +240,8 @@ namespace Tango.MachineStudio.Synchronization.ViewModels SelectedDifference = null; InvalidateRelayCommands(); - SettingsManager.Default.MachineStudio.SynchronizationModule.LocalMasterDBFile = _masterDBFile; - SettingsManager.Default.MachineStudio.SynchronizationModule.LocalSlaveDBFile = _slaveDBFile; + SettingsManager.Default.MachineStudio.SynchronizationModule.LocalMasterDBFile = MasterDBFile; + SettingsManager.Default.MachineStudio.SynchronizationModule.LocalSlaveDBFile = SlaveDBFile; SettingsManager.SaveDefaultSettings(); } } @@ -258,7 +319,7 @@ namespace Tango.MachineStudio.Synchronization.ViewModels String file = BrowseForFilePath(); if (file != null) { - _slaveDBFile = file; + SlaveDBFile = file; SlaveDBName = Path.GetFileName(file); InvalidateRelayCommands(); } @@ -269,7 +330,7 @@ namespace Tango.MachineStudio.Synchronization.ViewModels String file = BrowseForFilePath(); if (file != null) { - _masterDBFile = file; + MasterDBFile = file; MasterDBName = Path.GetFileName(file); InvalidateRelayCommands(); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/RemoteSynchronizationViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/RemoteSynchronizationViewVM.cs new file mode 100644 index 000000000..e14b0ffb9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/RemoteSynchronizationViewVM.cs @@ -0,0 +1,372 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Data.Entity.Validation; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.DAL.Local.DB; +using Tango.DAL.Observables; +using Tango.DAL.Remote.DB; +using Tango.Logging; +using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.MachineStudio.Synchronization.Navigation; +using Tango.Settings; +using Tango.SharedUI; +using Tango.Synchronization; +using Tango.Synchronization.Local; +using Tango.Synchronization.Remote; + +namespace Tango.MachineStudio.Synchronization.ViewModels +{ + public class RemoteSynchronizationViewVM : ViewModel, IShutdownRequestBlocker + { + private SyncNavigationManager _navigation; + private String _slaveDBFile; + private INotificationProvider _notification; + private bool _isWorking; + private RemoteDBComparer _comparer; + private RemoteDB _remoteDB; + private LocalDB _localDB; + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The navigation. + /// The notification. + public RemoteSynchronizationViewVM(SyncNavigationManager navigation, INotificationProvider notification) + { + _navigation = navigation; + _notification = notification; + + BackCommand = new RelayCommand(() => _navigation.NavigateTo(NavigationView.MenuView)); + + Differences = new ObservableCollection(); + + BrowseSlaveDBCommand = new RelayCommand(BrowseSlaveDB, (x) => !_isWorking); + CompareCommand = new RelayCommand(Compare, (x) => SlaveDBFile != null && !_isWorking && SelectedMachine != null); + CommitCommand = new RelayCommand(Commit, (x) => SelectedDifference != null && !_isWorking && SelectedMachine != null); + CommitAllCommand = new RelayCommand(CommitAll, (x) => Differences.Count > 0 && !_isWorking && SelectedMachine != null); + CleanCommand = new RelayCommand(CleanSlave, (x) => !_isWorking && SlaveDBFile != null); + + if (File.Exists(SettingsManager.Default.MachineStudio.SynchronizationModule.RemoteSQLiteFile)) + { + SlaveDBFile = SettingsManager.Default.MachineStudio.SynchronizationModule.RemoteSQLiteFile; + SlaveDBName = Path.GetFileName(SlaveDBFile); + } + } + + #endregion + + #region Commands + + /// + /// Gets or sets the back command. + /// + public RelayCommand BackCommand { get; set; } + + /// + /// Gets or sets the browse master database command. + /// + public RelayCommand BrowseMasterDBCommand { get; set; } + + /// + /// Gets or sets the browse slave database command. + /// + public RelayCommand BrowseSlaveDBCommand { get; set; } + + /// + /// Gets or sets the compare command. + /// + public RelayCommand CompareCommand { get; set; } + + /// + /// Gets or sets the commit command. + /// + public RelayCommand CommitCommand { get; set; } + + /// + /// Gets or sets the commit all command. + /// + public RelayCommand CommitAllCommand { get; set; } + + /// + /// Gets or sets the clean command. + /// + public RelayCommand CleanCommand { get; set; } + + #endregion + + #region Properties + + private ObservableCollection _differences; + /// + /// Gets or sets the differences. + /// + public ObservableCollection Differences + { + get { return _differences; } + set { _differences = value; RaisePropertyChanged(nameof(Differences)); } + } + + private Diff _selectedDifference; + /// + /// Gets or sets the selected difference. + /// + public Diff SelectedDifference + { + get { return _selectedDifference; } + set { _selectedDifference = value; RaisePropertyChanged(nameof(SelectedDifference)); InvalidateRelayCommands(); } + } + + private String _slaveDBName; + /// + /// Gets or sets the name of the slave database. + /// + public String SlaveDBName + { + get { return _slaveDBName; } + set { _slaveDBName = value; RaisePropertyChanged(nameof(SlaveDBName)); } + } + + private Machine _selectedMachine; + /// + /// Gets or sets the selected machine. + /// + public Machine SelectedMachine + { + get { return _selectedMachine; } + set { _selectedMachine = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + /// + /// Gets or sets the slave database file. + /// + public String SlaveDBFile + { + get { return _slaveDBFile; } + set { _slaveDBFile = value; RaisePropertyChangedAuto(); } + } + #endregion + + #region Private Methods + + private async void CleanSlave() + { + if (_notification.ShowQuestion("Are you sure you want to erase all data on slave database?")) + { + using (_notification.PushTaskItem("Clearing database...")) + { + try + { + _isWorking = true; + await Task.Factory.StartNew(() => + { + SQLiteDataBase localDB = new SQLiteDataBase(SlaveDBFile); + localDB.LoadTables(); + localDB.ClearDataBase(); + try + { + localDB.Dispose(); + } + catch{ } + }); + + Differences.Clear(); + } + catch (Exception ex) + { + ShowError(LogManager.Log(ex).Message); + } + finally + { + _isWorking = false; + InvalidateRelayCommands(); + SelectedDifference = null; + } + } + } + } + + private void Compare() + { + Task.Factory.StartNew(() => + { + using (_notification.PushTaskItem("Comparing Databases...")) + { + try + { + if (_comparer != null) + { + _comparer.Dispose(); + } + + _remoteDB = RemoteDB.CreateDefault(); + _localDB = new LocalDB(SlaveDBFile); + _comparer = new RemoteDBComparer(_remoteDB, _localDB, SelectedMachine.SerialNumber); + _isWorking = true; + InvalidateRelayCommands(); + Thread.Sleep(1500); + var diffs = _comparer.Compare(); + Differences = new ObservableCollection(diffs); + + if (diffs.Where(x => x.Action != DiffAction.ReplaceTableDataInSlave).Count() > 0) + { + ShowInfo("Found " + Differences.Where(x => x.Action != DiffAction.ReplaceTableDataInSlave).Count() + " differences."); + } + else + { + ShowInfo("The master and slave databases are synchronized."); + } + } + catch (Exception ex) + { + ShowError(ex.Message); + } + finally + { + _isWorking = false; + SelectedDifference = null; + InvalidateRelayCommands(); + + SettingsManager.Default.MachineStudio.SynchronizationModule.RemoteSQLiteFile = SlaveDBFile; + SettingsManager.SaveDefaultSettings(); + } + } + }); + } + + private void Commit() + { + Task.Factory.StartNew(() => + { + using (_notification.PushTaskItem("Committing difference...")) + { + try + { + _isWorking = true; + InvalidateRelayCommands(); + Thread.Sleep(1500); + SelectedDifference.Commit(); + _remoteDB.SaveChanges(); + _localDB.SaveChanges(); + + InvokeUINow(() => Differences.Remove(SelectedDifference)); + } + catch (Exception ex) + { + ShowError(ex.Message); + } + finally + { + _isWorking = false; + SelectedDifference = null; + InvalidateRelayCommands(); + } + } + }); + } + + private void CommitAll() + { + Task.Factory.StartNew(() => + { + using (_notification.PushTaskItem("Committing all differences...")) + { + try + { + _isWorking = true; + InvalidateRelayCommands(); + Thread.Sleep(1500); + + for (int i = 0; i < Differences.Count; i++) + { + var diff = Differences[i]; + using (_notification.PushTaskItem("Committing difference " + (Differences.IndexOf(diff) + 1) + "...")) + { + diff.Commit(); + InvokeUINow(() => Differences.Remove(diff)); + i--; + } + } + + _remoteDB.SaveChanges(); + _localDB.SaveChanges(); + } + catch (DbEntityValidationException ex) + { + String message = "The following validation errors occurred while trying to update the database." + Environment.NewLine + Environment.NewLine; + + foreach (var error in ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).ToList()) + { + message += error.ErrorMessage + Environment.NewLine; + } + + ShowError(message); + } + catch (Exception ex) + { + ShowError(ex.Message); + } + finally + { + _isWorking = false; + SelectedDifference = null; + InvalidateRelayCommands(); + } + } + }); + } + + private void BrowseSlaveDB() + { + String file = BrowseForFilePath(); + if (file != null) + { + SlaveDBFile = file; + SlaveDBName = Path.GetFileName(file); + InvalidateRelayCommands(); + } + } + + private String BrowseForFilePath() + { + OpenFileDialog dlg = new OpenFileDialog(); + dlg.Title = "Select SQLite Database File"; + dlg.Filter = "SQLite Database|*.db"; + if (dlg.ShowDialog().Value) + { + return dlg.FileName; + } + return null; + } + + private void ShowError(String message) + { + InvokeUINow(() => _notification.ShowError(message)); + } + + private void ShowInfo(String message) + { + InvokeUINow(() => _notification.ShowInfo(message)); + } + + public Task OnShutdownRequest() + { + if (_comparer != null) + { + _comparer.Dispose(); + } + return Task.FromResult(true); + } + + #endregion + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/LocalSynchronizationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/LocalSynchronizationView.xaml index e52a8bfc1..72297e2cb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/LocalSynchronizationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/LocalSynchronizationView.xaml @@ -75,7 +75,7 @@ Master Database - + @@ -86,7 +86,7 @@ Slave Database - + @@ -101,7 +101,7 @@ - + @@ -131,6 +131,13 @@ + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/RemoteSynchronizationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/RemoteSynchronizationView.xaml index 92c8fa674..2487aab64 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/RemoteSynchronizationView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/Views/RemoteSynchronizationView.xaml @@ -3,10 +3,170 @@ 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:providers="clr-namespace:Tango.MachineStudio.Synchronization.AutoComplete" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:synchronization="clr-namespace:Tango.Synchronization;assembly=Tango.Synchronization" + xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" + xmlns:global="clr-namespace:Tango.MachineStudio.Synchronization" + xmlns:local="clr-namespace:Tango.MachineStudio.Synchronization.Views" + xmlns:fa="http://schemas.fontawesome.io/icons/" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" Background="White"> + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.RemoteSynchronizationViewVM}"> + + + + + + + + + + + + + + + + + + + + + + + + + + - Remote Sync + + + + + + + + Local Database Synchronization + + + + + + + + + + + + + + + + + + + + + + + + Remote Database + + + + + + + + + + + + + + + + + + SQLite Database + + + + + + + + + + + + + + + Differences + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/packages.config index 42945b407..8d8f972d1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/packages.config @@ -1,6 +1,7 @@  + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml index 482e852d6..58bb9ef34 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml @@ -1,5 +1,7 @@  @@ -61,5 +63,116 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index 0ee27fbf6..740c257b9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -8,6 +8,7 @@ namespace Tango.MachineStudio.Common.StudioApplication { public interface IStudioApplicationManager { + bool IsShuttingDown { get;} void ShutDown(); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 70962a2f7..32466e45a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -126,6 +126,10 @@ + + {bb2abb74-ba58-4812-83aa-ec8171f42df4} + Tango.AutoComplete + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} Tango.Core diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config index 250f57a4d..b31d56717 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.config @@ -1,7 +1,6 @@  -
@@ -11,6 +10,15 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml index 6974f54be..8e5876e79 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml @@ -9,64 +9,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs index 10314ae62..15f2fe422 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs @@ -11,7 +11,10 @@ namespace Tango.MachineStudio.UI.Navigation { public void NavigateTo(NavigationView view) { - MainWindow.Instance.TransitionControl.AutoNavigate(view.ToString()); + MainWindow.Instance.Dispatcher.Invoke(() => + { + MainWindow.Instance.TransitionControl.AutoNavigate(view.ToString()); + }); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index b95a74a3e..ea4234fd8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -23,9 +23,13 @@ namespace Tango.MachineStudio.UI.StudioApplication _navigationManager = navigationManager; } + public bool IsShuttingDown { get; private set; } + public async void ShutDown() { - _navigationManager.NavigateTo(NavigationView.ShutdownView); + if (IsShuttingDown) return; + + IsShuttingDown = true; await Task.Factory.StartNew(async () => { @@ -36,14 +40,12 @@ namespace Tango.MachineStudio.UI.StudioApplication var result = await vm.OnShutdownRequest(); if (!result) { - ThreadsHelper.InvokeUI(() => - { - _navigationManager.NavigateTo(NavigationView.MainView); - }); + IsShuttingDown = false; return; } } + _navigationManager.NavigateTo(NavigationView.ShutdownView); Thread.Sleep(3000); Environment.Exit(0); diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/BindingEvaluator.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/BindingEvaluator.cs new file mode 100644 index 000000000..a577db660 --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/BindingEvaluator.cs @@ -0,0 +1,56 @@ +namespace Tango.AutoComplete +{ + + using System.Windows; + using System.Windows.Data; + public class BindingEvaluator : FrameworkElement + { + + #region "Fields" + + + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(BindingEvaluator), new FrameworkPropertyMetadata(string.Empty)); + + private Binding _valueBinding; + #endregion + + #region "Constructors" + + public BindingEvaluator(Binding binding) + { + ValueBinding = binding; + } + + #endregion + + #region "Properties" + + public string Value + { + get { return (string)GetValue(ValueProperty); } + + set { SetValue(ValueProperty, value); } + } + + public Binding ValueBinding + { + get { return _valueBinding; } + set { _valueBinding = value; } + } + + #endregion + + #region "Methods" + + public string Evaluate(object dataItem) + { + this.DataContext = dataItem; + SetBinding(ValueProperty, ValueBinding); + return Value; + } + + #endregion + + } + +} diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs new file mode 100644 index 000000000..f350c0b9b --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs @@ -0,0 +1,545 @@ +namespace Tango.AutoComplete.Editors +{ + + using System; + using System.Collections; + using System.Threading; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Controls.Primitives; + using System.Windows.Data; + using System.Windows.Input; + using System.Windows.Media; + using System.Windows.Threading; + + [TemplatePart(Name = AutoCompleteTextBox.PartEditor, Type = typeof(TextBox))] + [TemplatePart(Name = AutoCompleteTextBox.PartPopup, Type = typeof(Popup))] + [TemplatePart(Name = AutoCompleteTextBox.PartSelector, Type = typeof(Selector))] + public class AutoCompleteTextBox : Control + { + + #region "Fields" + + public const string PartEditor = "PART_Editor"; + public const string PartPopup = "PART_Popup"; + + public const string PartSelector = "PART_Selector"; + public static readonly DependencyProperty DelayProperty = DependencyProperty.Register("Delay", typeof(int), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(200)); + public static readonly DependencyProperty DisplayMemberProperty = DependencyProperty.Register("DisplayMember", typeof(string), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(string.Empty)); + public static readonly DependencyProperty IconPlacementProperty = DependencyProperty.Register("IconPlacement", typeof(IconPlacement), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(IconPlacement.Left)); + public static readonly DependencyProperty IconProperty = DependencyProperty.Register("Icon", typeof(object), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(null)); + public static readonly DependencyProperty IconVisibilityProperty = DependencyProperty.Register("IconVisibility", typeof(Visibility), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(Visibility.Visible)); + public static readonly DependencyProperty IsDropDownOpenProperty = DependencyProperty.Register("IsDropDownOpen", typeof(bool), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(false)); + public static readonly DependencyProperty IsLoadingProperty = DependencyProperty.Register("IsLoading", typeof(bool), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(false)); + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(false)); + public static readonly DependencyProperty ItemTemplateProperty = DependencyProperty.Register("ItemTemplate", typeof(DataTemplate), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(null)); + public static readonly DependencyProperty ItemTemplateSelectorProperty = DependencyProperty.Register("ItemTemplateSelector", typeof(DataTemplateSelector), typeof(AutoCompleteTextBox)); + public static readonly DependencyProperty LoadingContentProperty = DependencyProperty.Register("LoadingContent", typeof(object), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(null)); + public static readonly DependencyProperty ProviderProperty = DependencyProperty.Register("Provider", typeof(ISuggestionProvider), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(null)); + public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem", typeof(object), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(null, OnSelectedItemChanged)); + public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(string.Empty)); + public static readonly DependencyProperty MaxLengthProperty = DependencyProperty.Register("MaxLength", typeof(int), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(0)); + public static readonly DependencyProperty CharacterCasingProperty = DependencyProperty.Register("CharacterCasing", typeof(CharacterCasing), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(CharacterCasing.Normal)); + public static readonly DependencyProperty MaxPopUpHeightProperty = DependencyProperty.Register("MaxPopUpHeight", typeof(int), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(600)); + + public static readonly DependencyProperty WatermarkProperty = DependencyProperty.Register("Watermark", typeof(string), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(string.Empty)); + + public static readonly DependencyProperty SuggestionBackgroundProperty = DependencyProperty.Register("SuggestionBackground", typeof(Brush), typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(Brushes.White)); + private BindingEvaluator _bindingEvaluator; + + private TextBox _editor; + + private DispatcherTimer _fetchTimer; + + private string _filter; + + private bool _isUpdatingText; + + private Selector _itemsSelector; + + private Popup _popup; + + private SelectionAdapter _selectionAdapter; + + private bool _selectionCancelled; + + private SuggestionsAdapter _suggestionsAdapter; + + + #endregion + + #region "Constructors" + + static AutoCompleteTextBox() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(AutoCompleteTextBox), new FrameworkPropertyMetadata(typeof(AutoCompleteTextBox))); + } + + #endregion + + #region "Properties" + + + public int MaxPopupHeight + { + get { return (int) GetValue(MaxPopUpHeightProperty); } + set { SetValue(MaxPopUpHeightProperty, value);} + } + + + public BindingEvaluator BindingEvaluator + { + get { return _bindingEvaluator; } + set { _bindingEvaluator = value; } + } + + public CharacterCasing CharacterCasing + { + get { return (System.Windows.Controls.CharacterCasing) GetValue(CharacterCasingProperty); } + set { SetValue(CharacterCasingProperty, value);} + } + + public int MaxLength + { + get { return (int) GetValue(DelayProperty); } + set { SetValue(MaxLengthProperty, value); } + } + + public int Delay + { + get { return (int)GetValue(DelayProperty); } + + set { SetValue(DelayProperty, value); } + } + + public string DisplayMember + { + get { return (string)GetValue(DisplayMemberProperty); } + + set { SetValue(DisplayMemberProperty, value); } + } + + public TextBox Editor + { + get { return _editor; } + set { _editor = value; } + } + + public DispatcherTimer FetchTimer + { + get { return _fetchTimer; } + set { _fetchTimer = value; } + } + + public string Filter + { + get { return _filter; } + set { _filter = value; } + } + + public object Icon + { + get { return GetValue(IconProperty); } + + set { SetValue(IconProperty, value); } + } + + public IconPlacement IconPlacement + { + get { return (IconPlacement)GetValue(IconPlacementProperty); } + + set { SetValue(IconPlacementProperty, value); } + } + + public Visibility IconVisibility + { + get { return (Visibility)GetValue(IconVisibilityProperty); } + + set { SetValue(IconVisibilityProperty, value); } + } + + public bool IsDropDownOpen + { + get { return (bool)GetValue(IsDropDownOpenProperty); } + + set { SetValue(IsDropDownOpenProperty, value); } + } + + public bool IsLoading + { + get { return (bool)GetValue(IsLoadingProperty); } + + set { SetValue(IsLoadingProperty, value); } + } + + public bool IsReadOnly + { + get { return (bool)GetValue(IsReadOnlyProperty); } + + set { SetValue(IsReadOnlyProperty, value); } + } + + public Selector ItemsSelector + { + get { return _itemsSelector; } + set { _itemsSelector = value; } + } + + public DataTemplate ItemTemplate + { + get { return (DataTemplate)GetValue(ItemTemplateProperty); } + + set { SetValue(ItemTemplateProperty, value); } + } + + public DataTemplateSelector ItemTemplateSelector + { + get { return ((DataTemplateSelector)(GetValue(AutoCompleteTextBox.ItemTemplateSelectorProperty))); } + set { SetValue(AutoCompleteTextBox.ItemTemplateSelectorProperty, value); } + } + + public object LoadingContent + { + get { return GetValue(LoadingContentProperty); } + + set { SetValue(LoadingContentProperty, value); } + } + + public Popup Popup + { + get { return _popup; } + set { _popup = value; } + } + + public ISuggestionProvider Provider + { + get { return (ISuggestionProvider)GetValue(ProviderProperty); } + + set { SetValue(ProviderProperty, value); } + } + + public object SelectedItem + { + get { return GetValue(SelectedItemProperty); } + + set { SetValue(SelectedItemProperty, value); } + } + + public SelectionAdapter SelectionAdapter + { + get { return _selectionAdapter; } + set { _selectionAdapter = value; } + } + + public string Text + { + get { return (string)GetValue(TextProperty); } + + set { SetValue(TextProperty, value); } + } + + public string Watermark + { + get { return (string)GetValue(WatermarkProperty); } + + set { SetValue(WatermarkProperty, value); } + } + public Brush SuggestionBackground { + get { return (Brush)GetValue(SuggestionBackgroundProperty); } + + set { SetValue(SuggestionBackgroundProperty, value); } + } + + #endregion + + #region "Methods" + + public static void OnSelectedItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + AutoCompleteTextBox act = null; + act = d as AutoCompleteTextBox; + if (act != null) + { + if (act.Editor != null & !act._isUpdatingText) + { + act._isUpdatingText = true; + act.Editor.Text = act.BindingEvaluator.Evaluate(e.NewValue); + act._isUpdatingText = false; + } + } + } + + private void ScrollToSelectedItem() + { + ListBox listBox = ItemsSelector as ListBox; + if (listBox != null && listBox.SelectedItem != null) + listBox.ScrollIntoView(listBox.SelectedItem); + } + + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + Editor = Template.FindName(PartEditor, this) as TextBox; + Popup = Template.FindName(PartPopup, this) as Popup; + ItemsSelector = Template.FindName(PartSelector, this) as Selector; + BindingEvaluator = new BindingEvaluator(new Binding(DisplayMember)); + + if (Editor != null) + { + Editor.TextChanged += OnEditorTextChanged; + Editor.PreviewKeyDown += OnEditorKeyDown; + Editor.LostFocus += OnEditorLostFocus; + + if (SelectedItem != null) + { + Editor.Text = BindingEvaluator.Evaluate(SelectedItem); + } + + } + + this.GotFocus += AutoCompleteTextBox_GotFocus; + + if (Popup != null) + { + Popup.StaysOpen = false; + Popup.Opened += OnPopupOpened; + Popup.Closed += OnPopupClosed; + } + if (ItemsSelector != null) + { + SelectionAdapter = new SelectionAdapter(ItemsSelector); + SelectionAdapter.Commit += OnSelectionAdapterCommit; + SelectionAdapter.Cancel += OnSelectionAdapterCancel; + SelectionAdapter.SelectionChanged += OnSelectionAdapterSelectionChanged; + ItemsSelector.PreviewMouseDown += ItemsSelector_PreviewMouseDown; + } + } + private void ItemsSelector_PreviewMouseDown(object sender, MouseButtonEventArgs e) + { + var pos_item = (e.OriginalSource as FrameworkElement)?.DataContext; + if (pos_item == null) + return; + if (!ItemsSelector.Items.Contains(pos_item)) + return; + ItemsSelector.SelectedItem = pos_item; + OnSelectionAdapterCommit(); + } + private void AutoCompleteTextBox_GotFocus(object sender, RoutedEventArgs e) + { + Editor?.Focus(); + } + + private string GetDisplayText(object dataItem) + { + if (BindingEvaluator == null) + { + BindingEvaluator = new BindingEvaluator(new Binding(DisplayMember)); + } + if (dataItem == null) + { + return string.Empty; + } + if (string.IsNullOrEmpty(DisplayMember)) + { + return dataItem.ToString(); + } + return BindingEvaluator.Evaluate(dataItem); + } + + private void OnEditorKeyDown(object sender, KeyEventArgs e) + { + if (SelectionAdapter != null) + { + if (IsDropDownOpen) + SelectionAdapter.HandleKeyDown(e); + else + IsDropDownOpen = e.Key == Key.Down || e.Key == Key.Up; + } + } + + private void OnEditorLostFocus(object sender, RoutedEventArgs e) + { + if (!IsKeyboardFocusWithin) + { + IsDropDownOpen = false; + } + } + + private void OnEditorTextChanged(object sender, TextChangedEventArgs e) + { + if (_isUpdatingText) + return; + if (FetchTimer == null) + { + FetchTimer = new DispatcherTimer(); + FetchTimer.Interval = TimeSpan.FromMilliseconds(Delay); + FetchTimer.Tick += OnFetchTimerTick; + } + FetchTimer.IsEnabled = false; + FetchTimer.Stop(); + SetSelectedItem(null); + if (Editor.Text.Length > 0) + { + IsLoading = true; + IsDropDownOpen = true; + ItemsSelector.ItemsSource = null; + FetchTimer.IsEnabled = true; + FetchTimer.Start(); + } + else + { + IsDropDownOpen = false; + } + } + + private void OnFetchTimerTick(object sender, EventArgs e) + { + FetchTimer.IsEnabled = false; + FetchTimer.Stop(); + if (Provider != null && ItemsSelector != null) + { + Filter = Editor.Text; + if (_suggestionsAdapter == null) + { + _suggestionsAdapter = new SuggestionsAdapter(this); + } + _suggestionsAdapter.GetSuggestions(Filter); + } + } + + private void OnPopupClosed(object sender, EventArgs e) + { + if (!_selectionCancelled) + { + OnSelectionAdapterCommit(); + } + } + + private void OnPopupOpened(object sender, EventArgs e) + { + _selectionCancelled = false; + ItemsSelector.SelectedItem = SelectedItem; + } + + private void OnSelectionAdapterCancel() + { + _isUpdatingText = true; + Editor.Text = SelectedItem == null ? Filter : GetDisplayText(SelectedItem); + Editor.SelectionStart = Editor.Text.Length; + Editor.SelectionLength = 0; + _isUpdatingText = false; + IsDropDownOpen = false; + _selectionCancelled = true; + } + + private void OnSelectionAdapterCommit() + { + if (ItemsSelector.SelectedItem != null) + { + SelectedItem = ItemsSelector.SelectedItem; + _isUpdatingText = true; + Editor.Text = GetDisplayText(ItemsSelector.SelectedItem); + SetSelectedItem(ItemsSelector.SelectedItem); + _isUpdatingText = false; + IsDropDownOpen = false; + } + } + + private void OnSelectionAdapterSelectionChanged() + { + _isUpdatingText = true; + if (ItemsSelector.SelectedItem == null) + { + Editor.Text = Filter; + } + else + { + Editor.Text = GetDisplayText(ItemsSelector.SelectedItem); + } + Editor.SelectionStart = Editor.Text.Length; + Editor.SelectionLength = 0; + ScrollToSelectedItem(); + _isUpdatingText = false; + } + + private void SetSelectedItem(object item) + { + _isUpdatingText = true; + SelectedItem = item; + _isUpdatingText = false; + } + #endregion + + #region "Nested Types" + + private class SuggestionsAdapter + { + + #region "Fields" + + private AutoCompleteTextBox _actb; + + private string _filter; + #endregion + + #region "Constructors" + + public SuggestionsAdapter(AutoCompleteTextBox actb) + { + _actb = actb; + } + + #endregion + + #region "Methods" + + public void GetSuggestions(string searchText) + { + _filter = searchText; + _actb.IsLoading = true; + ParameterizedThreadStart thInfo = new ParameterizedThreadStart(GetSuggestionsAsync); + Thread th = new Thread(thInfo); + th.Start(new object[] { + searchText, + _actb.Provider + }); + } + + private void DisplaySuggestions(IEnumerable suggestions, string filter) + { + if (_filter != filter) + { + return; + } + if (_actb.IsDropDownOpen) + { + _actb.IsLoading = false; + _actb.ItemsSelector.ItemsSource = suggestions; + _actb.IsDropDownOpen = _actb.ItemsSelector.HasItems; + } + + } + + private void GetSuggestionsAsync(object param) + { + object[] args = param as object[]; + string searchText = Convert.ToString(args[0]); + ISuggestionProvider provider = args[1] as ISuggestionProvider; + IEnumerable list = provider.GetSuggestions(searchText); + _actb.Dispatcher.BeginInvoke(new Action(DisplaySuggestions), DispatcherPriority.Background, new object[] { + list, + searchText + }); + } + + #endregion + + } + + #endregion + + } + +} diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/ISuggestionProvider.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/ISuggestionProvider.cs new file mode 100644 index 000000000..eca96a456 --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/ISuggestionProvider.cs @@ -0,0 +1,17 @@ + + +namespace Tango.AutoComplete.Editors +{ + using System.Collections; + + public interface ISuggestionProvider + { + + #region Public Methods + + IEnumerable GetSuggestions(string filter); + + #endregion Public Methods + + } +} diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/SelectionAdapter.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/SelectionAdapter.cs new file mode 100644 index 000000000..3fcc8fd12 --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/SelectionAdapter.cs @@ -0,0 +1,131 @@ +namespace Tango.AutoComplete.Editors +{ + + using System.Diagnostics; + using System.Windows.Controls.Primitives; + using System.Windows.Input; + + public class SelectionAdapter + { + + #region "Fields" + + + private Selector _selectorControl; + #endregion + + #region "Constructors" + + public SelectionAdapter(Selector selector) + { + SelectorControl = selector; + SelectorControl.PreviewMouseUp += OnSelectorMouseDown; + } + + #endregion + + #region "Events" + + public delegate void CancelEventHandler(); + + public delegate void CommitEventHandler(); + + public delegate void SelectionChangedEventHandler(); + + public event CancelEventHandler Cancel; + public event CommitEventHandler Commit; + public event SelectionChangedEventHandler SelectionChanged; + #endregion + + #region "Properties" + + public Selector SelectorControl + { + get { return _selectorControl; } + set { _selectorControl = value; } + } + + #endregion + + #region "Methods" + + public void HandleKeyDown(KeyEventArgs key) + { + Debug.WriteLine(key.Key); + switch (key.Key) + { + case Key.Down: + IncrementSelection(); + break; + case Key.Up: + DecrementSelection(); + break; + case Key.Enter: + if (Commit != null) + { + Commit(); + } + + break; + case Key.Escape: + if (Cancel != null) + { + Cancel(); + } + + break; + case Key.Tab: + if (Commit != null) + { + Commit(); + } + + break; + } + } + + private void DecrementSelection() + { + if (SelectorControl.SelectedIndex == -1) + { + SelectorControl.SelectedIndex = SelectorControl.Items.Count - 1; + } + else + { + SelectorControl.SelectedIndex -= 1; + } + if (SelectionChanged != null) + { + SelectionChanged(); + } + } + + private void IncrementSelection() + { + if (SelectorControl.SelectedIndex == SelectorControl.Items.Count - 1) + { + SelectorControl.SelectedIndex = -1; + } + else + { + SelectorControl.SelectedIndex += 1; + } + if (SelectionChanged != null) + { + SelectionChanged(); + } + } + + private void OnSelectorMouseDown(object sender, MouseButtonEventArgs e) + { + if (Commit != null) + { + Commit(); + } + } + + #endregion + + } + +} diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/SuggestionProvider.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/SuggestionProvider.cs new file mode 100644 index 000000000..8efb56f94 --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/SuggestionProvider.cs @@ -0,0 +1,39 @@ +namespace Tango.AutoComplete.Editors +{ + + using System; + using System.Collections; + public class SuggestionProvider : ISuggestionProvider + { + + + #region Private Fields + + private Func _method; + + #endregion Private Fields + + #region Public Constructors + + public SuggestionProvider(Func method) + { + if (method == null) + { + throw new ArgumentNullException("method"); + } + _method = method; + } + + #endregion Public Constructors + + #region Public Methods + + public System.Collections.IEnumerable GetSuggestions(string filter) + { + return _method(filter); + } + + #endregion Public Methods + + } +} diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/Themes/Generic.xaml b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/Themes/Generic.xaml new file mode 100644 index 000000000..a3c124841 --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/Themes/Generic.xaml @@ -0,0 +1,157 @@ + + + + + + + + + + diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Enumerations.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Enumerations.cs new file mode 100644 index 000000000..fdc6cbea1 --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Enumerations.cs @@ -0,0 +1,5 @@ +public enum IconPlacement +{ + Left, + Right +} \ No newline at end of file diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/AssemblyInfo.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..ef723816b --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/AssemblyInfo.cs @@ -0,0 +1,53 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; +using System.Windows.Markup; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.AutoComplete")] +[assembly: AssemblyDescription("A collection of WPF controls.")] +[assembly: AssemblyCompany("Deepak Bhardwaj")] +[assembly: AssemblyProduct("Tango.AutoComplete")] +[assembly: AssemblyCopyright("Copyright © Deepak Bhardwaj 2015")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.8")] +[assembly: AssemblyFileVersion("1.0.0.8")] diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Resources.Designer.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Resources.Designer.cs new file mode 100644 index 000000000..e649fff60 --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.AutoComplete.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.AutoComplete.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Resources.resx b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Settings.Designer.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Settings.Designer.cs new file mode 100644 index 000000000..46036a464 --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.AutoComplete.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Settings.settings b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Tango.AutoComplete.csproj b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Tango.AutoComplete.csproj new file mode 100644 index 000000000..130da019d --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Tango.AutoComplete.csproj @@ -0,0 +1,100 @@ + + + + + Debug + AnyCPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4} + library + Properties + Tango.AutoComplete + Tango.AutoComplete + v4.6 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Themes/Generic.xaml b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Themes/Generic.xaml new file mode 100644 index 000000000..a766db735 --- /dev/null +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Themes/Generic.xaml @@ -0,0 +1,7 @@ + + + + + diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs b/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs index 6fdd35983..f6fcbcf3f 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs @@ -4,6 +4,7 @@ using System.Data.Entity; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Settings; namespace Tango.DAL.Remote.DB { @@ -26,6 +27,9 @@ namespace Tango.DAL.Remote.DB } } - + public static RemoteDB CreateDefault() + { + return new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false); + } } } diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs index 18e50da90..e5e82f581 100644 --- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs +++ b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/SynchronizationModule.cs @@ -11,5 +11,7 @@ namespace Tango.Settings.MachineStudioSettings public String LocalMasterDBFile { get; set; } public String LocalSlaveDBFile { get; set; } + + public String RemoteSQLiteFile { get; set; } } } diff --git a/Software/Visual_Studio/Tango.Synchronization/Local/SqliteDataBase.cs b/Software/Visual_Studio/Tango.Synchronization/Local/SqliteDataBase.cs index add791b19..6068d5b6c 100644 --- a/Software/Visual_Studio/Tango.Synchronization/Local/SqliteDataBase.cs +++ b/Software/Visual_Studio/Tango.Synchronization/Local/SqliteDataBase.cs @@ -501,7 +501,9 @@ namespace Tango.Synchronization.Local _connection.Dispose(); GC.Collect(); - while (true) + DateTime startTime = DateTime.Now; + + while (startTime.AddSeconds(2) > DateTime.Now) { try { diff --git a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs index 82bc53c1f..514948d57 100644 --- a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs +++ b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBComparer.cs @@ -218,7 +218,7 @@ namespace Tango.Synchronization.Remote var master = _remoteDB.GetType().GetProperty(config.TABLE_NAME).GetValue(_remoteDB) as IEnumerable; var slave = _localDB.GetType().GetProperty(config.TABLE_NAME).GetValue(_localDB) as IEnumerable; - _diffs.Add(new Diff(DiffAction.ReplaceTableDataInSlave, "Override all rows on table " + config.TABLE_NAME, () => + _diffs.Add(new Diff(DiffAction.ReplaceTableDataInSlave, "Override all rows on slave table " + config.TABLE_NAME, () => { LogManager.Log("Overwriting slave table " + config.TABLE_NAME + "..."); diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 99f26f42d..52f716bf8 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 +VisualStudioVersion = 15.0.26430.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.Protobuf", "Tango.Protobuf\Tango.Protobuf.csproj", "{40073806-914E-4E78-97AB-FA9639308EBE}" EndProject @@ -99,6 +99,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.MachineStudio.Synchro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tango.ColorLib", "Native\Tango.ColorLib\Tango.ColorLib.vcxproj", "{625B2A26-97A9-45C9-8BCF-6BD30F593E17}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.AutoComplete", "SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj", "{BB2ABB74-BA58-4812-83AA-EC8171F42DF4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -839,6 +841,26 @@ Global {625B2A26-97A9-45C9-8BCF-6BD30F593E17}.Release|x64.Build.0 = Release|x64 {625B2A26-97A9-45C9-8BCF-6BD30F593E17}.Release|x86.ActiveCfg = Release|Win32 {625B2A26-97A9-45C9-8BCF-6BD30F593E17}.Release|x86.Build.0 = Release|Win32 + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Debug|ARM.ActiveCfg = Debug|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Debug|ARM.Build.0 = Debug|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Debug|ARM64.Build.0 = Debug|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Debug|x64.ActiveCfg = Debug|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Debug|x64.Build.0 = Debug|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Debug|x86.ActiveCfg = Debug|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Debug|x86.Build.0 = Debug|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|Any CPU.Build.0 = Release|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|ARM.ActiveCfg = Release|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|ARM.Build.0 = Release|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|ARM64.ActiveCfg = Release|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|ARM64.Build.0 = Release|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|x64.ActiveCfg = Release|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|x64.Build.0 = Release|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|x86.ActiveCfg = Release|Any CPU + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -864,5 +886,6 @@ Global {CE4A0D11-08A2-4CD6-9908-D6C62E80D805} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8} {12D0C43C-391F-4C74-92AB-82E9A9BEEB9B} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8} {625B2A26-97A9-45C9-8BCF-6BD30F593E17} = {4443B71C-216E-4D4C-8D19-868F50803813} + {BB2ABB74-BA58-4812-83AA-EC8171F42DF4} = {EC62BC9C-F2FE-4333-B7E4-110E38D43958} EndGlobalSection EndGlobal -- cgit v1.3.1