/// <summary>
 /// OnSaveCustomData method implmentation
 /// </summary>
 protected override byte[] OnSaveCustomData(SyncStatus status)
 {
     try
     {
         MMCPersistenceData data = new MMCPersistenceData();
         data.Filter = MMCService.Filter;
         if (CultureInfo.DefaultThreadCurrentUICulture.LCID == CultureInfo.InstalledUICulture.LCID)
         {
             data.Language = 0;
         }
         else
         {
             data.Language = CultureInfo.DefaultThreadCurrentUICulture.LCID;
         }
         return((byte[])data);
     }
     catch (Exception ex)
     {
         MessageBoxParameters msgp = new MessageBoxParameters();
         msgp.Text    = ex.Message;
         msgp.Buttons = MessageBoxButtons.OK;
         msgp.Icon    = MessageBoxIcon.Error;
         this.Console.ShowDialog(msgp);
         return(null);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// OnLoadCustomData method implmentation
 /// </summary>
 protected override void OnLoadCustomData(AsyncStatus status, byte[] persistenceData)
 {
     try
     {
         if (persistenceData != null)
         {
             try
             {
                 MMCPersistenceData data = (MMCPersistenceData)persistenceData;
                 MMCService.Filter = data.Filter;
                 if (data.Language == 0)
                 {
                     try
                     {
                         if (CultureInfo.DefaultThreadCurrentUICulture != CultureInfo.InstalledUICulture)
                         {
                             CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InstalledUICulture;
                             BuildNodes(false);
                         }
                     }
                     catch (NullReferenceException)
                     {
                         CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InstalledUICulture;
                         BuildNodes(false);
                     }
                 }
                 else
                 {
                     try
                     {
                         if (CultureInfo.DefaultThreadCurrentUICulture != new CultureInfo(data.Language))
                         {
                             CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(data.Language);
                             BuildNodes(false);
                         }
                     }
                     catch (NullReferenceException)
                     {
                         CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InstalledUICulture;
                         BuildNodes(false);
                     }
                 }
             }
             catch (SerializationException)
             {
                 //nothing
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxParameters msgp = new MessageBoxParameters
         {
             Text    = ex.Message,
             Buttons = MessageBoxButtons.OK,
             Icon    = MessageBoxIcon.Error
         };
         this.Console.ShowDialog(msgp);
     }
 }