示例#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);
            });
        }
示例#2
0
        private void OpenRecent(object sender, RoutedEventArgs e)
        {
            if (sender is MenuItem menuItem)
            {
                string path = menuItem.DataContext as string;
                RecentLocations.Add(path);
                CollectionViewSource.GetDefaultView(RecentLocations).Refresh();

                if (path?.StartsWith("ngdp://") == true)
                {
                    OpenNGDP(path);
                }
                else
                {
                    OpenCASC(path);
                }
            }
        }
示例#3
0
 private void OpenNGDP(string path)
 {
     RecentLocations.Add(path);
     CollectionViewSource.GetDefaultView(RecentLocations).Refresh();
     throw new NotImplementedException(nameof(OpenNGDP));
 }