protected void OnCurrentFolderChanging()
        {
            if (CurrentFolder != null)
            {
                RecentLocations.Remove(CurrentFolder);
                RecentLocations.Insert(0, CurrentFolder);

                if (!BackwardItemPushLock)
                {
                    BackwardItem = CurrentFolder;
                    BackwardItems.Push(CurrentFolder);
                }
            }
        }
Beispiel #2
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);
            });
        }
Beispiel #3
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);
                }
            }
        }
Beispiel #4
0
        public MainWindow()
        {
            ViewContext = SynchronizationContext.Current;

            NGDPPatchHosts  = new NGDPPatchHosts();
            RecentLocations = new RecentLocations();
            ProgressInfo    = new ProgressInfo();
            CASCSettings    = new CASCSettings();
            ProductAgent    = new ProductLocations();

            ProgressSlave.OnProgress += UpdateProgress;

            if (!NGDPPatchHosts.Any(x => x.Active))
            {
                NGDPPatchHosts[0].Active = true;
            }

            InitializeComponent();
            DataContext = this;
            // FolderView.ItemsSource = ;
            // FolderItemList.ItemsSource = ;
        }
Beispiel #5
0
 private void OpenNGDP(string path)
 {
     RecentLocations.Add(path);
     CollectionViewSource.GetDefaultView(RecentLocations).Refresh();
     throw new NotImplementedException(nameof(OpenNGDP));
 }