Skip to content

Commit

Permalink
Merge pull request #31 from rollingthunder/master
Browse files Browse the repository at this point in the history
Fix for MessageBus on WP7, fix IsInDesignMode on SL
  • Loading branch information
anaisbetts committed Aug 23, 2011
2 parents abd0ece + 02acecf commit c92780a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
32 changes: 29 additions & 3 deletions ReactiveUI/MemoizingMRUCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,39 @@ void Invariants()
}

#if DOTNETISOLDANDSAD || WINDOWS_PHONE
internal class Tuple<T1, T2>
internal class Tuple<T1, T2>
{
public Tuple(T1 item1, T2 item2) { Item1 = item1; Item2 = item2; }
public Tuple() {}
public Tuple(T1 item1, T2 item2)
{
Item1 = item1;
Item2 = item2;
var hash1 = (item1 != null) ? item1.GetHashCode() : 0;
var hash2 = (item2 != null) ? item2.GetHashCode() : 0;
hash = hash1 ^ hash2;
}
public Tuple() {}

private int hash;
public T1 Item1 {get; set;}
public T2 Item2 {get; set;}



public override bool Equals(object obj)
{
var other = obj as Tuple<T1, T2>;
if (other == null)
return false;

bool equals1 = (Item1 != null)? Item1.Equals(other.Item1) : other.Item1 == null;
bool equals2 = (Item2 != null)? Item2.Equals(other.Item2) : other.Item2 == null;
return equals1 && equals2;
}

public override int GetHashCode()
{
return hash;
}
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion ReactiveUI/RxApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public static bool InUnitTestRunner()
};

#if SILVERLIGHT
if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(Application.Current.RootVisual)) {
if (Application.Current.RootVisual != null && System.ComponentModel.DesignerProperties.GetIsInDesignMode(Application.Current.RootVisual)) {
return false;
}

Expand Down

0 comments on commit c92780a

Please sign in to comment.