Workspaces - trying to just get a proof of conept of something happenning in the UI; not working in our UI at the moment, but I can see it kind of working in snoop?

This commit is contained in:
Jake Norbut committed 2018-10-25 15:22:51 -05:00
1 parent 9ebdb107fa
commit 744260bea5
5 files changed
+70 -7

No files matched your search

@@ -0,0 +1,35 @@
<UserControl x:Class="mbts.ui.controls.WorkspaceItemControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:mbts.ui.controls"
xmlns:ui="clr-namespace:mbts.ui"
mc:Ignorable="d"
ui:StateManager.VisualState="{Binding VisualState}"
>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Overridden">
<Storyboard>
<ColorAnimation Storyboard.TargetName="_main_button" Storyboard.TargetProperty="Background.Color" From="Green" To="Orange" Duration="0:0:5" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<!-- Remove any styles that might be getting in the way from proving our proof of concept -->
<!-- Style="{DynamicResource DialogListButton}"
-->
<Button x:Name="_main_button" Command="{Binding ActivateCommand}">
<Grid>
<Image Source="{Binding Icon}" HorizontalAlignment="Left" Height="16" Margin="4" />
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" Margin="28,0,0,0" x:Name="text" />
<Button Style="{StaticResource RoundCloseButton}" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding DeleteCommand}" />
</Grid>
</Button>
</UserControl>
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace mbts.ui.controls {
/// <summary>
/// Interaction logic for WorkspaceItemControl.xaml
/// </summary>
public partial class WorkspaceItemControl : UserControl
{
public WorkspaceItemControl()
{
InitializeComponent();
}
}
}
@@ -21,6 +21,10 @@ namespace mbts.ui.shell
public object Icon {
get { return Icons.Window; }
}
private string _vstate = "Normal";
public string VisualState { get { return _vstate; } set { _vstate = value; RaisePropertyChanged("VisualState"); } }
internal WorkspaceDefinition Definition { get; private set; }
public ICommand ActivateCommand {
@@ -59,13 +59,7 @@
<ItemsControl ItemsSource="{Binding Workspaces}" Style="{StaticResource CommonList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Command="{Binding ActivateCommand}" Style="{DynamicResource DialogListButton}">
<Grid>
<Image Source="{Binding Icon}" HorizontalAlignment="Left" Height="16" Margin="4" />
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" Margin="28,0,0,0" x:Name="text" />
<Button Style="{StaticResource RoundCloseButton}" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding DeleteCommand}" />
</Grid>
</Button>
<controls:WorkspaceItemControl />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
@@ -45,6 +45,9 @@ namespace mbts.ui.shell
{
clear_error("SaveName");
}
if (Workspaces.Any( x => x.Name == SaveName)) {
Workspaces.Where(x => x.Name == SaveName).ForEach( x => x.VisualState = "Overridden");
}
// Save
_work_model.save_workspace(SaveName, ispublic: IsPublicWorkspace);
});