├── .gitignore ├── AssemblyVersionInfo.cs ├── Assets ├── BCF.ico ├── BCFierIcon16x16.png ├── BCFierIcon32x32.png ├── BCFierIcon64x64.png ├── Thumbs.db ├── bcfier-banner.bmp ├── bcfier-text.png ├── bcfier.ai ├── bcfier.png └── icon.ico ├── BCFier.exe ├── BCFier.sln ├── Bcfier.Navisworks ├── Assets │ └── icon.ico ├── Bcfier.Navisworks.csproj ├── Data │ ├── NavisUtils.cs │ └── NavisView.cs ├── Entry │ ├── AppMain.cs │ └── CmdMain.cs ├── Images │ ├── BCFierIcon16x16.png │ └── BCFierIcon32x32.png ├── NavisWindow.xaml ├── NavisWindow.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Windows │ ├── AddViewNavis.xaml │ └── AddViewNavis.xaml.cs ├── app.config └── en-US │ └── RibbonDefinition.xaml ├── Bcfier.Revit ├── AddIssueRevit.xaml ├── AddIssueRevit.xaml.cs ├── AddViewRevit.xaml ├── AddViewRevit.xaml.cs ├── App.config ├── Assets │ └── icon.ico ├── Bcfier.Revit.addin ├── Bcfier.Revit.csproj ├── Data │ ├── RevitUtils.cs │ └── RevitView.cs ├── Entry │ ├── AppMain.cs │ ├── CmdMain.cs │ ├── ExtAppBcfier.cs │ └── ExtEvntOpenView.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── RevitWindow.xaml ├── RevitWindow.xaml.cs └── packages.config ├── Bcfier.Win ├── App.config ├── App.xaml ├── App.xaml.cs ├── Assets │ └── icon.ico ├── Bcfier.Win.csproj ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings └── packages.config ├── Bcfier.XbimXplorer ├── AddViewXbim.xaml ├── AddViewXbim.xaml.cs ├── App.config ├── App.xaml ├── App.xaml.cs ├── Assets │ └── icon.ico ├── Bcfier.XbimXplorer.csproj ├── Bcfier.XbimXplorer.plugin.nuspec ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── MakeNugetInstaller.bat ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings └── packages.config ├── Bcfier ├── Api │ ├── GitHubAsset.cs │ ├── GitHubAuthor.cs │ ├── GitHubRelease.cs │ ├── GitHubRest.cs │ └── StatHat.cs ├── App.config ├── Assets │ ├── BCFierIcon16x16.png │ ├── BCFierIcon32x32.png │ ├── BCFierIcon64x64.png │ └── icon.ico ├── Bcf │ ├── Bcf2 │ │ ├── Markup.cs │ │ ├── Project.cs │ │ ├── Version.cs │ │ ├── ViewComment.cs │ │ ├── ViewPointExtended.cs │ │ └── Visinfo.cs │ ├── BcfContainer.cs │ └── BcfFile.cs ├── Bcfier.csproj ├── Data │ ├── AttachedProperties │ │ ├── CtrlEnterKeyDown.cs │ │ └── NavigationService.cs │ ├── Commands.cs │ ├── Globals.cs │ ├── Utils │ │ ├── IfcGuid.cs │ │ ├── ImagingUtils.cs │ │ ├── RelativeDate.cs │ │ ├── UserSettings.cs │ │ └── Utils.cs │ └── ValueConverters │ │ ├── BoolStarConverter.cs │ │ ├── BoolVisibConverter.cs │ │ ├── DateConverter.cs │ │ ├── IntPluralConverter.cs │ │ ├── IntVisibConverter.cs │ │ ├── MultiCommandConverter.cs │ │ └── PathToImageConv.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── SampleBcfFile.xaml ├── Themes │ ├── ButtonIcon.cs │ ├── ButtonStyles.xaml │ ├── Colors.xaml │ ├── Generic.xaml │ ├── Icons.xaml │ ├── IssueListStyle.xaml │ ├── IssueListStyle.xaml.cs │ ├── LabelSelectable.cs │ ├── ScrollViewer.xaml │ ├── TextPlaceholder.cs │ ├── ViewCommentDataTemplate.cs │ ├── ViewCommentDataTemplate.xaml │ ├── ViewCommentListStyle.xaml │ └── VisibilityAnimations.xaml ├── UserControls │ ├── AddView.xaml │ ├── AddView.xaml.cs │ ├── BcfReportPanel.xaml │ ├── BcfReportPanel.xaml.cs │ ├── BcfierPanel.xaml │ ├── BcfierPanel.xaml.cs │ └── IssuesPanel.xaml.cs ├── Windows │ ├── ComponentsList.xaml │ ├── ComponentsList.xaml.cs │ ├── NewVersion.xaml │ ├── NewVersion.xaml.cs │ ├── Settings.xaml │ ├── Settings.xaml.cs │ ├── SnapWin.xaml │ └── SnapWin.xaml.cs └── packages.config ├── CHANGELOG.md ├── InnoSetup └── BCFier.iss ├── LICENSE ├── README.md ├── Release.proj └── bcfier-update.xml /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # Node.js Tools for Visual Studio 190 | .ntvs_analysis.dat 191 | 192 | # Visual Studio 6 build log 193 | *.plg 194 | 195 | # Visual Studio 6 workspace options file 196 | *.opt 197 | -------------------------------------------------------------------------------- /AssemblyVersionInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | // Version information for an assembly consists of the following four values: 3 | // 4 | // Major Version 5 | // Minor Version 6 | // Build Number 7 | // Revision 8 | // 9 | // You can specify all the values or you can default the Build and Revision Numbers 10 | // by using the '*' as shown below: 11 | // [assembly: AssemblyVersion("1.0.*")] 12 | [assembly: AssemblyVersion("2.2.2")] 13 | [assembly: AssemblyFileVersion("2.2.2")] 14 | -------------------------------------------------------------------------------- /Assets/BCF.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Assets/BCF.ico -------------------------------------------------------------------------------- /Assets/BCFierIcon16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Assets/BCFierIcon16x16.png -------------------------------------------------------------------------------- /Assets/BCFierIcon32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Assets/BCFierIcon32x32.png -------------------------------------------------------------------------------- /Assets/BCFierIcon64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Assets/BCFierIcon64x64.png -------------------------------------------------------------------------------- /Assets/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Assets/Thumbs.db -------------------------------------------------------------------------------- /Assets/bcfier-banner.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Assets/bcfier-banner.bmp -------------------------------------------------------------------------------- /Assets/bcfier-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Assets/bcfier-text.png -------------------------------------------------------------------------------- /Assets/bcfier.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Assets/bcfier.ai -------------------------------------------------------------------------------- /Assets/bcfier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Assets/bcfier.png -------------------------------------------------------------------------------- /Assets/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Assets/icon.ico -------------------------------------------------------------------------------- /BCFier.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/BCFier.exe -------------------------------------------------------------------------------- /Bcfier.Navisworks/Assets/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Bcfier.Navisworks/Assets/icon.ico -------------------------------------------------------------------------------- /Bcfier.Navisworks/Data/NavisUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using Autodesk.Navisworks.Api; 8 | using Bcfier.Bcf.Bcf2; 9 | using Point = Bcfier.Bcf.Bcf2.Point; 10 | using Direction = Bcfier.Bcf.Bcf2.Direction; 11 | 12 | namespace Bcfier.Navisworks.Data 13 | { 14 | public static class NavisUtils 15 | { 16 | private static double _Units; 17 | 18 | public static Point3D GetNavisXYZ(Point d) 19 | { 20 | return new Point3D(d.X.ToInternal(), d.Y.ToInternal(), d.Z.ToInternal()); 21 | } 22 | public static Vector3D GetNavisVector(Direction d) 23 | { 24 | return new Point3D(d.X.ToInternal(), d.Y.ToInternal(), d.Z.ToInternal()).ToVector3D().Normalize(); 25 | } 26 | 27 | /// 28 | /// Converts meters units to feet 29 | /// 30 | /// Value in feet to be converted to feet 31 | /// 32 | public static double ToInternal(this double meters) 33 | { 34 | return meters * _Units; 35 | } 36 | 37 | public static double FromInternal(this double intUnits) 38 | { 39 | return intUnits / _Units; 40 | } 41 | 42 | public static void GetGunits(Document doc) 43 | { 44 | string units = doc.Units.ToString(); 45 | double factor = 1; 46 | switch (units) 47 | { 48 | case "Centimeters": 49 | factor = 100; 50 | break; 51 | case "Feet": 52 | factor = 3.28084; 53 | break; 54 | case "Inches": 55 | factor = 39.3701; 56 | break; 57 | case "Kilometers": 58 | factor = 0.001; 59 | break; 60 | case "Meters": 61 | factor = 1; 62 | break; 63 | case "Micrometers": 64 | factor = 1000000; 65 | break; 66 | case "Miles": 67 | factor = 0.000621371; 68 | break; 69 | case "Millimeters": 70 | factor = 1000; 71 | break; 72 | case "Mils": 73 | factor = 39370.0787; 74 | break; 75 | case "Yards": 76 | factor = 1.09361; 77 | break; 78 | default: 79 | //MessageBox.Show("Units " + units + " not recognized."); 80 | factor = 1; 81 | break; 82 | } 83 | _Units = factor; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/Entry/AppMain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using System.Windows.Forms.Integration; 4 | using Autodesk.Navisworks.Api.Plugins; 5 | 6 | namespace Bcfier.Navisworks.Entry 7 | { 8 | [Plugin("Bcfier.AppMain", "Bcfier", DisplayName = "BCFier", ToolTip = "Bcfier")] 9 | [DockPanePlugin(800, 500, FixedSize = false)] 10 | class AppMain : DockPanePlugin 11 | { 12 | NavisWindow ns; 13 | 14 | public override Control CreateControlPane() 15 | { 16 | //create an ElementHost 17 | ElementHost eh = new ElementHost(); 18 | 19 | //assign the control 20 | //eh.Anchor = AnchorStyles.Top; 21 | eh.Dock = DockStyle.Top; 22 | eh.Anchor = AnchorStyles.Top; 23 | ns = new NavisWindow(); 24 | eh.Child = ns; 25 | eh.HandleCreated += eh_HandleCreated; 26 | eh.CreateControl(); 27 | 28 | //return the ElementHost 29 | return eh; 30 | } 31 | 32 | void eh_HandleCreated(object sender, EventArgs e) 33 | { 34 | ElementHost eh = sender as ElementHost; 35 | eh.Dock = DockStyle.Top; 36 | eh.Anchor = AnchorStyles.Top; 37 | 38 | } 39 | 40 | public override void DestroyControlPane(Control pane) 41 | { 42 | //TODO: uncommet 43 | //ns.mainPan.onClosing(null); 44 | pane.Dispose(); 45 | 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Bcfier.Navisworks/Entry/CmdMain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Reflection; 4 | using System.Windows.Forms; 5 | using Autodesk.Navisworks.Api.Plugins; 6 | 7 | namespace Bcfier.Navisworks.Entry 8 | { 9 | 10 | [Plugin("Bcfier.CmdMain", "Bcfier", DisplayName = "BCFier")] 11 | [RibbonLayout("RibbonDefinition.xaml")] 12 | [RibbonTab("bcfierTab")] 13 | [Command("bcfierBtn", DisplayName = "BCFier", Icon = "BCFierIcon16x16.png", LargeIcon = "BCFierIcon32x32.png", ToolTip = "BCFier", ExtendedToolTip = "BCFier")] 14 | public class CmdMain : CommandHandlerPlugin 15 | { 16 | #if Version2017 17 | 18 | public const string NavisVersion = "2017"; 19 | 20 | #elif Version2015 21 | 22 | public const string NavisVersion = "2015"; 23 | 24 | #elif Version2016 25 | 26 | public const string NavisVersion = "2016"; 27 | 28 | #endif 29 | /// 30 | /// Constructor, just initialises variables. 31 | /// 32 | public CmdMain() 33 | { 34 | 35 | } 36 | 37 | public override int ExecuteCommand(string commandId, params string[] parameters) 38 | { 39 | switch (commandId) 40 | { 41 | case "bcfierBtn": 42 | { 43 | 44 | LaunchPlugin(); 45 | break; 46 | } 47 | 48 | default: 49 | { 50 | MessageBox.Show("You have clicked on the command with ID = '" + commandId + "'"); 51 | break; 52 | } 53 | } 54 | 55 | return 0; 56 | } 57 | 58 | public override bool TryShowCommandHelp(String commandId) 59 | { 60 | MessageBox.Show("Showing Help for command with the Id " + commandId); 61 | return true; 62 | } 63 | 64 | /// 65 | /// Launch 66 | /// 67 | public void LaunchPlugin() 68 | { 69 | 70 | // Running Navis 71 | if (Autodesk.Navisworks.Api.Application.IsAutomated) 72 | { 73 | throw new InvalidOperationException("Invalid when running using Automation"); 74 | } 75 | 76 | // Version 77 | if (!Autodesk.Navisworks.Api.Application.Version.RuntimeProductName.Contains(NavisVersion)) 78 | { 79 | MessageBox.Show("This Add - In was built and tested only for Navisworks Manage " + NavisVersion + ", proceed at your own risk", 80 | "Untested Navisworks Version", 81 | MessageBoxButtons.OK, 82 | MessageBoxIcon.Warning); 83 | } 84 | 85 | //Find the plugin 86 | PluginRecord pr = Autodesk.Navisworks.Api.Application.Plugins.FindPlugin("Bcfier.AppMain.Bcfier"); 87 | 88 | if (pr != null && pr is DockPanePluginRecord && pr.IsEnabled) 89 | { 90 | //string bcfier = "Bcfier.Navisworks.dll"; 91 | 92 | //check if it needs loading 93 | if (pr.LoadedPlugin == null) 94 | { 95 | pr.LoadPlugin(); 96 | } 97 | 98 | DockPanePlugin dpp = pr.LoadedPlugin as DockPanePlugin; 99 | if (dpp != null) 100 | { 101 | //switch the Visible flag 102 | dpp.Visible = !dpp.Visible; 103 | } 104 | } 105 | } 106 | } 107 | } 108 | 109 | 110 | 111 | // addin tab 112 | // [Plugin("Bcfier.CmdMain", "Bcfier", DisplayName = "BCFier")] 113 | // //[RibbonLayout("RibbonDefinition.xaml")] 114 | // // [RibbonTab("bcfierTab")] 115 | // [Command("bcfierBtn", DisplayName = "BCFier", Icon = "BCFierIcon16x16.png", LargeIcon = "BCFierIcon32x32.png", ToolTip = "BCFier", ExtendedToolTip = "BCFier")] 116 | // public class BasicDockPaneAddin : AddInPlugin 117 | // { 118 | // public override int Execute(params string[] parameters) 119 | // { 120 | // // Find the plugin 121 | // PluginRecord pr = Autodesk.Navisworks.Api.Application.Plugins.FindPlugin("Bcfier.AppMain.Bcfier"); 122 | 123 | // if (pr != null && pr is DockPanePluginRecord && pr.IsEnabled) 124 | // { //check if it needs loading if (pr.LoadedPlugin == null) { pr.LoadPlugin(); } 125 | 126 | // DockPanePlugin dpp = pr.LoadedPlugin as DockPanePlugin; if (dpp != null) 127 | // { // Switch the Visible flag 128 | // dpp.Visible = !dpp.Visible; 129 | // } 130 | // } 131 | // return 0; 132 | // } 133 | // } 134 | //} -------------------------------------------------------------------------------- /Bcfier.Navisworks/Images/BCFierIcon16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Bcfier.Navisworks/Images/BCFierIcon16x16.png -------------------------------------------------------------------------------- /Bcfier.Navisworks/Images/BCFierIcon32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Bcfier.Navisworks/Images/BCFierIcon32x32.png -------------------------------------------------------------------------------- /Bcfier.Navisworks/NavisWindow.xaml: -------------------------------------------------------------------------------- 1 |  15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/NavisWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using System.Windows.Input; 6 | using System.Linq; 7 | using System.Collections.Generic; 8 | 9 | using System.IO; 10 | using Bcfier.Data.Utils; 11 | using Bcfier.Navisworks.Data; 12 | using Bcfier.Bcf.Bcf2; 13 | using Autodesk.Navisworks.Api; 14 | using Bcfier.Navisworks.Windows; 15 | using ComBridge = Autodesk.Navisworks.Api.ComApi.ComApiBridge; 16 | using ComApi = Autodesk.Navisworks.Api.Interop.ComApi; 17 | 18 | 19 | namespace Bcfier.Navisworks 20 | { 21 | /// 22 | /// Interaction logic for NavisWindow.xaml 23 | /// 24 | public partial class NavisWindow : UserControl 25 | { 26 | List _savedViewpoints = new List(); 27 | 28 | public NavisWindow() 29 | { 30 | InitializeComponent(); 31 | 32 | // set image export settings 33 | // configure the option "export.image.format" to export png and image size 34 | ComApi.InwOaPropertyVec options = ComBridge.State.GetIOPluginOptions("lcodpimage"); 35 | foreach (ComApi.InwOaProperty opt in options.Properties()) 36 | { 37 | if (opt.name == "export.image.format") 38 | opt.value = "lcodpexpng"; 39 | if (opt.name == "export.image.width") 40 | opt.value = 1600; 41 | if (opt.name == "export.image.height") 42 | opt.value = 900; 43 | } 44 | } 45 | #region commands 46 | /// 47 | /// Raised when opening a view 48 | /// 49 | /// 50 | /// 51 | private void OnOpenView(object sender, ExecutedRoutedEventArgs e) 52 | { 53 | try 54 | { 55 | if (Bcfier.SelectedBcf() == null) 56 | return; 57 | var view = e.Parameter as ViewPoint; 58 | if (view == null) 59 | return; 60 | 61 | var v = view.VisInfo; 62 | 63 | //current document 64 | var doc = Autodesk.Navisworks.Api.Application.ActiveDocument; 65 | NavisView.Open(doc,v); 66 | } 67 | catch (System.Exception ex1) 68 | { 69 | MessageBox.Show("exception: " + ex1, "Error opening a View!"); 70 | } 71 | } 72 | /// 73 | /// Same as in the windows app, but here we generate a VisInfo that is attached to the view 74 | /// 75 | /// 76 | /// 77 | private void OnAddView(object sender, ExecutedRoutedEventArgs e) 78 | { 79 | try 80 | { 81 | 82 | if (Bcfier.SelectedBcf() == null) 83 | return; 84 | var issue = e.Parameter as Markup; 85 | if (issue == null) 86 | { 87 | MessageBox.Show("No Issue selected", "Error", MessageBoxButton.OK, MessageBoxImage.Error); 88 | return; 89 | } 90 | try 91 | { 92 | var doc = Autodesk.Navisworks.Api.Application.ActiveDocument; 93 | var dialog = new AddViewNavis(issue, Bcfier.SelectedBcf().TempPath); 94 | dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen; 95 | dialog.ShowDialog(); 96 | if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) 97 | { 98 | //generate and set the VisInfo 99 | //issue.Viewpoints.Last().VisInfo = GenerateViewpoint(); 100 | 101 | //set filename here as it's not set when an issue is created 102 | if (!string.IsNullOrEmpty(doc.FileName)) 103 | issue.Header[0].Filename = doc.FileName; 104 | else 105 | issue.Header[0].Filename = "Unknown"; 106 | 107 | Bcfier.SelectedBcf().HasBeenSaved = false; 108 | } 109 | } 110 | 111 | catch (Exception ex) 112 | { 113 | MessageBox.Show(ex.ToString()); 114 | } 115 | 116 | } 117 | catch (System.Exception ex1) 118 | { 119 | MessageBox.Show("exception: " + ex1, "Error adding a View!"); 120 | } 121 | } 122 | 123 | private void OnAddIssues(object sender, ExecutedRoutedEventArgs e) 124 | { 125 | 126 | } 127 | 128 | 129 | 130 | private void RecurseItems(SavedItem savedItem) 131 | { 132 | try 133 | { 134 | Autodesk.Navisworks.Api.GroupItem group = savedItem as Autodesk.Navisworks.Api.GroupItem; 135 | //is a group 136 | if (null != group) 137 | { 138 | foreach (SavedItem child in group.Children) 139 | { 140 | RecurseItems(child); 141 | } 142 | } 143 | else 144 | { 145 | _savedViewpoints.Add((SavedViewpoint)savedItem); 146 | } 147 | } 148 | catch 149 | { 150 | //do nothing 151 | } 152 | 153 | } 154 | 155 | 156 | #endregion 157 | //stats 158 | private void NavisWindow_OnLoaded(object sender, RoutedEventArgs e) 159 | { 160 | Task.Run(() => 161 | { 162 | StatHat.Post.EzCounter(@"hello@teocomi.com", "BCFierNavisStart", 1); 163 | }); 164 | } 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Bcfier.Navisworks")] 9 | [assembly: AssemblyDescription("Bcfier.Navisworks")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("teocomi")] 12 | [assembly: AssemblyProduct("Bcfier.Navisworks")] 13 | [assembly: AssemblyCopyright("Copyright © teocomi 2017")] 14 | [assembly: AssemblyTrademark("teocomi")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | //In order to begin building localizable applications, set 24 | //CultureYouAreCodingWith in your .csproj file 25 | //inside a . For example, if you are using US english 26 | //in your source files, set the to en-US. Then uncomment 27 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 28 | //the line below to match the UICulture setting in the project file. 29 | 30 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 31 | 32 | 33 | [assembly: ThemeInfo( 34 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 35 | //(used if a resource is not found in the page, 36 | // or application resource dictionaries) 37 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 38 | //(used if a resource is not found in the page, 39 | // app, or any theme specific resource dictionaries) 40 | )] 41 | 42 | 43 | // Version information for an assembly consists of the following four values: 44 | // 45 | // Major Version 46 | // Minor Version 47 | // Build Number 48 | // Revision 49 | // 50 | // You can specify all the values or you can default the Build and Revision Numbers 51 | // by using the '*' as shown below: 52 | // [assembly: AssemblyVersion("1.0.*")] 53 | [assembly: AssemblyVersion("2.1.0")] 54 | [assembly: AssemblyFileVersion("2.1.0")] 55 | [assembly: GuidAttribute("1A1B4852-D3E0-4ADC-9EDD-42A5D57652EA")] 56 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bcfier.Navisworks.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bcfier.Navisworks.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bcfier.Navisworks.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/Windows/AddViewNavis.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/Windows/AddViewNavis.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Windows; 4 | using Bcfier.Bcf.Bcf2; 5 | using Autodesk.Navisworks.Api; 6 | using ComBridge = Autodesk.Navisworks.Api.ComApi.ComApiBridge; 7 | using ComApi = Autodesk.Navisworks.Api.Interop.ComApi; 8 | using System.Drawing; 9 | using System.Drawing.Imaging; 10 | 11 | namespace Bcfier.Navisworks.Windows 12 | { 13 | /// 14 | /// Interaction logic for AddViewNavis.xaml 15 | /// 16 | public partial class AddViewNavis : Window 17 | { 18 | public AddViewNavis(Markup issue, string bcfTempFolder) 19 | { 20 | try 21 | { 22 | InitializeComponent(); 23 | AddViewControl.Issue = issue; 24 | AddViewControl.TempFolder = bcfTempFolder; 25 | 26 | AddViewControl.TextBlockInfo.Text = "3D information of the current view will be included in the viewpoint"; 27 | 28 | GetNavisSnapshot(); 29 | } 30 | catch (System.Exception ex1) 31 | { 32 | MessageBox.Show("exception: " + ex1, "Error!"); 33 | } 34 | 35 | } 36 | 37 | public void GetNavisSnapshot() 38 | { 39 | try 40 | { 41 | string tempImg = Path.Combine(Path.GetTempPath(), "BCFier", Path.GetTempFileName() + ".png"); 42 | // get the state of COM 43 | ComApi.InwOpState10 oState = ComBridge.State; 44 | // get the IO plugin for image 45 | ComApi.InwOaPropertyVec options = oState.GetIOPluginOptions("lcodpimage"); 46 | //export the viewpoint to the image 47 | oState.DriveIOPlugin("lcodpimage", tempImg, options); 48 | Bitmap bitmap = new Bitmap(tempImg); 49 | var imageStream = new MemoryStream(); 50 | bitmap.Save(imageStream, ImageFormat.Jpeg); 51 | bitmap.Dispose(); 52 | 53 | AddViewControl.AddViewpoint(tempImg); 54 | File.Delete(tempImg); 55 | 56 | } 57 | catch (Exception ex1) 58 | { 59 | MessageBox.Show("exception: " + ex1, "Error!",MessageBoxButton.OK,MessageBoxImage.Error); 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Bcfier.Navisworks/en-US/RibbonDefinition.xaml: -------------------------------------------------------------------------------- 1 |  2 | 10 | 11 | 12 | 13 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Bcfier.Revit/AddIssueRevit.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 92 | 93 | -------------------------------------------------------------------------------- /Bcfier.Revit/AddViewRevit.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Bcfier.Revit/AddViewRevit.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Windows; 3 | using Autodesk.Revit.DB; 4 | using Autodesk.Revit.UI; 5 | using Bcfier.Bcf.Bcf2; 6 | 7 | namespace Bcfier.Revit 8 | { 9 | /// 10 | /// Interaction logic for AddViewRevit.xaml 11 | /// 12 | public partial class AddViewRevit : Window 13 | { 14 | 15 | private Document doc = null; 16 | 17 | public AddViewRevit(Markup issue, string bcfTempFolder, Document _doc) 18 | { 19 | try 20 | { 21 | this.InitializeComponent(); 22 | AddViewControl.Issue = issue; 23 | AddViewControl.TempFolder = bcfTempFolder; 24 | doc = _doc; 25 | 26 | AddViewControl.TextBlockInfo.Text = "3D/2D information of the current view will be included in the viewpoint"; 27 | 28 | GetRevitSnapshot(); 29 | } 30 | catch (System.Exception ex1) 31 | { 32 | TaskDialog.Show("Error!", "exception: " + ex1); 33 | } 34 | 35 | } 36 | 37 | private void GetRevitSnapshot() 38 | { 39 | try 40 | { 41 | string tempImg = Path.Combine(Path.GetTempPath(), "BCFier", Path.GetTempFileName() + ".png"); 42 | var options = new ImageExportOptions 43 | { 44 | FilePath = tempImg, 45 | HLRandWFViewsFileType = ImageFileType.PNG, 46 | ShadowViewsFileType = ImageFileType.PNG, 47 | ExportRange = ExportRange.VisibleRegionOfCurrentView, 48 | ZoomType = ZoomFitType.FitToPage, 49 | ImageResolution = ImageResolution.DPI_72, 50 | PixelSize = 1000 51 | }; 52 | doc.ExportImage(options); 53 | 54 | AddViewControl.AddViewpoint(tempImg); 55 | File.Delete(tempImg); 56 | } 57 | catch (System.Exception ex1) 58 | { 59 | TaskDialog.Show("Error!", "exception: " + ex1); 60 | } 61 | } 62 | 63 | } 64 | } -------------------------------------------------------------------------------- /Bcfier.Revit/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Bcfier.Revit/Assets/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Bcfier.Revit/Assets/icon.ico -------------------------------------------------------------------------------- /Bcfier.Revit/Bcfier.Revit.addin: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | BCFier for Revit 5 | Bcfier.Revit\Bcfier.Revit.dll 6 | 0d553633-80f8-490b-84d6-9d3d6ad4196d 7 | Bcfier.Revit.Entry.AppMain 8 | TEOC 9 | Matteo Cominetti, http://bcfier.com 10 | 11 | -------------------------------------------------------------------------------- /Bcfier.Revit/Data/RevitUtils.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.Revit.DB; 2 | using Bcfier.Bcf.Bcf2; 3 | using System; 4 | using Point = Bcfier.Bcf.Bcf2.Point; 5 | 6 | namespace Bcfier.Revit.Data 7 | { 8 | public static class RevitUtils 9 | { 10 | /// 11 | //MOVES THE CAMERA ACCORDING TO THE PROJECT BASE LOCATION 12 | //function that changes the coordinates accordingly to the project base location to an absolute location (for BCF export) 13 | //if the value negative is set to true, does the opposite (for opening BCF views) 14 | /// 15 | /// center 16 | /// view direction 17 | /// up direction 18 | /// convert to/from 19 | /// 20 | public static ViewOrientation3D ConvertBasePoint(Document doc, XYZ c, XYZ view, XYZ up, bool negative) 21 | { 22 | double angle = 0; 23 | double x = 0; 24 | double y = 0; 25 | double z = 0; 26 | 27 | //VERY IMPORTANT 28 | //BuiltInParameter.BASEPOINT_EASTWEST_PARAM is the value of the BASE POINT LOCATION 29 | //position is the location of the BPL related to Revit's absolute origin 30 | //if BPL is set to 0,0,0 not always it corresponds to Revit's origin 31 | 32 | XYZ origin = new XYZ(0, 0, 0); 33 | #if Version2019 || Version2020 || Version2021 || Version2022 34 | ProjectPosition position = doc.ActiveProjectLocation.GetProjectPosition(origin); 35 | #else 36 | ProjectPosition position = doc.ActiveProjectLocation.get_ProjectPosition(origin); 37 | #endif 38 | 39 | int i = (negative) ? -1 : 1; 40 | 41 | x = i * position.EastWest; 42 | y = i * position.NorthSouth; 43 | z = i * position.Elevation; 44 | angle = i * position.Angle; 45 | 46 | if (negative) // I do the addition BEFORE 47 | c = new XYZ(c.X + x, c.Y + y, c.Z + z); 48 | 49 | //rotation 50 | double centX = (c.X * Math.Cos(angle)) - (c.Y * Math.Sin(angle)); 51 | double centY = (c.X * Math.Sin(angle)) + (c.Y * Math.Cos(angle)); 52 | 53 | XYZ newC = new XYZ(); 54 | if (negative) 55 | newC = new XYZ(centX, centY, c.Z); 56 | else // I do the addition AFTERWARDS 57 | newC = new XYZ(centX + x, centY + y, c.Z + z); 58 | 59 | 60 | double viewX = (view.X * Math.Cos(angle)) - (view.Y * Math.Sin(angle)); 61 | double viewY = (view.X * Math.Sin(angle)) + (view.Y * Math.Cos(angle)); 62 | XYZ newView = new XYZ(viewX, viewY, view.Z); 63 | 64 | double upX = (up.X * Math.Cos(angle)) - (up.Y * Math.Sin(angle)); 65 | double upY = (up.X * Math.Sin(angle)) + (up.Y * Math.Cos(angle)); 66 | 67 | XYZ newUp = new XYZ(upX, upY, up.Z); 68 | return new ViewOrientation3D(newC, newUp, newView); 69 | } 70 | 71 | public static XYZ GetRevitXYZ(double X, double Y, double Z) 72 | { 73 | return new XYZ(X.ToFeet(), Y.ToFeet(), Z.ToFeet()); 74 | } 75 | 76 | public static XYZ GetRevitXYZ(Direction d) 77 | { 78 | return new XYZ(d.X.ToFeet(), d.Y.ToFeet(), d.Z.ToFeet()); 79 | } 80 | 81 | public static XYZ GetRevitXYZ(Point d) 82 | { 83 | return new XYZ(d.X.ToFeet(), d.Y.ToFeet(), d.Z.ToFeet()); 84 | } 85 | 86 | /// 87 | /// Converts feet units to meters 88 | /// 89 | /// Value in feet to be converted to meters 90 | /// 91 | public static double ToMeters(this double feet) 92 | { 93 | #if Version2021 || Version2022 94 | return UnitUtils.ConvertFromInternalUnits(feet, UnitTypeId.Meters); 95 | #else 96 | return UnitUtils.ConvertFromInternalUnits(feet, DisplayUnitType.DUT_METERS); 97 | #endif 98 | } 99 | /// 100 | /// Converts meters units to feet 101 | /// 102 | /// Value in feet to be converted to feet 103 | /// 104 | public static double ToFeet(this double meters) 105 | { 106 | #if Version2021 || Version2022 107 | return UnitUtils.ConvertToInternalUnits(meters, UnitTypeId.Meters); 108 | #else 109 | return UnitUtils.ConvertToInternalUnits(meters, DisplayUnitType.DUT_METERS); 110 | #endif 111 | 112 | } 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /Bcfier.Revit/Entry/AppMain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Reflection; 4 | using System.Windows; 5 | using System.Windows.Media; 6 | using System.Windows.Media.Imaging; 7 | using Autodesk.Revit.Attributes; 8 | using Autodesk.Revit.UI; 9 | 10 | namespace Bcfier.Revit.Entry 11 | { 12 | 13 | [Transaction(TransactionMode.Manual)] 14 | public class AppMain : IExternalApplication 15 | { 16 | private string _path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 17 | 18 | #region Revit IExternalApplciation Implementation 19 | 20 | /// 21 | /// Startup 22 | /// 23 | /// 24 | /// 25 | public Result OnStartup(UIControlledApplication application) 26 | { 27 | try 28 | { 29 | // Tab 30 | RibbonPanel panel = application.CreateRibbonPanel("BCFier"); 31 | 32 | // Button Data 33 | PushButton pushButton = panel.AddItem(new PushButtonData("BCFier", 34 | "BCFier " + Assembly.GetExecutingAssembly().GetName().Version, 35 | Path.Combine(_path, "Bcfier.Revit.dll"), 36 | "Bcfier.Revit.Entry.CmdMain")) as PushButton; 37 | 38 | // Images and Tooltip 39 | if (pushButton != null) 40 | { 41 | pushButton.Image = LoadPngImgSource("Bcfier.Assets.BCFierIcon16x16.png", Path.Combine(_path, "Bcfier.dll")); 42 | pushButton.LargeImage = LoadPngImgSource("Bcfier.Assets.BCFierIcon32x32.png", Path.Combine(_path, "Bcfier.dll")); 43 | pushButton.ToolTip = "BCFier"; 44 | } 45 | } 46 | catch (Exception ex1) 47 | { 48 | MessageBox.Show("exception: " + ex1); 49 | return Result.Failed; 50 | } 51 | 52 | return Result.Succeeded; 53 | } 54 | 55 | /// 56 | /// Shut Down 57 | /// 58 | /// 59 | /// 60 | public Result OnShutdown(UIControlledApplication application) 61 | { 62 | return Result.Succeeded; 63 | } 64 | 65 | #endregion 66 | 67 | #region Private Members 68 | 69 | /// 70 | /// Get System Architecture 71 | /// 72 | /// 73 | static string ProgramFilesx86() 74 | { 75 | if (8 == IntPtr.Size || (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")))) 76 | return Environment.GetEnvironmentVariable("ProgramFiles(x86)"); 77 | 78 | return Environment.GetEnvironmentVariable("ProgramFiles"); 79 | } 80 | 81 | 82 | /// 83 | /// Load an Image Source from File 84 | /// 85 | /// 86 | /// 87 | /// 88 | private ImageSource LoadPngImgSource(string sourceName, string path) 89 | { 90 | 91 | try 92 | { 93 | // Assembly & Stream 94 | var assembly = Assembly.LoadFrom(Path.Combine(path)); 95 | var icon = assembly.GetManifestResourceStream(sourceName); 96 | 97 | // Decoder 98 | PngBitmapDecoder m_decoder = new PngBitmapDecoder(icon, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default); 99 | 100 | // Source 101 | ImageSource m_source = m_decoder.Frames[0]; 102 | return (m_source); 103 | 104 | } 105 | catch { } 106 | 107 | // Fail 108 | return null; 109 | 110 | } 111 | 112 | #endregion 113 | 114 | } 115 | } -------------------------------------------------------------------------------- /Bcfier.Revit/Entry/CmdMain.cs: -------------------------------------------------------------------------------- 1 | using Autodesk.Revit.Attributes; 2 | using Autodesk.Revit.DB; 3 | using Autodesk.Revit.UI; 4 | using System; 5 | using System.Reflection; 6 | 7 | namespace Bcfier.Revit.Entry 8 | { 9 | 10 | /// 11 | /// Obfuscation Ignore for External Interface 12 | /// 13 | [Obfuscation(Exclude = true, ApplyToMembers = false)] 14 | [Transaction(TransactionMode.Manual)] 15 | [Regeneration(RegenerationOption.Manual)] 16 | public class CmdMain : IExternalCommand 17 | { 18 | 19 | #if Version2022 20 | public const string RevitVersion = "2022"; 21 | #elif Version2021 22 | public const string RevitVersion = "2021"; 23 | #elif Version2020 24 | public const string RevitVersion = "2020"; 25 | #elif Version2019 26 | 27 | public const string RevitVersion = "2019"; 28 | 29 | #elif Version2018 30 | 31 | public const string RevitVersion = "2018"; 32 | 33 | #elif Version2017 34 | 35 | public const string RevitVersion = "2017"; 36 | 37 | #elif Version2016 38 | 39 | public const string RevitVersion = "2016"; 40 | 41 | #elif Version2015 42 | 43 | public const string RevitVersion = "2015"; 44 | 45 | 46 | #endif 47 | 48 | 49 | 50 | internal static CmdMain ThisCmd = null; 51 | private static bool _isRunning; 52 | private static ExtAppBcfier _extAppBcfier; 53 | 54 | /// 55 | /// Main Command Entry Point 56 | /// 57 | /// 58 | /// 59 | /// 60 | /// 61 | public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) 62 | { 63 | try 64 | { 65 | 66 | //Version check 67 | 68 | if (!commandData.Application.Application.VersionName.Contains(RevitVersion)) 69 | { 70 | using (var td = new TaskDialog("Untested version")) 71 | { 72 | td.TitleAutoPrefix = false; 73 | td.MainInstruction = "Untested Revit Version"; 74 | td.MainContent = "This Add-In was built and tested only for Revit " + RevitVersion + ", proceed at your own risk"; 75 | td.Show(); 76 | } 77 | } 78 | 79 | // Form Running? 80 | if (_isRunning && _extAppBcfier != null && _extAppBcfier.RvtWindow.IsLoaded) 81 | { 82 | _extAppBcfier.Focus(); 83 | return Result.Succeeded; 84 | } 85 | 86 | _isRunning = true; 87 | 88 | ThisCmd = this; 89 | _extAppBcfier = new ExtAppBcfier(); 90 | _extAppBcfier.ShowForm(commandData.Application); 91 | return Result.Succeeded; 92 | 93 | } 94 | catch (Exception e) 95 | { 96 | message = e.Message; 97 | return Result.Failed; 98 | } 99 | 100 | } 101 | 102 | } 103 | } -------------------------------------------------------------------------------- /Bcfier.Revit/Entry/ExtAppBcfier.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Autodesk.Revit.Attributes; 3 | using Autodesk.Revit.UI; 4 | using System; 5 | using System.Windows; 6 | 7 | namespace Bcfier.Revit.Entry 8 | { 9 | 10 | /// 11 | /// Obfuscation Ignore for External Interface 12 | /// 13 | [Obfuscation(Exclude = true, ApplyToMembers = false)] 14 | [Transaction(TransactionMode.Manual)] 15 | public class ExtAppBcfier : IExternalApplication 16 | { 17 | 18 | // class instance 19 | public static ExtAppBcfier This = null; 20 | // ModelessForm instance 21 | public RevitWindow RvtWindow; 22 | 23 | #region Revit IExternalApplication Implementation 24 | 25 | /// 26 | /// Startup 27 | /// 28 | /// 29 | /// 30 | public Result OnStartup(UIControlledApplication application) 31 | { 32 | RvtWindow = null; // no dialog needed yet; the command will bring it 33 | This = this; // static access to this application instance 34 | 35 | return Result.Succeeded; 36 | } 37 | 38 | /// 39 | /// Shut Down 40 | /// 41 | /// 42 | /// 43 | public Result OnShutdown(UIControlledApplication application) 44 | { 45 | if (RvtWindow != null && RvtWindow.IsVisible) 46 | { 47 | RvtWindow.Close(); 48 | } 49 | 50 | return Result.Succeeded; 51 | } 52 | 53 | #endregion 54 | 55 | #region public methods 56 | /// 57 | /// The external command invokes this on the end-user's request 58 | /// 59 | /// 60 | public void ShowForm(UIApplication uiapp) 61 | { 62 | try 63 | { 64 | // If we do not have a dialog yet, create and show it 65 | if (RvtWindow != null) return; 66 | 67 | // A new handler to handle request posting by the dialog 68 | var handler = new ExtEvntOpenView(); 69 | 70 | // External Event for the dialog to use (to post requests) 71 | var extEvent = ExternalEvent.Create(handler); 72 | 73 | // We give the objects to the new dialog; 74 | // The dialog becomes the owner responsible for disposing them, eventually. 75 | RvtWindow = new RevitWindow(uiapp, extEvent, handler); 76 | RvtWindow.Show(); 77 | } 78 | catch (Exception ex) 79 | { 80 | MessageBox.Show(ex.ToString()); 81 | } 82 | } 83 | 84 | /// 85 | /// Set Focus 86 | /// 87 | public void Focus() 88 | { 89 | try 90 | { 91 | if (RvtWindow == null) return; 92 | RvtWindow.Activate(); 93 | RvtWindow.WindowState = WindowState.Normal; 94 | } 95 | catch (Exception ex) 96 | { 97 | MessageBox.Show(ex.ToString()); 98 | } 99 | 100 | } 101 | #endregion 102 | } 103 | 104 | } -------------------------------------------------------------------------------- /Bcfier.Revit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Bcfier.Revit")] 9 | [assembly: AssemblyDescription("Bcfier.Revit")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("teocomi")] 12 | [assembly: AssemblyProduct("Bcfier.Revit")] 13 | [assembly: AssemblyCopyright("Copyright © teocomi 2017")] 14 | [assembly: AssemblyTrademark("teocomi")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | //In order to begin building localizable applications, set 23 | //CultureYouAreCodingWith in your .csproj file 24 | //inside a . For example, if you are using US english 25 | //in your source files, set the to en-US. Then uncomment 26 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 27 | //the line below to match the UICulture setting in the project file. 28 | 29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 30 | 31 | 32 | [assembly: ThemeInfo( 33 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 34 | //(used if a resource is not found in the page, 35 | // or application resource dictionaries) 36 | ResourceDictionaryLocation.ExternalAssembly //where the generic resource dictionary is located 37 | //(used if a resource is not found in the page, 38 | // app, or any theme specific resource dictionaries) 39 | )] 40 | 41 | [assembly: GuidAttribute("59068325-ACDC-4DB3-892A-1C90C9434BF8")] 42 | -------------------------------------------------------------------------------- /Bcfier.Revit/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bcfier.Revit.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bcfier.Revit.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Bcfier.Revit/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Bcfier.Revit/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bcfier.Revit.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Bcfier.Revit/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Bcfier.Revit/RevitWindow.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 18 | 19 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Bcfier.Revit/RevitWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows; 5 | using System.Windows.Input; 6 | 7 | using Autodesk.Revit.DB; 8 | using Autodesk.Revit.UI; 9 | using Bcfier.Bcf.Bcf2; 10 | using Bcfier.Revit.Data; 11 | using Bcfier.Revit.Entry; 12 | using System.ComponentModel; 13 | using System.Threading.Tasks; 14 | using Component = Bcfier.Bcf.Bcf2.Component; 15 | using Point = Bcfier.Bcf.Bcf2.Point; 16 | using Bcfier.Data.Utils; 17 | 18 | namespace Bcfier.Revit 19 | { 20 | /// 21 | /// Interaction logic for MainWindow.xaml 22 | /// 23 | public partial class RevitWindow : Window 24 | { 25 | private ExternalEvent ExtEvent; 26 | private ExtEvntOpenView Handler; 27 | private UIApplication uiapp; 28 | 29 | /// 30 | /// Constructor 31 | /// 32 | /// 33 | /// 34 | /// 35 | public RevitWindow(UIApplication _uiapp, ExternalEvent exEvent, ExtEvntOpenView handler) 36 | { 37 | InitializeComponent(); 38 | 39 | try 40 | { 41 | ExtEvent = exEvent; 42 | Handler = handler; 43 | uiapp = _uiapp; 44 | } 45 | catch (Exception ex1) 46 | { 47 | TaskDialog.Show("Error!", "exception: " + ex1); 48 | } 49 | } 50 | 51 | #region commands 52 | /// 53 | /// Raises the External Event to accomplish a transaction in a modeless window 54 | /// http://help.autodesk.com/view/RVT/2014/ENU/?guid=GUID-0A0D656E-5C44-49E8-A891-6C29F88E35C0 55 | /// http://matteocominetti.com/starting-a-transaction-from-an-external-application-running-outside-of-api-context-is-not-allowed/ 56 | /// 57 | /// 58 | /// 59 | private void OnOpenView(object sender, ExecutedRoutedEventArgs e) 60 | { 61 | try 62 | { 63 | if (Bcfier.SelectedBcf() == null) 64 | return; 65 | var view = e.Parameter as ViewPoint; 66 | if (view == null) 67 | return; 68 | UIDocument uidoc = uiapp.ActiveUIDocument; 69 | 70 | if (uidoc.ActiveView.ViewType == ViewType.Schedule) 71 | { 72 | MessageBox.Show("BCFier can't take snapshots of schedules.", 73 | "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); 74 | return; 75 | } 76 | 77 | if (uidoc.ActiveView.ViewType == ViewType.ThreeD) 78 | { 79 | var view3D = (View3D)uidoc.ActiveView; 80 | if (view3D.IsPerspective) 81 | { 82 | MessageBox.Show("This operation is not allowed in a Perspective View.\nPlease close the current window(s) and retry.", 83 | "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); 84 | return; 85 | } 86 | 87 | } 88 | Handler.v = view.VisInfo; 89 | ExtEvent.Raise(); 90 | } 91 | catch (System.Exception ex1) 92 | { 93 | TaskDialog.Show("Error opening a View!", "exception: " + ex1); 94 | } 95 | } 96 | /// 97 | /// Same as in the windows app, but here we generate a VisInfo that is attached to the view 98 | /// 99 | /// 100 | /// 101 | private void OnAddView(object sender, ExecutedRoutedEventArgs e) 102 | { 103 | try 104 | { 105 | 106 | if (Bcfier.SelectedBcf() == null) 107 | return; 108 | var issue = e.Parameter as Markup; 109 | if (issue == null) 110 | { 111 | MessageBox.Show("No Issue selected", "Error", MessageBoxButton.OK, MessageBoxImage.Error); 112 | return; 113 | } 114 | 115 | var dialog = new AddViewRevit(issue, Bcfier.SelectedBcf().TempPath, uiapp.ActiveUIDocument.Document); 116 | dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen; 117 | dialog.ShowDialog(); 118 | if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) 119 | { 120 | //generate and set the VisInfo 121 | issue.Viewpoints.Last().VisInfo = RevitView.GenerateViewpoint(uiapp.ActiveUIDocument); 122 | 123 | //get filename 124 | UIDocument uidoc = uiapp.ActiveUIDocument; 125 | 126 | if (uidoc.Document.Title != null) 127 | issue.Header[0].Filename = uidoc.Document.Title; 128 | else 129 | issue.Header[0].Filename = "Unknown"; 130 | 131 | Bcfier.SelectedBcf().HasBeenSaved = false; 132 | } 133 | 134 | } 135 | catch (System.Exception ex1) 136 | { 137 | TaskDialog.Show("Error adding a View!", "exception: " + ex1); 138 | } 139 | } 140 | #endregion 141 | 142 | #region private methods 143 | 144 | /// 145 | /// passing event to the user control 146 | /// 147 | /// 148 | /// 149 | private void Window_Closing(object sender, CancelEventArgs e) 150 | { 151 | e.Cancel = Bcfier.onClosing(e); 152 | } 153 | #endregion 154 | 155 | //stats 156 | private void RevitWindow_OnLoaded(object sender, RoutedEventArgs e) 157 | { 158 | Task.Run(() => 159 | { 160 | StatHat.Post.EzCounter(@"hello@teocomi.com", "BCFierRevitStart", 1); 161 | }); 162 | } 163 | 164 | } 165 | } -------------------------------------------------------------------------------- /Bcfier.Revit/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Bcfier.Win/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Bcfier.Win/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Bcfier.Win/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Bcfier.Win 4 | { 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Bcfier.Win/Assets/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Bcfier.Win/Assets/icon.ico -------------------------------------------------------------------------------- /Bcfier.Win/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 18 | 19 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Bcfier.Win/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Windows; 4 | using System.ComponentModel; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | using System.Windows.Threading; 8 | using Bcfier.Bcf.Bcf2; 9 | using Bcfier.UserControls; 10 | 11 | 12 | namespace Bcfier.Win 13 | { 14 | 15 | /// 16 | /// Interaction logic for MainWindow.xaml 17 | /// 18 | public partial class MainWindow : Window 19 | { 20 | public MainWindow() 21 | { 22 | InitializeComponent(); 23 | 24 | string[] args = Environment.GetCommandLineArgs(); 25 | if (args.Length > 1 && File.Exists(args[1])) 26 | { 27 | Bcfier.Dispatcher.BeginInvoke(DispatcherPriority.Background, 28 | new Action(() => Bcfier.BcfFileClicked(args[1]))); 29 | } 30 | } 31 | 32 | /// 33 | /// passing event to the user control 34 | /// 35 | /// 36 | /// 37 | private void Window_Closing(object sender, CancelEventArgs e) 38 | { 39 | e.Cancel = Bcfier.onClosing(e); 40 | } 41 | 42 | #region commands 43 | 44 | 45 | private void OnAddView(object sender, ExecutedRoutedEventArgs e) 46 | { 47 | try 48 | { 49 | 50 | if (Bcfier.SelectedBcf() == null) 51 | return; 52 | var issue = e.Parameter as Markup; 53 | if (issue == null) 54 | { 55 | MessageBox.Show("No Issue selected", "Error", MessageBoxButton.OK, MessageBoxImage.Error); 56 | return; 57 | } 58 | 59 | var addView = new AddView(issue, Bcfier.SelectedBcf().TempPath); 60 | var win = new Window 61 | { 62 | Content = addView, 63 | Title = "Add View", 64 | SizeToContent = SizeToContent.WidthAndHeight, 65 | WindowStartupLocation = WindowStartupLocation.CenterScreen 66 | }; 67 | win.ShowDialog(); 68 | if (win.DialogResult.HasValue && win.DialogResult.Value) 69 | Bcfier.SelectedBcf().HasBeenSaved = false; 70 | 71 | } 72 | catch (System.Exception ex1) 73 | { 74 | MessageBox.Show("exception: " + ex1); 75 | } 76 | } 77 | #endregion 78 | 79 | private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) 80 | { 81 | Task.Run(() => 82 | { 83 | StatHat.Post.EzCounter(@"hello@teocomi.com", "BCFierWinStart", 1); 84 | }); 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /Bcfier.Win/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Bcfier.Win")] 9 | [assembly: AssemblyDescription("Bcfier.Win")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("teocomi")] 12 | [assembly: AssemblyProduct("Bcfier.Win")] 13 | [assembly: AssemblyCopyright("Copyright © teocomi 2017")] 14 | [assembly: AssemblyTrademark("teocomi")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | //In order to begin building localizable applications, set 23 | //CultureYouAreCodingWith in your .csproj file 24 | //inside a . For example, if you are using US english 25 | //in your source files, set the to en-US. Then uncomment 26 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 27 | //the line below to match the UICulture setting in the project file. 28 | 29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 30 | 31 | 32 | [assembly: ThemeInfo( 33 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 34 | //(used if a resource is not found in the page, 35 | // or application resource dictionaries) 36 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 37 | //(used if a resource is not found in the page, 38 | // app, or any theme specific resource dictionaries) 39 | )] 40 | 41 | [assembly: GuidAttribute("9FC6BA85-A348-40B4-97C4-6699DA912C21")] 42 | -------------------------------------------------------------------------------- /Bcfier.Win/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34209 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bcfier.Win.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bcfier.Win.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Bcfier.Win/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Bcfier.Win/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34209 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bcfier.Win.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Bcfier.Win/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Bcfier.Win/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/AddViewXbim.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/AddViewXbim.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Windows; 4 | using System.Windows.Media; 5 | using System.Windows.Media.Imaging; 6 | using Bcfier.Bcf.Bcf2; 7 | using log4net; 8 | using Xbim.Presentation; 9 | 10 | namespace Bcfier.XbimXplorer 11 | { 12 | /// 13 | /// Interaction logic for AddViewRevit.xaml 14 | /// 15 | public partial class AddViewXbim 16 | { 17 | private static readonly ILog Log = LogManager.GetLogger(nameof(AddViewXbim)); 18 | private readonly DrawingControl3D _control; 19 | 20 | public AddViewXbim(Markup issue, string bcfTempFolder, DrawingControl3D control) 21 | { 22 | try 23 | { 24 | InitializeComponent(); 25 | AddViewControl.Issue = issue; 26 | AddViewControl.TempFolder = bcfTempFolder; 27 | _control = control; 28 | 29 | AddViewControl.TextBlockInfo.Text = 30 | "3D/2D information of the current view will be included in the viewpoint"; 31 | 32 | GetRevitSnapshot(); 33 | } 34 | catch (Exception ex) 35 | { 36 | MessageBox.Show("Error!", "exception: " + ex); 37 | } 38 | } 39 | 40 | private static RenderTargetBitmap Get3DVisual(FrameworkElement element) 41 | { 42 | var width = element.ActualWidth; 43 | 44 | var height = element.ActualHeight; 45 | var bmpCopied = new RenderTargetBitmap((int) Math.Round(width), (int) Math.Round(height), 96, 96, 46 | PixelFormats.Default); 47 | var dv = new DrawingVisual(); 48 | using (var dc = dv.RenderOpen()) 49 | { 50 | var vb = new VisualBrush(element); 51 | dc.DrawRectangle(vb, null, new Rect(new System.Windows.Point(), new Size(width, height))); 52 | } 53 | bmpCopied.Render(dv); 54 | return bmpCopied; 55 | } 56 | 57 | private bool SaveControlPng(FrameworkElement control, string outFile) 58 | { 59 | try 60 | { 61 | var renderTargetBitmap = Get3DVisual(control); 62 | 63 | var bitmapEncoder = new PngBitmapEncoder(); 64 | bitmapEncoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); 65 | 66 | using (var stream = File.Create(outFile)) 67 | { 68 | bitmapEncoder.Save(stream); 69 | stream.Seek(0, SeekOrigin.Begin); 70 | } 71 | } 72 | catch (Exception ex) 73 | { 74 | Log.Error("Counld not create screenshot from model.", ex); 75 | return false; 76 | } 77 | return true; 78 | } 79 | 80 | private void GetRevitSnapshot() 81 | { 82 | try 83 | { 84 | var tempImg = Path.Combine(Path.GetTempPath(), "BCFier", Path.GetTempFileName() + ".png"); 85 | 86 | var success = SaveControlPng(_control, tempImg); 87 | if (!success) 88 | { 89 | return; 90 | } 91 | AddViewControl.AddViewpoint(tempImg); 92 | File.Delete(tempImg); 93 | } 94 | catch (Exception ex) 95 | { 96 | MessageBox.Show("Error!", "exception: " + ex); 97 | } 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Bcfier.XbimXplorer 2 | { 3 | /// 4 | /// Interaction logic for App.xaml 5 | /// 6 | public partial class App 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/Assets/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Bcfier.XbimXplorer/Assets/icon.ico -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/Bcfier.XbimXplorer.plugin.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | Bcfier.XbimXplorer 9 | 4.0.1-V0001 10 | Bcfier.XbimXplorer 11 | Claudio Benghi, Matteo Cominetti 12 | Claudio Benghi, Matteo Cominetti 13 | https://raw.githubusercontent.com/CBenghi/BCFier/blob/master/LICENSE 14 | http://bcfier.com/ 15 | https://raw.githubusercontent.com/teocomi/BCFier/master/Bcfier/Assets/BCFierIcon64x64.png 16 | true 17 | Integration of Matteo Cominetti's BCFier editor of BuildingSmart's BCF. 18 | . 19 | en-GB 20 | 21 | BCF, Building Collaboration Format, BuildingSmart, XplorerPlugin 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/MakeNugetInstaller.bat: -------------------------------------------------------------------------------- 1 | md "bin\Packages" 2 | "C:\Program Files (x86)\NuGet\nuget.exe" pack "Bcfier.XbimXplorer.plugin.nuspec" -o bin\Packages 3 | @pause 4 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Bcfier.XbimXplorer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Bcfier.XbimXplorer")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | //In order to begin building localizable applications, set 23 | //CultureYouAreCodingWith in your .csproj file 24 | //inside a . For example, if you are using US english 25 | //in your source files, set the to en-US. Then uncomment 26 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 27 | //the line below to match the UICulture setting in the project file. 28 | 29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 30 | 31 | 32 | [assembly: ThemeInfo( 33 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 34 | //(used if a resource is not found in the page, 35 | // or application resource dictionaries) 36 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 37 | //(used if a resource is not found in the page, 38 | // app, or any theme specific resource dictionaries) 39 | )] 40 | 41 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bcfier.XbimXplorer.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bcfier.XbimXplorer.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bcfier.XbimXplorer.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Bcfier.XbimXplorer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Bcfier/Api/GitHubAsset.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Bcfier.Api 8 | { 9 | public class GitHubAsset 10 | { 11 | public string url { get; set; } 12 | public int id { get; set; } 13 | public string name { get; set; } 14 | public object label { get; set; } 15 | public GitHubAuthor uploader { get; set; } 16 | public string content_type { get; set; } 17 | public string state { get; set; } 18 | public int size { get; set; } 19 | public int download_count { get; set; } 20 | public string created_at { get; set; } 21 | public string updated_at { get; set; } 22 | public string browser_download_url { get; set; } 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /Bcfier/Api/GitHubAuthor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Bcfier.Api 8 | { 9 | public class GitHubAuthor 10 | { 11 | public string login { get; set; } 12 | public int id { get; set; } 13 | public string avatar_url { get; set; } 14 | public string gravatar_id { get; set; } 15 | public string url { get; set; } 16 | public string html_url { get; set; } 17 | public string followers_url { get; set; } 18 | public string following_url { get; set; } 19 | public string gists_url { get; set; } 20 | public string starred_url { get; set; } 21 | public string subscriptions_url { get; set; } 22 | public string organizations_url { get; set; } 23 | public string repos_url { get; set; } 24 | public string events_url { get; set; } 25 | public string received_events_url { get; set; } 26 | public string type { get; set; } 27 | public bool site_admin { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Bcfier/Api/GitHubRelease.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Bcfier.Api 8 | { 9 | public class GitHubRelease 10 | { 11 | public string url { get; set; } 12 | public string assets_url { get; set; } 13 | public string upload_url { get; set; } 14 | public string html_url { get; set; } 15 | public int id { get; set; } 16 | public string tag_name { get; set; } 17 | public string target_commitish { get; set; } 18 | public string name { get; set; } 19 | public bool draft { get; set; } 20 | public GitHubAuthor author { get; set; } 21 | public bool prerelease { get; set; } 22 | public DateTime created_at { get; set; } 23 | public DateTime published_at { get; set; } 24 | public List assets { get; set; } 25 | public string tarball_url { get; set; } 26 | public string zipball_url { get; set; } 27 | public string body { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /Bcfier/Api/GitHubRest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Text; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using RestSharp; 10 | using DataFormat = RestSharp.DataFormat; 11 | 12 | namespace Bcfier.Api 13 | { 14 | public static class GitHubRest 15 | { 16 | internal static RestClient Client 17 | { 18 | get { return new RestClient(@"https://api.github.com/"); } 19 | } 20 | 21 | internal static async Task> GetReleases(CancellationTokenSource cancel) 22 | { 23 | if (cancel.IsCancellationRequested) 24 | return null; 25 | 26 | 27 | var request = new RestRequest("repos/teocomi/bcfier/releases", Method.GET); 28 | request.AddHeader("Content-Type", "application/json"); 29 | request.RequestFormat = DataFormat.Json; 30 | request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; }; 31 | 32 | var response = await DoTaskAsync>(request, cancel); 33 | 34 | return cancel.IsCancellationRequested || !CheckResponse(response, HttpStatusCode.OK) ? null : response.Data; 35 | } 36 | 37 | internal static GitHubRelease GetLatestRelease() 38 | { 39 | 40 | var request = new RestRequest("repos/teocomi/bcfier/releases/latest", Method.GET); 41 | request.AddHeader("Content-Type", "application/json"); 42 | request.RequestFormat = DataFormat.Json; 43 | 44 | var response = Client.Execute (request); 45 | //if cancellation oending or invalid reponse return null, otherwise the data 46 | return !CheckResponse(response, HttpStatusCode.OK) ? null : response.Data; 47 | } 48 | 49 | private static async Task> DoTaskAsync(RestRequest request, CancellationTokenSource cancel) where T : class 50 | { 51 | IRestResponse response = null; 52 | try 53 | { 54 | if (cancel != null) 55 | response = await Client.ExecuteTaskAsync(request, cancel.Token); 56 | } 57 | catch (OperationCanceledException ex) 58 | { 59 | var gg = ex.Data; 60 | return null; 61 | } 62 | return response; 63 | } 64 | 65 | private static bool CheckResponse(IRestResponse response, HttpStatusCode expectedCode) 66 | { 67 | try 68 | { 69 | if (null == response || response.StatusCode != expectedCode) 70 | return false; 71 | } 72 | catch (Exception ex1) 73 | { 74 | MessageBox.Show("exception: " + ex1); 75 | } 76 | return true; 77 | } 78 | 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Bcfier/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Bcfier/Assets/BCFierIcon16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Bcfier/Assets/BCFierIcon16x16.png -------------------------------------------------------------------------------- /Bcfier/Assets/BCFierIcon32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Bcfier/Assets/BCFierIcon32x32.png -------------------------------------------------------------------------------- /Bcfier/Assets/BCFierIcon64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Bcfier/Assets/BCFierIcon64x64.png -------------------------------------------------------------------------------- /Bcfier/Assets/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/teocomi/BCFier/09efae233dbd0419f9b2c3d29cc55e23b129cfb3/Bcfier/Assets/icon.ico -------------------------------------------------------------------------------- /Bcfier/Bcf/Bcf2/Project.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace Bcfier.Bcf.Bcf2 4 | { 5 | 6 | /// 7 | [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1586.0")] 8 | [System.SerializableAttribute()] 9 | [System.Diagnostics.DebuggerStepThroughAttribute()] 10 | [System.ComponentModel.DesignerCategoryAttribute("code")] 11 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] 12 | [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)] 13 | public partial class ProjectExtension 14 | { 15 | 16 | private Project projectField; 17 | 18 | private string extensionSchemaField; 19 | 20 | /// 21 | [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] 22 | public Project Project 23 | { 24 | get { return this.projectField; } 25 | set { this.projectField = value; } 26 | } 27 | 28 | /// 29 | [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, 30 | DataType = "anyURI")] 31 | public string ExtensionSchema 32 | { 33 | get { return this.extensionSchemaField; } 34 | set { this.extensionSchemaField = value; } 35 | } 36 | } 37 | 38 | /// 39 | [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1586.0")] 40 | [System.SerializableAttribute()] 41 | [System.Diagnostics.DebuggerStepThroughAttribute()] 42 | [System.ComponentModel.DesignerCategoryAttribute("code")] 43 | public partial class Project 44 | { 45 | 46 | private string nameField; 47 | 48 | private string projectIdField; 49 | 50 | /// 51 | [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] 52 | public string Name 53 | { 54 | get { return this.nameField; } 55 | set { this.nameField = value; } 56 | } 57 | 58 | /// 59 | [System.Xml.Serialization.XmlAttributeAttribute()] 60 | public string ProjectId 61 | { 62 | get { return this.projectIdField; } 63 | set { this.projectIdField = value; } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Bcfier/Bcf/Bcf2/Version.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace Bcfier.Bcf.Bcf2 4 | { 5 | 6 | /// 7 | [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1586.0")] 8 | [System.SerializableAttribute()] 9 | [System.Diagnostics.DebuggerStepThroughAttribute()] 10 | [System.ComponentModel.DesignerCategoryAttribute("code")] 11 | [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)] 12 | [System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)] 13 | public partial class Version 14 | { 15 | 16 | private string detailedVersionField; 17 | 18 | private string versionIdField; 19 | 20 | /// 21 | [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] 22 | public string DetailedVersion 23 | { 24 | get { return this.detailedVersionField; } 25 | set { this.detailedVersionField = value; } 26 | } 27 | 28 | /// 29 | [System.Xml.Serialization.XmlAttributeAttribute()] 30 | public string VersionId 31 | { 32 | get { return this.versionIdField; } 33 | set { this.versionIdField = value; } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Bcfier/Bcf/Bcf2/ViewComment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Bcfier.Bcf.Bcf2; 8 | 9 | namespace Bcfier.Bcf.Bcf2 10 | { 11 | /// 12 | /// View Model that binds to the BcfReportPanel grouping comments and viewpoints 13 | /// Not part of BCF 14 | /// 15 | public class ViewComment 16 | { 17 | public ViewPoint Viewpoint 18 | { 19 | get; set; 20 | } 21 | public ObservableCollection Comments { get; set; } 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Bcfier/Bcf/Bcf2/ViewPointExtended.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Bcfier.Bcf.Bcf2; 7 | 8 | namespace Bcfier.Bcf.Bcf2 9 | { 10 | //I store the deserialized VisualizationInfo here (inside the markup) so there is a 1 to 1 corrispondence 11 | //betweeen the Markup/Viewpoints tag and the actual viewpoints 12 | //and I don't need to add any new class 13 | //could be improved by creating a proper Model View / View Model class 14 | public partial class ViewPoint 15 | { 16 | private VisualizationInfo _visInfoField; 17 | 18 | [System.Xml.Serialization.XmlIgnoreAttribute()] 19 | public VisualizationInfo VisInfo 20 | { 21 | get 22 | { 23 | return this._visInfoField; 24 | } 25 | set 26 | { 27 | this._visInfoField = value; 28 | } 29 | } 30 | 31 | private string _snapshotPath; 32 | 33 | //used for an easier binding in the UI 34 | [System.Xml.Serialization.XmlIgnoreAttribute()] 35 | public string SnapshotPath 36 | { 37 | get 38 | { 39 | return this._snapshotPath; 40 | } 41 | set 42 | { 43 | this._snapshotPath = value; 44 | NotifyPropertyChanged("SnapshotPath"); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Bcfier/Data/AttachedProperties/CtrlEnterKeyDown.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Text.RegularExpressions; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Input; 10 | using System.Windows.Controls; 11 | using System.Windows.Documents; 12 | 13 | namespace Bcfier.Data.AttachedProperties 14 | { 15 | /// 16 | /// Binds Ctrl+Enter events to a command 17 | /// Edited from: http://stackoverflow.com/questions/4834227/invoke-command-when-enter-key-is-pressed-in-xaml 18 | /// 19 | public sealed class CtrlEnterKeyDown 20 | { 21 | #region Properties 22 | 23 | #region Command 24 | 25 | public static ICommand GetCommand(DependencyObject obj) 26 | { 27 | return (ICommand)obj.GetValue(CommandProperty); 28 | } 29 | 30 | public static void SetCommand(DependencyObject obj, ICommand value) 31 | { 32 | obj.SetValue(CommandProperty, value); 33 | } 34 | 35 | public static readonly DependencyProperty CommandProperty = 36 | DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(CtrlEnterKeyDown), 37 | new PropertyMetadata(null, OnCommandChanged)); 38 | 39 | #endregion Command 40 | 41 | #region CommandArgument 42 | 43 | public static object GetCommandArgument(DependencyObject obj) 44 | { 45 | return (object)obj.GetValue(CommandArgumentProperty); 46 | } 47 | 48 | public static void SetCommandArgument(DependencyObject obj, object value) 49 | { 50 | obj.SetValue(CommandArgumentProperty, value); 51 | } 52 | 53 | public static readonly DependencyProperty CommandArgumentProperty = 54 | DependencyProperty.RegisterAttached("CommandArgument", typeof(object), typeof(CtrlEnterKeyDown), 55 | new PropertyMetadata(null, OnCommandArgumentChanged)); 56 | 57 | #endregion CommandArgument 58 | 59 | #region HasCommandArgument 60 | 61 | 62 | private static bool GetHasCommandArgument(DependencyObject obj) 63 | { 64 | return (bool)obj.GetValue(HasCommandArgumentProperty); 65 | } 66 | 67 | private static void SetHasCommandArgument(DependencyObject obj, bool value) 68 | { 69 | obj.SetValue(HasCommandArgumentProperty, value); 70 | } 71 | 72 | private static readonly DependencyProperty HasCommandArgumentProperty = 73 | DependencyProperty.RegisterAttached("HasCommandArgument", typeof(bool), typeof(CtrlEnterKeyDown), 74 | new PropertyMetadata(false)); 75 | 76 | 77 | #endregion HasCommandArgument 78 | 79 | #endregion Propreties 80 | 81 | #region Event Handling 82 | 83 | private static void OnCommandArgumentChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) 84 | { 85 | SetHasCommandArgument(o, true); 86 | } 87 | 88 | private static void OnCommandChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) 89 | { 90 | FrameworkElement element = o as FrameworkElement; 91 | if (element != null) 92 | { 93 | if (e.NewValue == null) 94 | { 95 | element.KeyDown -= new KeyEventHandler(FrameworkElement_KeyDown); 96 | } 97 | else if (e.OldValue == null) 98 | { 99 | element.KeyDown += new KeyEventHandler(FrameworkElement_KeyDown); 100 | } 101 | } 102 | } 103 | 104 | private static void FrameworkElement_KeyDown(object sender, KeyEventArgs e) 105 | { 106 | 107 | if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.Enter) 108 | { 109 | DependencyObject o = sender as DependencyObject; 110 | ICommand command = GetCommand(sender as DependencyObject); 111 | 112 | FrameworkElement element = e.OriginalSource as FrameworkElement; 113 | if (element != null) 114 | { 115 | // If the command argument has been explicitly set (even to NULL) 116 | if (GetHasCommandArgument(o)) 117 | { 118 | object commandArgument = GetCommandArgument(o); 119 | 120 | // Execute the command 121 | if (command.CanExecute(commandArgument)) 122 | { 123 | command.Execute(commandArgument); 124 | } 125 | } 126 | else if (command.CanExecute(element.DataContext)) 127 | { 128 | command.Execute(element.DataContext); 129 | } 130 | } 131 | } 132 | } 133 | 134 | #endregion 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /Bcfier/Data/AttachedProperties/NavigationService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Text.RegularExpressions; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Controls; 10 | using System.Windows.Documents; 11 | 12 | namespace Bcfier.Data.AttachedProperties 13 | { 14 | //Copied from http://stackoverflow.com/questions/861409/wpf-making-hyperlinks-clickable 15 | /// 16 | /// Renders the text of the comments as clickable links if detects URLs or local PATHs 17 | /// 18 | public static class NavigationService 19 | { 20 | //URL 21 | // (?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~/|/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)? 22 | //PATH 23 | //((\\\\[a-zA-Z0-9-]+\\[a-zA-Z0-9`~!@#$%^&(){}'._-]+([ ]+[a-zA-Z0-9`~!@#$%^&(){}'._-]+)*)|([a-zA-Z]:))(\\[^ \\/:*?""<>|]+([ ]+[^ \\/:*?""<>|]+)*)*\\? 24 | private static readonly Regex RE_URL = new Regex(@"(?(?:(?:ht|f)tp(?:s?)\:\/\/|~/|/)(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?)|(?\[(((\\\\[a-zA-Z0-9-]+\\[a-zA-Z0-9`~!@#$%^&(){}'._-]+([ ]+[a-zA-Z0-9`~!@#$%^&(){}'._-]+)*)|([a-zA-Z]:))(\\[^ \\/:*?""<>|]+([ ]+[^ \\/:*?""<>|]+)*)*\\?)\])"); 25 | 26 | public static readonly DependencyProperty TextProperty = DependencyProperty.RegisterAttached( 27 | "Text", 28 | typeof(string), 29 | typeof(NavigationService), 30 | new PropertyMetadata(null, OnTextChanged) 31 | ); 32 | 33 | public static string GetText(DependencyObject d) 34 | { return d.GetValue(TextProperty) as string; } 35 | 36 | public static void SetText(DependencyObject d, string value) 37 | { d.SetValue(TextProperty, value); } 38 | 39 | private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 40 | { 41 | try { 42 | var text_block = d as TextBlock; 43 | if (text_block == null) 44 | return; 45 | 46 | text_block.Inlines.Clear(); 47 | 48 | var new_text = (string)e.NewValue; 49 | if (string.IsNullOrEmpty(new_text)) 50 | return; 51 | 52 | // Find all URLs using a regular expression 53 | int last_pos = 0; 54 | foreach (Match match in RE_URL.Matches(new_text)) 55 | { 56 | var matchString = match.Value.Replace("[","").Replace("]",""); 57 | Uri url = null; 58 | if (!Uri.TryCreate(matchString, UriKind.RelativeOrAbsolute, out url)) 59 | continue; 60 | // Copy raw string from the last position up to the match 61 | if (match.Index != last_pos) 62 | { 63 | var raw_text = new_text.Substring(last_pos, match.Index - last_pos); 64 | text_block.Inlines.Add(new Run(raw_text)); 65 | } 66 | 67 | // Create a hyperlink for the match 68 | var link = new Hyperlink(new Run(matchString)) 69 | { 70 | NavigateUri = url 71 | }; 72 | link.Click += OnUrlClick; 73 | 74 | text_block.Inlines.Add(link); 75 | 76 | // Update the last matched position 77 | last_pos = match.Index + match.Length; 78 | } 79 | 80 | // Finally, copy the remainder of the string 81 | if (last_pos < new_text.Length) 82 | text_block.Inlines.Add(new Run(new_text.Substring(last_pos))); 83 | } 84 | catch (System.Exception ex1) 85 | { 86 | MessageBox.Show("exception: " + ex1); 87 | } 88 | } 89 | 90 | private static void OnUrlClick(object sender, RoutedEventArgs e) 91 | { 92 | var link = (Hyperlink)sender; 93 | // Do something with link.NavigateUri like: 94 | try { 95 | Process.Start(link.NavigateUri.ToString()); 96 | } 97 | catch (System.Exception ex1) 98 | { 99 | Console.WriteLine(ex1.Message); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Bcfier/Data/Commands.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Controls; 7 | using System.Windows.Input; 8 | using Bcfier.UserControls; 9 | 10 | namespace Bcfier.Data 11 | { 12 | /// 13 | /// Commands used by the application 14 | /// 15 | public static class Commands 16 | { 17 | //issues 18 | public static readonly RoutedCommand AddIssue = new RoutedCommand("AddIssue", typeof(Button)); 19 | public static readonly RoutedCommand AddIssues = new RoutedCommand("AddIssues", typeof(Button)); 20 | public static readonly RoutedCommand DeleteIssues = new RoutedCommand("DeleteIssues", typeof(Button)); 21 | //comments 22 | public static readonly RoutedCommand AddComment = new RoutedCommand("AddComment", typeof(Button)); 23 | public static readonly RoutedCommand DeleteComments = new RoutedCommand("DeleteComments", typeof(Button)); 24 | //viewpoints 25 | public static readonly RoutedCommand AddView = new RoutedCommand("AddView", typeof(Button)); 26 | public static readonly RoutedCommand DeleteViews = new RoutedCommand("DeleteViews", typeof(Button)); 27 | public static readonly RoutedCommand OpenView = new RoutedCommand("OpenView", typeof(Button)); 28 | public static readonly RoutedCommand OpenSnapshot = new RoutedCommand("OpenSnapshot", typeof(Button)); 29 | public static readonly RoutedCommand OpenComponents = new RoutedCommand("OpenComponents", typeof(Button)); 30 | 31 | public static readonly RoutedCommand CloseBcf = new RoutedCommand("CloseBcf", typeof(Button)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Bcfier/Data/Globals.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Bcfier.Data 8 | { 9 | public static class Globals 10 | { 11 | public static List OpenStatuses = new List(); 12 | public static List OpenTypes = new List(); 13 | 14 | private static IEnumerable availStatuses = new List(); 15 | private static IEnumerable availTypes = new List(); 16 | 17 | //join with the list of statuses from other open BCFs 18 | public static IEnumerable AvailStatuses 19 | { 20 | get { return availStatuses.Union(OpenStatuses); } 21 | } 22 | 23 | public static void SetStatuses(string statusString) 24 | { 25 | availStatuses = new List(statusString.Split(new char[] { ',' }).Select(o => o.Trim())); 26 | } 27 | 28 | //join with the list of types from other open BCFs 29 | public static IEnumerable AvailTypes 30 | { 31 | get { return availTypes.Union(OpenTypes); } 32 | } 33 | 34 | public static void SetTypes(string statusTypes) 35 | { 36 | availTypes = new List(statusTypes.Split(new char[] { ',' }).Select(o => o.Trim())); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Bcfier/Data/Utils/RelativeDate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Bcfier.Data.Utils 8 | { 9 | /// 10 | /// Convert a DateTime or string to a relative date 11 | /// 12 | public static class RelativeDate 13 | { 14 | public static string ToRelative(string DateString) 15 | { 16 | DateTime theDate = Convert.ToDateTime(DateString); 17 | var thresholds = new Dictionary(); 18 | int minute = 60; 19 | int hour = 60 * minute; 20 | int day = 24 * hour; 21 | thresholds.Add(60, "{0} seconds ago"); 22 | thresholds.Add(minute * 2, "a minute ago"); 23 | thresholds.Add(45 * minute, "{0} minutes ago"); 24 | thresholds.Add(120 * minute, "an hour ago"); 25 | thresholds.Add(day, "{0} hours ago"); 26 | thresholds.Add(day * 2, "yesterday"); 27 | // thresholds.Add(day * 30, "{0} days ago"); 28 | thresholds.Add(day * 365, "{0} days ago"); 29 | thresholds.Add(long.MaxValue, "{0} years ago"); 30 | 31 | long since = (DateTime.Now.Ticks - theDate.Ticks) / 10000000; 32 | foreach (long threshold in thresholds.Keys) 33 | { 34 | if (since < threshold) 35 | { 36 | TimeSpan t = new TimeSpan((DateTime.Now.Ticks - theDate.Ticks)); 37 | return string.Format(thresholds[threshold], (t.Days > 365 ? t.Days / 365 : (t.Days > 0 ? t.Days : (t.Hours > 0 ? t.Hours : (t.Minutes > 0 ? t.Minutes : (t.Seconds > 0 ? t.Seconds : 0))))).ToString()); 38 | } 39 | } 40 | return ""; 41 | } 42 | public static string ToRelative(DateTime theDate) 43 | { 44 | 45 | var thresholds = new Dictionary(); 46 | int minute = 60; 47 | int hour = 60 * minute; 48 | int day = 24 * hour; 49 | thresholds.Add(60, "{0} seconds ago"); 50 | thresholds.Add(minute * 2, "a minute ago"); 51 | thresholds.Add(45 * minute, "{0} minutes ago"); 52 | thresholds.Add(120 * minute, "an hour ago"); 53 | thresholds.Add(day, "{0} hours ago"); 54 | thresholds.Add(day * 2, "yesterday"); 55 | // thresholds.Add(day * 30, "{0} days ago"); 56 | thresholds.Add(day * 365, "{0} days ago"); 57 | thresholds.Add(long.MaxValue, "{0} years ago"); 58 | 59 | long since = (DateTime.Now.Ticks - theDate.Ticks) / 10000000; 60 | foreach (long threshold in thresholds.Keys) 61 | { 62 | if (since < threshold) 63 | { 64 | TimeSpan t = new TimeSpan((DateTime.Now.Ticks - theDate.Ticks)); 65 | return string.Format(thresholds[threshold], (t.Days > 365 ? t.Days / 365 : (t.Days > 0 ? t.Days : (t.Hours > 0 ? t.Hours : (t.Minutes > 0 ? t.Minutes : (t.Seconds > 0 ? t.Seconds : 0))))).ToString()); 66 | } 67 | } 68 | return ""; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Bcfier/Data/Utils/Utils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Security.Principal; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | 10 | namespace Bcfier.Data.Utils 11 | { 12 | public static class Utils 13 | { 14 | public static bool IsFileLocked(string path) 15 | { 16 | if (!File.Exists(path)) 17 | return false; 18 | var file = new FileInfo(path); 19 | FileStream stream = null; 20 | try 21 | { 22 | stream = file.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None); 23 | } 24 | catch (IOException) 25 | { 26 | //the file is unavailable because it is: 27 | //still being written to 28 | //or being processed by another thread 29 | //or does not exist (has already been processed) 30 | return true; 31 | } 32 | finally 33 | { 34 | if (stream != null) 35 | stream.Close(); 36 | } 37 | 38 | //file is not locked 39 | return false; 40 | } 41 | /// 42 | /// If no Username is set in settings returns the Windows username 43 | /// 44 | /// 45 | public static string GetUsername() 46 | { 47 | string username = UserSettings.Get("BCFusername"); 48 | 49 | if (string.IsNullOrEmpty(username)) //EMPTY VALUE IN CONFIG 50 | { 51 | string s = WindowsIdentity.GetCurrent().Name; 52 | int stop = s.IndexOf("\\"); 53 | username = (stop > -1) ? s.Substring(stop + 1, s.Length - stop - 1) : "Unknown User"; 54 | } 55 | return username; 56 | } 57 | 58 | /// 59 | /// Recursively deletes safely a directory and its content 60 | /// 61 | /// 62 | public static void DeleteDirectory(string target_dir) 63 | { 64 | try 65 | { 66 | if (Directory.Exists(target_dir)) 67 | { 68 | string[] files = Directory.GetFiles(target_dir); 69 | string[] dirs = Directory.GetDirectories(target_dir); 70 | foreach (string file in files) 71 | { 72 | File.SetAttributes(file, FileAttributes.Normal); 73 | File.Delete(file); 74 | } 75 | 76 | foreach (string dir in dirs) 77 | { 78 | DeleteDirectory(dir); 79 | } 80 | Directory.Delete(target_dir, false); 81 | } 82 | } 83 | catch (System.Exception ex1) 84 | { 85 | MessageBox.Show("exception: " + ex1); 86 | } 87 | } 88 | 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /Bcfier/Data/ValueConverters/BoolStarConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Bcfier.Data.ValueConverters 6 | { 7 | /// 8 | /// If the value is false return a *. 9 | /// Used to append * to unsaved file names. 10 | /// 11 | [ValueConversion(typeof(Boolean), typeof(string))] 12 | public class BoolStarConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | return ((bool)value) ? "" : "*"; 17 | } 18 | 19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 20 | { 21 | 22 | throw new NotImplementedException(); 23 | } 24 | 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Bcfier/Data/ValueConverters/BoolVisibConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Data; 4 | using System.Globalization; 5 | 6 | namespace Bcfier.Data.ValueConverters 7 | { 8 | 9 | /// 10 | /// return visible if true. 11 | /// can set second parameter to be "opposite" to reverse the functionality 12 | /// 13 | [ValueConversion(typeof(String), typeof(Visibility))] 14 | public class BoolVisibConverter : IValueConverter 15 | { 16 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 17 | { 18 | if (value == null) 19 | value = false; 20 | bool c = (bool)value; 21 | 22 | if (parameter!=null&¶meter.ToString() == "opposite") 23 | c = !c; 24 | 25 | return (c) ? Visibility.Visible : Visibility.Collapsed; 26 | } 27 | 28 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 29 | { 30 | 31 | throw new NotImplementedException(); 32 | } 33 | 34 | 35 | } 36 | } -------------------------------------------------------------------------------- /Bcfier/Data/ValueConverters/DateConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using Bcfier.Data.Utils; 5 | 6 | 7 | namespace Bcfier.Data.ValueConverters 8 | { 9 | /// 10 | /// Converts a date to relative 11 | /// 12 | [ValueConversion(typeof(DateTime), typeof(String))] 13 | public class DateConverter : IValueConverter 14 | { 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | if (value == null) 18 | return ""; 19 | var date = new DateTime(); 20 | if (! DateTime.TryParse(value.ToString(), out date)) 21 | return ""; 22 | 23 | if (parameter!=null&¶meter.ToString() == "relative") 24 | return RelativeDate.ToRelative(date); 25 | else 26 | return date.ToShortDateString() + " at " + date.ToShortTimeString(); 27 | 28 | } 29 | 30 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 31 | { 32 | 33 | throw new NotImplementedException(); 34 | } 35 | 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Bcfier/Data/ValueConverters/IntPluralConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Windows.Data; 4 | using System.Globalization; 5 | 6 | namespace Bcfier.Data.ValueConverters 7 | { 8 | /// 9 | /// Returna string formatted to have a number and a plural 10 | /// using %0% and %s% as wildcards 11 | /// 12 | [ValueConversion(typeof(Int16), typeof(String))] 13 | public class IntPluralConverter : IValueConverter 14 | { 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | var count = (int)value; 18 | var plural = (count == 1) ? "" : "s"; 19 | 20 | var text = ""; 21 | if (parameter != null) 22 | text = parameter.ToString(); 23 | text = text.Replace("%0%", count.ToString()); 24 | text = text.Replace("%s%", plural); 25 | 26 | 27 | return text; 28 | } 29 | 30 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 31 | { 32 | 33 | throw new NotImplementedException(); 34 | } 35 | 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Bcfier/Data/ValueConverters/IntVisibConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Data; 4 | using System.Globalization; 5 | 6 | namespace Bcfier.Data.ValueConverters 7 | { 8 | 9 | /// 10 | /// If the value is 0 or -1 returns collapsed 11 | /// 12 | [ValueConversion(typeof(String), typeof(Visibility))] 13 | public class IntVisibConverter : IValueConverter 14 | { 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | var c = (int)value; 18 | return (c == 0 || c == -1) ? Visibility.Collapsed : Visibility.Visible; 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | 24 | throw new NotImplementedException(); 25 | } 26 | 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Bcfier/Data/ValueConverters/MultiCommandConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Bcfier.Data.ValueConverters 6 | { 7 | /// 8 | /// Needed to assign bultiple bindings to a command 9 | /// 10 | public class MultiCommandConverter : IMultiValueConverter 11 | { 12 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | return values.Clone(); 15 | } 16 | 17 | public object[] ConvertBack(object values, Type[] targetType, object parameter, CultureInfo culture) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /Bcfier/Data/ValueConverters/PathToImageConv.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Data; 3 | using System.Windows.Media.Imaging; 4 | using System.Globalization; 5 | using Bcfier.Data.Utils; 6 | 7 | namespace Bcfier.Data.ValueConverters 8 | { 9 | /// 10 | /// This avoids issues when deleting an image that is loaded by the UI 11 | /// 12 | [ValueConversion(typeof(String), typeof(BitmapImage))] 13 | public class PathToImageConv : IValueConverter 14 | { 15 | 16 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 17 | { 18 | if (value == null) 19 | return null; 20 | 21 | if (!string.IsNullOrEmpty(value.ToString())) 22 | { 23 | return ImagingUtils.BitmapFromPath(value.ToString()); 24 | } 25 | 26 | return null; 27 | 28 | } 29 | 30 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 31 | { 32 | 33 | throw new NotImplementedException(); 34 | } 35 | 36 | 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Bcfier/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Windows; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Bcfier")] 10 | [assembly: AssemblyDescription("Bcfier")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("teocomi")] 13 | [assembly: AssemblyProduct("Bcfier")] 14 | [assembly: AssemblyCopyright("Copyright © teocomi 2017")] 15 | [assembly: AssemblyTrademark("teocomi")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | [assembly: InternalsVisibleTo("Bcfier.Revit")] 19 | [assembly: InternalsVisibleTo("Bcfier.Win")] 20 | [assembly: InternalsVisibleTo("Bcfier.XbimXplorer")] 21 | [assembly: InternalsVisibleTo("Bcfier.Navisworks")] 22 | 23 | // Setting ComVisible to false makes the types in this assembly not visible 24 | // to COM components. If you need to access a type in this assembly from 25 | // COM, set the ComVisible attribute to true on that type. 26 | [assembly: ComVisible(false)] 27 | 28 | //In order to begin building localizable applications, set 29 | //CultureYouAreCodingWith in your .csproj file 30 | //inside a . For example, if you are using US english 31 | //in your source files, set the to en-US. Then uncomment 32 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 33 | //the line below to match the UICulture setting in the project file. 34 | 35 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 36 | 37 | 38 | [assembly: ThemeInfo( 39 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 40 | //(used if a resource is not found in the page, 41 | // or application resource dictionaries) 42 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 43 | //(used if a resource is not found in the page, 44 | // app, or any theme specific resource dictionaries) 45 | )] 46 | 47 | [assembly: GuidAttribute("0d553633-80f8-490b-84d6-9d3d6ad4196d")] 48 | -------------------------------------------------------------------------------- /Bcfier/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34209 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bcfier.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Bcfier.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Bcfier/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Bcfier/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34209 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Bcfier.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Bcfier/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Bcfier/SampleBcfFile.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 14 | 15 | Issue 16 | Problem 17 | Solution 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | 49 | 54 | 55 | 56 | 57 | 58 | 62 | 63 | 64 | 68 | 69 | 70 | 75 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /Bcfier/Themes/ButtonIcon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Media; 5 | 6 | namespace Bcfier.Themes 7 | { 8 | /// 9 | /// A custom button with an icon and different settings 10 | /// Can be Vertical 11 | /// 12 | public class ButtonIcon : Button 13 | { 14 | static ButtonIcon() 15 | { 16 | DefaultStyleKeyProperty.OverrideMetadata( 17 | typeof(ButtonIcon), 18 | new FrameworkPropertyMetadata(typeof(ButtonIcon))); 19 | } 20 | 21 | public static readonly DependencyProperty IconColorProperty = DependencyProperty.Register("IconColor", typeof(Brush), typeof(ButtonIcon)); 22 | public Brush IconColor 23 | { 24 | get { return (Brush)GetValue(IconColorProperty); } 25 | set { SetValue(IconColorProperty, value); } 26 | } 27 | public static readonly DependencyProperty DisabledIconColorProperty = DependencyProperty.Register("DisabledIconColor", typeof(Brush), typeof(ButtonIcon)); 28 | public Brush DisabledIconColor 29 | { 30 | get { return (Brush)GetValue(DisabledIconColorProperty); } 31 | set { SetValue(DisabledIconColorProperty, value); } 32 | } 33 | 34 | public static readonly DependencyProperty HighlightColorProperty = DependencyProperty.Register("HighlightColor", typeof(Brush), typeof(ButtonIcon)); 35 | public Brush HighlightColor 36 | { 37 | get { return (Brush)GetValue(HighlightColorProperty); } 38 | set { SetValue(HighlightColorProperty, value); } 39 | } 40 | 41 | public static readonly DependencyProperty IconSizeProperty = DependencyProperty.Register("IconSize", typeof(int), typeof(ButtonIcon), new UIPropertyMetadata(15)); 42 | public int IconSize 43 | { 44 | get { return (int)GetValue(IconSizeProperty); } 45 | set { SetValue(IconSizeProperty, value); } 46 | } 47 | 48 | public static readonly DependencyProperty IconMarginProperty = DependencyProperty.Register("IconMargin", typeof(Thickness), typeof(ButtonIcon), new UIPropertyMetadata(new Thickness(5, 0, 4, 0))); 49 | public Thickness IconMargin 50 | { 51 | get { return (Thickness)GetValue(IconMarginProperty); } 52 | set { SetValue(IconMarginProperty, value); } 53 | } 54 | 55 | public static readonly DependencyProperty IconSizeVerticalProperty = DependencyProperty.Register("IconSizeVertical", typeof(int), typeof(ButtonIcon), new UIPropertyMetadata(25)); 56 | public int IconSizeVertical 57 | { 58 | get { return (int)GetValue(IconSizeVerticalProperty); } 59 | set { SetValue(IconSizeVerticalProperty, value); } 60 | } 61 | 62 | public static readonly DependencyProperty IconMarginVerticalProperty = DependencyProperty.Register("IconMarginVertical", typeof(Thickness), typeof(ButtonIcon), new UIPropertyMetadata(new Thickness(5))); 63 | public Thickness IconMarginVertical 64 | { 65 | get { return (Thickness)GetValue(IconMarginVerticalProperty); } 66 | set { SetValue(IconMarginVerticalProperty, value); } 67 | } 68 | 69 | public static readonly DependencyProperty IconPathProperty = DependencyProperty.Register("IconPath", typeof(Geometry), typeof(ButtonIcon)); 70 | public System.Windows.Media.Geometry IconPath 71 | { 72 | get { return (Geometry)GetValue(IconPathProperty); } 73 | set { SetValue(IconPathProperty, value); } 74 | } 75 | 76 | public static readonly DependencyProperty IsVerticalProperty = DependencyProperty.Register( 77 | "IsVertical", 78 | typeof(Boolean), 79 | typeof(ButtonIcon), 80 | new PropertyMetadata(false)); 81 | 82 | public Boolean IsVertical 83 | { 84 | get { return (Boolean)GetValue(IsVerticalProperty); } 85 | set { SetValue(IsVerticalProperty, value); } 86 | } 87 | 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Bcfier/Themes/Colors.xaml: -------------------------------------------------------------------------------- 1 |  2 | #4DBFF5 3 | #34A6DC 4 | #14324A 5 | #0F2636 6 | #F5F6FA 7 | #E0E7ED 8 | -------------------------------------------------------------------------------- /Bcfier/Themes/IssueListStyle.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 42 | 43 | 68 | -------------------------------------------------------------------------------- /Bcfier/Themes/IssueListStyle.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using System.Windows.Input; 3 | 4 | namespace Bcfier.Themes 5 | { 6 | public partial class IssueListStyle 7 | { 8 | protected void SelectCurrentItem(object sender, KeyboardFocusChangedEventArgs e) 9 | { 10 | var item = (ListViewItem)sender; 11 | item.IsSelected = true; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Bcfier/Themes/LabelSelectable.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | namespace Bcfier.Themes 5 | { 6 | /// 7 | /// A control that looks like a label but can be selected 8 | /// More code in generic.xaml 9 | /// 10 | public class LabelSelectable : TextBox 11 | { 12 | static LabelSelectable() 13 | { 14 | DefaultStyleKeyProperty.OverrideMetadata( 15 | typeof(LabelSelectable), 16 | new FrameworkPropertyMetadata(typeof(LabelSelectable))); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Bcfier/Themes/TextPlaceholder.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Media; 4 | 5 | 6 | namespace Bcfier.Themes 7 | { 8 | /// 9 | /// A TextBox with a placeholder 10 | /// more code in generic.xaml 11 | /// 12 | public class TextPlaceholder : TextBox 13 | { 14 | 15 | public static DependencyProperty PlaceholderProperty = 16 | DependencyProperty.Register( 17 | "Placeholder", 18 | typeof(string), 19 | typeof(TextPlaceholder)); 20 | 21 | public static DependencyProperty PlaceholderColorProperty = 22 | DependencyProperty.Register( 23 | "PlaceholderColor", 24 | typeof(Brush), 25 | typeof(TextPlaceholder)); 26 | 27 | 28 | private static DependencyPropertyKey HasTextPropertyKey = 29 | DependencyProperty.RegisterReadOnly( 30 | "HasText", 31 | typeof(bool), 32 | typeof(TextPlaceholder), 33 | new PropertyMetadata()); 34 | public static DependencyProperty HasTextProperty = HasTextPropertyKey.DependencyProperty; 35 | 36 | 37 | static TextPlaceholder() 38 | { 39 | DefaultStyleKeyProperty.OverrideMetadata( 40 | typeof(TextPlaceholder), 41 | new FrameworkPropertyMetadata(typeof(TextPlaceholder))); 42 | } 43 | 44 | 45 | 46 | protected override void OnTextChanged(TextChangedEventArgs e) 47 | { 48 | base.OnTextChanged(e); 49 | 50 | HasText = Text.Length != 0; 51 | 52 | } 53 | 54 | 55 | public string Placeholder 56 | { 57 | get { return (string)GetValue(PlaceholderProperty); } 58 | set { SetValue(PlaceholderProperty, value); } 59 | } 60 | 61 | public Brush PlaceholderColor 62 | { 63 | get { return (Brush)GetValue(PlaceholderColorProperty); } 64 | set { SetValue(PlaceholderColorProperty, value); } 65 | } 66 | 67 | 68 | 69 | public bool HasText 70 | { 71 | get { return (bool)GetValue(HasTextProperty); } 72 | private set { SetValue(HasTextPropertyKey, value); } 73 | } 74 | 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Bcfier/Themes/ViewCommentDataTemplate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls.Primitives; 8 | using System.Windows.Input; 9 | 10 | namespace Bcfier.Themes 11 | { 12 | public partial class ViewCommentDataTemplate : ResourceDictionary 13 | { 14 | public ViewCommentDataTemplate() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void UIElement_OnKeyDown(object sender, KeyEventArgs e) 20 | { 21 | if (e.Key == Key.Enter) 22 | { 23 | //AddCommButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Bcfier/Themes/ViewCommentListStyle.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 28 | -------------------------------------------------------------------------------- /Bcfier/Themes/VisibilityAnimations.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 35 | -------------------------------------------------------------------------------- /Bcfier/UserControls/AddView.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 41 | 49 | 50 |