aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs17
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs9
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs20
-rw-r--r--Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs2
-rw-r--r--Software/Visual_Studio/Tango.Core/CoreSettings.cs23
-rw-r--r--Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs47
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs2
-rw-r--r--Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs4
-rw-r--r--Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBSynchronizer.cs2
-rw-r--r--Software/Visual_Studio/Tango.Touch/Components/TransformationHelper.cs30
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs4
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs4
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs4
-rw-r--r--Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Program.cs2
15 files changed, 90 insertions, 83 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs
index e5f13e394..d728b7939 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCViewModel.cs
@@ -22,7 +22,20 @@ namespace Tango.PPC.Common
public INotificationProvider NotificationProvider { get; private set; }
- public PPCSettings Settings { get; private set; }
+ private PPCSettings _settings;
+ public PPCSettings Settings
+ {
+ get
+ {
+ if (_settings == null)
+ {
+ _settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
+ }
+
+ return _settings;
+ }
+ private set { _settings = value; }
+ }
public PPCViewModel(IPPCApplicationManager application, IAuthenticationProvider authentication, INavigationManager navigation, INotificationProvider notification)
{
@@ -30,8 +43,6 @@ namespace Tango.PPC.Common
AuthenticationProvider = authentication;
NavigationManager = navigation;
NotificationProvider = notification;
-
- Settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
}
public abstract void OnApplicationStarted();
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs
index cc13e1216..1e3a16e3e 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs
@@ -2,9 +2,12 @@
using System.Collections.Generic;
using System.Configuration;
using System.Data;
+using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
+using Tango.BL;
+using Tango.Core;
using Tango.Core.Helpers;
using Tango.Settings;
@@ -18,12 +21,6 @@ namespace Tango.PPC.UI
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
-
- Environment.CurrentDirectory = PathHelper.GetStartupPath();
-
- //var s = SettingsManager.Default.GetOrCreate<Core.CoreSettings>();
- //s.SQLServerAddress = "DB\\Tango.mdf";
- //s.Save();
}
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs
index 0eb59eeeb..b5af63e32 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using Tango.BL;
using Tango.BL.Entities;
@@ -42,6 +43,8 @@ namespace Tango.PPC.UI.ViewModels
{
Task.Factory.StartNew(() =>
{
+ Thread.Sleep(500);
+
if (_jobsContext != null)
{
_jobsContext.Dispose();
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 5373539f2..df4a9c8e2 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
@@ -1,8 +1,11 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core;
+using Tango.Core.Helpers;
using Tango.PPC.Common;
using Tango.PPC.Common.Application;
using Tango.PPC.Common.Authentication;
@@ -22,6 +25,23 @@ namespace Tango.PPC.UI.ViewModels
public async override void OnApplicationStarted()
{
await Task.Delay(500);
+
+ //TODO: Use this in the future.
+
+ //#if DEBUG
+ // DataSource = "localhost\\SQLEXPRESS";
+ //#else
+ // DataBaseSettings.DefaultDataSource = Path.Combine(PathHelper.GetUserTangoFolder(), "DB", "Tango.db");
+ //#endif
+
+ CoreSettings.DefaultDataBaseSource = Path.Combine(PathHelper.GetUserTangoFolder(), "DB", "Tango.db");
+
+ if (!File.Exists(CoreSettings.DefaultDataBaseSource))
+ {
+ Directory.CreateDirectory(Path.GetDirectoryName(CoreSettings.DefaultDataBaseSource));
+ File.Copy(Path.Combine(PathHelper.GetStartupPath(), "DB", "Tango.db"), CoreSettings.DefaultDataBaseSource);
+ }
+
NavigationManager.NavigateTo(NavigationView.LayoutView);
NavigationManager.NavigateTo(NavigationView.JobsView);
}
diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs
index 8518c6dd0..0ff636493 100644
--- a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs
+++ b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs
@@ -55,7 +55,7 @@ namespace Tango.BL
/// <returns></returns>
public static ObservablesContext CreateDefault()
{
- return CreateDefault(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress);
+ return CreateDefault(SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource);
}
/// <summary>
diff --git a/Software/Visual_Studio/Tango.Core/CoreSettings.cs b/Software/Visual_Studio/Tango.Core/CoreSettings.cs
index f02e84615..2f40d0ef0 100644
--- a/Software/Visual_Studio/Tango.Core/CoreSettings.cs
+++ b/Software/Visual_Studio/Tango.Core/CoreSettings.cs
@@ -10,22 +10,29 @@ namespace Tango.Core
public class CoreSettings : SettingsBase
{
/// <summary>
+ /// Gets or sets the default data base source.
+ /// </summary>
+ public static String DefaultDataBaseSource { get; set; }
+
+ /// <summary>
/// Gets or sets the SQL server address.
/// </summary>
- public String SQLServerAddress { get; set; }
+ public String DataBaseSource { get; set; }
+
+ /// <summary>
+ /// Initializes the <see cref="DataBaseSettings"/> class.
+ /// </summary>
+ static CoreSettings()
+ {
+ DefaultDataBaseSource = "localhost\\SQLEXPRESS";
+ }
/// <summary>
/// Initializes a new instance of the <see cref="CoreSettings"/> class.
/// </summary>
public CoreSettings()
{
-
-#if DEBUG
- SQLServerAddress = "localhost\\SQLEXPRESS";
-#else
- SQLServerAddress = "twine01\\SQLTWINE";
-#endif
-
+ DataBaseSource = DefaultDataBaseSource;
}
}
}
diff --git a/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs
index cd1f4b30b..ab0a189ed 100644
--- a/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs
+++ b/Software/Visual_Studio/Tango.Core/Helpers/PathHelper.cs
@@ -12,27 +12,14 @@ namespace Tango.Core.Helpers
/// </summary>
public static class PathHelper
{
- ///// <summary>
- ///// Creates a temporary folder in %temp%\Twine\{Random} and returns the path to that folder.
- ///// </summary>
- ///// <returns></returns>
- //public static String GetTempFolderPath()
- //{
- // String tempDirectory = Path.Combine(Path.GetTempPath(), "Twine", Path.GetRandomFileName());
- // Directory.CreateDirectory(tempDirectory);
- // return tempDirectory;
- //}
-
- ///// <summary>
- ///// Creates a temporary folder and file in %temp%\Twine\{RandomFile} and returns the path to that file.
- ///// </summary>
- ///// <returns></returns>
- //public static String GetTempFilePath()
- //{
- // String tempDirectory = Path.Combine(Path.GetTempPath(), "Twine");
- // Directory.CreateDirectory(tempDirectory);
- // return Path.Combine(tempDirectory, Path.GetRandomFileName());
- //}
+ /// <summary>
+ /// Gets the user tango folder (%appdata%\Twine\Tango).
+ /// </summary>
+ /// <returns></returns>
+ public static String GetUserTangoFolder()
+ {
+ return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango");
+ }
/// <summary>
/// Gets the application startup path.
@@ -43,24 +30,6 @@ namespace Tango.Core.Helpers
return AppDomain.CurrentDomain.BaseDirectory;
}
- ///// <summary>
- ///// Tries to delete the specified folder.
- ///// </summary>
- ///// <param name="path">The folder path.</param>
- ///// <returns></returns>
- //public static bool TryDeleteFolder(String path)
- //{
- // try
- // {
- // Directory.Delete(path, true);
- // return true;
- // }
- // catch
- // {
- // return false;
- // }
- //}
-
/// <summary>
/// Tries to delete the specified file.
/// </summary>
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs b/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs
index 3508e1137..a492df462 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs
+++ b/Software/Visual_Studio/Tango.DAL.Remote/Partials/RemoteDB.cs
@@ -49,7 +49,7 @@ namespace Tango.DAL.Remote.DB
/// <returns></returns>
public static RemoteDB CreateDefault()
{
- return new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false);
+ return new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource, false);
}
}
}
diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
index 961f98a24..6dc406a09 100644
--- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
+++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
@@ -392,7 +392,7 @@ namespace Tango.Emulations.Emulators
{
Transporter.SendResponse<JobResponse>(new JobResponse()
{
- Status = new JobStatus()
+ Status = new PMR.Printing.JobStatus()
{
Progress = progress
}
@@ -406,7 +406,7 @@ namespace Tango.Emulations.Emulators
Transporter.SendResponse<JobResponse>(new JobResponse()
{
- Status = new JobStatus()
+ Status = new PMR.Printing.JobStatus()
{
Progress = job.Length,
}
diff --git a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBSynchronizer.cs b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBSynchronizer.cs
index 09f7fe619..79c719d0e 100644
--- a/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBSynchronizer.cs
+++ b/Software/Visual_Studio/Tango.Synchronization/Remote/RemoteDBSynchronizer.cs
@@ -32,7 +32,7 @@ namespace Tango.Synchronization.Remote
sqlite.ClearDataBase();
}
- using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
+ using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource, false))
{
using (var localDB = new local.LocalDB(sqliteDbFile))
{
diff --git a/Software/Visual_Studio/Tango.Touch/Components/TransformationHelper.cs b/Software/Visual_Studio/Tango.Touch/Components/TransformationHelper.cs
index a565e3b84..ac46c2e4a 100644
--- a/Software/Visual_Studio/Tango.Touch/Components/TransformationHelper.cs
+++ b/Software/Visual_Studio/Tango.Touch/Components/TransformationHelper.cs
@@ -7,6 +7,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
+using Tango.Core.EventArguments;
using Tango.SharedUI.Helpers;
namespace Tango.Touch.Components
@@ -42,15 +43,14 @@ namespace Tango.Touch.Components
private static void UnRegisterTransformWhenPressed(FrameworkElement element)
{
- element.PreviewMouseDown -= Element_PreviewMouseDown;
- element.PreviewMouseUp -= Element_PreviewMouseUp;
+
}
private static void RegisterTransformWhenPressed(FrameworkElement element)
{
element.RenderTransformOrigin = new Point(0.5, 0.5);
element.RenderTransform = new ScaleTransform(1, 1);
- element.PreviewMouseDown += Element_PreviewMouseDown;
+ element.RegisterForPreviewMouseOrTouchDown(Element_PreviewMouseDown);
element.PreviewMouseUp += Element_PreviewMouseUp;
var scrollViewer = UIHelper.FindAncestor<ScrollViewer>(element);
@@ -65,22 +65,12 @@ namespace Tango.Touch.Components
}
}
- private static void Element_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- DoubleAnimation ani = new DoubleAnimation();
- ani.To = 1;
- ani.Duration = TimeSpan.FromSeconds(0.1);
- ScaleTransform scale = (sender as FrameworkElement).RenderTransform as ScaleTransform;
- scale.BeginAnimation(ScaleTransform.ScaleXProperty, ani);
- scale.BeginAnimation(ScaleTransform.ScaleYProperty, ani);
- }
-
- private static void Element_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ private static void Element_PreviewMouseDown(object sender, MouseOrTouchEventArgs e)
{
if (!GetPreventTransform(e.OriginalSource as FrameworkElement))
{
DoubleAnimation ani = new DoubleAnimation();
- ani.To = 1.1;
+ ani.To = 1.09;
ani.Duration = TimeSpan.FromSeconds(0.2);
ani.AutoReverse = true;
ScaleTransform scale = (sender as FrameworkElement).RenderTransform as ScaleTransform;
@@ -89,6 +79,16 @@ namespace Tango.Touch.Components
}
}
+ private static void Element_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ {
+ DoubleAnimation ani = new DoubleAnimation();
+ ani.To = 1;
+ ani.Duration = TimeSpan.FromSeconds(0.1);
+ ScaleTransform scale = (sender as FrameworkElement).RenderTransform as ScaleTransform;
+ scale.BeginAnimation(ScaleTransform.ScaleXProperty, ani);
+ scale.BeginAnimation(ScaleTransform.ScaleYProperty, ani);
+ }
+
/// <summary>
/// Sets the TransformWhenPressed attached property.
/// </summary>
diff --git a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
index f6ceb7789..305849694 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
@@ -17,7 +17,7 @@ namespace Tango.UnitTesting
{
String guid = Guid.NewGuid().ToString();
- using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
+ using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource, false))
{
var action = new DAL.Remote.DB.ACTION_TYPES();
action.CODE = 1;
@@ -30,7 +30,7 @@ namespace Tango.UnitTesting
db.SaveChanges();
}
- using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
+ using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource, false))
{
var action = db.ACTION_TYPES.Single(x => x.GUID == guid);
db.ACTION_TYPES.Remove(action);
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs
index 5135c5954..cbef9f4bd 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs
@@ -21,7 +21,7 @@ namespace Tango.UnitTesting
{
var console = Helper.InitializeLogging(true);
- using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
+ using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource, false))
{
using (var localDB = new local.LocalDB(Helper.GetSQLiteFilePath()))
{
@@ -45,7 +45,7 @@ namespace Tango.UnitTesting
[TestMethod]
public void Generate_Demo_Remote_Machine()
{
- using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
+ using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource, false))
{
var organization = new remote.ORGANIZATION()
{
diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
index fbe3af2e5..3ba0bd082 100644
--- a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
+++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/ObservablesGenerator.cs
@@ -100,7 +100,7 @@ namespace Tango.DBObservablesGenerator.CLI
//Generate Entities...
//Generate Enumerations...
- using (RemoteDB db = new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
+ using (RemoteDB db = new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource, false))
{
foreach (var tableProp in db.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericType))
{
@@ -267,7 +267,7 @@ namespace Tango.DBObservablesGenerator.CLI
//Generate Entities...
//Generate Enumerations...
- using (RemoteDB db = new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress, false))
+ using (RemoteDB db = new RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource, false))
{
foreach (var tableProp in db.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericType))
{
diff --git a/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Program.cs
index 6acdc5ff5..43a368358 100644
--- a/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Program.cs
+++ b/Software/Visual_Studio/Utilities/Tango.SQLiteGenerator.CLI/Program.cs
@@ -29,7 +29,7 @@ namespace Tango.SQLiteGenerator.CLI
bool completed = false;
- String connectionString = SettingsManager.Default.GetOrCreate<CoreSettings>().SQLServerAddress;
+ String connectionString = SettingsManager.Default.GetOrCreate<CoreSettings>().DataBaseSource;
Console.WriteLine("Connecting to " + connectionString + "...");