Exemplo n.º 1
0
        private void OpenCASC(string path)
        {
            RecentLocations.Add(path);
            CollectionViewSource.GetDefaultView(RecentLocations).Refresh();

            IsReady = false;

            Config = null;
            CASC   = null;
            GUIDTree?.Dispose();
            GUIDTree = new GUIDCollection();
            NotifyPropertyChanged(nameof(GUIDTree));
            GCSettings.LatencyMode = GCLatencyMode.Batch;

            Task.Run(delegate
            {
                try
                {
                    Config = CASCConfig.LoadLocalStorageConfig(path, true, CASCSettings.LoadAllLanguages);

                    if (Config.InstallData?.Uid != null && Config.InstallData.Uid != "prometheus")
                    {
                        MessageBox.Show($"The branch \"{Config.InstallData.Uid}\" is not supported!\nThis might result in failure to load.\nProceed with caution.", "Unsupported Branch", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
                    }

                    CASC = CASCHandler.Open(Config, ProgressSlave);

                    BuildTree();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Error while loading CASC", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
                    if (Debugger.IsAttached)
                    {
                        throw;
                    }
                }
                finally
                {
                    GCSettings.LatencyMode = GCLatencyMode.Interactive;
                    GC.Collect();
                }

                ViewContext.Send(new SendOrPostCallback(delegate
                {
                    IsReady = true;
                }), null);
            });
        }
Exemplo n.º 2
0
 private void BuildTree()
 {
     GUIDTree?.Dispose();
     GUIDTree = new GUIDCollection(Config, CASC, ProgressSlave);
     NotifyPropertyChanged(nameof(GUIDTree));
 }