这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Adspace/ExchangeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ public Ad GetAd(double width, double height)
if (!CacheManager.Instance.IsValidPath(ad.File))
{
Task.Factory.StartNew(() => ad.Download());

// Don't show it this time
adBuffet.Remove(ad);
throw new AdspaceNoAdException("Creative pending download");
}

// We've converted it into a play
Expand Down
14 changes: 7 additions & 7 deletions App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override void OnStartup(StartupEventArgs e)
}
catch (Exception ex)
{
HandleUnhandledException(ex, false);
HandleUnhandledException(ex, "Startup", false);
}

// Always flush at the end
Expand Down Expand Up @@ -118,30 +118,30 @@ private static void RunClient(bool screenSaver)
#region Exception Handlers
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
HandleUnhandledException(e.Exception, true);
HandleUnhandledException(e.Exception, "ThreadException", true);
}

static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
HandleUnhandledException(e.ExceptionObject, true);
HandleUnhandledException(e.ExceptionObject, "UnhandledException", true);
}

static void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
{
HandleUnhandledException(e.Exception, false);
HandleUnhandledException(e.Exception, "UnobservedTaskException", false);
}

/// <summary>
/// Event for unhandled exceptions
/// </summary>
/// <param name="o"></param>
static void HandleUnhandledException(Object o, bool quit)
static void HandleUnhandledException(Object o, string source, bool quit)
{
Exception e = o as Exception;

// What happens if we cannot start?
Trace.WriteLine(new LogMessage("Main", "Unhandled Exception: " + e.Message), LogType.Error.ToString());
Trace.WriteLine(new LogMessage("Main", "Stack Trace: " + e.StackTrace), LogType.Audit.ToString());
Trace.WriteLine(new LogMessage("Main", "Unhandled Exception: " + source + ": " + e.Message), LogType.Error.ToString());
Trace.WriteLine(new LogMessage("Main", "Stack Trace: " + e.StackTrace), LogType.Error.ToString());

// Should we quit or continue
if (quit)
Expand Down
4 changes: 2 additions & 2 deletions Logic/ApplicationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ private static readonly Lazy<ApplicationSettings>
/// </summary>
private List<string> ExcludedProperties;

public string ClientVersion { get; } = "3 R304.1";
public string ClientVersion { get; } = "3 R305.1";
public string Version { get; } = "6";
public int ClientCodeVersion { get; } = 304;
public int ClientCodeVersion { get; } = 305;

private ApplicationSettings()
{
Expand Down
2 changes: 1 addition & 1 deletion Logic/Schedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public void NextLayout()
}

// Make sure we can get this sequence
if (sequence > nextLayout.CycleScheduleItems.Count)
if (sequence >= nextLayout.CycleScheduleItems.Count)
{
sequence = 0;
}
Expand Down
19 changes: 19 additions & 0 deletions Logic/ScheduleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ private List<ScheduleItem> ResolveNormalAndInterrupts(List<ScheduleItem> schedul
int interruptPick = (int)Math.Floor(1.0 * pickCount / resolvedInterrupt.Count);
int normalIndex = 0;
int interruptIndex = 0;
int totalSecondsAllocated = 0;

// Pick as many times as we need to consume the larger list
for (int i = 0; i < pickCount; i++)
Expand All @@ -878,17 +879,35 @@ private List<ScheduleItem> ResolveNormalAndInterrupts(List<ScheduleItem> schedul
normalIndex = 0;
}
resolved.Add(resolvedNormal[normalIndex]);
totalSecondsAllocated += resolvedNormal[normalIndex].Duration;
normalIndex++;
}

// We can't overpick from the interrupt list
if (i % interruptPick == 0 && interruptIndex < resolvedInterrupt.Count)
{
resolved.Add(resolvedInterrupt[interruptIndex]);
totalSecondsAllocated += resolvedInterrupt[interruptIndex].Duration;
interruptIndex++;
}
}

