Jump to content
LaunchBox Community Forums

Big Box clock


Kimjongilist

Recommended Posts

  • 1 month later...

I'd like to dig this up cause I've noticed this being a problem since 12.14:

Here is the xaml information for some of the theme files that display clocks that I use:

./Views/PlatformWheel1FiltersView.xaml:171:                                             <TextBlock Name="tbArrivalDateTime" Text="{Binding Source={x:Static sys:DateTime.Today}, StringFormat='{}{0:MMMM dd, yyyy}'}" FontFamily="{StaticResource FontBebasNeue}"  VerticalAlignment="Center" HorizontalAlignment="Right" DockPanel.Dock="Right" FontSize="37" Foreground="Gold" />
./Views/PlatformWheel2FiltersView.xaml:160:                                             <TextBlock Name="tbArrivalDateTime" Text="{Binding Source={x:Static sys:DateTime.Today}, StringFormat='{}{0:MMMM dd, yyyy}'}" FontFamily="{StaticResource FontBebasNeue}"  VerticalAlignment="Center" HorizontalAlignment="Right" DockPanel.Dock="Right" FontSize="37" Foreground="DeepSkyBlue" />
./Views/TextGamesView.xaml:191:                                         <TextBlock Name="tbArrivalDateTime" Text="{Binding Source={x:Static sys:DateTime.Today}, StringFormat='{}{0:MMMM dd, yyyy}'}" FontFamily="{StaticResource FontBebasNeue}"  VerticalAlignment="Center" HorizontalAlignment="Right" DockPanel.Dock="Right" FontSize="37" Foreground="Gold" />
./Views/Wheel1GamesView.xaml:283:                                               <TextBlock Name="tbArrivalDateTime" Text="{Binding Source={x:Static sys:DateTime.Today}, StringFormat='{}{0:MMMM dd, yyyy}'}" FontFamily="{StaticResource FontBebasNeue}"  VerticalAlignment="Center" HorizontalAlignment="Right" DockPanel.Dock="Right" FontSize="37" Foreground="DeepSkyBlue" />

You'll see that each uses the same exact code, however the Game views all update the clock correctly, while Platform Views do not change the clock at all. The clock stays at the same time as the view was first loaded, and from what I can tell it never really gets unloaded though I don't think that's part of the issue. I've tried different variations of the DateTime Struct (such as Now, etc), however the time still never updates on Platform views and only on the Game views. 

If you can provide a fix that doesn't require me to update, that would be fantastic. My setup is finally perfectly configured, the only issue is the clock on the platform views. Everytime I update, some other aspect breaks (12.15 for example broke VLC as a video renderer for me so I'd like to stick on 12.14)

Thanks

Link to comment
Share on other sites

All of the views have a binding called "CurrentTime" that is the same as DateTime.Now but updates the binding every second so that it stays up to date correctly. Doing the binding the way you are won't work as the binding doesn't ever get updated. This is all assuming you want to do what you say you want to do and not what your code shows you doing. Your string format is set up in a way you would only ever see the date and no time information so short of the date changing the value displayed shouldn't be changing anyway.

Link to comment
Share on other sites

To be clear, this has functioned (and continues to function) for the game views, but does not for the Platform views. I can provide the full files if it will help track down where the issue is for the platform views. This is the Unified theme just to note.

 

Or if there is a specific suggestion for what to change I can try to get it working as it should. Appreciate the reply!

Edited by Saieno
Link to comment
Share on other sites

So I'm having trouble following. I'm looking through https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-6.0 For the documentation on the Structs but I'm not finding 'CurrentTime'. I'm assuming the code in question that needs to be adjusted is the following but I'm not sure what the source syntax or string format should be as a reference. Do you have a link to a reference or example?

{Binding Source={x:Static sys:DateTime.Today}, StringFormat='{}{0:MMMM dd, yyyy}'}
Link to comment
Share on other sites

I was previously mistaken. The binding you're probably wanting is CurrentDateTime. CurrentTime is a short time string.

