Produced by Araxis Merge on 2/1/2017 2:57:36 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\Tools\WebResourceUtility\ViewModels | ViewModelBase.cs | Tue Dec 20 19:52:28 2016 UTC |
| 2 | Wed Feb 1 19:57:36 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 139 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | using Syst em; | |||||
| 2 | using Syst em.Collect ions.Gener ic; | |||||
| 3 | using Syst em.Compone ntModel; | |||||
| 4 | using Syst em.Diagnos tics; | |||||
| 5 | using Syst em.Linq; | |||||
| 6 | using Syst em.Text; | |||||
| 7 | using Syst em.Windows .Threading ; | |||||
| 8 | using Syst em.Threadi ng; | |||||
| 9 | ||||||
| 10 | namespace Microsoft. Crm.Sdk.Sa mples | |||||
| 11 | { | |||||
| 12 | /// <s ummary> | |||||
| 13 | /// Ba se class f or all Vie wModel cla sses in th e applicat ion. | |||||
| 14 | /// It provides support fo r property change no tification s | |||||
| 15 | /// an d has a Di splayName property. This clas s is abstr act. | |||||
| 16 | /// </ summary> | |||||
| 17 | public abstract class View ModelBase : INotifyP ropertyCha nged, IDis posable | |||||
| 18 | { | |||||
| 19 | pr otected Di spatcher D ispatcher { get; pri vate set; } | |||||
| 20 | // / <summary > | |||||
| 21 | // / Returns the user-f riendly na me of this object. | |||||
| 22 | // / Child cl asses can set this p roperty to a new val ue, | |||||
| 23 | // / or overr ide it to determine the value on-demand. | |||||
| 24 | // / </summar y> | |||||
| 25 | pu blic virtu al string DisplayNam e { get; p rotected s et; } | |||||
| 26 | ||||||
| 27 | #r egion Cons tructor | |||||
| 28 | ||||||
| 29 | pr otected Vi ewModelBas e() | |||||
| 30 | { | |||||
| 31 | Dispatch er = Dispa tcher.Curr entDispatc her; | |||||
| 32 | } | |||||
| 33 | ||||||
| 34 | #e ndregion / / Construc tor | |||||
| 35 | ||||||
| 36 | pr otected vo id BeginIn voke(Actio n action) | |||||
| 37 | { | |||||
| 38 | if (this .Dispatche r.Thread = = Thread.C urrentThre ad) | |||||
| 39 | { | |||||
| 40 | acti on(); | |||||
| 41 | } | |||||
| 42 | else | |||||
| 43 | { | |||||
| 44 | Disp atcher.Beg inInvoke(a ction, nul l); | |||||
| 45 | } | |||||
| 46 | } | |||||
| 47 | ||||||
| 48 | #r egion Debu gging Aide s | |||||
| 49 | ||||||
| 50 | // / <summary > | |||||
| 51 | // / Warns th e develope r if this object doe s not have | |||||
| 52 | // / a public property with the s pecified n ame. This | |||||
| 53 | // / method d oes not ex ist in a R elease bui ld. | |||||
| 54 | // / </summar y> | |||||
| 55 | [C onditional ("DEBUG")] | |||||
| 56 | [D ebuggerSte pThrough] | |||||
| 57 | pu blic void VerifyProp ertyName(s tring prop ertyName) | |||||
| 58 | { | |||||
| 59 | // Verif y that the property name match es a real, | |||||
| 60 | // publi c, instanc e property on this o bject. | |||||
| 61 | if (Type Descriptor .GetProper ties(this) [propertyN ame] == nu ll) | |||||
| 62 | { | |||||
| 63 | stri ng msg = " Invalid pr operty nam e: " + pro pertyName; | |||||
| 64 | ||||||
| 65 | if ( this.Throw OnInvalidP ropertyNam e) | |||||
| 66 | throw new Exception( msg); | |||||
| 67 | else | |||||
| 68 | Debug.Fail (msg); | |||||
| 69 | } | |||||
| 70 | } | |||||
| 71 | ||||||
| 72 | // / <summary > | |||||
| 73 | // / Returns whether an exception is thrown , or if a Debug.Fail () is used | |||||
| 74 | // / when an invalid pr operty nam e is passe d to the V erifyPrope rtyName me thod. | |||||
| 75 | // / The defa ult value is false, but subcla sses used by unit te sts might | |||||
| 76 | // / override this prop erty's get ter to ret urn true. | |||||
| 77 | // / </summar y> | |||||
| 78 | pr otected vi rtual bool ThrowOnIn validPrope rtyName { get; priva te set; } | |||||
| 79 | ||||||
| 80 | #e ndregion / / Debuggin g Aides | |||||
| 81 | ||||||
| 82 | #r egion INot ifyPropert yChanged M embers | |||||
| 83 | ||||||
| 84 | // / <summary > | |||||
| 85 | // / Raised w hen a prop erty on th is object has a new value. | |||||
| 86 | // / </summar y> | |||||
| 87 | pu blic event PropertyC hangedEven tHandler P ropertyCha nged; | |||||
| 88 | ||||||
| 89 | // / <summary > | |||||
| 90 | // / Raises t his object 's Propert yChanged e vent. | |||||
| 91 | // / </summar y> | |||||
| 92 | // / <param n ame="prope rtyName">T he propert y that has a new val ue.</param > | |||||
| 93 | pr otected vi rtual void OnPropert yChanged(s tring prop ertyName) | |||||
| 94 | { | |||||
| 95 | this.Ver ifyPropert yName(prop ertyName); | |||||
| 96 | ||||||
| 97 | Property ChangedEve ntHandler handler = this.Prope rtyChanged ; | |||||
| 98 | if (hand ler != nul l) | |||||
| 99 | { | |||||
| 100 | var e = new Pr opertyChan gedEventAr gs(propert yName); | |||||
| 101 | hand ler(this, e); | |||||
| 102 | } | |||||
| 103 | } | |||||
| 104 | ||||||
| 105 | #e ndregion / / INotifyP ropertyCha nged Membe rs | |||||
| 106 | ||||||
| 107 | #r egion IDis posable Me mbers | |||||
| 108 | ||||||
| 109 | // / <summary > | |||||
| 110 | // / Invoked when this object is being remo ved from t he applica tion | |||||
| 111 | // / and will be subjec t to garba ge collect ion. | |||||
| 112 | // / </summar y> | |||||
| 113 | pu blic void Dispose() | |||||
| 114 | { | |||||
| 115 | this.OnD ispose(); | |||||
| 116 | } | |||||
| 117 | ||||||
| 118 | // / <summary > | |||||
| 119 | // / Child cl asses can override t his method to perfor m | |||||
| 120 | // / clean-up logic, su ch as remo ving event handlers. | |||||
| 121 | // / </summar y> | |||||
| 122 | pr otected vi rtual void OnDispose () | |||||
| 123 | { | |||||
| 124 | } | |||||
| 125 | ||||||
| 126 | #if DEBUG | |||||
| 127 | // / <summary > | |||||
| 128 | // / Useful f or ensurin g that Vie wModel obj ects are p roperly ga rbage coll ected. | |||||
| 129 | // / </summar y> | |||||
| 130 | ~V iewModelBa se() | |||||
| 131 | { | |||||
| 132 | string m sg = strin g.Format(" {0} ({1}) ({2}) Fina lized", th is.GetType ().Name, t his.Displa yName, thi s.GetHashC ode()); | |||||
| 133 | System.D iagnostics .Debug.Wri teLine(msg ); | |||||
| 134 | } | |||||
| 135 | #endif | |||||
| 136 | ||||||
| 137 | #e ndregion / / IDisposa ble Member s | |||||
| 138 | } | |||||
| 139 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.