Skip to content

Commit

Permalink
- Fix views to not load data when in designer mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
cabal95 committed Mar 26, 2018
1 parent 973c376 commit 837ce9a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
28 changes: 20 additions & 8 deletions RockDevBooster/GitHubVersions.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
Expand Down Expand Up @@ -33,10 +34,13 @@ public GitHubVersions()
{
InitializeComponent();

txtStatus.Text = "Loading...";
btnImport.IsEnabled = false;
if ( !DesignerProperties.GetIsInDesignMode( this ) )
{
txtStatus.Text = "Loading...";
btnImport.IsEnabled = false;

new Task( LoadData ).Start();
new Task( LoadData ).Start();
}
}

#endregion
Expand Down Expand Up @@ -67,11 +71,19 @@ private async void LoadData()

var vsList = Support.GetVisualStudioInstances();

var list = ( await tags )
.Select( t => new GitHubTag( t ) )
.Where( t => t.Version >= minimumVersion )
.OrderByDescending( t => t.Version )
.ToList();
List<GitHubTag> list;
try
{
list = ( await tags )
.Select( t => new GitHubTag( t ) )
.Where( t => t.Version >= minimumVersion )
.OrderByDescending( t => t.Version )
.ToList();
}
catch
{
list = new List<GitHubTag>();
}
list.Insert( 0, new GitHubTag() );

Dispatcher.Invoke( () =>
Expand Down
10 changes: 7 additions & 3 deletions RockDevBooster/InstancesView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Data.SqlLocalDb;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.ComponentModel;

namespace com.blueboxmoon.RockDevBooster
{
Expand Down Expand Up @@ -58,10 +59,13 @@ public InstancesView()
{
InitializeComponent();

DefaultInstancesView = this;
UpdateInstances();
if ( !DesignerProperties.GetIsInDesignMode( this ) )
{
DefaultInstancesView = this;
UpdateInstances();

Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
Dispatcher.ShutdownStarted += Dispatcher_ShutdownStarted;
}
}

#endregion
Expand Down
6 changes: 5 additions & 1 deletion RockDevBooster/PackageView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Newtonsoft.Json;

using com.blueboxmoon.RockDevBooster.PluginFormat;
using System.ComponentModel;

namespace com.blueboxmoon.RockDevBooster
{
Expand Down Expand Up @@ -47,7 +48,10 @@ public PackageView()
{
InitializeComponent();

LoadData();
if ( !DesignerProperties.GetIsInDesignMode( this ) )
{
LoadData();
}
}

#endregion
Expand Down
12 changes: 8 additions & 4 deletions RockDevBooster/TemplatesView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Threading;
Expand Down Expand Up @@ -32,12 +33,15 @@ public TemplatesView()
{
InitializeComponent();

txtStatus.Text = string.Empty;
if ( !DesignerProperties.GetIsInDesignMode( this ) )
{
txtStatus.Text = string.Empty;

UpdateState();
UpdateState();

DefaultTemplatesView = this;
UpdateTemplates();
DefaultTemplatesView = this;
UpdateTemplates();
}
}

#endregion
Expand Down

0 comments on commit 837ce9a

Please sign in to comment.