Both however are a part of the View (which is passed as the DataContext to your controls) and NOT a static variable so you wouldn't be able to look it up on MSDN. The binding would look like:
 

{Binding CurrentDateTime, StringFormat='{}{0:MMMM dd, yyyy}'}

Again though this string format is saying you only want the Month Day, Year so no time would be displayed.

Link to comment
Share on other sites

I'll try out the CurrentDateTime and see if that resolves the issue. I am displaying the date, and the time, so that makes sense with the stringformat for the date, but I assumed the binding for DateTime.Today was displaying the time as I couldn't find a solid reference of where that was being called from.

Thanks! I'll follow up if that resolved the issue!

Link to comment
Share on other sites

So I adjusted the Binding as suggested, didn't change the String format as I still do want the date and time, but as before I'm getting the same behavior. The game view updates time, the Platform view does not. Note the system clock compared to the Dashboard clock.

Here's the Platform View:

image.thumb.png.799dc10e04e94e4db1e32bdb4d420cc2.png

Here's the Game View:

image.thumb.png.7e700a5fc7092555f936d7b37d2ae6a8.png

Any suggestions would be fantastic for resolving this. I can also provide the entire xaml files as reference but it is just the Unified theme as mentioned.

Link to comment
Share on other sites

Yeah, you'll want to post your xaml file, as what's interesting is that you posted the wrong TextBlock earlier in this thread that would only display the date, and not the time, so there's probably another TextBlock in the xaml specifically to display time.

Link to comment
Share on other sites

45 minutes ago, faeran said:

Yeah, you'll want to post your xaml file, as what's interesting is that you posted the wrong TextBlock earlier in this thread that would only display the date, and not the time, so there's probably another TextBlock in the xaml specifically to display time.

I'll be honest, I've been looking at these freaking xaml files for days and I can't tell which section would be specifically for the time and which would be specifically for the date. The sections are clearly defined but nothing sticks out to be as obviously 'THIS IS THE CLOCK'. The following is the main section I've been trying to work with cause that seems like the obvious section but I honestly can't tell anymore lol.
 

			<!-- DATE AND TIME -->
				<Viewbox x:Name="DateTimeWeather" Grid.Row="0" Grid.Column="2" >
					<DockPanel Height="45" Width="385" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
						<TextBlock Text="{Binding CurrentTime}" FontFamily="{StaticResource FontBebasNeue}" VerticalAlignment="Center" DockPanel.Dock="Right" FontSize="37" Foreground="Aqua" />
						<TextBlock Text="  " FontFamily="{StaticResource FontBebasNeue}" FontSize="37" VerticalAlignment="Center" DockPanel.Dock="Right" />
						<TextBlock Name="tbArrivalDateTime" Text="{Binding Source={x:Static sys:DateTime.Today}, StringFormat='{}{0:MMMM dd, yyyy}'}" FontFamily="{StaticResource FontBebasNeue}"  VerticalAlignment="Center" HorizontalAlignment="Right" DockPanel.Dock="Right" FontSize="37" Foreground="DeepSkyBlue" />
						<TextBlock Text="  " FontFamily="{StaticResource FontBebasNeue}" FontSize="37" VerticalAlignment="Center" DockPanel.Dock="Right" />
					</DockPanel>
					<Viewbox.RenderTransform>
						<TransformGroup>
							<ScaleTransform/>
							<SkewTransform/>
							<RotateTransform/>
							<TranslateTransform/>
						</TransformGroup>
					</Viewbox.RenderTransform>
				</Viewbox>
			</Grid>

 

Looks like this would be it, but its exactly what was suggested earlier in the thread by C-Beats, and its identical in the Platform View versus the Game View, but Game View functions correctly and Platform View doesn't.

<TextBlock Text="{Binding CurrentTime}" FontFamily="{StaticResource FontBebasNeue}" VerticalAlignment="Center" DockPanel.Dock="Right" FontSize="37" Foreground="Aqua" />
						
Edited by Saieno
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...