File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
src/Certify.UI.Shared/ViewModel Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change 1- using System ;
1+ using System ;
22using System . Collections . Generic ;
33using System . Collections . ObjectModel ;
4- using System . Diagnostics ;
4+ using System . ComponentModel ;
55using System . IO ;
66using System . Linq ;
77using System . Threading . Tasks ;
@@ -53,14 +53,13 @@ public AppViewModel(ICertifyClient certifyClient)
5353 /// <returns></returns>
5454 public static AppViewModel GetModel ( )
5555 {
56- var stack = new StackTrace ( ) ;
57- if ( stack . GetFrames ( ) . Last ( ) . GetMethod ( ) . Name == "Main" )
56+ if ( DesignerProperties . GetIsInDesignMode ( new DependencyObject ( ) ) )
5857 {
59- return new AppViewModel ( ) ;
58+ return new AppViewModelDesign ( ) ;
6059 }
6160 else
6261 {
63- return new AppViewModelDesign ( ) ;
62+ return new AppViewModel ( ) ;
6463 }
6564 }
6665
Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
33using System . Collections . ObjectModel ;
4+ using System . ComponentModel ;
45using System . Linq ;
56using System . Threading . Tasks ;
67using System . Windows ;
@@ -19,7 +20,6 @@ public class ManagedCertificateViewModel : BindableBase
1920 /// <summary>
2021 /// Provide single static instance of model for all consumers
2122 /// </summary>
22- //public static AppModel AppViewModel = new DesignViewModel(); // for UI testing
2323 public static ManagedCertificateViewModel Current = ManagedCertificateViewModel . GetModel ( ) ;
2424
2525 private Certify . UI . ViewModel . AppViewModel _appViewModel => ViewModel . AppViewModel . Current ;
@@ -449,14 +449,13 @@ public int? PercentageLifetimeElapsed
449449
450450 public static ManagedCertificateViewModel GetModel ( )
451451 {
452- var stack = new System . Diagnostics . StackTrace ( ) ;
453- if ( stack . GetFrames ( ) . Last ( ) . GetMethod ( ) . Name == "Main" )
452+ if ( DesignerProperties . GetIsInDesignMode ( new DependencyObject ( ) ) )
454453 {
455- return new ManagedCertificateViewModel ( ) ;
454+ return new ManagedCertificateViewModelDesign ( ) ;
456455 }
457456 else
458457 {
459- return new ManagedCertificateViewModelDesign ( ) ;
458+ return new ManagedCertificateViewModel ( ) ;
460459 }
461460 }
462461
You can’t perform that action at this time.
0 commit comments