Skip to content

Commit

Permalink
Merge pull request #48 from Sparkiy/edge
Browse files Browse the repository at this point in the history
Edge
  • Loading branch information
AleksandarDev committed Jan 7, 2015
2 parents b3dab7c + 89a91c8 commit 96e1108
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Navigation;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Views;
using SparkiyClient.Common;
Expand Down Expand Up @@ -31,6 +32,7 @@ public interface IDebugPageViewModel

public class DebugPageViewModel : ExtendedViewModel, IDebugPageViewModel
{
private readonly IProjectService projectService;
private readonly INavigationService navigationService;
private IProjectPlayEngineManagement projectPlayEngineManager;
private IProjectPlayStateManagment projectPlayStateManager;
Expand All @@ -39,8 +41,9 @@ public class DebugPageViewModel : ExtendedViewModel, IDebugPageViewModel
private DispatcherTimer messagesCheckTimer;


public DebugPageViewModel(INavigationService navigationService)
public DebugPageViewModel(IProjectService projectService, INavigationService navigationService)
{
this.projectService = projectService;
this.navigationService = navigationService;

this.messagesCheckTimer = new DispatcherTimer();
Expand All @@ -52,6 +55,22 @@ public DebugPageViewModel(INavigationService navigationService)
this.NavigateToEditorCommand = new RelayCommand(this.NavigateToEditorCommandExecute);
}

public async override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);

// Retrieve passed project
var project = e.Parameter as Project;
if (project == null)
throw new NullReferenceException("Passed data is not in expected format.");

// Load project
await project.LoadAsync(this.projectService);

// Assign the project to the engine
await this.AssignProjectAsync(project);
}

