aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs47
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml178
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj19
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config1
6 files changed, 250 insertions, 5 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs
new file mode 100644
index 000000000..e5e4cac78
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/DialogViewVM.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.Commands;
+using Tango.SharedUI;
+
+namespace Tango.MachineStudio.Common.Notifications
+{
+ public abstract class DialogViewVM : ViewModel
+ {
+ public event Action Accepted;
+ public event Action Canceled;
+
+ public DialogViewVM()
+ {
+ CanClose = true;
+ CloseCommand = new RelayCommand(Cancel, (x) => CanClose);
+ }
+
+ private bool _canClose;
+
+ public bool CanClose
+ {
+ get { return _canClose; }
+ set { _canClose = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
+ public RelayCommand CloseCommand { get; set; }
+
+ public virtual void OnShow()
+ {
+
+ }
+
+ protected virtual void Accept()
+ {
+ Accepted?.Invoke();
+ }
+
+ protected virtual void Cancel()
+ {
+ Canceled?.Invoke();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs
index a45f9a847..937a39ec2 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs
@@ -24,11 +24,11 @@ namespace Tango.MachineStudio.Common.Notifications
void PopTaskItem(TaskItem taskItem);
- bool? ShowModalWindow(Window window);
+ void ShowModalDialog<View, VM>(Action<VM> onAccept, Action onCancel) where View : FrameworkElement where VM : DialogViewVM;
- bool ShowModalWindow<T>(PackIconKind icon, String title, object context) where T : FrameworkElement;
+ void ShowModalDialog<VM>(Action<VM> onAccept, Action onCancel) where VM : DialogViewVM;
- bool ShowModalWindow(PackIconKind icon, String title, FrameworkElement content, object context);
+ void ShowModalDialog<VM>(Action<VM> onAccept) where VM : DialogViewVM;
bool? ShowDialog(PackIconKind icon, Brush iconColor, String message, bool hasCancel);
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml
new file mode 100644
index 000000000..58bb9ef34
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml
@@ -0,0 +1,178 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters;assembly=MaterialDesignThemes.Wpf"
+ xmlns:editors="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete"
+ xmlns:local="clr-namespace:Tango.MachineStudio.Common.Resources">
+ <ResourceDictionary.MergedDictionaries>
+ <!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
+ <!-- Accent and AppTheme setting -->
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml">
+ </ResourceDictionary>
+ <!--Material Design-->
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/materialdesigncolor.lightblue.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/materialdesigncolor.yellow.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.CheckBox.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ListBox.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.RadioButton.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToggleButton.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.TextBlock.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.Label.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.Slider.xaml">
+ </ResourceDictionary>
+ <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/materialdesigntheme.ProgressBar.xaml"/>
+
+
+ <!--MahApps Brushes-->
+ <ResourceDictionary>
+ <SolidColorBrush x:Key="HighlightBrush" Color="{DynamicResource Primary700}" />
+ <SolidColorBrush x:Key="AccentColorBrush" Color="{DynamicResource Primary500}" />
+ <SolidColorBrush x:Key="AccentColorBrush2" Color="{DynamicResource Primary400}" />
+ <SolidColorBrush x:Key="AccentColorBrush3" Color="{DynamicResource Primary300}" />
+ <SolidColorBrush x:Key="AccentColorBrush4" Color="{DynamicResource Primary200}" />
+ <SolidColorBrush x:Key="WindowTitleColorBrush" Color="{DynamicResource Primary700}" />
+ <SolidColorBrush x:Key="AccentSelectedColorBrush" Color="{DynamicResource Primary500Foreground}" />
+ <LinearGradientBrush x:Key="ProgressBrush" EndPoint="0.001,0.5" StartPoint="1.002,0.5">
+ <GradientStop Color="{DynamicResource Primary700}" Offset="0" />
+ <GradientStop Color="{DynamicResource Primary300}" Offset="1" />
+ </LinearGradientBrush>
+ <SolidColorBrush x:Key="CheckmarkFill" Color="{DynamicResource Primary500}" />
+ <SolidColorBrush x:Key="RightArrowFill" Color="{DynamicResource Primary500}" />
+ <SolidColorBrush x:Key="IdealForegroundColorBrush" Color="{DynamicResource Primary500Foreground}" />
+ <SolidColorBrush x:Key="IdealForegroundDisabledBrush" Color="{DynamicResource Primary500}" Opacity="0.4" />
+ </ResourceDictionary>
+
+ <!--Styles-->
+ <ResourceDictionary>
+
+ <BooleanToVisibilityConverter x:Key="BoolToVisConverter" />
+ <converters:TextFieldHintVisibilityConverter x:Key="TextFieldHintVisibilityConverter" />
+
+ <Style TargetType="editors:AutoCompleteTextBox" >
+ <Setter Property="Focusable" Value="True" />
+ <Setter Property="BorderThickness" Value="0 0 0 1"/>
+ <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignTextBoxBorder}" />
+ <Setter Property="Background" Value="Transparent"/>
+ <!--<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>-->
+ <Setter Property="HorizontalContentAlignment" Value="Left"/>
+ <Setter Property="VerticalContentAlignment" Value="Top"/>
+ <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
+ <Setter Property="AllowDrop" Value="true"/>
+ <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
+ <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
+ <Setter Property="Validation.ErrorTemplate" Value="{DynamicResource MaterialDesignValidationErrorTemplate}"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type editors:AutoCompleteTextBox}">
+ <Grid>
+ <DockPanel>
+ <ContentPresenter ContentSource="Icon"
+ x:Name="PART_Icon"
+ Visibility="{TemplateBinding IconVisibility}" />
+ <Grid>
+ <TextBlock x:Name="PART_Watermark"
+ Text="{TemplateBinding Watermark}"
+ Visibility="Collapsed"
+ VerticalAlignment="Center"
+ HorizontalAlignment="Left"
+ Focusable="False"
+ Foreground="Gray"
+ Margin="3,0" />
+ <TextBox x:Name="PART_Editor"
+ Focusable="True"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center"
+ Style="{StaticResource ResourceKey=MaterialDesignTextBox}"
+ MaxLength="{Binding Path=MaxLength, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}"
+ CharacterCasing="{Binding Path=CharacterCasing, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}"
+ Text="{Binding Path=Text, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}" />
+ </Grid>
+ </DockPanel>
+ <Popup x:Name="PART_Popup"
+ IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}"
+ Width="{TemplateBinding ActualWidth}"
+ HorizontalOffset="0"
+ MinHeight="25"
+ MaxHeight="600"
+ AllowsTransparency="True"
+ PopupAnimation="Slide"
+ Focusable="False">
+ <Border Background="White"
+ BorderThickness="1"
+ BorderBrush="#BDBDBD"
+ CornerRadius="0"
+ Padding="2">
+ <Grid>
+ <ListBox x:Name="PART_Selector"
+ ItemTemplate="{TemplateBinding ItemTemplate}"
+ ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
+ Focusable="False"
+ BorderThickness="0"
+ MaxHeight="{Binding Path=MaxPopupHeight, RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}"
+ ScrollViewer.HorizontalScrollBarVisibility="Auto"
+ ScrollViewer.VerticalScrollBarVisibility="Auto"
+ >
+ </ListBox>
+ <Border Visibility="{Binding Path=IsLoading, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource ResourceKey=BoolToVisConverter}}">
+ <ContentPresenter ContentSource="LoadingContent"/>
+ </Border>
+ </Grid>
+ </Border>
+ </Popup>
+
+ </Grid>
+ <!--</Border>-->
+ <ControlTemplate.Triggers>
+ <Trigger Property="Text"
+ Value=""
+ SourceName="PART_Editor">
+ <Setter Property="Visibility"
+ Value="Visible"
+ TargetName="PART_Watermark" />
+ </Trigger>
+ <Trigger Property="IconPlacement"
+ Value="Left">
+ <Setter Property="DockPanel.Dock"
+ Value="Left"
+ TargetName="PART_Icon" />
+ </Trigger>
+ <Trigger Property="IconPlacement"
+ Value="Right">
+ <Setter Property="DockPanel.Dock"
+ Value="Right"
+ TargetName="PART_Icon" />
+ </Trigger>
+ <Trigger Property="Validation.HasError" Value="True">
+ <Setter Property="BorderBrush"
+ Value="Red"/>
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </ResourceDictionary>
+
+ </ResourceDictionary.MergedDictionaries>
+</ResourceDictionary> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs
index 0ee27fbf6..3297f9374 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs
@@ -3,11 +3,15 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.Integration.Services;
namespace Tango.MachineStudio.Common.StudioApplication
{
public interface IStudioApplicationManager
{
+ bool IsShuttingDown { get;}
void ShutDown();
+ IExternalBridgeClient ConnectedMachine { get; set; }
+ bool IsMachineConnected { get; }
}
}
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 1aa5216b4..5cf171090 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
@@ -40,6 +40,9 @@
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
<HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
</Reference>
+ <Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath>
+ </Reference>
<Reference Include="MaterialDesignColors, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll</HintPath>
</Reference>
@@ -52,8 +55,7 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
- <Private>True</Private>
+ <HintPath>..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
@@ -69,6 +71,7 @@
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Notifications\DialogViewVM.cs" />
<Compile Include="StudioApplication\IStudioApplicationManager.cs" />
<Compile Include="StudioApplication\IShutdownRequestBlocker.cs" />
<Compile Include="ExtensionMethods\IStudioMessageExtensions.cs" />
@@ -94,6 +97,10 @@
<Compile Include="Navigation\INavigationManager.cs" />
<Compile Include="Navigation\NavigationView.cs" />
<Compile Include="Notifications\INotificationProvider.cs" />
+ <Page Include="Resources\MaterialDesign.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@@ -120,6 +127,10 @@
</None>
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj">
+ <Project>{bb2abb74-ba58-4812-83aa-ec8171f42df4}</Project>
+ <Name>Tango.AutoComplete</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
<Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
<Name>Tango.Core</Name>
@@ -132,6 +143,10 @@
<Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project>
<Name>Tango.DAL.Remote</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj">
+ <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project>
+ <Name>Tango.Integration</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj">
<Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project>
<Name>Tango.SharedUI</Name>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config
index f67c854e3..4fd672b32 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net46" />
+ <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" />
<package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" />
<package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" />
<package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" />