diff --git a/SparkiyClient/SparkiyClient.UILogic.Windows/ViewModels/CreateProjectPageViewModel.cs b/SparkiyClient/SparkiyClient.UILogic.Windows/ViewModels/CreateProjectPageViewModel.cs index 6917300..7ae1a2f 100644 --- a/SparkiyClient/SparkiyClient.UILogic.Windows/ViewModels/CreateProjectPageViewModel.cs +++ b/SparkiyClient/SparkiyClient.UILogic.Windows/ViewModels/CreateProjectPageViewModel.cs @@ -1,5 +1,6 @@ using System.Collections.ObjectModel; using System.Threading.Tasks; +using Windows.System.UserProfile; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; @@ -36,6 +37,8 @@ public CreateProjectPageViewModel(IProjectService projectService, INavigationSer this.Project = new Project() { + Description = "Amazing new project. Touch Play button and try it out yourself. It's great!", + Author = "Unknown", Files = new ObservableCollection() { new Script() diff --git a/SparkiyClient/SparkiyClient.UILogic/ViewModels/MainPageViewModel.cs b/SparkiyClient/SparkiyClient.UILogic/ViewModels/MainPageViewModel.cs index 6e73210..d31f65a 100644 --- a/SparkiyClient/SparkiyClient.UILogic/ViewModels/MainPageViewModel.cs +++ b/SparkiyClient/SparkiyClient.UILogic/ViewModels/MainPageViewModel.cs @@ -21,6 +21,10 @@ public interface IMainPageViewModel : IViewModelBase { bool RequiresWorkspaceInitialization { get; } + TimeSpan NextReleaseCountdown { get; } + + bool IsNextReleaseReady { get; } + ObservableCollection Projects { get; } RelayCommand InitializeWorkspaceCommand { get; } @@ -40,6 +44,8 @@ public class MainPageViewModel : ExtendedViewModel, IMainPageViewModel private readonly IStorageService storageService; private readonly IProjectService projectService; + private readonly DispatcherTimer nextReleaseCountdownTimer; + public MainPageViewModel(INavigationService navigationService, IAlertMessageService alertMessageService, IStorageService storageService, IProjectService projectService) { @@ -53,8 +59,14 @@ public MainPageViewModel(INavigationService navigationService, IAlertMessageServ this.InitializeWorkspaceCommand = new RelayCommand(this.InitializeWorkspaceCommandExecuteAsync); this.ProjectSelectedCommand = new RelayCommand(this.ProjectSelectedCommandExecute); this.NewProjectCommand = new RelayCommand(this.NewProjectCommandExecute); - } + this.NextReleaseCountdown = (new DateTime(2015, 1, 26, 0, 0, 0)) - DateTime.Now; + this.nextReleaseCountdownTimer = new DispatcherTimer(); + this.nextReleaseCountdownTimer.Interval = TimeSpan.FromSeconds(1); + this.nextReleaseCountdownTimer.Tick += NextReleaseCountdownTimerOnTick; + this.nextReleaseCountdownTimer.Start(); + this.NextReleaseCountdownTimerOnTick(null, null); + } public override async void OnNavigatedTo(NavigationEventArgs e) { @@ -67,7 +79,14 @@ public override async void OnNavigatedTo(NavigationEventArgs e) } } - private async Task LoadProjectsAsync() + private void NextReleaseCountdownTimerOnTick(object sender, object o) + { + this.NextReleaseCountdown = NextReleaseCountdown - TimeSpan.FromSeconds(1); + if (NextReleaseCountdown.TotalSeconds <= 0) + this.IsNextReleaseReady = true; + } + + private async Task LoadProjectsAsync() { Log.Debug("Loading project..."); if (this.storageService.RequiresHardStorageInitialization()) @@ -110,6 +129,18 @@ public bool RequiresWorkspaceInitialization protected set { this.SetProperty(value); } } + public TimeSpan NextReleaseCountdown + { + get { return this.GetProperty(); } + protected set { this.SetProperty(value); } + } + + public bool IsNextReleaseReady + { + get { return this.GetProperty(); } + protected set { this.SetProperty(value); } + } + public RelayCommand InitializeWorkspaceCommand { get; } public RelayCommand ProjectSelectedCommand { get; } diff --git a/SparkiyClient/SparkiyClient/SparkiyClient.Shared/Controls/PlayView/PlayViewControl.xaml.cs b/SparkiyClient/SparkiyClient/SparkiyClient.Shared/Controls/PlayView/PlayViewControl.xaml.cs index 337b091..0e965cd 100644 --- a/SparkiyClient/SparkiyClient/SparkiyClient.Shared/Controls/PlayView/PlayViewControl.xaml.cs +++ b/SparkiyClient/SparkiyClient/SparkiyClient.Shared/Controls/PlayView/PlayViewControl.xaml.cs @@ -59,8 +59,6 @@ public void AssignProject(Project project) this.project = project; this.RebuildEngine(); - - this.isInitialized = true; } private void StopProject() @@ -75,7 +73,7 @@ private void StopProject() public void PlayProject() { - if (this.IsPlaying) + if (!this.IsInitialized || this.IsPlaying) return; this.Engine.Play(); @@ -87,7 +85,7 @@ public void PlayProject() public void PauseProject() { - if (this.IsPause) + if (!this.IsInitialized || this.IsPause) return; this.Engine.Pause(); @@ -138,8 +136,12 @@ private void RebuildEngine() // TODO Add assets to the engine // Add scripts to the engine + bool allScriptsValid = true; foreach (var script in this.project.Files.OfType