// We might have some time left over at the end
// Our pick indexes are ceiling/floor
// https://github.com/xibosignage/xibo-dotnetclient/issues/263
while (totalSecondsAllocated < 3600)
{
// We fill up the rest of the schedule with normal events.
// continuing from where we left off
if (normalIndex >= resolvedNormal.Count)
{
normalIndex = 0;
}
resolved.Add(resolvedNormal[normalIndex]);
totalSecondsAllocated += resolvedNormal[normalIndex].Duration;
normalIndex++;
}

return resolved;
}

Expand Down
8 changes: 5 additions & 3 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (C) 2021 Xibo Signage Ltd
* Copyright (C) 2022 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand Down Expand Up @@ -216,7 +216,10 @@ private void MouseInterceptor_MouseMoveEvent()
{
if (_screenSaver)
{
System.Windows.Application.Current.Shutdown();
if (System.Windows.Application.Current != null)
{
System.Windows.Application.Current.Shutdown();
}
}
}

Expand Down Expand Up @@ -509,7 +512,6 @@ private void ChangeToNextLayout(ScheduleItem scheduleItem)
this.Scene.Children.Clear();

Trace.WriteLine(new LogMessage("MainForm", "ChangeToNextLayout: Destroy Layout Failed. Exception raised was: " + e.Message), LogType.Info.ToString());
throw e;
}

// Prepare the next layout
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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("3.304.1.0")]
[assembly: AssemblyFileVersion("3.304.1.0")]
[assembly: AssemblyVersion("3.305.0.1")]
[assembly: AssemblyFileVersion("3.305.0.1")]
[assembly: Guid("3bd467a4-4ef9-466a-b156-a79c13a863f7")]
2 changes: 1 addition & 1 deletion Rendering/Layout.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public void LoadFromFile(ScheduleItem scheduleItem, XmlDocument layoutXml, DateT
{
// Sequential
sequence++;
if (sequence > parsedMedia[groupKey].Count)
if (sequence >= parsedMedia[groupKey].Count)
{
sequence = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion Rendering/Media.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ public static MediaOptions ParseOptions(XmlNode node)
// Check isnt blacklisted
if (CacheManager.Instance.IsUnsafeMedia(options.mediaid))
{
Trace.WriteLine(new LogMessage("Media", string.Format("ParseOptions: MediaID [{0}] has been blacklisted.", options.mediaid)), LogType.Error.ToString());
Trace.WriteLine(new LogMessage("Media", string.Format("ParseOptions: MediaID [{0}] has been blacklisted.", options.mediaid)), LogType.Info.ToString());
throw new Exception("Unsafe Media");
}

Expand Down
11 changes: 9 additions & 2 deletions Rendering/WebCef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,15 @@ private void WebView_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs
if (e.Frame.IsMain && !Expired && !IsNativeOpen())
{
// Initialise Interactive Control
webView.GetBrowser().MainFrame.ExecuteJavaScriptAsync("xiboIC.config({hostname:\"localhost\", port: "
+ ApplicationSettings.Default.EmbeddedServerPort + "})");
try
{
webView.GetBrowser().MainFrame.ExecuteJavaScriptAsync("xiboIC.config({hostname:\"localhost\", port: "
+ ApplicationSettings.Default.EmbeddedServerPort + "})");
}
catch
{
Trace.WriteLine(new LogMessage("WebCef: WebView_FrameLoadEnd", "Cant execute xiboIC"), LogType.Info.ToString());
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion XiboClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>echo F|xcopy /Y "$(TargetPath)" "$(TargetDir)\Xibo.scr"</PostBuildEvent>
<PostBuildEvent>echo F|xcopy /Y "$(TargetPath)" "$(TargetDir)Xibo.scr"
echo F|xcopy /Y "$(TargetDir)XiboClient.exe.config" "$(TargetDir)Xibo.scr.config"</PostBuildEvent>
</PropertyGroup>
</Project>