697. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2/1/2017 2:56:57 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.

697.1 Files compared

# Location File Last Modified
1 C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\SampleCode\CS\XRMTooling\QuickStartXRMToolingWPFClient\LoginWindow CrmLogin.xaml.cs Tue Dec 20 19:51:43 2016 UTC
2 Wed Feb 1 19:56:57 2017 UTC

697.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 0 0
Changed 0 0
Inserted 0 0
Removed 1 371

697.3 Comparison options

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

697.4 Active regular expressions

No regular expressions were active.

697.5 Comparison detail

1   // ======= ========== ========== ========== ========== ========== ========== ==        
2   //  This f ile is par t of the M icrosoft D ynamics CR M SDK code  samples.        
3   //        
4   //  Copyri ght (C) Mi crosoft Co rporation.   All righ ts reserve d.        
5   //        
6   //  This s ource code  is intend ed only as  a supplem ent to Mic rosoft        
7   //  Develo pment Tool s and/or o n-line doc umentation .  See the se other        
8   //  materi als for de tailed inf ormation r egarding M icrosoft c ode sample s.        
9   //        
10   //  THIS C ODE AND IN FORMATION  ARE PROVID ED "AS IS"  WITHOUT W ARRANTY OF  ANY        
11   //  KIND,  EITHER EXP RESSED OR  IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E        
12   //  IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR  A        
13   //  PARTIC ULAR PURPO SE.        
14          
15   //  This f ile is aut o-generate d when you  use the C RM SDK Tem plate        
16   //  (WPF A pplication  for CRM)  to create  a project.  This prov ides         
17   //  a comm on login c ontrol and  built in  authentica tion and         
18   //  creden tial-cachi ng support .        
19   //        
20   //  For mo re informa tion, see  http://go. microsoft. com/fwlink /?LinkId=5 21516        
21          
22   using Micr osoft.Xrm. Tooling.Co nnector;        
23   using Micr osoft.Xrm. Tooling.Cr mConnectCo ntrol;        
24   using Syst em;        
25   using Syst em.Collect ions.Gener ic;        
26   using Syst em.Linq;        
27   using Syst em.Text;        
28   using Syst em.Threadi ng.Tasks;        
29   using Syst em.Windows ;        
30   using Syst em.Windows .Controls;        
31   using Syst em.Windows .Data;        
32   using Syst em.Windows .Documents ;        
33   using Syst em.Windows .Input;        
34   using Syst em.Windows .Media;        
35   using Syst em.Windows .Media.Ima ging;        
36   using Syst em.Windows .Shapes;        
37   using Syst em.Windows .Threading ;        
38          
39   namespace  QuickStart XRMTooling WPFClient. LoginWindo w        
40   {        
41       /// <s ummary>        
42       /// In teraction  logic for  CrmLogin.x aml        
43       /// </ summary>        
44       public  partial c lass CrmLo gin : Wind ow        
45       {        
46           #r egion Vars        
47           // / <summary >        
48           // / Microsof t.Xrm.Tool ing.Connec tor servic es        
49           // / </summar y>        
50           pr ivate CrmS erviceClie nt CrmSvc  = null;        
51           // / <summary >        
52           // / Bool fla g to deter mine if th ere is a c onnection         
53           // / </summar y>        
54           pr ivate bool  bIsConnec tedComplet e = false;        
55           // / <summary >        
56           // / CRM Conn ection Man ager compo nent.         
57           // / </summar y>        
58           pr ivate CrmC onnectionM anager mgr  = null;        
59           // / <summary >        
60           // /  This is  used to a llow the U I to reset  w/out clo sing         
61           // / </summar y>        
62           pr ivate bool  resetUiFl ag = false ;        
63           #e ndregion        
64          
65           #r egion Prop erties        
66           // / <summary >        
67           // / CRM Conn ection Man ager         
68           // / </summar y>        
69           pu blic CrmCo nnectionMa nager CrmC onnectionM gr { get {  return mg r; } }        
70           #e ndregion        
71          
72           #r egion Even t        
73           // / <summary >        
74           // / Raised w hen a conn ection to  CRM has co mpleted.         
75           // / </summar y>        
76           pu blic event  EventHand ler Connec tionToCrmC ompleted;        
77           #e ndregion        
78          
79          
80           pu blic CrmLo gin()        
81           {        
82                Initiali zeComponen t();        
83                //// Sho uld be use d for test ing only.        
84                //Servic ePointMana ger.Server Certificat eValidatio nCallback  = (sender,  certifica te, chain,  sslPolicy Errors) =>        
85                //{        
86                //    Me ssageBox.S how("CertE rror");        
87                //    re turn true;        
88                //};        
89           }        
90          
91           // / <summary >        
92           // / Raised w hen the wi ndow loads  for the f irst time.          
93           // / </summar y>        
94           // / <param n ame="sende r"></param >        
95           // / <param n ame="e"></ param>        
96           pr ivate void  Window_Lo aded(objec t sender,  RoutedEven tArgs e)        
97           {        
98                /*        
99                                      This is  the setup  process fo r the logi n control,          
100                                      The logi n control  uses a cla ss called  CrmConnect ionManager  to manage  the inter action wit h CRM, thi s class an d also be  queried as  later poi nts for in formation  about the  current co nnection.         
101                                      In this  case, the  login cont rol is ref erred to a s CrmLogin Ctrl        
102                              */        
103          
104                // Set o ff flag.         
105                bIsConne ctedComple te = false ;        
106          
107                // Init  the CRM Co nnection m anager..         
108                mgr = ne w CrmConne ctionManag er();        
109                // Pass  a referenc e to the c urrent UI  or contain er control ,  this is  used to s ynchronize  UI thread s In the l ogin contr ol        
110                mgr.Pare ntControl  = CrmLogin Ctrl;        
111                // if yo u are usin g an unman aged clien t, excel f or example , and need  to store  the config  in the us ers local  directory        
112                // set t his option  to true.         
113                mgr.UseU serLocalDi rectoryFor ConfigStor e = true;        
114                // if yo u are usin g an unman aged clien t,  you ne ed to prov ide the na me of an e xe to use  to create  app config  key's for        
115                //mgr.Ho stApplicat ioNameOver ide = "MyE xecName.ex e";        
116                // CrmLo ginCtrl is  the Login  control,   this sets  the CrmCo nnection M anager int o it.         
117                CrmLogin Ctrl.SetGl obalStoreA ccess(mgr) ;        
118                // There  are sever al modes t o the logi n control  UI        
119                CrmLogin Ctrl.SetCo ntrolMode( ServerLogi nConfigCtr lMode.Full LoginPanel );        
120                // this  wires an e vent that  is raised  when the l ogin butto n is press ed.         
121                CrmLogin Ctrl.Conne ctionCheck Begining + = new Even tHandler(C rmLoginCtr l_Connecti onCheckBeg ining);        
122                // this  wires an e vent that  is raised  when an er ror in the  connect p rocess occ urs.         
123                CrmLogin Ctrl.Conne ctErrorEve nt += new  EventHandl er<Connect ErrorEvent Args>(CrmL oginCtrl_C onnectErro rEvent);        
124                // this  wires an e vent that  is raised  when a sta tus event  is returne d.         
125                CrmLogin Ctrl.Conne ctionStatu sEvent +=  new EventH andler<Con nectStatus EventArgs> (CrmLoginC trl_Connec tionStatus Event);        
126                // this  wires an e vent that  is raised  when the u ser clicks  the cance l button.         
127                CrmLogin Ctrl.UserC ancelClick ed += new  EventHandl er(CrmLogi nCtrl_User CancelClic ked);        
128                // Check  to see if  its possi ble to do  an Auto Lo gin         
129                if (!mgr .RequireUs erLogin())        
130                {        
131                    if ( MessageBox .Show("Cre dentials a lready sav ed in conf iguration\ nChoose Ye s to Auto  Login or N o to Reset  Credentia ls", "Auto  Login", M essageBoxB utton.YesN o, Message BoxImage.Q uestion) = = MessageB oxResult.Y es)        
132                    {        
133                         // If Requ ireUserLog in is fals e, it mean s that the re has bee n a succes sful login  here befo re and the  credentia ls are cac hed.         
134                         CrmLoginCt rl.IsEnabl ed = false ;        
135                         // When ru nning an a uto login,   you need  to wire a nd listen  to the eve nts from t he connect ion manage r.        
136                         // Run Aut o User Log in process , Wire eve nts.         
137                         mgr.Server Connection StatusUpda te += new  EventHandl er<ServerC onnectStat usEventArg s>(mgr_Ser verConnect ionStatusU pdate);        
138                         mgr.Connec tionCheckC omplete +=  new Event Handler<Se rverConnec tStatusEve ntArgs>(mg r_Connecti onCheckCom plete);        
139                         // Start t he connect ion proces s.         
140                         mgr.Connec tToServerC heck();        
141          
142                         // Show th e message  grid.         
143                         CrmLoginCt rl.ShowMes sageGrid() ;        
144                    }        
145                }        
146           }        
147          
148           #r egion Even ts        
149          
150           // / <summary >        
151           // / Updates  from the A uto Login  process.         
152           // / </summar y>        
153           // / <param n ame="sende r"></param >        
154           // / <param n ame="e"></ param>        
155           pr ivate void  mgr_Serve rConnectio nStatusUpd ate(object  sender, S erverConne ctStatusEv entArgs e)        
156           {        
157                // The S tatus even t will con tain infor mation abo ut the cur rent login  process,   if Connec ted is fal se, then t here is no t yet a co nnection.         
158                // Set t he updated  status of  the loadi ng process        
159                Dispatch er.Invoke( Dispatcher Priority.N ormal,        
160                                     new Syste m.Action(( ) =>        
161                                     {        
162                                         this. Title = st ring.IsNul lOrWhiteSp ace(e.Stat usMessage)  ? e.Error Message :  e.StatusMe ssage;        
163                                     }        
164                                         ));        
165          
166           }        
167          
168           // / <summary >        
169           // / Complete  Event fro m the Auto  Login pro cess        
170           // / </summar y>        
171           // / <param n ame="sende r"></param >        
172           // / <param n ame="e"></ param>        
173           pr ivate void  mgr_Conne ctionCheck Complete(o bject send er, Server ConnectSta tusEventAr gs e)        
174           {        
175                // The S tatus even t will con tain infor mation abo ut the cur rent login  process,   if Connec ted is fal se, then t here is no t yet a co nnection.         
176                // Unwir e events t hat we are  not using  anymore,  this preve nts issues  if the us er uses th e control  after a fa iled login        
177                ((CrmCon nectionMan ager)sende r).Connect ionCheckCo mplete -=  mgr_Connec tionCheckC omplete;        
178                ((CrmCon nectionMan ager)sende r).ServerC onnectionS tatusUpdat e -= mgr_S erverConne ctionStatu sUpdate;        
179          
180                if (!e.C onnected)        
181                {        
182                    // i f its not  connected  pop the lo gin screen  here.         
183                    if ( e.MultiOrg sFound)        
184                         MessageBox .Show("Una ble to Log in to CRM  using cach ed credent ials. Org  Not found" , "Login F ailure");        
185                    else        
186                         MessageBox .Show("Una ble to Log in to CRM  using cach ed credent ials", "Lo gin Failur e");        
187          
188                    rese tUiFlag =  true;        
189                    CrmL oginCtrl.G oBackToLog in();        
190                    // B ad Login G et back on  the UI.         
191                    Disp atcher.Inv oke(Dispat cherPriori ty.Normal,        
192                            new Sys tem.Action (() =>        
193                            {        
194                                thi s.Title =  "Failed to  Login wit h cached c redentials .";        
195                                Mes sageBox.Sh ow(this.Ti tle, "Noti fication f rom Connec tionManage r", Messag eBoxButton .OK, Messa geBoxImage .Error);        
196                                Crm LoginCtrl. IsEnabled  = true;        
197                            }        
198                             ));        
199                    rese tUiFlag =  false;        
200                }        
201                else        
202                {        
203                    // G ood Login  Get back o n the UI         
204                    if ( e.Connecte d && !bIsC onnectedCo mplete)        
205                         ProcessSuc cess();        
206                }        
207          
208           }        
209          
210           // / <summary >        
211           // /  Login c ontrol con nect check  starting.          
212           // / </summar y>        
213           // / <param n ame="sende r"></param >        
214           // / <param n ame="e"></ param>        
215           pr ivate void  CrmLoginC trl_Connec tionCheckB egining(ob ject sende r, EventAr gs e)        
216           {        
217                bIsConne ctedComple te = false ;        
218                Dispatch er.Invoke( Dispatcher Priority.N ormal,        
219                                     new Syste m.Action(( ) =>        
220                                     {        
221                                         this. Title = "S tarting Lo gin Proces s. ";        
222                                         CrmLo ginCtrl.Is Enabled =  true;        
223                                     }        
224                                         ));        
225           }        
226          
227           // / <summary >        
228           // / Login co ntrol conn ect check  status eve nt.         
229           // / </summar y>        
230           // / <param n ame="sende r"></param >        
231           // / <param n ame="e"></ param>        
232           pr ivate void  CrmLoginC trl_Connec tionStatus Event(obje ct sender,  ConnectSt atusEventA rgs e)        
233           {        
234                //Here w e are usin g the bIsC onnectedCo mplete boo l to check  to make s ure we onl y process  this call  once.         
235                if (e.Co nnectSucce eded && !b IsConnecte dComplete)        
236                    Proc essSuccess ();        
237          
238           }        
239          
240           // / <summary >        
241           // / Login co ntrol Erro r event.         
242           // / </summar y>        
243           // / <param n ame="sende r"></param >        
244           // / <param n ame="e"></ param>        
245           pr ivate void  CrmLoginC trl_Connec tErrorEven t(object s ender, Con nectErrorE ventArgs e )        
246           {        
247                //Messag eBox.Show( e.ErrorMes sage, "Err or here");        
248           }        
249          
250           // / <summary >        
251           // / Login Co ntrol Canc el event r aised.         
252           // / </summar y>        
253           // / <param n ame="sende r"></param >        
254           // / <param n ame="e"></ param>        
255           pr ivate void  CrmLoginC trl_UserCa ncelClicke d(object s ender, Eve ntArgs e)        
256           {        
257                if (!res etUiFlag)        
258                    this .Close();        
259           }        
260          
261           #e ndregion        
262          
263           // / <summary >        
264           // / This rai ses and pr ocesses Su ccess        
265           // / </summar y>        
266           pr ivate void  ProcessSu ccess()        
267           {        
268                resetUiF lag = true ;        
269                bIsConne ctedComple te = true;        
270                CrmSvc =  mgr.CrmSv c;        
271                CrmLogin Ctrl.GoBac kToLogin() ;        
272                Dispatch er.Invoke( Dispatcher Priority.N ormal,        
273                   new S ystem.Acti on(() =>        
274                   {        
275                       t his.Title  = "Notific ation from  Parent";        
276                       C rmLoginCtr l.IsEnable d = true;        
277                   }        
278                    ));        
279          
280                // Notif y Caller t hat we are  done with  success.         
281                if (Conn ectionToCr mCompleted  != null)        
282                    Conn ectionToCr mCompleted (this, nul l);        
283          
284                resetUiF lag = fals e;        
285           }        
286          
287       }        
288          
289       #regio n system.d iagnostics  settings  for this c ontrol        
290          
291       // Add  or merge  this secti on to your  app to en able diagn ostics on  the use of  the CRM l ogin contr ol and con nection        
292       /*        
293     <system. diagnostic s>        
294       <trace  autoflush ="true" />        
295       <sourc es>        
296         <sou rce name=" Microsoft. Xrm.Toolin g.Connecto r.CrmServi ceClient"        
297                  switch Name="Micr osoft.Xrm. Tooling.Co nnector.Cr mServiceCl ient"        
298                  switch Type="Syst em.Diagnos tics.Sourc eSwitch">        
299           <l isteners>        
300              <add name= "console"  type="Syst em.Diagnos tics.Defau ltTraceLis tener" />        
301              <remove na me="Defaul t"/>        
302              <add name  ="fileList ener"/>        
303           </ listeners>        
304         </so urce>        
305         <sou rce name=" Microsoft. Xrm.Toolin g.CrmConne ctControl"        
306                  switch Name="Micr osoft.Xrm. Tooling.Cr mConnectCo ntrol"        
307                  switch Type="Syst em.Diagnos tics.Sourc eSwitch">        
308           <l isteners>        
309              <add name= "console"  type="Syst em.Diagnos tics.Defau ltTraceLis tener" />        
310              <remove na me="Defaul t"/>        
311              <add name  ="fileList ener"/>        
312           </ listeners>        
313         </so urce>        
314          
315         <sou rce name=" Microsoft. Xrm.Toolin g.WebResou rceUtility "        
316                  switch Name="Micr osoft.Xrm. Tooling.We bResourceU tility"        
317                  switch Type="Syst em.Diagnos tics.Sourc eSwitch">        
318           <l isteners>        
319              <add name= "console"  type="Syst em.Diagnos tics.Defau ltTraceLis tener" />        
320              <remove na me="Defaul t"/>        
321              <add name  ="fileList ener"/>        
322           </ listeners>        
323         </so urce>        
324                 
325       <!-- W CF DEBUG S OURCES -->        
326         <sou rce name=" System.Ide ntityModel " switchNa me="System .IdentityM odel">        
327           <l isteners>        
328              <add name= "xml" />        
329           </ listeners>        
330         </so urce>        
331         <!--  Log all m essages in  the 'Mess ages' tab  of SvcTrac eViewer. - ->        
332         <sou rce name=" System.Ser viceModel. MessageLog ging" swit chName="Sy stem.Servi ceModel.Me ssageLoggi ng" >        
333           <l isteners>        
334              <add name= "xml" />        
335           </ listeners>        
336         </so urce>        
337         <!--  ActivityT racing and  propogate Activity a re used to  flesh out  the 'Acti vities' ta b in        
338               SvcTraceV iewer to a id debuggi ng. -->        
339         <sou rce name=" System.Ser viceModel"  switchNam e="System. ServiceMod el" propag ateActivit y="true">        
340           <l isteners>        
341              <add name= "xml" />        
342           </ listeners>        
343         </so urce>        
344         <!--  END WCF D EBUG SOURC ES -->        
345       </sour ces>        
346       <switc hes>        
347         <!--          
348                Possible  values fo r switches : Off, Err or, Warini ng, Info,  Verbose        
349                    Verb ose:    in cludes Err or, Warnin g, Info, T race level s        
350                    Info :       in cludes Err or, Warnin g, Info le vels        
351                    Warn ing:    in cludes Err or, Warnin g levels        
352                    Erro r:      in cludes Err or level        
353           -- >        
354         <add  name="Mic rosoft.Xrm .Tooling.C onnector.C rmServiceC lient" val ue="Verbos e" />        
355         <add  name="Mic rosoft.Xrm .Tooling.C rmConnectC ontrol" va lue="Verbo se"/>        
356         <add  name="Mic rosoft.Xrm .Tooling.W ebResource Utility" v alue="Verb ose" />        
357         <add  name="Sys tem.Identi tyModel" v alue="Verb ose"/>        
358         <add  name="Sys tem.Servic eModel.Mes sageLoggin g" value=" Verbose"/>        
359         <add  name="Sys tem.Servic eModel" va lue="Error , Activity Tracing"/>        
360                 
361       </swit ches>        
362       <share dListeners >        
363         <add  name="fil eListener"  type="Sys tem.Diagno stics.Text WriterTrac eListener"  initializ eData="Log inControlT esterLog.t xt"/>        
364         <!-- <add name= "eventLogL istener" t ype="Syste m.Diagnost ics.EventL ogTraceLis tener" ini tializeDat a="CRM UII "/>-->        
365         <add  name="xml " type="Sy stem.Diagn ostics.Xml WriterTrac eListener"  initializ eData="Crm ToolBox.sv clog" />        
366       </shar edListener s>        
367     </system .diagnosti cs>        
368   */        
369          
370       #endre gion        
371   }