aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-08-23 09:45:01 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-08-23 09:45:01 +0300
commit2c8da378c82e5181f0566a564de529ab7ef96f4f (patch)
treed450472402b15fc30d8bd482da348826caf487c5 /Software/Visual_Studio/MachineStudio
parent774da535e732ecd5a3737550ef1d35819a1e7fc6 (diff)
downloadTango-2c8da378c82e5181f0566a564de529ab7ef96f4f.tar.gz
Tango-2c8da378c82e5181f0566a564de529ab7ef96f4f.zip
Improvements to machine studio view models and navigation system.
Improvements to tech board selection and edit modes handling.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs45
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs8
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs13
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs7
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BreakSensorElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml17
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml17
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SpeedSensorElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs7
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs19
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationBlocker.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs98
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationObjectReceiver.cs21
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationResultProvider.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs7
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs180
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj10
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Threading/IDispatcherProvider.cs26
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs369
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs25
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Threading/DefaultDispatcherProvider.cs46
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs7
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs20
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs8
49 files changed, 1039 insertions, 318 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs
index 5c513af9e..f0b33ed06 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs
@@ -25,7 +25,7 @@ using Tango.SharedUI.Controls;
namespace Tango.MachineStudio.ColorLab.ViewModels
{
- public class MainViewVM : StudioViewModel<ColorLabModule>
+ public class MainViewVM : StudioViewModel
{
private ObservablesContext _dbContext;
private INotificationProvider _notification;
@@ -278,8 +278,6 @@ namespace Tango.MachineStudio.ColorLab.ViewModels
public override void OnApplicationReady()
{
- base.OnApplicationReady();
-
Task.Factory.StartNew(() =>
{
_dbContext = ObservablesContext.CreateDefault();
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs
index 2f3419d67..9503e4c38 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs
@@ -15,7 +15,7 @@ using Tango.SharedUI;
namespace Tango.MachineStudio.DB.ViewModels
{
- public class MainViewVM : StudioViewModel<DBModule>
+ public class MainViewVM : StudioViewModel
{
private bool _isLoading;
public bool IsLoading
@@ -53,29 +53,34 @@ namespace Tango.MachineStudio.DB.ViewModels
NotLoaded = false;
}
- public override void OnModuleRequest(params object[] args)
+ public override void OnApplicationReady()
{
- if (args != null && args.Length > 0 && args[0] is IObservableEntity)
- {
- var arg = args[0];
+
+ }
- String vmName = arg.GetType().Name + "sViewVM";
+ //public override void OnModuleRequest(params object[] args)
+ //{
+ // if (args != null && args.Length > 0 && args[0] is IObservableEntity)
+ // {
+ // var arg = args[0];
- Type vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName);
+ // String vmName = arg.GetType().Name + "sViewVM";
- if (vmType == null)
- {
- vmName = arg.GetType().BaseType.Name + "sViewVM";
- vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName);
- }
+ // Type vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName);
- if (vmType != null)
- {
- var vm = TangoIOC.Default.GetInstance(vmType);
- vmType.GetProperty("SelectedEntity").SetValue(vm, arg);
- vmType.GetMethod("OnEdit", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(vm, new object[] { });
- }
- }
- }
+ // if (vmType == null)
+ // {
+ // vmName = arg.GetType().BaseType.Name + "sViewVM";
+ // vmType = Assembly.GetAssembly(typeof(MainViewVM)).GetTypes().SingleOrDefault(x => x.Name == vmName);
+ // }
+
+ // if (vmType != null)
+ // {
+ // var vm = TangoIOC.Default.GetInstance(vmType);
+ // vmType.GetProperty("SelectedEntity").SetValue(vm, arg);
+ // vmType.GetMethod("OnEdit", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(vm, new object[] { });
+ // }
+ // }
+ //}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs
index ff8b0320d..b1039c2c5 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs
@@ -16,7 +16,7 @@ namespace Tango.MachineStudio.Developer.Navigation
public void NavigateTo(DeveloperNavigationView view)
{
LogManager.Log(String.Format("Navigating to view {0}...", view.ToString()));
- MainView.Instance.TransitionControl.NavigateTo(view.ToString());
+ MainView.Instance.NavigationControl.NavigateTo(view.ToString());
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
index 9eaa56870..6178ae30a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
@@ -52,7 +52,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
/// </summary>
/// <seealso cref="Tango.SharedUI.ViewModel" />
[TangoCreateWhenRegistered]
- public class MainViewVM : StudioViewModel<DeveloperModule>
+ public class MainViewVM : StudioViewModel
{
private static object _syncLock = new object();
private const string EMB_FORMATS_EXPORT = "Baby Lock (PES)|*.pes|Tajima (DST)|*.dst|EXP|*.exp|PCS|*.pcs|HUS|*.hus|KSM|*.ksm";
@@ -699,7 +699,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
PushProcessParametersCommand = new RelayCommand(PushProcessParameters, () => SelectedRML != null && CanWork && SelectedRML.ProcessParametersTablesGroups.Count > 0 && SelectedProcessParametersTable != null && MachineOperator != null);
ImportEmbroideryFileCommand = new RelayCommand(ImportEmbroideryFile, () => SelectedMachine != null && CanWork);
DisplayJobEmbroideryFileCommand = new RelayCommand<Job>(DisplayJobEmbroideryFile, () => CanWork);
- ReloadMachinesCommand = new RelayCommand(() => LoadMachine(), () => CanWork);
+ ReloadMachinesCommand = new RelayCommand(() => LoadMachine(), () => CanWork && SelectedMachine != null);
ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged;
@@ -725,8 +725,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
public override void OnApplicationReady()
{
- base.OnApplicationReady();
-
_settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>();
SelectedJobs = new ObservableCollection<Job>();
@@ -1348,7 +1346,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
private void EditRML()
{
LogManager.Log(String.Format("Requesting DB module for RML {0} editing...", SelectedRML.Name));
- ApplicationManager.RequestModule("Data Base", SelectedRML);
}
/// <summary>
@@ -1713,7 +1710,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
private void EditMachine()
{
LogManager.Log(String.Format("Requesting machine designer module for machine {0} editing...", SelectedMachine.SerialNumber));
- ApplicationManager.RequestModule("Machine Designer", SelectedMachine);
}
#endregion
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
index a7348d869..68cd65ad4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
@@ -575,7 +575,7 @@
<Grid Grid.Row="1">
- <controls:NavigationControl x:Name="TransitionControl" TransitionType="Slide" KeepElementsAttached="True">
+ <controls:NavigationControl x:Name="NavigationControl" TransitionType="Slide" KeepElementsAttached="True">
<local:MachineJobSelectionView controls:NavigationControl.NavigationName="MachineJobSelectionView" />
<local:JobView controls:NavigationControl.NavigationName="JobView" />
<local:RunningJobView controls:NavigationControl.NavigationName="RunningJobView" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
index 9197ad989..8dcd92691 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs
@@ -15,7 +15,7 @@ using Tango.MachineStudio.Common;
namespace Tango.MachineStudio.HardwareDesigner.ViewModels
{
- public class MainViewVM : StudioViewModel<HardwareDesignerModule>
+ public class MainViewVM : StudioViewModel
{
private INotificationProvider _notification;
private bool _isNew;
@@ -81,8 +81,6 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels
public override void OnApplicationReady()
{
- base.OnApplicationReady();
-
Task.Factory.StartNew(() =>
{
RefreshVersions();
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
index d2838b758..bac916771 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
@@ -21,7 +21,7 @@ using System.Data.Entity;
namespace Tango.MachineStudio.MachineDesigner.ViewModels
{
- public class MainViewVM : StudioViewModel<MachineDesignerModule>
+ public class MainViewVM : StudioViewModel
{
private INotificationProvider _notification;
private ObservablesContext _db;
@@ -206,8 +206,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
public async override void OnApplicationReady()
{
- base.OnApplicationReady();
-
await InitCollections();
}
@@ -760,14 +758,5 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
}
#endregion
-
- #region IStudioModuleVM
-
- public override void OnModuleRequest(params object[] args)
- {
- //SelectedMachine = Adapter.Machines.SingleOrDefault(x => x.Guid == (args[0] as Machine).Guid);
- }
-
- #endregion
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs
index fb05a0b94..ca598881a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/ViewModels/MainViewVM.cs
@@ -27,7 +27,7 @@ namespace Tango.MachineStudio.Stubs.ViewModels
/// Represents the script execution module main view model.
/// </summary>
/// <seealso cref="Tango.SharedUI.ViewModel" />
- public class MainViewVM : StudioViewModel<StubsModule>
+ public class MainViewVM : StudioViewModel
{
private INotificationProvider _notification;
@@ -75,6 +75,11 @@ namespace Tango.MachineStudio.Stubs.ViewModels
StubsViewVM.SaveSettings();
}
+ public override void OnApplicationReady()
+ {
+
+ }
+
#endregion
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml
index 675571657..e06d1f559 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/blower-big.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BreakSensorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BreakSensorElementEditor.xaml
index 18c992193..78834aca7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BreakSensorElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BreakSensorElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/break-big.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml
index 346c0067b..de604625d 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml
@@ -28,7 +28,7 @@
<!--Content-->
- <Grid ClipToBounds="False" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid ClipToBounds="False">
<Border>
<Viewbox>
<Grid>
@@ -99,7 +99,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml
index 3c6ee7d49..2960a8807 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DancerElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/dancer-big.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml
index 8c72798d5..5c1cfc3ad 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalInElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="221*"/>
<RowDefinition Height="Auto"/>
@@ -51,7 +51,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml
index 5fd92c336..862fa0597 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DigitalOutElementEditor.xaml
@@ -28,7 +28,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="221*"/>
<RowDefinition Height="Auto"/>
@@ -62,7 +62,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml
index 0a088df69..1fa1c6c48 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml
@@ -45,7 +45,7 @@
<Grid>
- <Grid Margin="5" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="100*"/>
@@ -254,7 +254,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml
index c481f1e1b..76a6a16a7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml
@@ -42,7 +42,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Border Padding="10" BorderThickness="1" BorderBrush="#202020" Background="#88FFFFFF" CornerRadius="5">
<DockPanel>
<TextBox Foreground="#202020" FontSize="14" DockPanel.Dock="Top" Text="{Binding Job.Name}"></TextBox>
@@ -239,7 +239,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml
index 98ace7816..2631f3a06 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MeterElementEditor.xaml
@@ -28,7 +28,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="221*"/>
<RowDefinition Height="Auto"/>
@@ -47,7 +47,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml
index 8f66adeeb..a39fa975c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MonitorElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Viewbox Stretch="Fill">
<StackPanel>
<Grid Grid.Column="1" Grid.Row="1" Width="200" Height="120">
@@ -55,7 +55,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml
index 48186fd56..80bfe8f96 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml
@@ -47,7 +47,7 @@
<Grid>
- <Grid Margin="5" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="100*"/>
@@ -243,7 +243,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml
index 64ed5bb43..3adee13d6 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorGroupElementEditor.xaml
@@ -47,7 +47,7 @@
<Grid>
- <Grid Margin="5" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="100*"/>
@@ -229,7 +229,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
index 9bc22d0f6..dcba1e77b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml
@@ -43,7 +43,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml
index 6d4f49ace..197640b14 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/PidElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/pid.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml
index 716ac0a2d..f057521e0 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml
@@ -31,7 +31,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Grid>
<Border BorderThickness="1" CornerRadius="5" Padding="10">
<Border.BorderBrush>
@@ -73,7 +73,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
index 16f94b251..a9eb9e9f4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml
@@ -43,7 +43,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SpeedSensorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SpeedSensorElementEditor.xaml
index b9dce9112..8696a3c53 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SpeedSensorElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SpeedSensorElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/speed-big.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml
index 3bac433ad..6e2315dc8 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml
@@ -47,7 +47,7 @@
<Grid>
- <Grid Margin="5" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="100*"/>
@@ -158,7 +158,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml
index f81597574..2b6ee303d 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/WinderElementEditor.xaml
@@ -27,7 +27,7 @@
<!--Content-->
- <Grid IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}">
+ <Grid>
<Image Source="../Images/winder-big.png"></Image>
@@ -38,7 +38,22 @@
<!--Content-->
- <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected),Converter={StaticResource BoolToVisibilityConverter}}">
+ <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
+ <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
+ </MultiDataTrigger.Conditions>
+
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<Grid>
<ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
index 8b331b5f5..f96960883 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
@@ -41,7 +41,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// </summary>
/// <seealso cref="Tango.SharedUI.ViewModel" />
/// <seealso cref="Tango.MachineStudio.Common.StudioApplication.IShutdownListener" />
- public class MachineTechViewVM : StudioViewModel<TechnicianModule>
+ public class MachineTechViewVM : StudioViewModel
{
private List<PropertyInfo> _diagnoticsMonitorsDataProperties;
private IDiagnosticsFrameProvider _diagnosticsFrameProvider;
@@ -1572,6 +1572,11 @@ namespace Tango.MachineStudio.Technician.ViewModels
});
}
+ public override void OnApplicationReady()
+ {
+
+ }
+
#endregion
#region Hardware Configuration
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs
index b60f4d725..977974f8a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs
@@ -59,7 +59,7 @@ namespace Tango.MachineStudio.Technician.Views
private void OnActionModeClicked(object sender, MouseButtonEventArgs e)
{
- editor.DeselectElements();
+ //editor.DeselectElements();
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
index 56888e631..a5ef4f095 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
@@ -17,7 +17,7 @@ using System.Data.Entity;
namespace Tango.MachineStudio.UsersAndRoles.ViewModels
{
- public class MainViewVM : StudioViewModel<UsersAndRolesModule>
+ public class MainViewVM : StudioViewModel
{
private ObservablesContext _organizationsContext;
private ObservablesContext _manageContext;
@@ -146,7 +146,6 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
public override void OnApplicationReady()
{
- base.OnApplicationReady();
LoadOrganizations();
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs
index 76cc0433c..be0906fc4 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioViewModel.cs
@@ -3,25 +3,16 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using static Tango.SharedUI.Controls.NavigationControl;
namespace Tango.MachineStudio.Common
{
/// <summary>
/// Represents a Machine Studio view model.
/// </summary>
- public interface IStudioViewModel
+ public interface IStudioViewModel : INavigationViewModel
{
/// <summary>
- /// Called when the user has navigated in to the module.
- /// </summary>
- void OnNavigatedTo();
-
- /// <summary>
- /// Called when the user has navigated out of the module.
- /// </summary>
- void OnNavigatedFrom();
-
- /// <summary>
/// Called when application is shutting down.
/// </summary>
void OnShuttingDown();
@@ -34,12 +25,6 @@ namespace Tango.MachineStudio.Common
Task<bool> OnShutdownRequest();
/// <summary>
- /// Called when another module has wants to navigate to this module with some arguments.
- /// </summary>
- /// <param name="args">The arguments.</param>
- void OnModuleRequest(params object[] args);
-
- /// <summary>
/// Called when the application has been started
/// </summary>
void OnApplicationStarted();
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationBlocker.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationBlocker.cs
new file mode 100644
index 000000000..abd6db172
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationBlocker.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.MachineStudio.Common.Navigation
+{
+ /// <summary>
+ /// Represents an object which can abort the navigation from it.
+ /// </summary>
+ public interface INavigationBlocker
+ {
+ /// <summary>
+ /// Called before the navigation system navigates from this object.
+ /// Return false to abort the navigation.
+ /// </summary>
+ /// <returns></returns>
+ Task<bool> OnNavigateOutRequest();
+
+ /// <summary>
+ /// Called before the navigation system navigates back from this object.
+ /// Return false to abort the navigation.
+ /// </summary>
+ /// <returns></returns>
+ Task<bool> OnNavigateBackRequest();
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs
index 4d1cbea8c..e20940c8d 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core.Commands;
namespace Tango.MachineStudio.Common.Navigation
{
@@ -12,9 +13,102 @@ namespace Tango.MachineStudio.Common.Navigation
public interface INavigationManager
{
/// <summary>
- /// Navigates to the specified view.
+ /// Gets the current module.
+ /// </summary>
+ IStudioModule CurrentModule { get; }
+
+ /// <summary>
+ /// Gets the current view model.
+ /// </summary>
+ StudioViewModel CurrentVM { get; }
+
+ /// <summary>
+ /// Gets a value indicating whether the navigation system is able to navigate to the previous view.
+ /// </summary>
+ bool CanNavigateBack { get; }
+
+ /// <summary>
+ /// Navigates to the previous view if <see cref="CanNavigateBack"/> is true.
+ /// </summary>
+ Task<bool> NavigateBack();
+
+ /// <summary>
+ /// Navigates to the previous view..
+ /// </summary>
+ RelayCommand NavigateBackCommand { get; }
+
+ /// <summary>
+ /// Navigates to the specified full path in command parameter.
+ /// </summary>
+ RelayCommand<String> NavigateToCommand { get; }
+
+ /// <summary>
+ /// Navigates to the specified PPC view.
/// </summary>
/// <param name="view">The view.</param>
- void NavigateTo(NavigationView view);
+ 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>
+ Task<bool> NavigateTo<T>(bool pushToHistory = true) where T : IStudioModule;
+
+ /// <summary>
+ /// Navigates to the specified module using the view path (e.g MainView.JobsView).
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="viewPath">The view path.</param>
+ Task<bool> NavigateTo<T>(String viewPath, bool pushToHistory = true) where T : IStudioModule;
+
+ /// <summary>
+ /// Navigates to the specified module using the view path (e.g MainView,JobsView).
+ /// This method makes it easy to do stuff like NavigateTo(nameof(MainView),nameof(JobsView));
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="viewPath">The view path.</param>
+ Task<bool> NavigateTo<T>(bool pushToHistory = true, params String[] viewPath) where T : IStudioModule;
+
+ /// <summary>
+ /// Navigates to the specified module and view by full path (e.g Jobs.JobsView).
+ /// </summary>
+ /// <param name="fullPath">The full path.</param>
+ Task<bool> NavigateTo(String fullPath, bool pushToHistory = true);
+
+ /// <summary>
+ /// Navigates to the specified module and view with the specified object and expecting a return parameter.
+ /// The view must be of type INavigationResultProvider<TResult>.
+ /// </summary>
+ /// <param name="fullPath">The full path.</param>
+ Task<TResult> NavigateForResult<TModule, TView, TResult, TPass>(TPass obj, bool pushToHistory = true)
+ where TModule : IStudioModule;
+
+ /// <summary>
+ /// Navigates to the specified module and view with the specified object.
+ /// </summary>
+ /// <typeparam name="TModule">The type of the module.</typeparam>
+ /// <typeparam name="TView">The type of the view.</typeparam>
+ /// <typeparam name="TPass">The type of the pass.</typeparam>
+ /// <param name="obj">The object.</param>
+ /// <param name="pushToHistory">if set to <c>true</c> [push to history].</param>
+ /// <returns></returns>
+ Task<bool> NavigateWithObject<TModule, TView, TPass>(TPass obj, bool pushToHistory = true)
+ where TModule : IStudioModule;
+
+ /// <summary>
+ /// Clears the navigation back history.
+ /// </summary>
+ void ClearHistory();
+
+ /// <summary>
+ /// Clears the navigation back history except the specified view type.
+ /// </summary>
+ void ClearHistoryExcept<T>();
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationObjectReceiver.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationObjectReceiver.cs
new file mode 100644
index 000000000..5072881d2
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationObjectReceiver.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.MachineStudio.Common.Navigation
+{
+ /// <summary>
+ /// Represents an object which supports receiving an object as part of the navigation to it.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ public interface INavigationObjectReceiver<T>
+ {
+ /// <summary>
+ /// Called when navigation system is going to navigate to this instance with the specified object.
+ /// </summary>
+ /// <param name="obj">The object.</param>
+ void OnNavigatedToWithObject(T obj);
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationResultProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationResultProvider.cs
new file mode 100644
index 000000000..dee037432
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationResultProvider.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.MachineStudio.Common.Navigation
+{
+ /// <summary>
+ /// Represents a object which provides a result the navigation system navigates away from it.
+ /// </summary>
+ /// <typeparam name="TResult">The type of the result.</typeparam>
+ /// <typeparam name="TPass">The type of the pass.</typeparam>
+ public interface INavigationResultProvider<TResult, TPass>
+ {
+ /// <summary>
+ /// Called when the navigation system requests a result when it is navigating away from this instance.
+ /// </summary>
+ /// <returns></returns>
+ TResult GetNavigationResult();
+
+ /// <summary>
+ /// Called when navigation system is going to navigate to this instance with the specified object.
+ /// </summary>
+ /// <param name="obj">The object.</param>
+ void OnNavigationObjectReceived(TPass obj);
+ }
+}
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 441a4ca93..96de3eea0 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs
@@ -45,13 +45,6 @@ namespace Tango.MachineStudio.Common.StudioApplication
bool IsMachineConnectedViaTCP { get; }
/// <summary>
- /// Loads the specified module if permitted.
- /// </summary>
- /// <param name="moduleName">Name of the module.</param>
- /// <param name="args">The arguments.</param>
- void RequestModule(String moduleName, params object[] args);
-
- /// <summary>
/// Gets the machine studio application version.
/// </summary>
Version Version { get; }
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs
index 08ddbc073..63ff2119a 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core.DI;
using Tango.SharedUI;
namespace Tango.MachineStudio.Common
@@ -10,128 +11,42 @@ namespace Tango.MachineStudio.Common
/// <summary>
/// Represents a Machine Studio view model
/// </summary>
- /// <typeparam name="Module">The type of the module.</typeparam>
/// <seealso cref="Tango.SharedUI.ViewModel" />
/// <seealso cref="Tango.MachineStudio.Common.IStudioViewModel" />
- public abstract class StudioViewModelInternal : ViewModel, IStudioViewModel
+ public abstract class StudioViewModel : ViewModel, IStudioViewModel
{
- public bool IsVisible { get; private set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether this view model studio module is currently loaded.
- /// </summary>
- public bool IsModuleLoaded { get; private set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="StudioViewModel{Module}"/> class.
- /// </summary>
- public StudioViewModelInternal() : base()
- {
-
- }
-
- /// <summary>
- /// Called when another module has wants to navigate to this module with some arguments.
- /// </summary>
- /// <param name="args">The arguments.</param>
- public virtual void OnModuleRequest(params object[] args)
- {
-
- }
-
+ private bool _isVisible;
/// <summary>
- /// Called when the user has navigated out of the module.
+ /// Gets or sets a value indicating whether this view model view's is visible.
/// </summary>
- public virtual void OnNavigatedFrom()
+ public bool IsVisible
{
- IsVisible = false;
- IsModuleLoaded = false;
+ get { return _isVisible; }
+ set { _isVisible = value; RaisePropertyChangedAuto(); }
}
/// <summary>
- /// Called when the user has navigated in to the module.
- /// </summary>
- public virtual void OnNavigatedTo()
- {
- IsVisible = true;
- IsModuleLoaded = true;
- }
-
- /// <summary>
- /// Called before the application is shutting down.
- /// Return false to cancel the shutdown in case an important process is in progress.
- /// </summary>
- /// <returns></returns>
- public virtual Task<bool> OnShutdownRequest()
- {
- return Task.FromResult(true);
- }
-
- /// <summary>
- /// Called when application is shutting down.
- /// </summary>
- public virtual void OnShuttingDown()
- {
-
- }
-
- /// <summary>
- /// Called when the application has been started
- /// </summary>
- public virtual void OnApplicationStarted()
- {
-
- }
-
- /// <summary>
- /// Called when the application is ready and all modules are loaded.
- /// </summary>
- public virtual void OnApplicationReady()
- {
-
- }
- }
-
- /// <summary>
- /// Represents a Machine Studio view model
- /// </summary>
- /// <typeparam name="Module">The type of the module.</typeparam>
- /// <seealso cref="Tango.SharedUI.ViewModel" />
- /// <seealso cref="Tango.MachineStudio.Common.IStudioViewModel" />
- public abstract class StudioViewModel<Module> : ViewModel, IStudioViewModel where Module : IStudioModule
- {
- public bool IsVisible { get; private set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether this view model studio module is currently loaded.
- /// </summary>
- public bool IsModuleLoaded { get; private set; }
-
- /// <summary>
- /// Called when another module has wants to navigate to this module with some arguments.
+ /// Initializes a new instance of the <see cref="StudioViewModel{Module}"/> class.
/// </summary>
- /// <param name="args">The arguments.</param>
- public virtual void OnModuleRequest(params object[] args)
+ public StudioViewModel() : base()
{
}
/// <summary>
- /// Called when the user has navigated out of the module.
+ /// Called when the user has navigated out of this view model.
/// </summary>
public virtual void OnNavigatedFrom()
{
IsVisible = false;
- IsModuleLoaded = false;
}
/// <summary>
- /// Called when the user has navigated in to the module.
+ /// Called when the user has navigated in to this view model.
/// </summary>
public virtual void OnNavigatedTo()
{
IsVisible = true;
- IsModuleLoaded = true;
}
/// <summary>
@@ -163,79 +78,38 @@ namespace Tango.MachineStudio.Common
/// <summary>
/// Called when the application is ready and all modules are loaded.
/// </summary>
- public virtual void OnApplicationReady()
- {
-
- }
+ public abstract void OnApplicationReady();
}
/// <summary>
- /// Represents a Machine Studio view model.
+ /// Represents a Machine Studio view model with a support for a view contract.
/// </summary>
- /// <typeparam name="Module">The type of the module.</typeparam>
- /// <typeparam name="T"></typeparam>
+ /// <typeparam name="TView"></typeparam>
/// <seealso cref="Tango.SharedUI.ViewModel" />
- /// <seealso cref="Tango.MachineStudio.Common.IStudioViewModel" />
- public abstract class StudioViewModel<Module, T> : ViewModel<T>, IStudioViewModel where Module : IStudioModule where T : IView
+ public abstract class StudioViewModel<TView> : StudioViewModel where TView : IView
{
/// <summary>
- /// Called when the application has been started
- /// </summary>
- public virtual void OnApplicationStarted()
- {
-
- }
-
- /// <summary>
- /// Called when the application is ready and all modules are loaded.
- /// </summary>
- public virtual void OnApplicationReady()
- {
-
- }
-
- /// <summary>
- /// Called when another module has wants to navigate to this module with some arguments.
+ /// Gets the view model's view.
/// </summary>
- /// <param name="args">The arguments.</param>
- public virtual void OnModuleRequest(params object[] args)
- {
-
- }
+ public TView View { get; private set; }
/// <summary>
- /// Called when the user has navigated out of the module.
+ /// Initializes a new instance of the <see cref="StudioViewModel{TView}"/> class.
/// </summary>
- public virtual void OnNavigatedFrom()
+ public StudioViewModel() : base()
{
-
+ TangoIOC.Default.GetInstanceWhenAvailable<TView>((view) =>
+ {
+ View = view;
+ OnViewAttached(view);
+ });
}
/// <summary>
- /// Called when the user has navigated in to the module.
+ /// Called when the view has been attached
/// </summary>
- public virtual void OnNavigatedTo()
- {
-
- }
-
- /// <summary>
- /// Called before the application is shutting down.
- /// Return false to cancel the shutdown in case an important process is in progress.
- /// </summary>
- /// <returns></returns>
- public virtual Task<bool> OnShutdownRequest()
- {
- return Task.FromResult(true);
- }
-
- /// <summary>
- /// Called when application is shutting down.
- /// </summary>
- public virtual void OnShuttingDown()
- {
-
- }
+ /// <param name="view">The view.</param>
+ protected abstract void OnViewAttached(TView view);
}
}
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 8b251074d..09678b515 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
@@ -106,6 +106,9 @@
<Compile Include="IStudioViewModel.cs" />
<Compile Include="MachineStudioSettings.cs" />
<Compile Include="Messages\MachineConnectionChangedMessage.cs" />
+ <Compile Include="Navigation\INavigationBlocker.cs" />
+ <Compile Include="Navigation\INavigationObjectReceiver.cs" />
+ <Compile Include="Navigation\INavigationResultProvider.cs" />
<Compile Include="Notifications\BarItem.cs" />
<Compile Include="Speech\DefaultSpeechProvider.cs" />
<Compile Include="Speech\ISpeechProvider.cs" />
@@ -115,6 +118,7 @@
<Compile Include="StudioModuleAttribute.cs" />
<Compile Include="StudioModuleBase.cs" />
<Compile Include="StudioViewModel.cs" />
+ <Compile Include="Threading\IDispatcherProvider.cs" />
<Compile Include="Update\CheckForUpdatesResponse.cs" />
<Compile Include="Update\CheckForUpdatesRequest.cs" />
<Compile Include="Update\IMachineStudioUpdateService.cs" />
@@ -292,13 +296,11 @@
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
- <ItemGroup>
- <Folder Include="MarkupExtensions\" />
- </ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Threading/IDispatcherProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Threading/IDispatcherProvider.cs
new file mode 100644
index 000000000..1c960ed3a
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Threading/IDispatcherProvider.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.MachineStudio.Common.Threading
+{
+ /// <summary>
+ /// Represents a mechanism for invoking actions on the main application thread.
+ /// </summary>
+ public interface IDispatcherProvider
+ {
+ /// <summary>
+ /// Invokes the specified action asynchronously.
+ /// </summary>
+ /// <param name="action">The action.</param>
+ void Invoke(Action action);
+
+ /// <summary>
+ /// Invokes the specified action synchronously.
+ /// </summary>
+ /// <param name="action">The action.</param>
+ void InvokeSync(Action action);
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml
index b8a6cd1c0..44b2ed401 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml
@@ -17,7 +17,7 @@
<Viewbox Stretch="Fill">
<Grid x:Name="grid" Width="1920" Height="1100">
<Grid>
- <sharedControls:NavigationControl TransitionAlwaysFades="True" TransitionType="Zoom" x:Name="TransitionControl" x:FieldModifier="public">
+ <sharedControls:NavigationControl TransitionAlwaysFades="True" TransitionType="Zoom" x:Name="NavigationControl" x:FieldModifier="public">
<views:LoadingView sharedControls:NavigationControl.NavigationName="LoadingView"></views:LoadingView>
<views:LoginView sharedControls:NavigationControl.NavigationName="LoginView"></views:LoginView>
<views:MainView sharedControls:NavigationControl.NavigationName="MainView"></views:MainView>
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 092b958cc..899ba846e 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs
@@ -3,8 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core;
+using Tango.Core.Commands;
using Tango.MachineStudio.Common;
+using Tango.MachineStudio.Common.Modules;
using Tango.MachineStudio.Common.Navigation;
+using Tango.MachineStudio.Common.Threading;
+using Tango.SharedUI.Controls;
namespace Tango.MachineStudio.UI.Navigation
{
@@ -12,18 +17,372 @@ namespace Tango.MachineStudio.UI.Navigation
/// Represents the Machine Studio default <see cref="INavigationManager">Navigation Manager</see>.
/// </summary>
/// <seealso cref="Tango.MachineStudio.Common.Navigation.INavigationManager" />
- public class DefaultNavigationManager : INavigationManager
+ public class DefaultNavigationManager : ExtendedObject, INavigationManager
{
+ private event Action<Object, Object> NavigationCycleCompleted;
+
+ private IDispatcherProvider _dispatcherProvider;
+ private IStudioModuleLoader _moduleLoader;
+ private Object _currentVM;
+ private String _lastFullPath;
+ private bool _preventHistory;
+ private bool _navigating_back;
+
+ private Stack<String> _navigationHistory;
+
+ /// <summary>
+ /// Gets the current view model.
+ /// </summary>
+ public StudioViewModel CurrentVM
+ {
+ get { return _currentVM as StudioViewModel; }
+ }
+
+ private IStudioModule _currentModule;
+ /// <summary>
+ /// Gets or sets the current module.
+ /// </summary>
+ public IStudioModule CurrentModule
+ {
+ get { return _currentModule; }
+ private set { _currentModule = value; RaisePropertyChangedAuto(); }
+ }
+
+ /// <summary>
+ /// Navigates to the previous view.
+ /// </summary>
+ public RelayCommand NavigateBackCommand { get; private set; }
+
+ /// <summary>
+ /// Navigates to the specified full path in command parameter.
+ /// </summary>
+ public RelayCommand<String> NavigateToCommand { get; private set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DefaultNavigationManager"/> class.
+ /// </summary>
+ /// <param name="moduleLoader">The module loader.</param>
+ public DefaultNavigationManager(IStudioModuleLoader moduleLoader, IDispatcherProvider dispatcherProvider)
+ {
+ _navigationHistory = new Stack<String>();
+ _moduleLoader = moduleLoader;
+
+ NavigateToCommand = new RelayCommand<string>(async (x) => await NavigateTo(x));
+ NavigateBackCommand = new RelayCommand(async () => await NavigateBack());
+
+ _dispatcherProvider = dispatcherProvider;
+ }
+
/// <summary>
- /// Navigates to the specified view.
+ /// Navigates to the specified PPC view.
/// </summary>
/// <param name="view">The view.</param>
- public void NavigateTo(NavigationView view)
+ public Task<bool> NavigateTo(NavigationView view, bool pushToHistory = true)
{
- MainWindow.Instance.Dispatcher.Invoke(() =>
+ LogManager.Log($"Navigating to: {view.ToString()}...");
+
+ _dispatcherProvider.Invoke(() =>
{
- MainWindow.Instance.TransitionControl.NavigateTo(view.ToString());
+ MainWindow.Instance.NavigationControl.NavigateTo(view.ToString());
});
+
+ return Task.FromResult(true);
+ }
+
+ /// <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)
+ {
+ LogManager.Log($"Navigating to: {view.ToString()}, with object {typeof(TPass).Name}...");
+ MainWindow.Instance.NavigationControl.NavigateTo(view.ToString());
+ INavigationObjectReceiver<TPass> receiver = MainWindow.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>
+ public Task<bool> NavigateTo<T>(bool pushToHistory = true) where T : IStudioModule
+ {
+ return NavigateTo(typeof(T));
+ }
+
+ /// <summary>
+ /// Navigates to the specified module using the view path (e.g MainView.JobsView).
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="viewPath">The view path.</param>
+ public Task<bool> NavigateTo<T>(string viewPath, bool pushToHistory = true) where T : IStudioModule
+ {
+ return NavigateTo<T>(pushToHistory, viewPath.Split('.'));
+ }
+
+ /// <summary>
+ /// Navigates to the specified module using the view path (e.g MainView,JobsView).
+ /// This method makes it easy to do stuff like NavigateTo(nameof(MainView),nameof(JobsView));
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="viewPath">The view path.</param>
+ public Task<bool> NavigateTo<T>(bool pushToHistory = true, params String[] viewPath) where T : IStudioModule
+ {
+ return NavigateTo(typeof(T), pushToHistory, viewPath);
+ }
+
+ /// <summary>
+ /// Navigates to the specified module and view by full path (e.g Jobs.JobsView).
+ /// </summary>
+ /// <param name="fullPath">The full path.</param>
+ public async Task<bool> NavigateTo(String fullPath, bool pushToHistory = true)
+ {
+ String[] path = fullPath.Split('.');
+ var module = _moduleLoader.UserModules.SingleOrDefault(x => x.GetType().Name == path[0] || x.Name == path[0]);
+
+ if (path.Length == 1 && path[0] == CurrentModule.Name) return true;
+
+ LogManager.Log($"Navigating to: {fullPath}...");
+
+ var fromVM = _currentVM;
+
+ if (_currentVM != null && _currentVM is INavigationBlocker)
+ {
+ if (_navigating_back)
+ {
+ if (!await (_currentVM as INavigationBlocker).OnNavigateBackRequest())
+ {
+ return false;
+ }
+ }
+ else
+ {
+ if (!await (_currentVM as INavigationBlocker).OnNavigateOutRequest())
+ {
+ return false;
+ }
+ }
+ }
+
+ if (pushToHistory && _lastFullPath != null && !_preventHistory)
+ {
+ _navigationHistory.Push(_lastFullPath);
+ RaisePropertyChanged(nameof(CanNavigateBack));
+ }
+
+ _lastFullPath = fullPath;
+
+ MainWindow.Instance.NavigationControl.NavigateTo(NavigationView.MainView.ToString());
+ var navigationControl = MachineStudio.UI.Views.MainView.Instance.NavigationControl;
+ CurrentModule = module;
+ var moduleView = navigationControl.NavigateTo(module.Name);
+
+ _currentVM = moduleView.DataContext;
+
+ if (path.Length > 1)
+ {
+ var moduleNavigation = moduleView.FindChildOffline<NavigationControl>();
+
+ moduleNavigation.RegisterForLoadedOrNow(async (x, e) =>
+ {
+ foreach (var view in path.Skip(1))
+ {
+ await Task.Delay(100);
+ var v = moduleNavigation.NavigateTo(view);
+
+ if (v != null)
+ {
+ _currentVM = v.DataContext;
+
+ if (view != path.Last())
+ {
+ moduleNavigation = v.FindChildOffline<NavigationControl>();
+ }
+ }
+ else
+ {
+ throw LogManager.Log(new ArgumentNullException("Could not navigate to " + fullPath));
+ }
+ }
+
+ NavigationCycleCompleted?.Invoke(fromVM, _currentVM);
+ });
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Navigates for result.
+ /// </summary>
+ /// <typeparam name="TModule">The type of the module.</typeparam>
+ /// <typeparam name="TView">The type of the view.</typeparam>
+ /// <typeparam name="TResult">The type of the result.</typeparam>
+ /// <typeparam name="TObject">The type of the object.</typeparam>
+ /// <param name="obj">The object.</param>
+ /// <param name="pushToHistory">if set to <c>true</c> [push to history].</param>
+ /// <returns></returns>
+ public Task<TResult> NavigateForResult<TModule, TView, TResult, TObject>(TObject obj, bool pushToHistory = true)
+ where TModule : IStudioModule
+ {
+ TaskCompletionSource<TResult> source = new TaskCompletionSource<TResult>();
+
+ var fromVM = _currentVM;
+ Object toVM = null;
+
+
+ Action<Object, Object> handler = null;
+
+ handler = (from, to) =>
+ {
+ if (toVM == null)
+ {
+ toVM = to;
+ if (toVM is INavigationResultProvider<TResult, TObject>)
+ {
+ (toVM as INavigationResultProvider<TResult, TObject>).OnNavigationObjectReceived(obj);
+ }
+ }
+ else
+ {
+ if (to == fromVM && from == toVM)
+ {
+ if (from is INavigationResultProvider<TResult, TObject>)
+ {
+ source.SetResult((from as INavigationResultProvider<TResult, TObject>).GetNavigationResult());
+ }
+ }
+
+ NavigationCycleCompleted -= handler;
+ }
+ };
+
+ NavigationCycleCompleted += handler;
+
+ NavigateTo<TModule>(typeof(TView).Name, pushToHistory);
+
+ return source.Task;
+ }
+
+ /// <summary>
+ /// Navigates to the specified module and view with the specified object.
+ /// </summary>
+ /// <typeparam name="TModule">The type of the module.</typeparam>
+ /// <typeparam name="TView">The type of the view.</typeparam>
+ /// <typeparam name="TPass">The type of the pass.</typeparam>
+ /// <param name="obj">The object.</param>
+ /// <param name="pushToHistory">if set to <c>true</c> [push to history].</param>
+ /// <returns></returns>
+ public Task<bool> NavigateWithObject<TModule, TView, TPass>(TPass obj, bool pushToHistory = true) where TModule : IStudioModule
+ {
+ TaskCompletionSource<bool> source = new TaskCompletionSource<bool>();
+
+ Action<Object, Object> handler = null;
+
+ handler = (from, to) =>
+ {
+ if (to is INavigationObjectReceiver<TPass>)
+ {
+ (to as INavigationObjectReceiver<TPass>).OnNavigatedToWithObject(obj);
+ }
+
+ NavigationCycleCompleted -= handler;
+ };
+
+ NavigationCycleCompleted += handler;
+
+ NavigateTo<TModule>(typeof(TView).Name, pushToHistory);
+
+ return source.Task;
+ }
+
+ private Task<bool> NavigateTo(Type moduleType, bool pushToHistory = true, params String[] viewPath)
+ {
+ if (viewPath != null && viewPath.Length > 0)
+ {
+ return NavigateTo(moduleType.Name + "." + String.Join(".", viewPath), pushToHistory);
+ }
+ else
+ {
+ return NavigateTo(moduleType.Name, pushToHistory);
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the navigation system is able to navigate to the previous view.
+ /// </summary>
+ public bool CanNavigateBack
+ {
+ get { return _navigationHistory.Count > 0; }
+ }
+
+ /// <summary>
+ /// Navigates to the previous view if <see cref="P:Tango.PPC.Common.Navigation.INavigationManager.CanNavigateBack" /> is true.
+ /// </summary>
+ public async Task<bool> NavigateBack()
+ {
+ LogManager.Log("Navigating back...");
+
+ _navigating_back = true;
+
+ String first = _navigationHistory.Pop();
+ _preventHistory = true;
+
+
+ if (await NavigateTo(first))
+ {
+ RaisePropertyChanged(nameof(CanNavigateBack));
+ _preventHistory = false;
+ _navigating_back = false;
+ return true;
+ }
+ else
+ {
+ _navigationHistory.Push(first);
+ _preventHistory = false;
+ _navigating_back = false;
+ RaisePropertyChanged(nameof(CanNavigateBack));
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Clears the navigation back history.
+ /// </summary>
+ public void ClearHistory()
+ {
+ LogManager.Log("Navigation history cleared.");
+ _navigationHistory.Clear();
+ RaisePropertyChanged(nameof(CanNavigateBack));
+ }
+
+ /// <summary>
+ /// Clears the navigation back history except the specified view type.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ public void ClearHistoryExcept<T>()
+ {
+ LogManager.Log($"Navigation history cleared except for {typeof(T).Name}.");
+
+ var history_list = _navigationHistory.ToList();
+ history_list = history_list.Where(x => x.Contains(typeof(T).Name)).Distinct().ToList();
+ _navigationHistory.Clear();
+
+ foreach (var item in history_list)
+ {
+ _navigationHistory.Push(item);
+ }
+
+ RaisePropertyChanged(nameof(CanNavigateBack));
}
}
}
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 b8e6e1670..7c7e18276 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
@@ -226,31 +226,6 @@ namespace Tango.MachineStudio.UI.StudioApplication
}
/// <summary>
- /// Loads the specified module if permitted.
- /// </summary>
- /// <param name="moduleName">Name of the module.</param>
- /// <param name="args">The arguments.</param>
- public void RequestModule(string moduleName, params object[] args)
- {
- IStudioModule module = _moduleLoader.UserModules.SingleOrDefault(x => x.Name == moduleName);
-
- if (module != null)
- {
- TangoIOC.Default.GetInstance<ViewModels.MainViewVM>().StartModule(module);
-
- //Notify request listeners.
- foreach (var vm in TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>())
- {
- vm.OnModuleRequest(module, args);
- }
- }
- else
- {
- throw new InvalidOperationException("The module was not found or you do not have sufficient privileges.");
- }
- }
-
- /// <summary>
/// Notify the application manager about an external opened window.
/// When application exists. All registered windows will be closed.
/// </summary>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj
index 4ded3b300..1bbabb0af 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj
@@ -168,6 +168,7 @@
<Compile Include="TFS\TeamFoundationServiceExtendedClient.cs" />
<Compile Include="TFS\TeamMembersProvider.cs" />
<Compile Include="TFS\WorkItemValidationAttribute.cs" />
+ <Compile Include="Threading\DefaultDispatcherProvider.cs" />
<Compile Include="ViewModels\AboutViewVM.cs" />
<Compile Include="ViewModels\ConnectedMachineViewVM.cs" />
<Compile Include="ViewModels\LoadingViewVM.cs" />
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Threading/DefaultDispatcherProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Threading/DefaultDispatcherProvider.cs
new file mode 100644
index 000000000..611dca6b9
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Threading/DefaultDispatcherProvider.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Threading;
+using Tango.MachineStudio.Common.Threading;
+
+namespace Tango.MachineStudio.UI.Threading
+{
+ /// <summary>
+ /// Represents the default PPC <see cref="IDispatcherProvider"/> which will invoke action on the current application dispatcher.
+ /// </summary>
+ /// <seealso cref="Tango.PPC.Common.Threading.IDispatcherProvider" />
+ public class DefaultDispatcherProvider : IDispatcherProvider
+ {
+ private Dispatcher _dispatcher;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DefaultDispatcherProvider"/> class.
+ /// </summary>
+ /// <param name="dispatcher">The dispatcher.</param>
+ public DefaultDispatcherProvider(Dispatcher dispatcher)
+ {
+ _dispatcher = dispatcher;
+ }
+
+ /// <summary>
+ /// Invokes the specified action asynchronously.
+ /// </summary>
+ /// <param name="action">The action.</param>
+ public void Invoke(Action action)
+ {
+ _dispatcher.BeginInvoke(action);
+ }
+
+ /// <summary>
+ /// Invokes the specified action synchronously.
+ /// </summary>
+ /// <param name="action">The action.</param>
+ public void InvokeSync(Action action)
+ {
+ _dispatcher.Invoke(action);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
index 2c816eb6c..10aa86ad1 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs
@@ -1,4 +1,5 @@
using System;
+using System.Windows;
using Tango.Core.DI;
using Tango.Integration.ExternalBridge;
using Tango.Logging;
@@ -11,6 +12,7 @@ using Tango.MachineStudio.Common.Navigation;
using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.Common.Speech;
using Tango.MachineStudio.Common.StudioApplication;
+using Tango.MachineStudio.Common.Threading;
using Tango.MachineStudio.Common.Video;
using Tango.MachineStudio.UI.Authentication;
using Tango.MachineStudio.UI.Console;
@@ -21,6 +23,7 @@ using Tango.MachineStudio.UI.Notifications;
using Tango.MachineStudio.UI.StudioApplication;
using Tango.MachineStudio.UI.SupervisingController;
using Tango.MachineStudio.UI.TFS;
+using Tango.MachineStudio.UI.Threading;
using Tango.MachineStudio.UI.ViewModels;
using Tango.MachineStudio.UI.Views;
using Tango.Settings;
@@ -64,7 +67,10 @@ namespace Tango.MachineStudio.UI
TangoIOC.Default.Unregister<ISpeechProvider>();
TangoIOC.Default.Unregister<IHtmlPresenter>();
TangoIOC.Default.Unregister<ITeamFoundationServiceClient>();
+ TangoIOC.Default.Unregister<IDispatcherProvider>();
+
+ TangoIOC.Default.Register<IDispatcherProvider, DefaultDispatcherProvider>(new DefaultDispatcherProvider(Application.Current.Dispatcher));
TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>();
TangoIOC.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>();
TangoIOC.Default.Register<INavigationManager, DefaultNavigationManager>();
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
index eacc8a4cb..215f7afb5 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs
@@ -28,7 +28,7 @@ namespace Tango.MachineStudio.UI.ViewModels
/// Represents the Machine Studio loading view, view model.
/// </summary>
/// <seealso cref="Tango.SharedUI.ViewModel" />
- public class LoadingViewVM : StudioViewModelInternal
+ public class LoadingViewVM : StudioViewModel
{
private INotificationProvider _notificationProvider;
private TeamFoundationServiceExtendedClient _tfs;
@@ -172,5 +172,10 @@ namespace Tango.MachineStudio.UI.ViewModels
}
});
}
+
+ public override void OnApplicationReady()
+ {
+
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
index 23dd4ecd7..36ce62897 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -629,20 +629,19 @@ namespace Tango.MachineStudio.UI.ViewModels
{
LogManager.Log(String.Format("Starting module '{0}'...", module.Name));
- if (!(MainView.Self as MainView).TransitionControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType))
+ if (!(MainView.Self as MainView).NavigationControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType))
{
LogManager.Log("Module was not initialized. Initializing...");
FrameworkElement view = Activator.CreateInstance(module.MainViewType) as FrameworkElement;
NavigationControl.SetNavigationName(view, module.Name);
- (MainView.Self as MainView).TransitionControl.Elements.Add(view);
+ (MainView.Self as MainView).NavigationControl.Elements.Add(view);
}
}
foreach (var m in StudioModuleLoader.AllModules.Where(x => x != module && !x.InNewWindow))
{
m.IsLoaded = false;
- TangoIOC.Default.GetModuleViewModels(m).ToList().ForEach(x => x.OnNavigatedFrom());
}
if (module != null)
@@ -652,15 +651,13 @@ namespace Tango.MachineStudio.UI.ViewModels
IsModuleLoaded = true;
LogManager.Log(String.Format("Navigating to module '{0}'...", module.Name));
- (MainView.Self as MainView).TransitionControl.NavigateTo(module.Name);
-
- TangoIOC.Default.GetModuleViewModels(module).ToList().ForEach(x => x.OnNavigatedTo());
+ (MainView.Self as MainView).NavigationControl.NavigateTo(module.Name);
}
else
{
IsModuleLoaded = false;
LogManager.Log(String.Format("Navigating to Home..."));
- (MainView.Self as MainView).TransitionControl.NavigateTo("Home");
+ (MainView.Self as MainView).NavigationControl.NavigateTo("Home");
}
}
@@ -680,16 +677,16 @@ namespace Tango.MachineStudio.UI.ViewModels
LogManager.Log(String.Format("Starting module '{0}' in new window...", module.Name));
- if (!(MainView.Self as MainView).TransitionControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType))
+ if (!(MainView.Self as MainView).NavigationControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType))
{
LogManager.Log("Module was not initialized. Initializing...");
FrameworkElement v = Activator.CreateInstance(module.MainViewType) as FrameworkElement;
NavigationControl.SetNavigationName(v, module.Name);
- (MainView.Self as MainView).TransitionControl.Elements.Add(v);
+ (MainView.Self as MainView).NavigationControl.Elements.Add(v);
}
LogManager.Log("Detaching module view...");
- var view = (MainView.Self as MainView).TransitionControl.GetAndDetach(module.Name);
+ var view = (MainView.Self as MainView).NavigationControl.GetAndDetach(module.Name);
ModuleWindowVM vm = new ModuleWindowVM(module);
ModuleWindow window = new ModuleWindow(this, vm, view);
@@ -700,7 +697,6 @@ namespace Tango.MachineStudio.UI.ViewModels
window.grid.Children.Remove(view);
module.InNewWindow = false;
- TangoIOC.Default.GetModuleViewModels(module).ToList().ForEach(v => v.OnNavigatedFrom());
};
window.Owner = MainWindow.Instance;
@@ -708,8 +704,6 @@ namespace Tango.MachineStudio.UI.ViewModels
LogManager.Log("Opening new window...");
window.Show();
- TangoIOC.Default.GetModuleViewModels(module).ToList().ForEach(x => x.OnNavigatedTo());
-
(_applicationManager as DefaultStudioApplicationManager).RegisterOpenedWindow(window);
}
catch (Exception ex)
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
index bb5c6458b..9a494f862 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml
@@ -397,7 +397,7 @@
</Grid.RowDefinitions>
<Grid Grid.Row="1">
- <controls:NavigationControl x:Name="TransitionControl" TransitionAlwaysFades="True" TransitionType="Zoom">
+ <controls:NavigationControl x:Name="NavigationControl" TransitionAlwaysFades="True" TransitionType="Zoom">
<Grid controls:NavigationControl.NavigationName="Home">
<Grid.RowDefinitions>
<RowDefinition Height="150"/>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs
index 7ed119abd..ca8d7066c 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs
@@ -38,10 +38,14 @@ namespace Tango.MachineStudio.UI.Views
{
private DefaultStudioModuleLoader _loader;
+ public static MainView Instance { get; set; }
+
public MainView() : base()
{
InitializeComponent();
+ Instance = this;
+
_loader = TangoIOC.Default.GetInstance<IStudioModuleLoader>() as DefaultStudioModuleLoader;
_loader.ModulesLoaded += Loader_ModulesLoaded;
}
@@ -69,11 +73,11 @@ namespace Tango.MachineStudio.UI.Views
ThreadsHelper.InvokeUI(() =>
{
- if (!TransitionControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType))
+ if (!NavigationControl.Elements.ToList().Exists(x => x.GetType() == module.MainViewType))
{
FrameworkElement view = Activator.CreateInstance(module.MainViewType) as FrameworkElement;
NavigationControl.SetNavigationName(view, module.Name);
- TransitionControl.Elements.Add(view);
+ NavigationControl.Elements.Add(view);
}
_loader.UserModules.Add(module);