private void NavigateToEditorCommandExecute()
{
this.navigationService.GoBack();
Expand Down Expand Up @@ -85,8 +104,11 @@ public void AssignProjectPlayStateManager(IProjectPlayStateManagment projectPlay
public async Task AssignProjectAsync(Project project)
{
this.project = project;

// Assign project to the engine
this.projectPlayEngineManager.AssignProject(this.project);

// Run the project
this.projectPlayStateManager.PlayProject();
}

Expand All @@ -103,7 +125,7 @@ public async Task AssignProjectAsync(Project project)

public sealed class DebugPageViewModelDesignTime : DebugPageViewModel
{
public DebugPageViewModelDesignTime() : base(null)
public DebugPageViewModelDesignTime() : base(null, null)
{
this.OutputMessages.Add(new EngineMessage() { Message = "Test1" });
this.OutputMessages.Add(new EngineMessage() { Message = "Test2" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public LuaGrammer()
new GrammerRule(TokenType.Identifier, new Regex(@"^[a-z_]\w*")),

// String Marker
new GrammerRule(TokenType.String, new Regex(@"^(?:\""(?:[^\""\\]|\\[\s\S])*(?:\""|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))", RegexOptions.IgnoreCase | RegexOptions.Singleline)),
new GrammerRule(TokenType.String, new Regex(@"^\[(=*)\[[\s\S]*?(?:\]\1\]|$)", RegexOptions.IgnoreCase | RegexOptions.Multiline)),
new GrammerRule(TokenType.String, new Regex("^(?:\\\"(?:[^\"\\]|\\[\\s\\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\\s\\S])*(?:\'|$))", RegexOptions.IgnoreCase | RegexOptions.Singleline)),
};

Keywords = new string[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<Style x:Key="SideBarShadowStyle" TargetType="Rectangle">
<Setter Property="Width" Value="32" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="IsHitTestVisible" Value="False" />
</Style>

<Style x:Key="SideBarShadowLeftStyle" BasedOn="{StaticResource SideBarShadowStyle}" TargetType="Rectangle">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
<Identity Name="53858AleksandarToplek.Sparkiy" Publisher="CN=E746B84B-09A1-43E8-B524-41758B02DFE1" Version="1.1.0.3" />
<Identity Name="53858AleksandarToplek.Sparkiy" Publisher="CN=E746B84B-09A1-43E8-B524-41758B02DFE1" Version="1.2.0.0" />
<Properties>
<DisplayName>Sparkiy</DisplayName>
<PublisherDisplayName>Aleksandar Toplek</PublisherDisplayName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SparkiyClient.Windows")]
[assembly: AssemblyTitle("Sparkiy for Windows")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("Sparkiy")]
[assembly: AssemblyProduct("SparkiyClient.Windows")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyCopyright("Copyright © Sparkiy 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -24,6 +24,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: ComVisible(false)]
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,19 @@ public DebugPage()
}


protected override async void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);

// Retrieve passed project
var project = e.Parameter as Project;
if (project == null)
throw new NullReferenceException("Passed data is not in expected format.");

// Assign play engine
this.ViewModel.AssignProjectPlayEngineManager(this.PlayView);

// Assign play state manager
this.ViewModel.AssignProjectPlayStateManager(this.PlayView);
this.PlaybackControlsControl.AssignPlayStateManager(this.PlayView);

// Assign project
await this.ViewModel.AssignProjectAsync(project);

// Watch output messages changes
this.ViewModel.OutputMessages.CollectionChanged += OutputMessagesOnCollectionChanged;

base.OnNavigatedTo(e);
}

private void OutputMessagesOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

</Grid>

<sideBar:SideBarControl x:Name="SideBarFiles" IsOpen="False">
<sideBar:SideBarControl IsOpen="False">
<sideBar:SideBarControl.Content>
<Grid>
<Grid.RowDefinitions>
Expand Down Expand Up @@ -163,82 +163,83 @@
FontFamily="Segoe UI" FontWeight="Light" FontSize="32"
Padding="0,0,0,8" Margin="0" />
</Button>
<Grid DataContext="{Binding ElementName=pageRoot, Path=DataContext.NewFileViewModel}"
Visibility="{Binding ElementName=pageRoot, Path=DataContext.NewFileViewModel, Converter={StaticResource NegatedNullToVisibilityConverter}}"
Margin="18 4 18 0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<!-- File name -->
<TextBlock Text="Name"
<Border Visibility="{Binding NewFileViewModel, Converter={StaticResource NegatedNullToVisibilityConverter}}"
Margin="18 4 18 0">
<Grid DataContext="{Binding NewFileViewModel}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<!-- File name -->
<TextBlock Text="Name"
Style="{StaticResource BaseTextBlockStyle}"
Margin="0 0 16 0"
VerticalAlignment="Center"
Grid.Row="0" Grid.Column="0" />
<TextBox x:Name="NewFileNameTextBox"
<TextBox x:Name="NewFileNameTextBox"
Text="{Binding Name, Mode=TwoWay}"
extensions:FieldValidationExtensions.Format="MatchesRegexPattern"
extensions:FieldValidationExtensions.Pattern="^(?!(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.[^.]*)?$)[^&lt;&gt;:\&quot;/\\|?*\x00-\x1F]*[^&lt;&gt;:\&quot;/\\|?*\x00-\x1F\ .]$"
extensions:FieldValidationExtensions.PatternErrorMessage="Invalid filename.&#13;A filename can't be empty or contain any of the following characters:&#13; \ / * ? : &quot; &lt; &gt; |"
extensions:FieldValidationExtensions.InvalidBrush="{StaticResource SideBarBrushNameInvalid}"
Margin="0 8"
Grid.Row="0" Grid.Column="1" />
<TextBlock Text="{Binding (extensions:FieldValidationExtensions.ValidationMessage), ElementName=NewFileNameTextBox}"
<TextBlock Text="{Binding (extensions:FieldValidationExtensions.ValidationMessage), ElementName=NewFileNameTextBox}"
Visibility="{Binding (extensions:FieldValidationExtensions.ValidationMessageVisibility), ElementName=NewFileNameTextBox}"
Padding="0 0 0 12"
TextWrapping="Wrap"
Foreground="{StaticResource AccentBrushRed}"
Grid.Row="1" Grid.Column="1"/>

<!-- File type -->
<TextBlock Text="Type"
<!-- File type -->
<TextBlock Text="Type"
Style="{StaticResource BaseTextBlockStyle}"
Margin="0 0 16 0"
VerticalAlignment="Center"
Grid.Row="2" Grid.Column="0" />
<ComboBox SelectedIndex="{Binding TypeIndex, Mode=TwoWay}"
<ComboBox SelectedIndex="{Binding TypeIndex, Mode=TwoWay}"
Margin="0 8"
Grid.Row="2" Grid.Column="1">
<ComboBox.Resources>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="8,3" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="#555" />
</Style>
</ComboBox.Resources>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Border Background="DarkViolet">
<TextBlock Text="S" Foreground="White" />
</Border>
<TextBlock Text="Script" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Border Background="ForestGreen">
<TextBlock Text="C" Foreground="White" />
</Border>
<TextBlock Text="Class" />
</StackPanel>
</ComboBoxItem>
</ComboBox>
</Grid>
<ComboBox.Resources>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="8,3" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="#555" />
</Style>
</ComboBox.Resources>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Border Background="DarkViolet">
<TextBlock Text="S" Foreground="White" />
</Border>
<TextBlock Text="Script" />
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Border Background="ForestGreen">
<TextBlock Text="C" Foreground="White" />
</Border>
<TextBlock Text="Class" />
</StackPanel>
</ComboBoxItem>
</ComboBox>
</Grid>
</Border>
</StackPanel>
</Grid>
</sideBar:SideBarControl.Content>
</sideBar:SideBarControl>

<sideBar:SideBarControl x:Name="SideBarAssets" IsLeft="False" IsOpen="False" Grid.Column="2">
<sideBar:SideBarControl IsLeft="False" IsOpen="False" Grid.Column="2">
<sideBar:SideBarControl.Content>
<Grid>
<Grid.RowDefinitions>
Expand Down

0 comments on commit 96e1108

Please sign in to comment.