Cleanup warnings
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using xUnitRevitUtils;
|
||||
|
||||
namespace SampleLibrary {
|
||||
public sealed class DocFixture : IDisposable
|
||||
{
|
||||
public Document Doc { get; set; }
|
||||
public IList<Element> Walls { get; set; }
|
||||
|
||||
|
||||
public DocFixture()
|
||||
{
|
||||
var testModel = Utils.GetTestModel("walls.rvt");
|
||||
Doc = xru.OpenDoc(testModel);
|
||||
|
||||
Walls = new FilteredElementCollector(Doc).WhereElementIsNotElementType().OfCategory(BuiltInCategory.OST_Walls).ToElements();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DocFixture.cs" />
|
||||
<Compile Include="SampleTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestWithFixture.cs" />
|
||||
|
||||
@@ -68,7 +68,5 @@ namespace SampleLibrary
|
||||
}, doc).Wait();
|
||||
Assert.True(grossArea > 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -8,27 +6,8 @@ using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using xUnitRevitUtils;
|
||||
|
||||
namespace SampleLibrary
|
||||
{
|
||||
public class DocFixture : IDisposable
|
||||
{
|
||||
public Document Doc { get; set; }
|
||||
public IList<Element> Walls { get; set; }
|
||||
|
||||
|
||||
public DocFixture()
|
||||
{
|
||||
var testModel = Utils.GetTestModel("walls.rvt");
|
||||
Doc = xru.OpenDoc(testModel);
|
||||
|
||||
Walls = new FilteredElementCollector(Doc).WhereElementIsNotElementType().OfCategory(BuiltInCategory.OST_Walls).ToElements();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
public class TestWithFixture : IClassFixture<DocFixture>
|
||||
namespace SampleLibrary {
|
||||
public class TestWithFixture : IClassFixture<DocFixture>
|
||||
{
|
||||
DocFixture fixture;
|
||||
public TestWithFixture(DocFixture fixture)
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace xUnitRevit
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
|
||||
private void ControlledApplication_ApplicationInitialized(object sender, Autodesk.Revit.DB.Events.ApplicationInitializedEventArgs e)
|
||||
{
|
||||
Application app = sender as Application;
|
||||
@@ -30,7 +29,6 @@ namespace xUnitRevit
|
||||
Runner.Launch(uiapp);
|
||||
}
|
||||
|
||||
|
||||
public Result OnShutdown(UIControlledApplication a)
|
||||
{
|
||||
return Result.Succeeded;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace xUnitRevit
|
||||
/// </summary>
|
||||
public class Configuration
|
||||
{
|
||||
public List<string> startupAssemblies { get; set; } = new List<string>();
|
||||
public IList<string> StartupAssemblies { get; set; } = new List<string>();
|
||||
public bool autoStart { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace xUnitRevit
|
||||
{
|
||||
|
||||
public bool Running = false;
|
||||
public List<Action> Queue { get; set; }
|
||||
public IList<Action> Queue { get; set; }
|
||||
|
||||
public ExternalEventHandler(List<Action> queue)
|
||||
public ExternalEventHandler(IList<Action> queue)
|
||||
{
|
||||
Queue = queue;
|
||||
}
|
||||
|
||||
@@ -34,13 +34,11 @@ namespace xUnitRevit
|
||||
main.MaxHeight = 800;
|
||||
|
||||
//pre-load asssemblies, if you're a lazy developer
|
||||
(main.DataContext as MainViewModel).StartupAssemblies = Config.startupAssemblies;
|
||||
if (main.DataContext is MainViewModel mainViewModel)
|
||||
mainViewModel.StartupAssemblies = Config.StartupAssemblies.ToList();
|
||||
main.Show();
|
||||
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
catch (Exception) {
|
||||
//fail silently
|
||||
}
|
||||
}
|
||||
@@ -59,5 +57,4 @@ namespace xUnitRevit
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ namespace xUnitRevitUtils
|
||||
{
|
||||
public static UIApplication Uiapp { get; set; }
|
||||
|
||||
private static List<Action> Queue { get; set; }
|
||||
private static IList<Action> Queue { get; set; }
|
||||
private static ExternalEvent EventHandler { get; set; }
|
||||
|
||||
public static SynchronizationContext UiContext { get; set; }
|
||||
|
||||
public static void Initialize(UIApplication uiapp, SynchronizationContext uiContext, ExternalEvent eventHandler, List<Action> queue)
|
||||
public static void Initialize(UIApplication uiapp, SynchronizationContext uiContext, ExternalEvent eventHandler, IList<Action> queue)
|
||||
{
|
||||
Uiapp = uiapp;
|
||||
UiContext = uiContext;
|
||||
@@ -33,12 +33,11 @@ namespace xUnitRevitUtils
|
||||
|
||||
#region utility methods
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the selected elements in the active document
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Element> GetActiveSelection()
|
||||
public static IList<Element> GetActiveSelection()
|
||||
{
|
||||
Assert.NotNull(Uiapp);
|
||||
|
||||
@@ -60,7 +59,6 @@ namespace xUnitRevitUtils
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty document
|
||||
/// </summary>
|
||||
@@ -98,7 +96,6 @@ namespace xUnitRevitUtils
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Runs an Action in a Revit transaction, uses TaskCompletionSource to communicate when done
|
||||
/// </summary>
|
||||
@@ -139,7 +136,6 @@ namespace xUnitRevitUtils
|
||||
EventHandler.Raise();
|
||||
|
||||
return tcs.Task;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -167,7 +163,6 @@ namespace xUnitRevitUtils
|
||||
EventHandler.Raise();
|
||||
|
||||
return tcs.Task;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -188,7 +183,6 @@ namespace xUnitRevitUtils
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace xUnitRevitUtils
|
||||
public static class xru
|
||||
{
|
||||
public static UIApplication Uiapp { get; set; }
|
||||
private static List<Action> Queue { get; set; }
|
||||
private static IList<Action> Queue { get; set; }
|
||||
private static ExternalEvent EventHandler { get; set; }
|
||||
public static SynchronizationContext UiContext { get; set; }
|
||||
public static void Initialize(UIApplication uiapp, SynchronizationContext uiContext, ExternalEvent eventHandler, List<Action> queue)
|
||||
public static void Initialize(UIApplication uiapp, SynchronizationContext uiContext, ExternalEvent eventHandler, IList<Action> queue)
|
||||
{
|
||||
Uiapp = uiapp;
|
||||
UiContext = uiContext;
|
||||
@@ -30,12 +30,11 @@ namespace xUnitRevitUtils
|
||||
|
||||
#region utility methods
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the selected elements in the active document
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Element> GetActiveSelection()
|
||||
public static IList<Element> GetActiveSelection()
|
||||
{
|
||||
Assert.NotNull(Uiapp);
|
||||
|
||||
@@ -57,7 +56,6 @@ namespace xUnitRevitUtils
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty document
|
||||
/// </summary>
|
||||
@@ -95,7 +93,6 @@ namespace xUnitRevitUtils
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Runs an Action in a Revit transaction, uses TaskCompletionSource to communicate when done
|
||||
/// </summary>
|
||||
@@ -136,7 +133,6 @@ namespace xUnitRevitUtils
|
||||
EventHandler.Raise();
|
||||
|
||||
return tcs.Task;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -164,7 +160,6 @@ namespace xUnitRevitUtils
|
||||
EventHandler.Raise();
|
||||
|
||||
return tcs.Task;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -184,8 +179,6 @@ namespace xUnitRevitUtils
|
||||
return FailureProcessingResult.Continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace xUnitRevitUtils
|
||||
public static class xru
|
||||
{
|
||||
public static UIApplication Uiapp { get; set; }
|
||||
private static List<Action> Queue { get; set; }
|
||||
private static IList<Action> Queue { get; set; }
|
||||
private static ExternalEvent EventHandler { get; set; }
|
||||
public static SynchronizationContext UiContext { get; set; }
|
||||
public static void Initialize(UIApplication uiapp, SynchronizationContext uiContext, ExternalEvent eventHandler, List<Action> queue)
|
||||
public static void Initialize(UIApplication uiapp, SynchronizationContext uiContext, ExternalEvent eventHandler, IList<Action> queue)
|
||||
{
|
||||
Uiapp = uiapp;
|
||||
UiContext = uiContext;
|
||||
@@ -30,12 +30,11 @@ namespace xUnitRevitUtils
|
||||
|
||||
#region utility methods
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the selected elements in the active document
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Element> GetActiveSelection()
|
||||
public static IList<Element> GetActiveSelection()
|
||||
{
|
||||
Assert.NotNull(Uiapp);
|
||||
|
||||
@@ -57,7 +56,6 @@ namespace xUnitRevitUtils
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty document
|
||||
/// </summary>
|
||||
@@ -95,7 +93,6 @@ namespace xUnitRevitUtils
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Runs an Action in a Revit transaction, uses TaskCompletionSource to communicate when done
|
||||
/// </summary>
|
||||
@@ -136,7 +133,6 @@ namespace xUnitRevitUtils
|
||||
EventHandler.Raise();
|
||||
|
||||
return tcs.Task;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -164,7 +160,6 @@ namespace xUnitRevitUtils
|
||||
EventHandler.Raise();
|
||||
|
||||
return tcs.Task;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -184,8 +179,6 @@ namespace xUnitRevitUtils
|
||||
return FailureProcessingResult.Continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user