public override void Enter(object[] parameters)
        {
            BusyDialog dialog = new BusyDialog("Scanning Worlds", (string)null);

            DialogsManager.ShowDialog((Dialog)dialog);
            Task.Run((Action)(() =>
            {
                WorldInfo selectedItem = (WorldInfo)this.m_worldsListWidget.SelectedItem;
                WorldsManager.UpdateWorldsList();
                List <WorldInfo> worldInfos = new List <WorldInfo>((IEnumerable <WorldInfo>)(object) WorldsManager.WorldInfos);
                worldInfos.Sort((Comparison <WorldInfo>)((w1, w2) => DateTime.Compare(w2.LastSaveTime, w1.LastSaveTime)));
                Dispatcher.Dispatch((Action)(() =>
                {
                    this.m_worldsListWidget.ClearItems();
                    foreach (object obj in worldInfos)
                    {
                        this.m_worldsListWidget.AddItem(obj);
                    }
                    if (selectedItem != null)
                    {
                        this.m_worldsListWidget.SelectedItem = (object)worldInfos.FirstOrDefault <WorldInfo>((Func <WorldInfo, bool>)(wi => wi.DirectoryName == selectedItem.DirectoryName));
                    }
                    DialogsManager.HideDialog((Dialog)dialog);
                }), false);
            }));
        }
Example #2
0
        public override void Enter(object[] parameters)
        {
            BusyDialog dialog = new BusyDialog(LanguageControl.GetContentWidgets(fName, 5), null);

            DialogsManager.ShowDialog(null, dialog);
            Task.Run(delegate
            {
                WorldInfo selectedItem = (WorldInfo)m_worldsListWidget.SelectedItem;
                WorldsManager.UpdateWorldsList();
                List <WorldInfo> worldInfos = new List <WorldInfo>(WorldsManager.WorldInfos);
                worldInfos.Sort((WorldInfo w1, WorldInfo w2) => DateTime.Compare(w2.LastSaveTime, w1.LastSaveTime));
                Dispatcher.Dispatch(delegate
                {
                    m_worldsListWidget.ClearItems();
                    foreach (WorldInfo item in worldInfos)
                    {
                        m_worldsListWidget.AddItem(item);
                    }
                    if (selectedItem != null)
                    {
                        m_worldsListWidget.SelectedItem = worldInfos.FirstOrDefault((WorldInfo wi) => wi.DirectoryName == selectedItem.DirectoryName);
                    }
                    DialogsManager.HideDialog(dialog);
                });
            });
        }
Example #3
0
 public static void MigrateDataFromIsolatedStorageWithDialog()
 {
     try
     {
         if (Storage.DirectoryExists("data:/.config/.isolated-storage"))
         {
             Log.Information("1.26 data found, starting migration to 1.27.");
             BusyDialog dialog = new BusyDialog("Please wait", "Migrating 1.26 data to 1.27 format...");
             DialogsManager.ShowDialog(null, dialog);
             Task.Run(delegate
             {
                 string empty  = string.Empty;
                 string empty2 = string.Empty;
                 try
                 {
                     int num = MigrateFolder("data:/.config/.isolated-storage", "data:");
                     empty   = "Migration Successful";
                     empty2  = $"{num} file(s) were migrated from 1.26 to 1.27.";
                     AnalyticsManager.LogEvent("[Migration to 1.27]", new AnalyticsParameter("Details", empty2));
                 }
                 catch (Exception ex2)
                 {
                     empty  = "Migration Failed";
                     empty2 = ex2.Message;
                     Log.Error("Migration to 1.27 failed, reason: {0}", ex2.Message);
                     AnalyticsManager.LogError("Migration to 1.27 failed", ex2);
                 }
                 DialogsManager.HideDialog(dialog);
                 DialogsManager.ShowDialog(null, new MessageDialog(empty, empty2, LanguageControl.Get("Usual", "ok"), null, null));
                 Dispatcher.Dispatch(delegate
                 {
                     SettingsManager.LoadSettings();
                 });
             });
         }
     }
     catch (Exception ex)
     {
         Log.Error("Failed to migrate data. Reason: {0}", ex.Message);
         AnalyticsManager.LogError("Migration to 1.27 failed", ex);
     }
 }