Added blank screen when project isn't loaded
This commit is contained in:
parent
0e618b9909
commit
37c676f734
|
@ -82,12 +82,12 @@ public class TimelapsePack
|
|||
{
|
||||
//build the library
|
||||
Process p = new Process();
|
||||
p.StartInfo = new ProcessStartInfo("dotnet","build --configuration Release");
|
||||
p.StartInfo = new ProcessStartInfo("dotnet","publish --configuration Release");
|
||||
p.StartInfo.UseShellExecute=false;
|
||||
if(p.Start())
|
||||
{
|
||||
p.WaitForExit();
|
||||
return Path.Combine(Environment.CurrentDirectory,"bin","Release","net6.0",$"{curDirName}.dll");
|
||||
return Path.Combine(Environment.CurrentDirectory,"bin","Release","net6.0","publish",$"{curDirName}.dll");
|
||||
}else{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("ERROR: process not started");
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
<PackageId>Tesses.TimelapsePack</PackageId>
|
||||
<Authors>Mike Nolan</Authors>
|
||||
<Company>Tesses</Company>
|
||||
<Version>1.0.2</Version>
|
||||
<AssemblyVersion>1.0.2</AssemblyVersion>
|
||||
<FileVersion>1.0.2</FileVersion>
|
||||
<Version>1.0.3</Version>
|
||||
<AssemblyVersion>1.0.3</AssemblyVersion>
|
||||
<FileVersion>1.0.3</FileVersion>
|
||||
<Description>Extension Packaging tool for TimelapseNow</Description>
|
||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
|
|
|
@ -324,11 +324,21 @@ public class MainForm : Form
|
|||
svr.Listen();
|
||||
});
|
||||
t.Start();
|
||||
|
||||
Instance.HasCamera=c !=null;
|
||||
if(c == null)
|
||||
{
|
||||
MessageBox.Show("You will need to restart app to record");
|
||||
return;
|
||||
|
||||
Thread t2=new Thread(async()=>{
|
||||
while(true)
|
||||
{
|
||||
Image<Rgb24> rgb=new Image<Rgb24>(Instance.Model.blankCameraWidth,Instance.Model.blankCameraHeight,new Rgb24(0,0,0));
|
||||
await FrameChanged(rgb);
|
||||
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
});
|
||||
t2.Start();
|
||||
return;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
|
|
|
@ -27,7 +27,9 @@ public class GuiData
|
|||
Instance.Extensions.Add(ext);
|
||||
await ext._Create();
|
||||
}
|
||||
Instance.SetPriority();
|
||||
}
|
||||
|
||||
public void FSChanged()
|
||||
{
|
||||
if(Instance != null)
|
||||
|
@ -52,8 +54,22 @@ public class GuiData
|
|||
public IEnumerable<(Func<Window,string,Task> ShareActionAsync,string Text,TimelapseExtension extension)>? Share {get {if(Instance==null) return null;return Instance._share;}}
|
||||
public int CurrentFSIndex {get;set;}
|
||||
}
|
||||
internal class PriorityCompare : IComparer<(Func<Image<Rgb24>, Task<bool>> Handler, string HandlerName, TimelapseExtension Extension, int Priority)>
|
||||
{
|
||||
public int Compare((Func<Image<Rgb24>, Task<bool>> Handler, string HandlerName, TimelapseExtension Extension, int Priority) x, (Func<Image<Rgb24>, Task<bool>> Handler, string HandlerName, TimelapseExtension Extension, int Priority) y)
|
||||
{
|
||||
|
||||
return y.Priority.CompareTo(x.Priority);
|
||||
}
|
||||
}
|
||||
public class Api
|
||||
{
|
||||
internal void SetPriority()
|
||||
{
|
||||
_frameHandlers.Sort(new PriorityCompare());
|
||||
}
|
||||
|
||||
public bool HasCamera {get;set;}
|
||||
public TimelapseSettingsModel Model = LoadModel();
|
||||
internal static string ModelLocation = GetInternalFile("config.json");
|
||||
private static TimelapseSettingsModel LoadModel()
|
||||
|
@ -193,7 +209,7 @@ public class Api
|
|||
return fs;
|
||||
}
|
||||
|
||||
internal List<(Func<Image<Rgb24>,Task<bool>> Handler,string HandlerName, TimelapseExtension Extension)> _frameHandlers=new List<(Func<Image<Rgb24>, Task<bool>> Handler,string HandlerName, TimelapseExtension Extension)>();
|
||||
internal List<(Func<Image<Rgb24>,Task<bool>> Handler,string HandlerName, TimelapseExtension Extension,int Priority)> _frameHandlers=new List<(Func<Image<Rgb24>, Task<bool>> Handler,string HandlerName, TimelapseExtension Extension,int Priority)>();
|
||||
|
||||
internal List<(Func<Dialog> Dialog,string Text,TimelapseExtension Extension)> _extSettings= new List<(Func<Dialog> Dialog,string Text,TimelapseExtension Extension)>();
|
||||
|
||||
|
|
|
@ -22,9 +22,7 @@ public sealed class ExtensionFeatures
|
|||
}
|
||||
public ExtensionFeatures RegisterAsyncFrameHandler(Func<Image<Rgb24>,Task<bool>> handler,string handlerName)
|
||||
{
|
||||
if(!Valid || Instance == null) return this;
|
||||
Instance._frameHandlers.Add((handler,handlerName,Extension));
|
||||
return this;
|
||||
return RegisterAsyncFrameHandler(handler,handlerName,10000);
|
||||
}
|
||||
public ExtensionFeatures RegisterFileSystem(TimelapseFileSystem fs,string name)
|
||||
{
|
||||
|
@ -32,6 +30,12 @@ public sealed class ExtensionFeatures
|
|||
Instance._fs.Add((fs,name,Extension));
|
||||
return this;
|
||||
}
|
||||
public ExtensionFeatures RegisterAsyncFrameHandler(Func<Image<Rgb24>,Task<bool>> handler,string handlerName,int priority)
|
||||
{
|
||||
if(!Valid || Instance == null) return this;
|
||||
Instance._frameHandlers.Add((handler,handlerName,Extension,priority));
|
||||
return this;
|
||||
}
|
||||
public ExtensionFeatures RegisterFrameHandler(Func<Image<Rgb24>,bool> handler,string handlerName)
|
||||
{
|
||||
if(!Valid) return this;
|
||||
|
@ -46,6 +50,20 @@ public sealed class ExtensionFeatures
|
|||
},handlerName);
|
||||
return this;
|
||||
}
|
||||
public ExtensionFeatures RegisterFrameHandler(Func<Image<Rgb24>,bool> handler,string handlerName,int priority)
|
||||
{
|
||||
if(!Valid) return this;
|
||||
RegisterAsyncFrameHandler(async(e)=>{
|
||||
if(handler !=null)
|
||||
{
|
||||
return await Task.Run<bool>(()=>{
|
||||
return handler(e);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
},handlerName,priority);
|
||||
return this;
|
||||
}
|
||||
public ExtensionFeatures RegisterExport(Func<IEnumerable<Image<Rgb24>>,string,CancellationToken,Task> export,FileFilter[] filter,string text)
|
||||
{
|
||||
if(!Valid || Instance == null) return this;
|
||||
|
|
|
@ -56,6 +56,7 @@ public class ExtensionLoader
|
|||
ext2.Instance=instance;
|
||||
instance.Extensions.Add(ext2);
|
||||
await ext2._Create();
|
||||
instance.SetPriority();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,18 @@ internal class TimelapseSettings : Dialog
|
|||
};
|
||||
DynamicLayout lyt1=new DynamicLayout();
|
||||
Scrollable scrollable=new Scrollable();
|
||||
|
||||
GroupBox szRow=new GroupBox {Text="Blank camera size"};
|
||||
NumericStepper blankWidth=new NumericStepper{Value=api.Model.blankCameraWidth,MinValue=120,MaxValue=65535};
|
||||
NumericStepper blankHeight =new NumericStepper{Value=api.Model.blankCameraHeight,MinValue=90,MaxValue=65535};
|
||||
|
||||
DynamicLayout lyt3=new DynamicLayout();
|
||||
lyt3.BeginVertical();
|
||||
lyt3.BeginHorizontal();
|
||||
lyt3.Add(blankWidth,true);
|
||||
lyt3.Add(blankHeight,true);
|
||||
lyt3.EndHorizontal();
|
||||
lyt3.EndVertical();
|
||||
szRow.Content=lyt3;
|
||||
DynamicLayout lyt2=new DynamicLayout();
|
||||
scrollable.Content=lyt2;
|
||||
lyt2.BeginVertical();
|
||||
|
@ -206,6 +217,7 @@ internal class TimelapseSettings : Dialog
|
|||
lyt2.AddRow(installExtension);
|
||||
lyt2.AddRow(enableExt);
|
||||
lyt2.AddRow(useCustomFilePickerForNativeFS);
|
||||
lyt2.AddRow(szRow);
|
||||
|
||||
lyt2.AddRow(null);
|
||||
lyt2.EndVertical();
|
||||
|
@ -218,7 +230,8 @@ internal class TimelapseSettings : Dialog
|
|||
saveBtn.Click += (sender,e)=>{
|
||||
api.Model.canBlockFrames=blockBoxState;
|
||||
api.Model.canOverlayVideo=overLayBoxState;
|
||||
|
||||
api.Model.blankCameraWidth=(int)blankWidth.Value;
|
||||
api.Model.blankCameraHeight=(int)blankHeight.Value;
|
||||
api.Model.deniedBlockExtensions.Clear();
|
||||
api.Model.deniedOverlayExtensions.Clear();
|
||||
api.Model.enableWebServer=enableServer.Checked.GetValueOrDefault();
|
||||
|
|
|
@ -11,8 +11,12 @@ public class TimelapseSettingsModel
|
|||
timelapsePort=49290;
|
||||
canBlockFrames=true;
|
||||
addExtensionOnInstall=true;
|
||||
blankCameraHeight=720;
|
||||
blankCameraWidth=1280;
|
||||
|
||||
}
|
||||
public int blankCameraWidth {get;set;}
|
||||
public int blankCameraHeight {get;set;}
|
||||
public bool useCustomFilePickerForNativeFS {get;set;}
|
||||
public bool addExtensionOnInstall {get;set;}
|
||||
public bool canOverlayVideo {get;set;}
|
||||
|
|
Loading…
Reference in New Issue