E:\TrabalhoSuely\RoboDescompilado\Redistribuir_Suely_2023_02_16\ZionRobot\Tasks\Synchronizer.cs E:\TrabalhoSuely\RoboDescompilado\Sincronizar_Mauro_2022_06_01\ZionRobot\Tasks\Synchronizer.cs
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;
using ZionRobot.Handlers; using ZionRobot.Handlers;
using ZionRobot.Models.Source; using ZionRobot.Models.Source;
using ZionRobot.Models.ZFlow; using ZionRobot.Models.ZFlow;
   
namespace ZionRobot.Tasks namespace ZionRobot.Tasks
{ {
    // Token: 0x02000023 RID: 35     // Token: 0x02000022 RID: 34
    internal class Synchronizer     internal class Synchronizer
    {     {
        // Token: 0x17000031 RID: 49         // Token: 0x17000031 RID: 49
        // (get) Token: 0x060000C7 RID: 199 RVA: 0x00006A82 File Offset: 0x00004C82         // (get) Token: 0x060000C2 RID: 194 RVA: 0x0000678A File Offset: 0x0000498A
        public bool Running         public bool Running
        {         {
            get             get
            {             {
                return this.running;                 return this.running;
            }             }
        }         }
   
        // Token: 0x060000C8 RID: 200 RVA: 0x00006A8A File Offset: 0x00004C8A         // Token: 0x060000C3 RID: 195 RVA: 0x00006792 File Offset: 0x00004992
        public Synchronizer()         public Synchronizer()
        {         {
            this.running = false;             this.running = false;
        }         }
   
        // Token: 0x060000C9 RID: 201 RVA: 0x00006AB4 File Offset: 0x00004CB4         // Token: 0x060000C4 RID: 196 RVA: 0x000067BC File Offset: 0x000049BC
        public void Execute(Origin source, Activity activity)         public void Execute(Origin source, Activity activity)
        {         {
            this.running = true;             this.running = true;
            this.stopwatch.Start();             this.stopwatch.Start();
            Application.Current.Dispatcher.Invoke(delegate()             Application.Current.Dispatcher.Invoke(delegate()
            {             {
                this.handler = Browser.Instance;                 this.handler = Browser.Instance;
            });             });
            System.Action <>9__4;             System.Action <>9__4;
            ThreadStart <>9__2;             ThreadStart <>9__2;
            System.Action <>9__5;             System.Action <>9__5;
            ThreadStart <>9__3;             ThreadStart <>9__3;
            new Thread(delegate()             new Thread(delegate()
            {             {
                ThreadStart start;                 ThreadStart start;
                if ((start = <>9__2) == null)                 if ((start = <>9__2) == null)
                {                 {
                    start = (<>9__2 = delegate()                     start = (<>9__2 = delegate()
                    {                     {
                        try                         try
                        {                         {
                            Dispatcher dispatcher = Application.Current.Dispatcher;                             Dispatcher dispatcher = Application.Current.Dispatcher;
                            System.Action callback;                             System.Action callback;
                            if ((callback = <>9__4) == null)                             if ((callback = <>9__4) == null)
                            {                             {
                                callback = (<>9__4 = delegate()                                 callback = (<>9__4 = delegate()
                                {                                 {
                                    this.handler.Source = source;                                     this.handler.Source = source;
                                    bool flag = activity.Action.ToUpper() == "UPDATE" && !string.IsNullOrEmpty(activity.DataJuri);                                     bool flag = activity.Action.ToUpper() == "UPDATE" && !string.IsNullOrEmpty(activity.DataJuri);
                                    if (flag)                                     if (flag)
                                    {                                     {
                                        this.handler.UpdateActivity(activity);                                         this.handler.UpdateActivity(activity);
                                    }                                     }
                                    else                                     else
                                    {                                     {
                                        bool flag2 = activity.Action.ToUpper() == "CREATE";                                         bool flag2 = activity.Action.ToUpper() == "CREATE";
                                        if (flag2)                                         if (flag2)
                                        {                                         {
                                            this.handler.CreateSubActivity(activity);                                             this.handler.CreateSubActivity(activity);
                                        }                                         }
                                        else                                         else
                                        {                                         {
                                            bool flag3 = activity.Action.ToUpper() == "CREATECASE";                                             bool flag3 = activity.Action.ToUpper() == "CREATECASE";
                                            if (flag3)                                             if (flag3)
                                            {                                             {
                                                this.handler.CreateCase(activity);                                                 this.handler.CreateCase(activity);
                                            }                                             }
                                            else                                             else
                                            {                                             {
                                                bool flag4 = activity.Action.ToUpper() == "CLOSE";                                                 bool flag4 = activity.Action.ToUpper() == "CLOSE";
                                                if (flag4)                                                 if (flag4)
                                                {                                                 {
                                                    this.handler.CloseCase(activity);                                                     this.handler.CloseCase(activity);
                                                }                                                 }
                                                else                                                 else
                                                {                                                 {
                                                    bool flag5 = activity.Action.ToUpper() == "SHAREPOINT";                                                     bool flag5 = activity.Action.ToUpper() == "SHAREPOINT";
                                                    if (flag5)                                                     if (flag5)
                                                    {                                                     {
.                                                        Console.WriteLine(activity.Id);  
                                                        this.handler.UploadAttachments(activity);                                                         this.handler.UploadAttachments(activity);
                                                    }                                                     }
                                                }                                                 }
                                            }                                             }
                                        }                                         }
                                    }                                     }
                                });                                 });
                            }                             }
                            dispatcher.Invoke(callback);                             dispatcher.Invoke(callback);
                        }                         }
                        catch (Exception ex)                         catch (Exception ex)
                        {                         {
                            throw ex;                             throw ex;
                        }                         }
                    });                     });
                }                 }
                Thread t = new Thread(start);                 Thread t = new Thread(start);
                t.Start();                 t.Start();
                ThreadStart start2;                 ThreadStart start2;
                if ((start2 = <>9__3) == null)                 if ((start2 = <>9__3) == null)
                {                 {
                    start2 = (<>9__3 = delegate()                     start2 = (<>9__3 = delegate()
                    {                     {
                        while (this.handler.Main == null || this.handler.Main.IsAlive)                         while (this.handler.Main == null || this.handler.Main.IsAlive)
                        {                         {
                            bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;                             bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;
                            if (flag)                             if (flag)
                            {                             {
.                                activity.UpdateActivitySycn(3);  
                                break;                                 break;
                            }                             }
                            Thread.Sleep(1000);                             Thread.Sleep(1000);
                        }                         }
                        this.stopwatch.Stop();                         this.stopwatch.Stop();
                        this.stopwatch.Reset();                         this.stopwatch.Reset();
                        Dispatcher dispatcher = Application.Current.Dispatcher;                         Dispatcher dispatcher = Application.Current.Dispatcher;
                        System.Action callback;                         System.Action callback;
                        if ((callback = <>9__5) == null)                         if ((callback = <>9__5) == null)
                        {                         {
                            callback = (<>9__5 = delegate()                             callback = (<>9__5 = delegate()
                            {                             {
                                this.handler.Close();                                 this.handler.Close();
                            });                             });
                        }                         }
                        dispatcher.Invoke(callback);                         dispatcher.Invoke(callback);
                        this.running = false;                         this.running = false;
                    });                     });
                }                 }
                new Thread(start2).Start();                 new Thread(start2).Start();
            }).Start();             }).Start();
        }         }
   
        // Token: 0x060000CA RID: 202 RVA: 0x00006B24 File Offset: 0x00004D24         // Token: 0x060000C5 RID: 197 RVA: 0x0000682C File Offset: 0x00004A2C
        public void Execute(Origin source, Lawsuit lawsuit)         public void Execute(Origin source, Lawsuit lawsuit)
        {         {
            this.running = true;             this.running = true;
            this.stopwatch.Start();             this.stopwatch.Start();
            Application.Current.Dispatcher.Invoke(delegate()             Application.Current.Dispatcher.Invoke(delegate()
            {             {
                this.handler = Browser.Instance;                 this.handler = Browser.Instance;
            });             });
            System.Action <>9__4;             System.Action <>9__4;
            ThreadStart <>9__2;             ThreadStart <>9__2;
            System.Action <>9__5;             System.Action <>9__5;
            ThreadStart <>9__3;             ThreadStart <>9__3;
            new Thread(delegate()             new Thread(delegate()
            {             {
                ThreadStart start;                 ThreadStart start;
                if ((start = <>9__2) == null)                 if ((start = <>9__2) == null)
                {                 {
                    start = (<>9__2 = delegate()                     start = (<>9__2 = delegate()
                    {                     {
                        try                         try
                        {                         {
                            Dispatcher dispatcher = Application.Current.Dispatcher;                             Dispatcher dispatcher = Application.Current.Dispatcher;
                            System.Action callback;                             System.Action callback;
                            if ((callback = <>9__4) == null)                             if ((callback = <>9__4) == null)
                            {                             {
                                callback = (<>9__4 = delegate()                                 callback = (<>9__4 = delegate()
                                {                                 {
                                    this.handler.Source = source;                                     this.handler.Source = source;
                                    bool flag = lawsuit.SyncAction.ToUpper() == "UPDATE";                                     bool flag = lawsuit.SyncAction.ToUpper() == "UPDATE";
                                    if (flag)                                     if (flag)
                                    {                                     {
                                        this.handler.UpdateLawsuit(lawsuit);                                         this.handler.UpdateLawsuit(lawsuit);
                                    }                                     }
                                    bool flag2 = lawsuit.SyncAction.ToUpper() == "CREATE";                                     bool flag2 = lawsuit.SyncAction.ToUpper() == "CREATE";
                                    if (flag2)                                     if (flag2)
                                    {                                     {
                                        this.handler.CreateLawsuit(lawsuit);                                         this.handler.CreateLawsuit(lawsuit);
                                    }                                     }
                                });                                 });
                            }                             }
                            dispatcher.Invoke(callback);                             dispatcher.Invoke(callback);
                        }                         }
                        catch (Exception ex)                         catch (Exception ex)
                        {                         {
                            throw ex;                             throw ex;
                        }                         }
                    });                     });
                }                 }
                Thread t = new Thread(start);                 Thread t = new Thread(start);
                t.Start();                 t.Start();
                ThreadStart start2;                 ThreadStart start2;
                if ((start2 = <>9__3) == null)                 if ((start2 = <>9__3) == null)
                {                 {
                    start2 = (<>9__3 = delegate()                     start2 = (<>9__3 = delegate()
                    {                     {
                        while (this.handler.Main == null || this.handler.Main.IsAlive)                         while (this.handler.Main == null || this.handler.Main.IsAlive)
                        {                         {
                            bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;                             bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;
                            if (flag)                             if (flag)
                            {                             {
                                break;                                 break;
                            }                             }
                            Thread.Sleep(1000);                             Thread.Sleep(1000);
                        }                         }
                        this.stopwatch.Stop();                         this.stopwatch.Stop();
                        this.stopwatch.Reset();                         this.stopwatch.Reset();
                        Dispatcher dispatcher = Application.Current.Dispatcher;                         Dispatcher dispatcher = Application.Current.Dispatcher;
                        System.Action callback;                         System.Action callback;
                        if ((callback = <>9__5) == null)                         if ((callback = <>9__5) == null)
                        {                         {
                            callback = (<>9__5 = delegate()                             callback = (<>9__5 = delegate()
                            {                             {
                                this.handler.Close();                                 this.handler.Close();
                            });                             });
                        }                         }
                        dispatcher.Invoke(callback);                         dispatcher.Invoke(callback);
                        this.running = false;                         this.running = false;
                    });                     });
                }                 }
                new Thread(start2).Start();                 new Thread(start2).Start();
            }).Start();             }).Start();
        }         }
   
        // Token: 0x060000CB RID: 203 RVA: 0x00006B94 File Offset: 0x00004D94         // Token: 0x060000C6 RID: 198 RVA: 0x0000689C File Offset: 0x00004A9C
        public void Execute(Origin source, LawsuitPhase lawsuitPhase)         public void Execute(Origin source, LawsuitPhase lawsuitPhase)
        {         {
            this.running = true;             this.running = true;
            this.stopwatch.Start();             this.stopwatch.Start();
            Application.Current.Dispatcher.Invoke(delegate()             Application.Current.Dispatcher.Invoke(delegate()
            {             {
                this.handler = Browser.Instance;                 this.handler = Browser.Instance;
            });             });
            System.Action <>9__4;             System.Action <>9__4;
            ThreadStart <>9__2;             ThreadStart <>9__2;
            System.Action <>9__5;             System.Action <>9__5;
            ThreadStart <>9__3;             ThreadStart <>9__3;
            new Thread(delegate()             new Thread(delegate()
            {             {
                ThreadStart start;                 ThreadStart start;
                if ((start = <>9__2) == null)                 if ((start = <>9__2) == null)
                {                 {
                    start = (<>9__2 = delegate()                     start = (<>9__2 = delegate()
                    {                     {
                        try                         try
                        {                         {
                            Dispatcher dispatcher = Application.Current.Dispatcher;                             Dispatcher dispatcher = Application.Current.Dispatcher;
                            System.Action callback;                             System.Action callback;
                            if ((callback = <>9__4) == null)                             if ((callback = <>9__4) == null)
                            {                             {
                                callback = (<>9__4 = delegate()                                 callback = (<>9__4 = delegate()
                                {                                 {
                                    this.handler.Source = source;                                     this.handler.Source = source;
                                    bool flag = lawsuitPhase.SyncAction.ToUpper() == "CREATE";                                     bool flag = lawsuitPhase.SyncAction.ToUpper() == "CREATE";
                                    if (flag)                                     if (flag)
                                    {                                     {
                                        this.handler.CreateLawsuitPhase(lawsuitPhase);                                         this.handler.CreateLawsuitPhase(lawsuitPhase);
                                    }                                     }
                                });                                 });
                            }                             }
                            dispatcher.Invoke(callback);                             dispatcher.Invoke(callback);
                        }                         }
                        catch (Exception ex)                         catch (Exception ex)
                        {                         {
                            throw ex;                             throw ex;
                        }                         }
                    });                     });
                }                 }
                Thread t = new Thread(start);                 Thread t = new Thread(start);
                t.Start();                 t.Start();
                ThreadStart start2;                 ThreadStart start2;
                if ((start2 = <>9__3) == null)                 if ((start2 = <>9__3) == null)
                {                 {
                    start2 = (<>9__3 = delegate()                     start2 = (<>9__3 = delegate()
                    {                     {
                        while (this.handler.Main == null || this.handler.Main.IsAlive)                         while (this.handler.Main == null || this.handler.Main.IsAlive)
                        {                         {
                            bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;                             bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;
                            if (flag)                             if (flag)
                            {                             {
                                break;                                 break;
                            }                             }
                            Thread.Sleep(1000);                             Thread.Sleep(1000);
                        }                         }
                        this.stopwatch.Stop();                         this.stopwatch.Stop();
                        this.stopwatch.Reset();                         this.stopwatch.Reset();
                        Dispatcher dispatcher = Application.Current.Dispatcher;                         Dispatcher dispatcher = Application.Current.Dispatcher;
                        System.Action callback;                         System.Action callback;
                        if ((callback = <>9__5) == null)                         if ((callback = <>9__5) == null)
                        {                         {
                            callback = (<>9__5 = delegate()                             callback = (<>9__5 = delegate()
                            {                             {
                                this.handler.Close();                                 this.handler.Close();
                            });                             });
                        }                         }
                        dispatcher.Invoke(callback);                         dispatcher.Invoke(callback);
                        this.running = false;                         this.running = false;
                    });                     });
                }                 }
                new Thread(start2).Start();                 new Thread(start2).Start();
            }).Start();             }).Start();
        }         }
   
        // Token: 0x060000CC RID: 204 RVA: 0x00006C04 File Offset: 0x00004E04         // Token: 0x060000C7 RID: 199 RVA: 0x0000690C File Offset: 0x00004B0C
        public void Execute(Origin source, LawsuitPhaseProgress lawsuitPhaseProgress)         public void Execute(Origin source, LawsuitPhaseProgress lawsuitPhaseProgress)
        {         {
            this.running = true;             this.running = true;
            this.stopwatch.Start();             this.stopwatch.Start();
            Application.Current.Dispatcher.Invoke(delegate()             Application.Current.Dispatcher.Invoke(delegate()
            {             {
                this.handler = Browser.Instance;                 this.handler = Browser.Instance;
            });             });
            System.Action <>9__4;             System.Action <>9__4;
            ThreadStart <>9__2;             ThreadStart <>9__2;
            System.Action <>9__5;             System.Action <>9__5;
            ThreadStart <>9__3;             ThreadStart <>9__3;
            new Thread(delegate()             new Thread(delegate()
            {             {
                ThreadStart start;                 ThreadStart start;
                if ((start = <>9__2) == null)                 if ((start = <>9__2) == null)
                {                 {
                    start = (<>9__2 = delegate()                     start = (<>9__2 = delegate()
                    {                     {
                        try                         try
                        {                         {
                            Dispatcher dispatcher = Application.Current.Dispatcher;                             Dispatcher dispatcher = Application.Current.Dispatcher;
                            System.Action callback;                             System.Action callback;
                            if ((callback = <>9__4) == null)                             if ((callback = <>9__4) == null)
                            {                             {
                                callback = (<>9__4 = delegate()                                 callback = (<>9__4 = delegate()
                                {                                 {
                                    this.handler.Source = source;                                     this.handler.Source = source;
                                    bool flag = lawsuitPhaseProgress.SyncAction.ToUpper() == "CREATE";                                     bool flag = lawsuitPhaseProgress.SyncAction.ToUpper() == "CREATE";
                                    if (flag)                                     if (flag)
                                    {                                     {
                                        this.handler.CreateLawsuitPhaseProgress(lawsuitPhaseProgress);                                         this.handler.CreateLawsuitPhaseProgress(lawsuitPhaseProgress);
                                    }                                     }
                                });                                 });
                            }                             }
                            dispatcher.Invoke(callback);                             dispatcher.Invoke(callback);
                        }                         }
                        catch (Exception ex)                         catch (Exception ex)
                        {                         {
                            throw ex;                             throw ex;
                        }                         }
                    });                     });
                }                 }
                Thread t = new Thread(start);                 Thread t = new Thread(start);
                t.Start();                 t.Start();
                ThreadStart start2;                 ThreadStart start2;
                if ((start2 = <>9__3) == null)                 if ((start2 = <>9__3) == null)
                {                 {
                    start2 = (<>9__3 = delegate()                     start2 = (<>9__3 = delegate()
                    {                     {
                        while (this.handler.Main == null || this.handler.Main.IsAlive)                         while (this.handler.Main == null || this.handler.Main.IsAlive)
                        {                         {
                            bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;                             bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;
                            if (flag)                             if (flag)
                            {                             {
                                break;                                 break;
                            }                             }
                            Thread.Sleep(1000);                             Thread.Sleep(1000);
                        }                         }
                        this.stopwatch.Stop();                         this.stopwatch.Stop();
                        this.stopwatch.Reset();                         this.stopwatch.Reset();
                        Dispatcher dispatcher = Application.Current.Dispatcher;                         Dispatcher dispatcher = Application.Current.Dispatcher;
                        System.Action callback;                         System.Action callback;
                        if ((callback = <>9__5) == null)                         if ((callback = <>9__5) == null)
                        {                         {
                            callback = (<>9__5 = delegate()                             callback = (<>9__5 = delegate()
                            {                             {
                                this.handler.Close();                                 this.handler.Close();
                            });                             });
                        }                         }
                        dispatcher.Invoke(callback);                         dispatcher.Invoke(callback);
                        this.running = false;                         this.running = false;
                    });                     });
                }                 }
                new Thread(start2).Start();                 new Thread(start2).Start();
            }).Start();             }).Start();
        }         }
   
        // Token: 0x060000CD RID: 205 RVA: 0x00006C74 File Offset: 0x00004E74         // Token: 0x060000C8 RID: 200 RVA: 0x0000697C File Offset: 0x00004B7C
        public void Execute(Origin source, LawsuitDemand lawsuitDemand)         public void Execute(Origin source, LawsuitDemand lawsuitDemand)
        {         {
            this.running = true;             this.running = true;
            this.stopwatch.Start();             this.stopwatch.Start();
            Application.Current.Dispatcher.Invoke(delegate()             Application.Current.Dispatcher.Invoke(delegate()
            {             {
                this.handler = Browser.Instance;                 this.handler = Browser.Instance;
            });             });
            System.Action <>9__4;             System.Action <>9__4;
            ThreadStart <>9__2;             ThreadStart <>9__2;
            System.Action <>9__5;             System.Action <>9__5;
            ThreadStart <>9__3;             ThreadStart <>9__3;
            new Thread(delegate()             new Thread(delegate()
            {             {
                ThreadStart start;                 ThreadStart start;
                if ((start = <>9__2) == null)                 if ((start = <>9__2) == null)
                {                 {
                    start = (<>9__2 = delegate()                     start = (<>9__2 = delegate()
                    {                     {
                        try                         try
                        {                         {
                            Dispatcher dispatcher = Application.Current.Dispatcher;                             Dispatcher dispatcher = Application.Current.Dispatcher;
                            System.Action callback;                             System.Action callback;
                            if ((callback = <>9__4) == null)                             if ((callback = <>9__4) == null)
                            {                             {
                                callback = (<>9__4 = delegate()                                 callback = (<>9__4 = delegate()
                                {                                 {
                                    this.handler.Source = source;                                     this.handler.Source = source;
                                    bool flag = lawsuitDemand.SyncAction.ToUpper() == "CREATE";                                     bool flag = lawsuitDemand.SyncAction.ToUpper() == "CREATE";
                                    if (flag)                                     if (flag)
                                    {                                     {
                                        this.handler.CreateLawsuitDemand(lawsuitDemand);                                         this.handler.CreateLawsuitDemand(lawsuitDemand);
                                    }                                     }
                                });                                 });
                            }                             }
                            dispatcher.Invoke(callback);                             dispatcher.Invoke(callback);
                        }                         }
                        catch (Exception ex)                         catch (Exception ex)
                        {                         {
                            throw ex;                             throw ex;
                        }                         }
                    });                     });
                }                 }
                Thread t = new Thread(start);                 Thread t = new Thread(start);
                t.Start();                 t.Start();
                ThreadStart start2;                 ThreadStart start2;
                if ((start2 = <>9__3) == null)                 if ((start2 = <>9__3) == null)
                {                 {
                    start2 = (<>9__3 = delegate()                     start2 = (<>9__3 = delegate()
                    {                     {
                        while (this.handler.Main == null || this.handler.Main.IsAlive)                         while (this.handler.Main == null || this.handler.Main.IsAlive)
                        {                         {
                            bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;                             bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;
                            if (flag)                             if (flag)
                            {                             {
                                break;                                 break;
                            }                             }
                            Thread.Sleep(1000);                             Thread.Sleep(1000);
                        }                         }
                        this.stopwatch.Stop();                         this.stopwatch.Stop();
                        this.stopwatch.Reset();                         this.stopwatch.Reset();
                        Dispatcher dispatcher = Application.Current.Dispatcher;                         Dispatcher dispatcher = Application.Current.Dispatcher;
                        System.Action callback;                         System.Action callback;
                        if ((callback = <>9__5) == null)                         if ((callback = <>9__5) == null)
                        {                         {
                            callback = (<>9__5 = delegate()                             callback = (<>9__5 = delegate()
                            {                             {
                                this.handler.Close();                                 this.handler.Close();
                            });                             });
                        }                         }
                        dispatcher.Invoke(callback);                         dispatcher.Invoke(callback);
                        this.running = false;                         this.running = false;
                    });                     });
                }                 }
                new Thread(start2).Start();                 new Thread(start2).Start();
            }).Start();             }).Start();
        }         }
   
        // Token: 0x060000CE RID: 206 RVA: 0x00006CE4 File Offset: 0x00004EE4         // Token: 0x060000C9 RID: 201 RVA: 0x000069EC File Offset: 0x00004BEC
        public void SyncFromLocal(Origin source, string json, string type)         public void SyncFromLocal(Origin source, string json, string type)
        {         {
            this.running = true;             this.running = true;
            this.stopwatch.Start();             this.stopwatch.Start();
            Application.Current.Dispatcher.Invoke(delegate()             Application.Current.Dispatcher.Invoke(delegate()
            {             {
                this.handler = Browser.Instance;                 this.handler = Browser.Instance;
            });             });
            System.Action <>9__4;             System.Action <>9__4;
            ThreadStart <>9__2;             ThreadStart <>9__2;
            System.Action <>9__9;             System.Action <>9__9;
            ThreadStart <>9__3;             ThreadStart <>9__3;
            new Thread(delegate()             new Thread(delegate()
            {             {
                ThreadStart start;                 ThreadStart start;
                if ((start = <>9__2) == null)                 if ((start = <>9__2) == null)
                {                 {
                    start = (<>9__2 = delegate()                     start = (<>9__2 = delegate()
                    {                     {
                        try                         try
                        {                         {
                            Dispatcher dispatcher = Application.Current.Dispatcher;                             Dispatcher dispatcher = Application.Current.Dispatcher;
                            System.Action callback;                             System.Action callback;
                            if ((callback = <>9__4) == null)                             if ((callback = <>9__4) == null)
                            {                             {
                                callback = (<>9__4 = delegate()                                 callback = (<>9__4 = delegate()
                                {                                 {
                                    this.handler.Source = source;                                     this.handler.Source = source;
                                    BlockElement blockElement = null;                                     BlockElement blockElement = null;
                                    bool flag = type.ToUpper() == "ANDAMENTOS";                                     bool flag = type.ToUpper() == "ANDAMENTOS";
                                    if (flag)                                     if (flag)
                                    {                                     {
                                        blockElement = (from be in source.BlockElements                                         blockElement = (from be in source.BlockElements
                                        where be.Name == "CreateLawsuitPhaseProgressLocal"                                          where be.Name == "CreateLawsuitPhaseProgressLocal" 
                                        select be).FirstOrDefault<BlockElement>();                                         select be).FirstOrDefault<BlockElement>();
                                    }                                     }
                                    bool flag2 = type.ToUpper() == "DEPOSITOS";                                     bool flag2 = type.ToUpper() == "DEPOSITOS";
                                    if (flag2)                                     if (flag2)
                                    {                                     {
                                        blockElement = (from be in source.BlockElements                                         blockElement = (from be in source.BlockElements
                                        where be.Name == "CreateLawsuitDepositLocal"                                          where be.Name == "CreateLawsuitDepositLocal" 
                                        select be).FirstOrDefault<BlockElement>();                                         select be).FirstOrDefault<BlockElement>();
                                    }                                     }
                                    bool flag3 = type.ToUpper() == "PEDIDOS";                                     bool flag3 = type.ToUpper() == "PEDIDOS";
                                    if (flag3)                                     if (flag3)
                                    {                                     {
                                        blockElement = (from be in source.BlockElements                                         blockElement = (from be in source.BlockElements
                                        where be.Name == "CreateLawsuitDemandLocal"                                          where be.Name == "CreateLawsuitDemandLocal" 
                                        select be).FirstOrDefault<BlockElement>();                                         select be).FirstOrDefault<BlockElement>();
                                    }                                     }
                                    bool flag4 = type.ToUpper() == "PROCESSOS";                                     bool flag4 = type.ToUpper() == "PROCESSOS";
                                    if (flag4)                                     if (flag4)
                                    {                                     {
                                        blockElement = (from be in source.BlockElements                                         blockElement = (from be in source.BlockElements
                                        where be.Name == "CreateLawsuitLocal"                                          where be.Name == "CreateLawsuitLocal" 
                                        select be).FirstOrDefault<BlockElement>();                                         select be).FirstOrDefault<BlockElement>();
                                    }                                     }
                                    this.handler.CreateWithLocal(json, blockElement);                                     this.handler.CreateWithLocal(json, blockElement);
                                });                                 });
                            }                             }
                            dispatcher.Invoke(callback);                             dispatcher.Invoke(callback);
                        }                         }
                        catch (Exception ex)                         catch (Exception ex)
                        {                         {
                            throw ex;                             throw ex;
                        }                         }
                    });                     });
                }                 }
                Thread t = new Thread(start);                 Thread t = new Thread(start);
                t.Start();                 t.Start();
                ThreadStart start2;                 ThreadStart start2;
                if ((start2 = <>9__3) == null)                 if ((start2 = <>9__3) == null)
                {                 {
                    start2 = (<>9__3 = delegate()                     start2 = (<>9__3 = delegate()
                    {                     {
                        while (this.handler.Main == null || this.handler.Main.IsAlive)                         while (this.handler.Main == null || this.handler.Main.IsAlive)
                        {                         {
                            bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;                             bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;
                            if (flag)                             if (flag)
                            {                             {
                                break;                                 break;
                            }                             }
                            Thread.Sleep(1000);                             Thread.Sleep(1000);
                        }                         }
                        this.stopwatch.Stop();                         this.stopwatch.Stop();
                        this.stopwatch.Reset();                         this.stopwatch.Reset();
                        Dispatcher dispatcher = Application.Current.Dispatcher;                         Dispatcher dispatcher = Application.Current.Dispatcher;
                        System.Action callback;                         System.Action callback;
                        if ((callback = <>9__9) == null)                         if ((callback = <>9__9) == null)
                        {                         {
                            callback = (<>9__9 = delegate()                             callback = (<>9__9 = delegate()
                            {                             {
                                this.handler.Close();                                 this.handler.Close();
                            });                             });
                        }                         }
                        dispatcher.Invoke(callback);                         dispatcher.Invoke(callback);
                        this.running = false;                         this.running = false;
                    });                     });
                }                 }
                new Thread(start2).Start();                 new Thread(start2).Start();
            }).Start();             }).Start();
        }         }
   
        // Token: 0x060000CF RID: 207 RVA: 0x00006D5C File Offset: 0x00004F5C         // Token: 0x060000CA RID: 202 RVA: 0x00006A64 File Offset: 0x00004C64
        private string convertDate(string value)         private string convertDate(string value)
        {         {
            return DateTime.Parse(value, new CultureInfo("pt-BR")).ToString("dd/MM/yyyy");             return DateTime.Parse(value, new CultureInfo("pt-BR")).ToString("dd/MM/yyyy");
        }         }
   
        // Token: 0x0400004C RID: 76         // Token: 0x04000046 RID: 70
        private bool running;         private bool running;
   
        // Token: 0x0400004D RID: 77         // Token: 0x04000047 RID: 71
        private Browser handler;         private Browser handler;
   
        // Token: 0x0400004E RID: 78         // Token: 0x04000048 RID: 72
        private int limitTime = 300;         private int limitTime = 300;
   
        // Token: 0x0400004F RID: 79         // Token: 0x04000049 RID: 73
        private Stopwatch stopwatch = new Stopwatch();         private Stopwatch stopwatch = new Stopwatch();
    }     }
} }